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 <sal/types.h>
28 #include <typelib/typedescription.h>
29 #include <uno/environment.h>
30 #include <uno/mapping.h>
32 namespace bridges::cpp_uno::shared
{
35 extern "C" void freeMapping(uno_Mapping
*);
38 extern "C" void acquireMapping(uno_Mapping
*);
41 extern "C" void releaseMapping(uno_Mapping
*);
44 extern "C" void cpp2unoMapping(
45 uno_Mapping
*, void **, void *, typelib_InterfaceTypeDescription
*);
48 extern "C" void uno2cppMapping(
49 uno_Mapping
*, void **, void *, typelib_InterfaceTypeDescription
*);
52 * Holding environments and mappings.
56 // Interface for generic/component.cxx:
58 static uno_Mapping
* createMapping(
59 uno_ExtEnvironment
* pCppEnv
, uno_ExtEnvironment
* pUnoEnv
,
62 // Interface for Cpp/UnoInterfaceProxy:
67 // Interface for individual CPP--UNO bridges:
69 uno_ExtEnvironment
* getCppEnv() { return pCppEnv
; }
70 uno_ExtEnvironment
* getUnoEnv() { return pUnoEnv
; }
72 uno_Mapping
* getCpp2Uno() { return &aCpp2Uno
; }
73 uno_Mapping
* getUno2Cpp() { return &aUno2Cpp
; }
76 Bridge(Bridge
const &) = delete;
77 Bridge
& operator =(const Bridge
&) = delete;
80 uno_ExtEnvironment
* pCppEnv_
, uno_ExtEnvironment
* pUnoEnv_
,
81 bool bExportCpp2Uno_
);
85 struct Mapping
: public uno_Mapping
{
89 std::atomic
<std::size_t> nRef
;
91 uno_ExtEnvironment
* pCppEnv
;
92 uno_ExtEnvironment
* pUnoEnv
;
99 friend void freeMapping(uno_Mapping
* pMapping
);
101 friend void acquireMapping(uno_Mapping
* pMapping
);
103 friend void releaseMapping(uno_Mapping
* pMapping
);
105 friend void cpp2unoMapping(
106 uno_Mapping
* pMapping
, void ** ppUnoI
, void * pCppI
,
107 typelib_InterfaceTypeDescription
* pTypeDescr
);
109 friend void uno2cppMapping(
110 uno_Mapping
* pMapping
, void ** ppCppI
, void * pUnoI
,
111 typelib_InterfaceTypeDescription
* pTypeDescr
);
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */