1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <sal/config.h>
27 #include <rtl/ustring.hxx>
28 #include <sal/types.h>
29 #include <typelib/typedescription.h>
30 #include <uno/dispatcher.h>
31 #include <uno/environment.h>
33 namespace com::sun::star::uno
{ class XInterface
; }
35 namespace bridges::cpp_uno::shared
{
39 extern "C" void freeUnoInterfaceProxy(
40 uno_ExtEnvironment
* pEnv
, void * pProxy
);
43 extern "C" void unoInterfaceProxyDispatch(
44 uno_Interface
* pUnoI
, typelib_TypeDescription
const * pMemberDescr
,
45 void * pReturn
, void * pArgs
[], uno_Any
** ppException
);
46 // this function is not defined in the generic part, but instead has to be
47 // defined individually for each CPP--UNO bridge
50 extern "C" void acquireProxy(uno_Interface
*);
53 extern "C" void releaseProxy(uno_Interface
*);
56 * A uno proxy wrapping a cpp interface.
58 class UnoInterfaceProxy
: public uno_Interface
{
60 // Interface for Bridge:
62 static UnoInterfaceProxy
* create(
63 Bridge
* pBridge
, com::sun::star::uno::XInterface
* pCppI
,
64 typelib_InterfaceTypeDescription
* pTypeDescr
,
65 OUString
const & rOId
);
67 // Interface for individual CPP--UNO bridges:
69 Bridge
* getBridge() { return pBridge
; }
70 com::sun::star::uno::XInterface
* getCppI() { return pCppI
; }
73 UnoInterfaceProxy(UnoInterfaceProxy
const &) = delete;
74 UnoInterfaceProxy
& operator =(const UnoInterfaceProxy
&) = delete;
77 Bridge
* pBridge_
, com::sun::star::uno::XInterface
* pCppI_
,
78 typelib_InterfaceTypeDescription
* pTypeDescr_
,
79 OUString
const & rOId_
);
83 std::atomic
<std::size_t> nRef
;
86 // mapping information
87 com::sun::star::uno::XInterface
* pCppI
; // wrapped interface
88 typelib_InterfaceTypeDescription
* pTypeDescr
;
91 friend void freeUnoInterfaceProxy(
92 uno_ExtEnvironment
* pEnv
, void * pProxy
);
94 friend void unoInterfaceProxyDispatch(
95 uno_Interface
* pUnoI
, typelib_TypeDescription
const * pMemberDescr
,
96 void * pReturn
, void * pArgs
[], uno_Any
** ppException
);
98 friend void acquireProxy(uno_Interface
* pUnoI
);
100 friend void releaseProxy(uno_Interface
* pUnoI
);
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */