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_BRIDGE_HXX
21 #define INCLUDED_BRIDGES_INC_BRIDGE_HXX
23 #include <sal/config.h>
28 #include <sal/types.h>
29 #include <typelib/typedescription.h>
30 #include <uno/environment.h>
31 #include <uno/mapping.h>
33 namespace bridges
{ namespace cpp_uno
{ namespace shared
{
36 extern "C" void freeMapping(uno_Mapping
*);
39 extern "C" void acquireMapping(uno_Mapping
*);
42 extern "C" void releaseMapping(uno_Mapping
*);
45 extern "C" void cpp2unoMapping(
46 uno_Mapping
*, void **, void *, typelib_InterfaceTypeDescription
*);
49 extern "C" void uno2cppMapping(
50 uno_Mapping
*, void **, void *, typelib_InterfaceTypeDescription
*);
53 * Holding environments and mappings.
57 // Interface for generic/component.cxx:
59 static uno_Mapping
* createMapping(
60 uno_ExtEnvironment
* pCppEnv
, uno_ExtEnvironment
* pUnoEnv
,
63 // Interface for Cpp/UnoInterfaceProxy:
68 // Interface for individual CPP--UNO bridges:
70 uno_ExtEnvironment
* getCppEnv() { return pCppEnv
; }
71 uno_ExtEnvironment
* getUnoEnv() { return pUnoEnv
; }
73 uno_Mapping
* getCpp2Uno() { return &aCpp2Uno
; }
74 uno_Mapping
* getUno2Cpp() { return &aUno2Cpp
; }
77 Bridge(Bridge
const &) = delete;
78 Bridge
& operator =(const Bridge
&) = delete;
81 uno_ExtEnvironment
* pCppEnv_
, uno_ExtEnvironment
* pUnoEnv_
,
82 bool bExportCpp2Uno_
);
86 struct Mapping
: public uno_Mapping
{
90 std::atomic
<std::size_t> nRef
;
92 uno_ExtEnvironment
* pCppEnv
;
93 uno_ExtEnvironment
* pUnoEnv
;
100 friend void freeMapping(uno_Mapping
* pMapping
);
102 friend void acquireMapping(uno_Mapping
* pMapping
);
104 friend void releaseMapping(uno_Mapping
* pMapping
);
106 friend void cpp2unoMapping(
107 uno_Mapping
* pMapping
, void ** ppUnoI
, void * pCppI
,
108 typelib_InterfaceTypeDescription
* pTypeDescr
);
110 friend void uno2cppMapping(
111 uno_Mapping
* pMapping
, void ** ppCppI
, void * pUnoI
,
112 typelib_InterfaceTypeDescription
* pTypeDescr
);
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */