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 .
20 #ifndef INCLUDED_BRIDGES_INC_CPPINTERFACEPROXY_HXX
21 #define INCLUDED_BRIDGES_INC_CPPINTERFACEPROXY_HXX
23 #include <sal/config.h>
28 #include <rtl/ustring.hxx>
29 #include <sal/types.h>
30 #include <typelib/typedescription.h>
31 #include <uno/dispatcher.h>
32 #include <uno/environment.h>
33 #include "vtablefactory.hxx"
35 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{
44 namespace bridges
{ namespace cpp_uno
{ namespace shared
{
48 extern "C" void freeCppInterfaceProxy(
49 uno_ExtEnvironment
* pEnv
, void * pInterface
);
52 * A cpp proxy wrapping a uno interface.
54 class CppInterfaceProxy
{
56 // Interface for Bridge:
58 static com::sun::star::uno::XInterface
* create(
59 Bridge
* pBridge
, uno_Interface
* pUnoI
,
60 typelib_InterfaceTypeDescription
* pTypeDescr
,
61 OUString
const & rOId
);
63 // Interface for individual CPP--UNO bridges:
65 Bridge
* getBridge() { return pBridge
; }
66 uno_Interface
* getUnoI() { return pUnoI
; }
67 typelib_InterfaceTypeDescription
* getTypeDescr() { return pTypeDescr
; }
68 const OUString
& getOid() const { return oid
; }
70 // non virtual methods called on incoming vtable calls #1, #2
74 static CppInterfaceProxy
* castInterfaceToProxy(void * pInterface
);
77 CppInterfaceProxy(CppInterfaceProxy
const &) = delete;
78 CppInterfaceProxy
& operator =(const CppInterfaceProxy
&) = delete;
81 Bridge
* pBridge_
, uno_Interface
* pUnoI_
,
82 typelib_InterfaceTypeDescription
* pTypeDescr_
,
83 OUString
const & rOId_
);
87 static com::sun::star::uno::XInterface
* castProxyToInterface(
88 CppInterfaceProxy
* pProxy
);
90 std::atomic
<std::size_t> nRef
;
93 // mapping information
94 uno_Interface
* pUnoI
; // wrapped interface
95 typelib_InterfaceTypeDescription
* pTypeDescr
;
98 VtableFactory::Slot
* vtables
[1];
100 friend void freeCppInterfaceProxy(
101 uno_ExtEnvironment
* pEnv
, void * pInterface
);
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */