Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_JVMFWK_SOURCE_FRAMEWORK_HXX
20 : #define INCLUDED_JVMFWK_SOURCE_FRAMEWORK_HXX
21 :
22 : #include "rtl/ustring.hxx"
23 : #include "rtl/byteseq.hxx"
24 : #include "jvmfwk/framework.h"
25 : #include "vendorplugin.hxx"
26 :
27 : /** typedefs for functions from vendorplugin.hxx
28 : */
29 : typedef javaPluginError (*jfw_plugin_getAllJavaInfos_ptr)(
30 : rtl_uString * sVendor,
31 : rtl_uString * sMinVersion,
32 : rtl_uString * sMaxVersion,
33 : rtl_uString * * arExcludeList,
34 : sal_Int32 nLenList,
35 : JavaInfo*** parJavaInfo,
36 : sal_Int32 *nLenInfoList);
37 :
38 : typedef javaPluginError (*jfw_plugin_getJavaInfoByPath_ptr)(
39 : rtl_uString * sPath,
40 : rtl_uString * sVendor,
41 : rtl_uString * sMinVersion,
42 : rtl_uString * sMaxVersion,
43 : rtl_uString * * arExcludeList,
44 : sal_Int32 nLenList,
45 : JavaInfo** ppInfo);
46 :
47 : /** starts a Java Virtual Machine.
48 : <p>
49 : The function shall ensure, that the VM does not abort the process
50 : during instantiation.
51 : </p>
52 : */
53 : typedef javaPluginError (*jfw_plugin_startJavaVirtualMachine_ptr)(
54 : const JavaInfo *info,
55 : const JavaVMOption* options,
56 : sal_Int32 cOptions,
57 : JavaVM ** ppVM,
58 : JNIEnv ** ppEnv);
59 :
60 : typedef javaPluginError (*jfw_plugin_existJRE_ptr)(
61 : const JavaInfo *info,
62 : sal_Bool *exist);
63 :
64 :
65 : namespace jfw
66 : {
67 :
68 : class CJavaInfo
69 : {
70 : static JavaInfo * copyJavaInfo(const JavaInfo * pInfo);
71 :
72 : enum _transfer_ownership {TRANSFER};
73 : /*Attaching the pointer to this class. The argument pInfo must not
74 : be freed afterwards.
75 : */
76 : CJavaInfo(::JavaInfo * info, _transfer_ownership);
77 :
78 : public:
79 : ::JavaInfo * pInfo;
80 :
81 :
82 :
83 : CJavaInfo();
84 : CJavaInfo(const CJavaInfo &);
85 : ~CJavaInfo();
86 : CJavaInfo& operator =(const ::JavaInfo* info);
87 : CJavaInfo & operator = (const CJavaInfo& info);
88 :
89 : /* The returned class takes ownership of the argument info. info
90 : must not been freed afterwards.
91 : */
92 : static CJavaInfo createWrapper(::JavaInfo* info);
93 : /*Attaching the pointer to this class. The argument pInfo must not
94 : be freed afterwards.
95 : */
96 : void attach(::JavaInfo* pInfo);
97 : ::JavaInfo * detach();
98 0 : const ::JavaInfo* operator ->() const { return pInfo;}
99 56 : operator ::JavaInfo* () { return pInfo;}
100 0 : operator ::JavaInfo const * () const { return pInfo;}
101 : ::JavaInfo* cloneJavaInfo() const;
102 :
103 : OUString getVendor() const;
104 : OUString getLocation() const;
105 : sal_uInt64 getFeatures() const;
106 : };
107 :
108 : class FrameworkException : public std::exception
109 : {
110 : public:
111 :
112 0 : FrameworkException(javaFrameworkError err, const OString& msg):
113 0 : errorCode(err), message(msg)
114 : {
115 0 : }
116 0 : virtual ~FrameworkException() throw () {}
117 : javaFrameworkError errorCode;
118 : OString message;
119 : };
120 : }
121 : #endif
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|