tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / jvmaccess / unovirtualmachine.hxx
blob1b424dba9c6a67cf5f899fc19ca9a681a4677ff3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
21 #define INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
23 #include <jvmaccess/jvmaccessdllapi.h>
24 #include <sal/config.h>
25 #include <salhelper/simplereferenceobject.hxx>
26 #include <rtl/ref.hxx>
28 namespace jvmaccess
30 class VirtualMachine;
32 /** An encapsulating wrapper around a Java virtual machine and an appropriate
33 UNO class loader.
35 class JVMACCESS_DLLPUBLIC UnoVirtualMachine final : public salhelper::SimpleReferenceObject
37 public:
38 /** An exception indicating failure to create a UnoVirtualMachine.
40 class JVMACCESS_DLLPUBLIC CreationException final
42 public:
43 CreationException();
45 CreationException(CreationException const&);
47 CreationException& operator=(CreationException const&);
50 /** Create a wrapper around a Java virtual machine and an appropriate UNO
51 class loader.
53 @param virtualMachine
54 A Java virtual machine wrapper. Must not be null.
56 @param classLoader
57 A local or global JNI reference, relative to the given virtualMachine,
58 to an appropriate UNO class loader instance. Must not be null. This
59 parameter should be of type jobject, not void *, but the exact
60 definition of jobject is different for different JDK versions, so that
61 the mangled C++ name of the constructor would depend on the JDK version
62 used at compile time.
64 @exception CreationException
65 Thrown in case creation fails (due to a JNI problem).
67 UnoVirtualMachine(rtl::Reference<jvmaccess::VirtualMachine> virtualMachine, void* classLoader);
69 /** Get the Java virtual machine wrapper.
71 @return
72 The Java virtual machine wrapper. Will never be null.
74 const rtl::Reference<jvmaccess::VirtualMachine>& getVirtualMachine() const;
76 /** Get the UNO class loader.
78 @return
79 A global JNI reference to the UNO class loader. (The JNI reference must
80 not be deleted by client code.) Will never be null. This should be of
81 type jobject, not void *, but the exact definition of jobject is
82 different for different JDK versions, so that the mangled C++ name of
83 the function would depend on the JDK version used at compile time.
85 void* getClassLoader() const { return m_classLoader; }
87 private:
88 UnoVirtualMachine(UnoVirtualMachine const&) = delete;
89 UnoVirtualMachine& operator=(UnoVirtualMachine const&) = delete;
91 virtual ~UnoVirtualMachine() override;
93 rtl::Reference<jvmaccess::VirtualMachine> m_virtualMachine;
94 void* m_classLoader;
98 #endif
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */