LibreOffice Module cli_ure (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cli_uno::CliProxy Struct Reference

#include <cli_proxy.h>

Inheritance diagram for cli_uno::CliProxy:
[legend]
Collaboration diagram for cli_uno::CliProxy:
[legend]

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 Bridgem_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...
 

Detailed Description

Definition at line 172 of file cli_proxy.h.

Member Enumeration Documentation

◆ MethodKind

Enumerator
MK_METHOD 
MK_SET 
MK_GET 

Definition at line 182 of file cli_proxy.h.

Constructor & Destructor Documentation

◆ CliProxy()

cli_uno::CliProxy::CliProxy ( Bridge const *  bridge,
System::Object^  cliI,
typelib_TypeDescription const *  pTD,
const OUString &  usOid 
)

◆ ~CliProxy()

cli_uno::CliProxy::~CliProxy ( )

Member Function Documentation

◆ acquire()

void cli_uno::CliProxy::acquire ( ) const
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().

◆ create()

uno_Interface * cli_uno::CliProxy::create ( Bridge const *  bridge,
System::Object^  cliI,
typelib_TypeDescription const *  TD,
OUString const &  usOid 
)
static

◆ getMethodInfo()

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.

Parameters
nUnoFunctionPosPosition 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().

◆ makeMethodInfos()

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().

◆ release()

void cli_uno::CliProxy::release ( ) const
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().

◆ uno_DispatchMethod()

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.

Member Data Documentation

◆ m_arInterfaceMethodCount

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().

◆ m_arInterfaceMethodInfos

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().

◆ m_arMethodInfos

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().

◆ m_arUnoPosToCliPos

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().

◆ m_bridge

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().

◆ m_cliI

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().

◆ m_nInheritedInterfaces

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().

◆ m_oid

const gcroot<System::String^> cli_uno::CliProxy::m_oid

Definition at line 179 of file cli_proxy.h.

Referenced by CliProxy(), and ~CliProxy().

◆ m_ref

oslInterlockedCount cli_uno::CliProxy::m_ref
mutable

Definition at line 174 of file cli_proxy.h.

Referenced by acquire(), and release().

◆ m_type

gcroot<System::Type^> cli_uno::CliProxy::m_type

Definition at line 177 of file cli_proxy.h.

Referenced by CliProxy(), makeMethodInfos(), and ~CliProxy().

◆ m_unoType

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().

◆ m_usOid

const OUString cli_uno::CliProxy::m_usOid

Definition at line 180 of file cli_proxy.h.

Referenced by acquire(), and cli_proxy_dispatch().


The documentation for this struct was generated from the following files: