LibreOffice Module cli_ure (master) 1
|
#include <cli_proxy.h>
Public Types | |
enum | MethodKind { MK_METHOD = 0 , MK_SET , MK_GET } |
Public Member Functions | |
CliProxy (Bridge const *bridge, System::Object^ cliI, typelib_TypeDescription const *pTD, const OUString &usOid) | |
~CliProxy () | |
void | makeMethodInfos () |
Prepares an array (m_arMethoInfos) containing MethodInfo object of the interface and all inherited interfaces. More... | |
sr::MethodInfo | getMethodInfo (int nUnoFunctionPos, const OUString &usMethodName, MethodKind mk) |
Obtains a MethodInfo which can be used to invoke the cli object. More... | |
void SAL_CALL | uno_DispatchMethod (struct _uno_Interface *pUnoI, const struct _typelib_TypeDescription *pMemberType, void *pReturn, void *pArgs[], uno_Any **ppException) |
void | acquire () const |
void | release () const |
Static Public Member Functions | |
static uno_Interface * | create (Bridge const *bridge, System::Object^ cliI, typelib_TypeDescription const *TD, OUString const &usOid) |
Public Attributes | |
oslInterlockedCount | m_ref |
const Bridge * | m_bridge |
const gcroot< System::Object^> | m_cliI |
gcroot< System::Type^> | m_type |
const css::uno::TypeDescription | m_unoType |
const gcroot< System::String^> | m_oid |
const OUString | m_usOid |
gcroot< array< sr::MethodInfo^>^> | m_arMethodInfos |
The array contains MethodInfos of the cli object. More... | |
gcroot< array< sr::MethodInfo^>^> | m_arInterfaceMethodInfos |
This array is similar to m_arMethodInfos but it contains the MethodInfo objects of the interface (not the object). More... | |
gcroot< array< System::Int32 >^> | m_arUnoPosToCliPos |
Maps the position of the method in the UNO interface to the position of the corresponding MethodInfo in m_arMethodInfos. More... | |
int | m_nInheritedInterfaces |
Count of inherited interfaces of the cli interface. More... | |
gcroot< array< System::Int32^>^> | m_arInterfaceMethodCount |
Contains the number of methods of each interface. More... | |
Definition at line 172 of file cli_proxy.h.
Enumerator | |
---|---|
MK_METHOD | |
MK_SET | |
MK_GET |
Definition at line 182 of file cli_proxy.h.
cli_uno::CliProxy::CliProxy | ( | Bridge const * | bridge, |
System::Object^ | cliI, | ||
typelib_TypeDescription const * | pTD, | ||
const OUString & | usOid | ||
) |
Definition at line 633 of file cli_proxy.cxx.
References cli_uno::Bridge::acquire(), cli_proxy_acquire(), cli_proxy_dispatch(), cli_proxy_release(), m_bridge, m_bridge, m_oid, m_oid, m_ref, m_type, m_unoType, makeMethodInfos(), cli_uno::mapUnoType(), and pData.
Referenced by create().
cli_uno::CliProxy::~CliProxy | ( | ) |
Definition at line 812 of file cli_proxy.cxx.
References cli_uno::CliEnvHolder::g_cli_env, m_bridge, m_oid, m_type, m_unoType, cli_uno::mapUnoType(), cli_uno::Bridge::release(), and cli_uno::Cli_environment::revokeInterface().
|
inline |
Definition at line 855 of file cli_proxy.cxx.
References cli_proxy_free(), m_bridge, m_ref, cli_uno::Bridge::m_uno_env, m_unoType, and m_usOid.
Referenced by cli_proxy_acquire().
|
static |
Definition at line 825 of file cli_proxy.cxx.
References cli_proxy_free(), CliProxy(), cli_uno::CliEnvHolder::g_cli_env, cli_uno::Bridge::m_uno_env, cli_uno::mapUnoString(), cli_uno::mapUnoType(), and cli_uno::Cli_environment::registerInterface().
Referenced by cli_uno::Bridge::map_cli2uno().
sr::MethodInfo cli_uno::CliProxy::getMethodInfo | ( | int | nUnoFunctionPos, |
const OUString & | usMethodName, | ||
MethodKind | mk | ||
) |
Obtains a MethodInfo which can be used to invoke the cli object.
Internally it maps nUnoFunctionPos to an index that is used to get the corresponding MethodInfo object from m_arMethoInfos. The mapping table is dynamically initialized. If the cli interface has no base interface or exactly one then the mapping table is initialized in one go at the first call. In all ensuing calls the MethodInfo object is immediately retrieved through the mapping table.
If the interface has more than one interface in its inheritance chain, that is Type.GetInterfaces return more than one Type, then the mapping table is partially initialized. On the first call the mappings for the methods of the belonging interface are created.
The implementation assumes that the order of interface methods as provided by InterfaceMapping.InterfaceMethods corresponds to the order of methods in the interface declaration.
nUnoFunctionPos | Position of the method in the uno interface. |
Definition at line 743 of file cli_proxy.cxx.
References i, m_arInterfaceMethodInfos, m_arMethodInfos, m_arUnoPosToCliPos, cli_uno::mapUnoString(), MK_GET, MK_METHOD, MK_SET, cli_uno::Constants::sAttributeGet, and cli_uno::Constants::sAttributeSet.
Referenced by cli_proxy_dispatch().
void cli_uno::CliProxy::makeMethodInfos | ( | ) |
Prepares an array (m_arMethoInfos) containing MethodInfo object of the interface and all inherited interfaces.
At index null is the first method of the base interface and at the last position is the last method of the furthest derived interface. If a UNO call is received then one can determine the position of the method (or getter or setter for an attribute) from the passed type information. The position minus 3 (there is no XInterface in the cli mapping) corresponds to the index of the cli interface method in the array.
Definition at line 661 of file cli_proxy.cxx.
References i, index, m_arInterfaceMethodCount, m_arInterfaceMethodInfos, m_arMethodInfos, m_arUnoPosToCliPos, m_cliI, m_nInheritedInterfaces, m_type, map, cli_uno::mapCliString(), and type.
Referenced by CliProxy().
|
inline |
Definition at line 872 of file cli_proxy.cxx.
References m_bridge, m_ref, and cli_uno::Bridge::m_uno_env.
Referenced by cli_proxy_release().
void SAL_CALL cli_uno::CliProxy::uno_DispatchMethod | ( | struct _uno_Interface * | pUnoI, |
const struct _typelib_TypeDescription * | pMemberType, | ||
void * | pReturn, | ||
void * | pArgs[], | ||
uno_Any ** | ppException | ||
) |
Definition at line 847 of file cli_proxy.cxx.
gcroot<array<System::Int32^>^> cli_uno::CliProxy::m_arInterfaceMethodCount |
Contains the number of methods of each interface.
Definition at line 233 of file cli_proxy.h.
Referenced by makeMethodInfos().
gcroot<array<sr::MethodInfo^>^> cli_uno::CliProxy::m_arInterfaceMethodInfos |
This array is similar to m_arMethodInfos but it contains the MethodInfo objects of the interface (not the object).
When a call is made from uno to cli then the uno method name is compared to the cli method name. The cli method name can be obtained from the MethodInfo object in this array. The name of the actual implemented method may not be the same as the interface method.
Definition at line 213 of file cli_proxy.h.
Referenced by getMethodInfo(), and makeMethodInfos().
gcroot<array<sr::MethodInfo^>^> cli_uno::CliProxy::m_arMethodInfos |
The array contains MethodInfos of the cli object.
Each one reflects an implemented interface method of the interface for which this proxy was created. The MethodInfos are from the object's method and not from the interface type. That is, they can be used to invoke the methods. The order of the MethodInfo objects corresponds to the order of the interface methods (see member m_type). Position 0 contains the MethodInfo of the first method of the interface which represents the root of the inheritance chain. The last MethodInfo represents the last method of the furthest derived interface.
The array is completely initialized in the constructor of this object.
When the uno_DispatchMethod is called for this proxy then it receives a typelib_TypeDescription of the member which is either an attribute (setter or getter) or method. After determining the position of the method within the UNO interface one can use the position to obtain the MethodInfo of the corresponding cli method. To obtain the index for the m_arMethodInfos array the function position has to be decreased by 3. This is because, the cli interface does not contain the XInterface methods.
Definition at line 204 of file cli_proxy.h.
Referenced by getMethodInfo(), and makeMethodInfos().
gcroot<array<System::Int32>^> cli_uno::CliProxy::m_arUnoPosToCliPos |
Maps the position of the method in the UNO interface to the position of the corresponding MethodInfo in m_arMethodInfos.
The Uno position must not include the XInterface methods. For example, pos 0 = XInterface::queryInterface pos 1 = XInterface::acquire pos 2 = XInterface::release
That is the real Uno position has to be deducted by 3. Then arUnoPosToCliPos[pos] contains the index for m_arMethodInfos.
Definition at line 226 of file cli_proxy.h.
Referenced by getMethodInfo(), and makeMethodInfos().
const Bridge* cli_uno::CliProxy::m_bridge |
Definition at line 175 of file cli_proxy.h.
Referenced by acquire(), cli_proxy_dispatch(), CliProxy(), release(), and ~CliProxy().
const gcroot<System::Object^> cli_uno::CliProxy::m_cliI |
Definition at line 176 of file cli_proxy.h.
Referenced by cli_proxy_dispatch(), and makeMethodInfos().
int cli_uno::CliProxy::m_nInheritedInterfaces |
Count of inherited interfaces of the cli interface.
Definition at line 230 of file cli_proxy.h.
Referenced by makeMethodInfos().
const gcroot<System::String^> cli_uno::CliProxy::m_oid |
Definition at line 179 of file cli_proxy.h.
Referenced by CliProxy(), and ~CliProxy().
|
mutable |
Definition at line 174 of file cli_proxy.h.
gcroot<System::Type^> cli_uno::CliProxy::m_type |
Definition at line 177 of file cli_proxy.h.
Referenced by CliProxy(), makeMethodInfos(), and ~CliProxy().
const css::uno::TypeDescription cli_uno::CliProxy::m_unoType |
Definition at line 178 of file cli_proxy.h.
Referenced by acquire(), cli_proxy_dispatch(), CliProxy(), and ~CliProxy().
const OUString cli_uno::CliProxy::m_usOid |
Definition at line 180 of file cli_proxy.h.
Referenced by acquire(), and cli_proxy_dispatch().