LibreOffice Module bridges (master) 1
gcc3_wasm/uno2cpp.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 */
9
10#include <com/sun/star/uno/RuntimeException.hpp>
11
12#include <bridge.hxx>
13#include <types.hxx>
14#include <unointerfaceproxy.hxx>
15#include <vtables.hxx>
16
17using namespace ::com::sun::star::uno;
18
20{
21void unoInterfaceProxyDispatch(uno_Interface* pUnoI, const typelib_TypeDescription* pMemberDescr,
22 void* pReturn, void* pArgs[], uno_Any** ppException)
23{
26
27 switch (pMemberDescr->eTypeClass)
28 {
29 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
30 {
31 std::abort();
32 break;
33 }
34 case typelib_TypeClass_INTERFACE_METHOD:
35 {
36 VtableSlot aVtableSlot(getVtableSlot(
37 reinterpret_cast<typelib_InterfaceMethodTypeDescription const*>(pMemberDescr)));
38
39 switch (aVtableSlot.index)
40 {
41 case 1: // acquire uno interface
42 (*pUnoI->acquire)(pUnoI);
43 *ppException = 0;
44 break;
45 case 2: // release uno interface
46 (*pUnoI->release)(pUnoI);
47 *ppException = 0;
48 break;
49 case 0: // queryInterface() opt
50 {
52 TYPELIB_DANGER_GET(&pTD, reinterpret_cast<Type*>(pArgs[0])->getTypeLibType());
53 if (pTD)
54 {
55 uno_Interface* pInterface = 0;
56 (*pThis->getBridge()->getUnoEnv()->getRegisteredInterface)(
57 pThis->getBridge()->getUnoEnv(), (void**)&pInterface, pThis->oid.pData,
58 (typelib_InterfaceTypeDescription*)pTD);
59
60 if (pInterface)
61 {
62 ::uno_any_construct(reinterpret_cast<uno_Any*>(pReturn), &pInterface,
63 pTD, 0);
64 (*pInterface->release)(pInterface);
65 TYPELIB_DANGER_RELEASE(pTD);
66 *ppException = 0;
67 break;
68 }
69 TYPELIB_DANGER_RELEASE(pTD);
70 }
71 } // else perform queryInterface()
72 [[fallthrough]];
73 default:
74 std::abort();
75 }
76 break;
77 }
78 default:
79 {
80 ::com::sun::star::uno::RuntimeException aExc(
81 "illegal member type description!",
83
84 Type const& rExcType = cppu::UnoType<decltype(aExc)>::get();
85 // binary identical null reference
86 ::uno_type_any_construct(*ppException, &aExc, rExcType.getTypeLibType(), 0);
87 }
88 }
89}
90
91} // namespace bridges::cpp_uno::shared
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
uno_ExtEnvironment * getUnoEnv()
Definition: bridge.hxx:70
A uno proxy wrapping a cpp interface.
struct _typelib_TypeDescription typelib_TypeDescription
Definition: msvc/except.hxx:53
struct _uno_Any uno_Any
Definition: msvc/except.hxx:32
void unoInterfaceProxyDispatch(uno_Interface *pUnoI, typelib_TypeDescription const *pMemberDescr, void *pReturn, void **pArgs, uno_Any **ppException)
VtableSlot getVtableSlot(typelib_InterfaceAttributeTypeDescription const *ifcMember)
Calculates the vtable slot associated with an interface attribute member.
Definition: vtables.cxx:132
Type