summaryrefslogtreecommitdiff
path: root/cli_ure
diff options
context:
space:
mode:
authorPeter Foley <pefoley2@verizon.net>2012-08-27 15:28:23 -0400
committerDavid Tardon <dtardon@redhat.com>2012-10-07 10:42:14 +0200
commit4b56d82c7d20ba5897d87aaf7fc94da5356b8eec (patch)
treecf07b915fb3a6c76b992b28cdeeddeb346bad888 /cli_ure
parentb5bc77572338d04f8ff165ca85111096ce1d4804 (diff)
convert uno_bridge to new syntax
Change-Id: Iac5e9a860f7ef68104c4cfc19abe686b754190af
Diffstat (limited to 'cli_ure')
-rw-r--r--cli_ure/Library_cli_uno.mk2
-rw-r--r--cli_ure/source/uno_bridge/cli_base.h129
-rw-r--r--cli_ure/source/uno_bridge/cli_bridge.cxx11
-rw-r--r--cli_ure/source/uno_bridge/cli_bridge.h23
-rw-r--r--cli_ure/source/uno_bridge/cli_data.cxx687
-rw-r--r--cli_ure/source/uno_bridge/cli_environment.cxx67
-rw-r--r--cli_ure/source/uno_bridge/cli_environment.h31
-rw-r--r--cli_ure/source/uno_bridge/cli_proxy.cxx329
-rw-r--r--cli_ure/source/uno_bridge/cli_proxy.h104
-rw-r--r--cli_ure/source/uno_bridge/cli_uno.cxx42
10 files changed, 712 insertions, 713 deletions
diff --git a/cli_ure/Library_cli_uno.mk b/cli_ure/Library_cli_uno.mk
index 3166365bb1d4..aa34fc0641e2 100644
--- a/cli_ure/Library_cli_uno.mk
+++ b/cli_ure/Library_cli_uno.mk
@@ -11,7 +11,7 @@ $(eval $(call gb_Library_Library,cli_uno))
$(eval $(call gb_Library_add_cxxflags,cli_uno,\
-AI $(gb_Helper_OUTDIRLIBDIR) \
- -clr:oldSyntax \
+ -clr \
-wd4339 \
))
diff --git a/cli_ure/source/uno_bridge/cli_base.h b/cli_ure/source/uno_bridge/cli_base.h
index e678f8e52855..d544087d61cd 100644
--- a/cli_ure/source/uno_bridge/cli_base.h
+++ b/cli_ure/source/uno_bridge/cli_base.h
@@ -32,78 +32,77 @@ struct _oslMutexImpl
#include "rtl/ustring.hxx"
#include "typelib/typedescription.hxx"
-#using <mscorlib.dll>
#using <system.dll>
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
namespace cli_uno
{
-System::Type* loadCliType(System::String * typeName);
-System::Type* mapUnoType(typelib_TypeDescription const * pTD);
-System::Type* mapUnoType(typelib_TypeDescriptionReference const * pTD);
-typelib_TypeDescriptionReference* mapCliType(System::Type* cliType);
-rtl::OUString mapCliString(System::String const * data);
-System::String* mapUnoString(rtl_uString const * data);
-System::String* mapUnoTypeName(rtl_uString const * typeName);
-
-__gc struct Constants
+System::Type^ loadCliType(System::String ^ typeName);
+System::Type^ mapUnoType(typelib_TypeDescription const * pTD);
+System::Type^ mapUnoType(typelib_TypeDescriptionReference const * pTD);
+typelib_TypeDescriptionReference* mapCliType(System::Type^ cliType);
+rtl::OUString mapCliString(System::String const ^ data);
+System::String^ mapUnoString(rtl_uString const * data);
+System::String^ mapUnoTypeName(rtl_uString const * typeName);
+
+ref struct Constants
{
- static const System::String* sXInterfaceName= new System::String(
- S"unoidl.com.sun.star.uno.XInterface");
- static const System::String* sObject= new System::String(S"System.Object");
- static const System::String* sType= new System::String(S"System.Type");
- static const System::String* sUnoidl= new System::String(S"unoidl.");
- static const System::String* sVoid= new System::String(S"System.Void");
- static const System::String* sAny= new System::String(S"uno.Any");
- static const System::String* sArArray= new System::String(S"System.Array[]");
- static const System::String* sBoolean= new System::String(S"System.Boolean");
- static const System::String* sChar= new System::String(S"System.Char");
- static const System::String* sByte= new System::String(S"System.Byte");
- static const System::String* sInt16= new System::String(S"System.Int16");
- static const System::String* sUInt16= new System::String(S"System.UInt16");
- static const System::String* sInt32= new System::String(S"System.Int32");
- static const System::String* sUInt32= new System::String(S"System.UInt32");
- static const System::String* sInt64= new System::String(S"System.Int64");
- static const System::String* sUInt64= new System::String(S"System.UInt64");
- static const System::String* sString= new System::String(S"System.String");
- static const System::String* sSingle= new System::String(S"System.Single");
- static const System::String* sDouble= new System::String(S"System.Double");
- static const System::String* sArBoolean= new System::String(S"System.Boolean[]");
- static const System::String* sArChar= new System::String(S"System.Char[]");
- static const System::String* sArByte= new System::String(S"System.Byte[]");
- static const System::String* sArInt16= new System::String(S"System.Int16[]");
- static const System::String* sArUInt16= new System::String(S"System.UInt16[]");
- static const System::String* sArInt32= new System::String(S"System.Int32[]");
- static const System::String* sArUInt32= new System::String(S"System.UInt32[]");
- static const System::String* sArInt64= new System::String(S"System.Int64[]");
- static const System::String* sArUInt64= new System::String(S"System.UInt64[]");
- static const System::String* sArString= new System::String(S"System.String[]");
- static const System::String* sArSingle= new System::String(S"System.Single[]");
- static const System::String* sArDouble= new System::String(S"System.Double[]");
- static const System::String* sArType= new System::String(S"System.Type[]");
- static const System::String* sArObject= new System::String(S"System.Object[]");
- static const System::String* sBrackets= new System::String(S"[]");
- static const System::String* sAttributeSet= new System::String(S"set_");
- static const System::String* sAttributeGet= new System::String(S"get_");
-
- static const System::String* usXInterface = S"com.sun.star.uno.XInterface";
- static const System::String* usVoid = S"void";
- static const System::String* usType = S"type";
- static const System::String* usAny = S"any";
- static const System::String* usBrackets = S"[]";
- static const System::String* usBool = S"boolean";
- static const System::String* usByte = S"byte";
- static const System::String* usChar = S"char";
- static const System::String* usShort = S"short";
- static const System::String* usUShort = S"unsigned short";
- static const System::String* usLong = S"long";
- static const System::String* usULong = S"unsigned long";
- static const System::String* usHyper = S"hyper";
- static const System::String* usUHyper = S"unsigned hyper";
- static const System::String* usString = S"string";
- static const System::String* usFloat = S"float";
- static const System::String* usDouble = S"double";
+ static const System::String^ sXInterfaceName= gcnew System::String(
+ "unoidl.com.sun.star.uno.XInterface");
+ static const System::String^ sObject= gcnew System::String("System.Object");
+ static const System::String^ sType= gcnew System::String("System.Type");
+ static const System::String^ sUnoidl= gcnew System::String("unoidl.");
+ static const System::String^ sVoid= gcnew System::String("System.Void");
+ static const System::String^ sAny= gcnew System::String("uno.Any");
+ static const System::String^ sArArray= gcnew System::String("System.Array[]");
+ static const System::String^ sBoolean= gcnew System::String("System.Boolean");
+ static const System::String^ sChar= gcnew System::String("System.Char");
+ static const System::String^ sByte= gcnew System::String("System.Byte");
+ static const System::String^ sInt16= gcnew System::String("System.Int16");
+ static const System::String^ sUInt16= gcnew System::String("System.UInt16");
+ static const System::String^ sInt32= gcnew System::String("System.Int32");
+ static const System::String^ sUInt32= gcnew System::String("System.UInt32");
+ static const System::String^ sInt64= gcnew System::String("System.Int64");
+ static const System::String^ sUInt64= gcnew System::String("System.UInt64");
+ static const System::String^ sString= gcnew System::String("System.String");
+ static const System::String^ sSingle= gcnew System::String("System.Single");
+ static const System::String^ sDouble= gcnew System::String("System.Double");
+ static const System::String^ sArBoolean= gcnew System::String("System.Boolean[]");
+ static const System::String^ sArChar= gcnew System::String("System.Char[]");
+ static const System::String^ sArByte= gcnew System::String("System.Byte[]");
+ static const System::String^ sArInt16= gcnew System::String("System.Int16[]");
+ static const System::String^ sArUInt16= gcnew System::String("System.UInt16[]");
+ static const System::String^ sArInt32= gcnew System::String("System.Int32[]");
+ static const System::String^ sArUInt32= gcnew System::String("System.UInt32[]");
+ static const System::String^ sArInt64= gcnew System::String("System.Int64[]");
+ static const System::String^ sArUInt64= gcnew System::String("System.UInt64[]");
+ static const System::String^ sArString= gcnew System::String("System.String[]");
+ static const System::String^ sArSingle= gcnew System::String("System.Single[]");
+ static const System::String^ sArDouble= gcnew System::String("System.Double[]");
+ static const System::String^ sArType= gcnew System::String("System.Type[]");
+ static const System::String^ sArObject= gcnew System::String("System.Object[]");
+ static const System::String^ sBrackets= gcnew System::String("[]");
+ static const System::String^ sAttributeSet= gcnew System::String("set_");
+ static const System::String^ sAttributeGet= gcnew System::String("get_");
+
+ static const System::String^ usXInterface = "com.sun.star.uno.XInterface";
+ static const System::String^ usVoid = "void";
+ static const System::String^ usType = "type";
+ static const System::String^ usAny = "any";
+ static const System::String^ usBrackets = "[]";
+ static const System::String^ usBool = "boolean";
+ static const System::String^ usByte = "byte";
+ static const System::String^ usChar = "char";
+ static const System::String^ usShort = "short";
+ static const System::String^ usUShort = "unsigned short";
+ static const System::String^ usLong = "long";
+ static const System::String^ usULong = "unsigned long";
+ static const System::String^ usHyper = "hyper";
+ static const System::String^ usUHyper = "unsigned hyper";
+ static const System::String^ usString = "string";
+ static const System::String^ usFloat = "float";
+ static const System::String^ usDouble = "double";
};
struct BridgeRuntimeError
diff --git a/cli_ure/source/uno_bridge/cli_bridge.cxx b/cli_ure/source/uno_bridge/cli_bridge.cxx
index 53329e8d80b6..12b432ed6dab 100644
--- a/cli_ure/source/uno_bridge/cli_bridge.cxx
+++ b/cli_ure/source/uno_bridge/cli_bridge.cxx
@@ -31,7 +31,6 @@
#include "cli_bridge.h"
#include "cli_proxy.h"
-#using <mscorlib.dll>
#if defined(_MSC_VER) && (_MSC_VER < 1400)
#include <_vcclrit.h>
#endif
@@ -85,7 +84,7 @@ void SAL_CALL Mapping_cli2uno(
if (0 != cliI)
{
- System::Object* cliObj= sri::GCHandle::op_Explicit(cliI).Target;
+ System::Object^ cliObj= sri::GCHandle::FromIntPtr(IntPtr(cliI)).Target;
(*ppOut)= bridge->map_cli2uno(cliObj, (typelib_TypeDescription*) td);
}
}
@@ -130,16 +129,16 @@ void SAL_CALL Mapping_uno2cli(
if (0 != *ppDNetI)
{
- sri::GCHandle::op_Explicit(ppDNetI).Free();
+ sri::GCHandle::FromIntPtr(IntPtr(ppDNetI)).Free();
}
if (0 != pUnoI)
{
- System::Object* cliI= bridge->map_uno2cli(pUnoI, td);
+ System::Object^ cliI= bridge->map_uno2cli(pUnoI, td);
intptr_t ptr= NULL;
if(cliI)
{
- ptr= sri::GCHandle::op_Explicit(sri::GCHandle::Alloc(cliI))
+ ptr= sri::GCHandle::ToIntPtr(sri::GCHandle::Alloc(cliI))
#ifdef _WIN32
.ToInt32();
#else /* defined(_WIN64) */ .ToInt64();
@@ -288,7 +287,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_initEnvironment( uno_Environment * uno_cl
//where g_cli_env is accessed.
//When we compile the bridge with .NET 2 then we can again hold g_cli_env as a static gcroot
//member in a unmanaged class, such as Bridge.
- CliEnvHolder::g_cli_env = new Cli_environment();
+ CliEnvHolder::g_cli_env = gcnew Cli_environment();
}
//##################################################################################################
SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping(
diff --git a/cli_ure/source/uno_bridge/cli_bridge.h b/cli_ure/source/uno_bridge/cli_bridge.h
index 7c451695d10b..b12b44816f46 100644
--- a/cli_ure/source/uno_bridge/cli_bridge.h
+++ b/cli_ure/source/uno_bridge/cli_bridge.h
@@ -26,7 +26,6 @@
#include "uno/dispatcher.h"
#include "cli_base.h"
#include "cli_environment.h"
-#using <mscorlib.dll>
//#using <cli_uretypes.dll>
#using <cli_basetypes.dll>
#using <system.dll>
@@ -47,8 +46,8 @@ struct Mapping : public uno_Mapping
// The environment will be created in uno_initEnvironment. See also the remarks there
//Managed cli environment for cli objects an UNO proxies (which are cli
//objects. The uno_Environment is not used for cli objects.
-__gc struct CliEnvHolder {
-static Cli_environment * g_cli_env = NULL;
+ref struct CliEnvHolder {
+static Cli_environment ^ g_cli_env = nullptr;
};
//==================================================================================================
@@ -72,7 +71,7 @@ struct Bridge
void release() const;
void map_to_uno(
- void * uno_data, System::Object* cli_data,
+ void * uno_data, System::Object^ cli_data,
typelib_TypeDescriptionReference * type,
bool assign) const;
@@ -81,28 +80,28 @@ struct Bridge
the type of the converted data. It may be a byref type.
*/
void map_to_cli(
- System::Object* *cli_data, void const * uno_data,
- typelib_TypeDescriptionReference * type, System::Type* info /* maybe 0 */,
+ System::Object^ *cli_data, void const * uno_data,
+ typelib_TypeDescriptionReference * type, System::Type^ info /* maybe 0 */,
bool bDontCreateObj) const;
- System::Object* map_uno2cli(uno_Interface * pUnoI, typelib_InterfaceTypeDescription* pTD) const;
+ System::Object^ map_uno2cli(uno_Interface * pUnoI, typelib_InterfaceTypeDescription* pTD) const;
- System::Object* call_uno(uno_Interface * pUnoI,
+ System::Object^ call_uno(uno_Interface * pUnoI,
typelib_TypeDescription* member_td,
typelib_TypeDescriptionReference * return_type,
sal_Int32 nParams, typelib_MethodParameter const * pParams,
- System::Object * args[], System::Type* argTypes[],
- System::Object** pException) const;
+ array<System::Object^>^ args, array<System::Type^>^ argTypes,
+ System::Object^* pException) const;
void call_cli(
- System::Object* cliI, sr::MethodInfo* method,
+ System::Object^ cliI, sr::MethodInfo^ method,
typelib_TypeDescriptionReference * return_type,
typelib_MethodParameter * params, int nParams,
void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) const;
uno_Interface * map_cli2uno(
- System::Object* cliI, typelib_TypeDescription* pTD) const;
+ System::Object^ cliI, typelib_TypeDescription* pTD) const;
};
diff --git a/cli_ure/source/uno_bridge/cli_data.cxx b/cli_ure/source/uno_bridge/cli_data.cxx
index e9edae0dbb9e..3a0eb8050319 100644
--- a/cli_ure/source/uno_bridge/cli_data.cxx
+++ b/cli_ure/source/uno_bridge/cli_data.cxx
@@ -52,10 +52,10 @@ using ::rtl::OUStringBuffer;
namespace cli_uno
{
-System::String* mapUnoPolymorphicName(System::String* unoName);
-OUString mapCliTypeName(System::String* typeName);
-System::String* mapCliPolymorphicName(System::String* unoName);
-System::String* mapPolymorphicName(System::String* unoName, bool bCliToUno);
+System::String^ mapUnoPolymorphicName(System::String^ unoName);
+OUString mapCliTypeName(System::String^ typeName);
+System::String^ mapCliPolymorphicName(System::String^ unoName);
+System::String^ mapPolymorphicName(System::String^ unoName, bool bCliToUno);
inline auto_ptr< rtl_mem > seq_allocate( sal_Int32 nElements, sal_Int32 nSize )
{
@@ -68,9 +68,9 @@ inline auto_ptr< rtl_mem > seq_allocate( sal_Int32 nElements, sal_Int32 nSize )
}
-System::Object* Bridge::map_uno2cli(uno_Interface * pUnoI, typelib_InterfaceTypeDescription *pTD) const
+System::Object^ Bridge::map_uno2cli(uno_Interface * pUnoI, typelib_InterfaceTypeDescription *pTD) const
{
- System::Object* retVal= NULL;
+ System::Object^ retVal= nullptr;
// get oid
rtl_uString * pOid = 0;
(*m_uno_env->getObjectIdentifier)( m_uno_env, &pOid, pUnoI );
@@ -78,8 +78,8 @@ System::Object* Bridge::map_uno2cli(uno_Interface * pUnoI, typelib_InterfaceType
OUString oid(pOid, SAL_NO_ACQUIRE);
//see if the interface was already mapped
- System::Type* ifaceType= mapUnoType(reinterpret_cast<typelib_TypeDescription*>(pTD));
- System::String* sOid= mapUnoString(oid.pData);
+ System::Type^ ifaceType= mapUnoType(reinterpret_cast<typelib_TypeDescription*>(pTD));
+ System::String^ sOid= mapUnoString(oid.pData);
System::Threading::Monitor::Enter( CliEnvHolder::g_cli_env );
try
@@ -93,7 +93,7 @@ System::Object* Bridge::map_uno2cli(uno_Interface * pUnoI, typelib_InterfaceType
// interface. If it already does that, then it does nothing
if (srr::RemotingServices::IsTransparentProxy(retVal))
{
- UnoInterfaceProxy* p = static_cast<UnoInterfaceProxy*>(
+ UnoInterfaceProxy^ p = static_cast<UnoInterfaceProxy^>(
srr::RemotingServices::GetRealProxy(retVal));
p->addUnoInterface(pUnoI, pTD);
}
@@ -112,18 +112,18 @@ System::Object* Bridge::map_uno2cli(uno_Interface * pUnoI, typelib_InterfaceType
return retVal;
}
-uno_Interface* Bridge::map_cli2uno(System::Object* cliObj, typelib_TypeDescription *pTD) const
+uno_Interface* Bridge::map_cli2uno(System::Object^ cliObj, typelib_TypeDescription *pTD) const
{
uno_Interface* retIface = NULL;
// get oid from dot net environment
- System::String* ds_oid = CliEnvHolder::g_cli_env->getObjectIdentifier( cliObj);
+ System::String^ ds_oid = CliEnvHolder::g_cli_env->getObjectIdentifier( cliObj);
OUString ousOid = mapCliString(ds_oid);
// look if interface is already mapped
m_uno_env->getRegisteredInterface(m_uno_env, (void**) &retIface, ousOid.pData,
(typelib_InterfaceTypeDescription*) pTD);
if ( ! retIface)
{
- System::Threading::Monitor::Enter(__typeof(Cli_environment));
+ System::Threading::Monitor::Enter(Cli_environment::typeid);
try
{
m_uno_env->getRegisteredInterface(m_uno_env, (void**) &retIface, ousOid.pData,
@@ -135,35 +135,35 @@ uno_Interface* Bridge::map_cli2uno(System::Object* cliObj, typelib_TypeDescripti
}
__finally
{
- System::Threading::Monitor::Exit(__typeof(Cli_environment));
+ System::Threading::Monitor::Exit(Cli_environment::typeid);
}
}
return retIface;
}
-inline System::Type* loadCliType(rtl_uString * unoName)
+inline System::Type^ loadCliType(rtl_uString * unoName)
{
return loadCliType(mapUnoTypeName(unoName));
}
-System::Type* loadCliType(System::String * unoName)
+System::Type^ loadCliType(System::String ^ unoName)
{
- System::Type* retVal= NULL;
+ System::Type^ retVal= nullptr;
try
{
//If unoName denotes a polymorphic type, e.g com.sun.star.beans.Defaulted<System.Char>
//then we remove the type list, otherwise the type could not be loaded.
bool bIsPolymorphic = false;
- System::String * loadName = unoName;
+ System::String ^ loadName = unoName;
int index = unoName->IndexOf('<');
if (index != -1)
{
loadName = unoName->Substring(0, index);
bIsPolymorphic = true;
}
- System::AppDomain* currentDomain = System::AppDomain::CurrentDomain;
- sr::Assembly* assems[] = currentDomain->GetAssemblies();
+ System::AppDomain^ currentDomain = System::AppDomain::CurrentDomain;
+ array<sr::Assembly^>^ assems = currentDomain->GetAssemblies();
for (int i = 0; i < assems->Length; i++)
{
retVal = assems[i]->GetType(loadName, false);
@@ -171,9 +171,9 @@ System::Type* loadCliType(System::String * unoName)
break;
}
- if (retVal == NULL)
+ if (retVal == nullptr)
{
- System::String * msg = new System::String(S"A type could not be loaded: ");
+ System::String ^ msg = gcnew System::String("A type could not be loaded: ");
msg = System::String::Concat(msg, loadName);
throw BridgeRuntimeError(mapCliString(msg));
}
@@ -183,55 +183,55 @@ System::Type* loadCliType(System::String * unoName)
retVal = uno::PolymorphicType::GetType(retVal, unoName);
}
}
- catch( System::Exception * e)
+ catch( System::Exception ^ e)
{
- rtl::OUString ouMessage(mapCliString(e->get_Message()));
+ rtl::OUString ouMessage(mapCliString(e->Message));
throw BridgeRuntimeError(ouMessage);
}
return retVal;
}
-System::Type* mapUnoType(typelib_TypeDescription const * pTD)
+System::Type^ mapUnoType(typelib_TypeDescription const * pTD)
{
return mapUnoType(pTD->pWeakRef);
}
-System::Type* mapUnoType(typelib_TypeDescriptionReference const * pTD)
+System::Type^ mapUnoType(typelib_TypeDescriptionReference const * pTD)
{
- System::Type * retVal = 0;
+ System::Type ^ retVal = nullptr;
switch (pTD->eTypeClass)
{
case typelib_TypeClass_VOID:
- retVal= __typeof(void); break;
+ retVal= void::typeid; break;
case typelib_TypeClass_CHAR:
- retVal= __typeof(System::Char); break;
+ retVal= System::Char::typeid; break;
case typelib_TypeClass_BOOLEAN:
- retVal= __typeof(System::Boolean); break;
+ retVal= System::Boolean::typeid; break;
case typelib_TypeClass_BYTE:
- retVal= __typeof(System::Byte); break;
+ retVal= System::Byte::typeid; break;
case typelib_TypeClass_SHORT:
- retVal= __typeof(System::Int16); break;
+ retVal= System::Int16::typeid; break;
case typelib_TypeClass_UNSIGNED_SHORT:
- retVal= __typeof(System::UInt16); break;
+ retVal= System::UInt16::typeid; break;
case typelib_TypeClass_LONG:
- retVal= __typeof(System::Int32); break;
+ retVal= System::Int32::typeid; break;
case typelib_TypeClass_UNSIGNED_LONG:
- retVal= __typeof(System::UInt32); break;
+ retVal= System::UInt32::typeid; break;
case typelib_TypeClass_HYPER:
- retVal= __typeof(System::Int64); break;
+ retVal= System::Int64::typeid; break;
case typelib_TypeClass_UNSIGNED_HYPER:
- retVal= __typeof(System::UInt64); break;
+ retVal= System::UInt64::typeid; break;
case typelib_TypeClass_FLOAT:
- retVal= __typeof(System::Single); break;
+ retVal= System::Single::typeid; break;
case typelib_TypeClass_DOUBLE:
- retVal= __typeof(System::Double); break;
+ retVal= System::Double::typeid; break;
case typelib_TypeClass_STRING:
- retVal= __typeof(System::String); break;
+ retVal= System::String::typeid; break;
case typelib_TypeClass_TYPE:
- retVal= __typeof(System::Type); break;
+ retVal= System::Type::typeid; break;
case typelib_TypeClass_ANY:
- retVal= __typeof(uno::Any); break;
+ retVal= uno::Any::typeid; break;
case typelib_TypeClass_ENUM:
case typelib_TypeClass_STRUCT:
case typelib_TypeClass_EXCEPTION:
@@ -241,7 +241,7 @@ System::Type* mapUnoType(typelib_TypeDescriptionReference const * pTD)
//special handling for XInterface, since it does not exist in cli.
rtl::OUString usXInterface(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface"));
if (usXInterface.equals(pTD->pTypeName))
- retVal= __typeof(System::Object);
+ retVal= System::Object::typeid;
else
retVal= loadCliType(pTD->pTypeName);
break;
@@ -255,42 +255,42 @@ System::Type* mapUnoType(typelib_TypeDescriptionReference const * pTD)
switch (pElementTDRef->eTypeClass)
{
case typelib_TypeClass_CHAR:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArChar)); break;
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArChar)); break;
case typelib_TypeClass_BOOLEAN:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArBoolean));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArBoolean));
break;
case typelib_TypeClass_BYTE:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArByte));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArByte));
break;
case typelib_TypeClass_SHORT:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArInt16));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArInt16));
break;
case typelib_TypeClass_UNSIGNED_SHORT:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArUInt16));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArUInt16));
break;
case typelib_TypeClass_LONG:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArInt32));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArInt32));
break;
case typelib_TypeClass_UNSIGNED_LONG:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArUInt32));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArUInt32));
break;
case typelib_TypeClass_HYPER:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArInt64));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArInt64));
break;
case typelib_TypeClass_UNSIGNED_HYPER:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArUInt64));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArUInt64));
break;
case typelib_TypeClass_FLOAT:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArSingle));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArSingle));
break;
case typelib_TypeClass_DOUBLE:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArDouble));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArDouble));
break;
case typelib_TypeClass_STRING:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArString));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArString));
break;
case typelib_TypeClass_TYPE:
- retVal= System::Type::GetType(const_cast<System::String*>(Constants::sArType));
+ retVal= System::Type::GetType(const_cast<System::String^>(Constants::sArType));
break;
case typelib_TypeClass_ANY:
case typelib_TypeClass_ENUM:
@@ -318,10 +318,10 @@ System::Type* mapUnoType(typelib_TypeDescriptionReference const * pTD)
/** Returns an acquired td.
*/
-typelib_TypeDescriptionReference* mapCliType(System::Type* cliType)
+typelib_TypeDescriptionReference* mapCliType(System::Type^ cliType)
{
typelib_TypeDescriptionReference* retVal= NULL;
- if (cliType == NULL)
+ if (cliType == nullptr)
{
retVal = * typelib_static_type_getByTypeClass(
typelib_TypeClass_VOID );
@@ -330,9 +330,9 @@ typelib_TypeDescriptionReference* mapCliType(System::Type* cliType)
}
//check for Enum first,
//because otherwise case System::TypeCode::Int32 applies
- if (cliType->get_IsEnum())
+ if (cliType->IsEnum)
{
- OUString usTypeName= mapCliTypeName(cliType->get_FullName());
+ OUString usTypeName= mapCliTypeName(cliType->FullName);
css::uno::Type unoType(css::uno::TypeClass_ENUM, usTypeName);
retVal= unoType.getTypeLibType();
typelib_typedescriptionreference_acquire(retVal);
@@ -407,9 +407,9 @@ typelib_TypeDescriptionReference* mapCliType(System::Type* cliType)
}
if (retVal == NULL)
{
- System::String* cliTypeName= cliType->get_FullName();
+ System::String^ cliTypeName= cliType->FullName;
// Void
- if (const_cast<System::String*>(Constants::sVoid)->Equals(
+ if (const_cast<System::String^>(Constants::sVoid)->Equals(
cliTypeName))
{
retVal = * typelib_static_type_getByTypeClass(
@@ -417,7 +417,7 @@ typelib_TypeDescriptionReference* mapCliType(System::Type* cliType)
typelib_typedescriptionreference_acquire( retVal );
}
// Type
- else if (const_cast<System::String*>(Constants::sType)->Equals(
+ else if (const_cast<System::String^>(Constants::sType)->Equals(
cliTypeName))
{
retVal = * typelib_static_type_getByTypeClass(
@@ -425,7 +425,7 @@ typelib_TypeDescriptionReference* mapCliType(System::Type* cliType)
typelib_typedescriptionreference_acquire( retVal );
}
// Any
- else if (const_cast<System::String*>(Constants::sAny)->Equals(
+ else if (const_cast<System::String^>(Constants::sAny)->Equals(
cliTypeName))
{
retVal = * typelib_static_type_getByTypeClass(
@@ -436,8 +436,8 @@ typelib_TypeDescriptionReference* mapCliType(System::Type* cliType)
else
{
OUString usTypeName;
- uno::PolymorphicType * poly = dynamic_cast<uno::PolymorphicType*>(cliType);
- if (poly != NULL)
+ uno::PolymorphicType ^ poly = dynamic_cast<uno::PolymorphicType^>(cliType);
+ if (poly != nullptr)
usTypeName = mapCliTypeName( poly->PolymorphicName);
else
usTypeName = mapCliTypeName(cliTypeName);
@@ -457,7 +457,7 @@ typelib_TypeDescriptionReference* mapCliType(System::Type* cliType)
buf.appendAscii(
RTL_CONSTASCII_STRINGPARAM("[cli_uno bridge] mapCliType():"
"could not map type: ") );
- buf.append(mapCliString(cliType->get_FullName()));
+ buf.append(mapCliString(cliType->FullName));
throw BridgeRuntimeError( buf.makeStringAndClear() );
}
return retVal;
@@ -466,10 +466,10 @@ typelib_TypeDescriptionReference* mapCliType(System::Type* cliType)
/**
Otherwise a leading "unoidl." is removed.
*/
-System::String* mapUnoTypeName(rtl_uString const * typeName)
+System::String^ mapUnoTypeName(rtl_uString const * typeName)
{
OUString usUnoName( const_cast< rtl_uString * >( typeName ) );
- st::StringBuilder* buf= new st::StringBuilder();
+ st::StringBuilder^ buf= gcnew st::StringBuilder();
//determine if the type is a sequence and its dimensions
int dims= 0;
if (usUnoName[0] == '[')
@@ -484,52 +484,52 @@ System::String* mapUnoTypeName(rtl_uString const * typeName)
}
usUnoName = usUnoName.copy(index - 1);
}
- System::String * sUnoName = mapUnoString(usUnoName.pData);
- if (sUnoName->Equals(const_cast<System::String*>(Constants::usBool)))
- buf->Append(const_cast<System::String*>(Constants::sBoolean));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usChar)))
- buf->Append(const_cast<System::String*>(Constants::sChar));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usByte)))
- buf->Append(const_cast<System::String*>(Constants::sByte));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usShort)))
- buf->Append(const_cast<System::String*>(Constants::sInt16));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usUShort)))
- buf->Append(const_cast<System::String*>(Constants::sUInt16));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usLong)))
- buf->Append(const_cast<System::String*>(Constants::sInt32));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usULong)))
- buf->Append(const_cast<System::String*>(Constants::sUInt32));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usHyper)))
- buf->Append(const_cast<System::String*>(Constants::sInt64));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usUHyper)))
- buf->Append(const_cast<System::String*>(Constants::sUInt64));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usFloat)))
- buf->Append(const_cast<System::String*>(Constants::sSingle));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usDouble)))
- buf->Append(const_cast<System::String*>(Constants::sDouble));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usString)))
- buf->Append(const_cast<System::String*>(Constants::sString));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usVoid)))
- buf->Append(const_cast<System::String*>(Constants::sVoid));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usType)))
- buf->Append(const_cast<System::String*>(Constants::sType));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usXInterface)))
- buf->Append(const_cast<System::String*>(Constants::sObject));
- else if (sUnoName->Equals(const_cast<System::String*>(Constants::usAny)))
+ System::String ^ sUnoName = mapUnoString(usUnoName.pData);
+ if (sUnoName->Equals(const_cast<System::String^>(Constants::usBool)))
+ buf->Append(const_cast<System::String^>(Constants::sBoolean));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usChar)))
+ buf->Append(const_cast<System::String^>(Constants::sChar));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usByte)))
+ buf->Append(const_cast<System::String^>(Constants::sByte));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usShort)))
+ buf->Append(const_cast<System::String^>(Constants::sInt16));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usUShort)))
+ buf->Append(const_cast<System::String^>(Constants::sUInt16));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usLong)))
+ buf->Append(const_cast<System::String^>(Constants::sInt32));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usULong)))
+ buf->Append(const_cast<System::String^>(Constants::sUInt32));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usHyper)))
+ buf->Append(const_cast<System::String^>(Constants::sInt64));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usUHyper)))
+ buf->Append(const_cast<System::String^>(Constants::sUInt64));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usFloat)))
+ buf->Append(const_cast<System::String^>(Constants::sSingle));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usDouble)))
+ buf->Append(const_cast<System::String^>(Constants::sDouble));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usString)))
+ buf->Append(const_cast<System::String^>(Constants::sString));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usVoid)))
+ buf->Append(const_cast<System::String^>(Constants::sVoid));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usType)))
+ buf->Append(const_cast<System::String^>(Constants::sType));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usXInterface)))
+ buf->Append(const_cast<System::String^>(Constants::sObject));
+ else if (sUnoName->Equals(const_cast<System::String^>(Constants::usAny)))
{
- buf->Append(const_cast<System::String*>(Constants::sAny));
+ buf->Append(const_cast<System::String^>(Constants::sAny));
}
else
{
//put "unoidl." at the beginning
- buf->Append(const_cast<System::String*>(Constants::sUnoidl));
+ buf->Append(const_cast<System::String^>(Constants::sUnoidl));
//for polymorphic struct types remove the brackets, e.g mystruct<bool> -> mystruct
- System::String * sName = mapUnoPolymorphicName(sUnoName);
+ System::String ^ sName = mapUnoPolymorphicName(sUnoName);
buf->Append(sName);
}
// apend []
for (;dims--;)
- buf->Append(const_cast<System::String*>(Constants::sBrackets));
+ buf->Append(const_cast<System::String^>(Constants::sBrackets));
return buf->ToString();
}
@@ -544,7 +544,7 @@ System::String* mapUnoTypeName(rtl_uString const * typeName)
System.Int32, etc.
The präfix unoidl is not added.
*/
-inline System::String* mapUnoPolymorphicName(System::String* unoName)
+inline System::String^ mapUnoPolymorphicName(System::String^ unoName)
{
return mapPolymorphicName(unoName, false);
}
@@ -555,18 +555,18 @@ inline System::String* mapUnoPolymorphicName(System::String* unoName)
long, etc.
The präfix unoidl remains.
*/
-inline System::String* mapCliPolymorphicName(System::String* unoName)
+inline System::String^ mapCliPolymorphicName(System::String^ unoName)
{
return mapPolymorphicName(unoName, true);
}
-System::String* mapPolymorphicName(System::String* unoName, bool bCliToUno)
+System::String^ mapPolymorphicName(System::String^ unoName, bool bCliToUno)
{
int index = unoName->IndexOf('<');
if (index == -1)
return unoName;
- System::Text::StringBuilder * builder = new System::Text::StringBuilder(256);
+ System::Text::StringBuilder ^ builder = gcnew System::Text::StringBuilder(256);
builder->Append(unoName->Substring(0, index +1 ));
//Find the first occurrence of ','
@@ -579,14 +579,14 @@ System::String* mapPolymorphicName(System::String* unoName, bool bCliToUno)
int countParams = 0;
while (cur <= endIndex)
{
- System::Char c = unoName->Chars[cur];
+ System::Char c = unoName[cur];
if (c == ',' || c == '>')
{
//insert a comma if needed
if (countParams != 0)
- builder->Append(S",");
+ builder->Append(",");
countParams++;
- System::String * sParam = unoName->Substring(index, cur - index);
+ System::String ^ sParam = unoName->Substring(index, cur - index);
//skip the comma
cur++;
//the the index to the beginning of the next param
@@ -608,7 +608,7 @@ System::String* mapPolymorphicName(System::String* unoName, bool bCliToUno)
int numNested = 0;
for (;;cur++)
{
- System::Char curChar = unoName->Chars[cur];
+ System::Char curChar = unoName[cur];
if (curChar == '<')
{
numNested ++;
@@ -629,7 +629,7 @@ System::String* mapPolymorphicName(System::String* unoName, bool bCliToUno)
return builder->ToString();
}
-OUString mapCliTypeName(System::String* typeName)
+OUString mapCliTypeName(System::String^ typeName)
{
int dims= 0;
// Array? determine the "rank" (number of "[]")
@@ -640,7 +640,7 @@ OUString mapCliTypeName(System::String* typeName)
bool bRightBracket = false;
while (cur >= 0)
{
- System::Char c = typeName->Chars[cur];
+ System::Char c = typeName[cur];
if (c == ']')
{
bRightBracket = true;
@@ -672,47 +672,47 @@ OUString mapCliTypeName(System::String* typeName)
typeName = typeName->Substring(0, cur + 1);
- System::Text::StringBuilder * buf = new System::Text::StringBuilder(512);
+ System::Text::StringBuilder ^ buf = gcnew System::Text::StringBuilder(512);
//Put the "[]" at the beginning of the uno type name
for (;dims--;)
- buf->Append(const_cast<System::String*>(Constants::usBrackets));
-
- if (typeName->Equals(const_cast<System::String*>(Constants::sBoolean)))
- buf->Append(const_cast<System::String*>(Constants::usBool));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sChar)))
- buf->Append(const_cast<System::String*>(Constants::usChar));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sByte)))
- buf->Append(const_cast<System::String*>(Constants::usByte));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sInt16)))
- buf->Append(const_cast<System::String*>(Constants::usShort));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sUInt16)))
- buf->Append(const_cast<System::String*>(Constants::usUShort));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sInt32)))
- buf->Append(const_cast<System::String*>(Constants::usLong));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sUInt32)))
- buf->Append(const_cast<System::String*>(Constants::usULong));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sInt64)))
- buf->Append(const_cast<System::String*>(Constants::usHyper));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sUInt64)))
- buf->Append(const_cast<System::String*>(Constants::usUHyper));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sSingle)))
- buf->Append(const_cast<System::String*>(Constants::usFloat));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sDouble)))
- buf->Append(const_cast<System::String*>(Constants::usDouble));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sString)))
- buf->Append(const_cast<System::String*>(Constants::usString));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sVoid)))
- buf->Append(const_cast<System::String*>(Constants::usVoid));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sType)))
- buf->Append(const_cast<System::String*>(Constants::usType));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sObject)))
- buf->Append(const_cast<System::String*>(Constants::usXInterface));
- else if (typeName->Equals(const_cast<System::String*>(Constants::sAny)))
- buf->Append(const_cast<System::String*>(Constants::usAny));
+ buf->Append(const_cast<System::String^>(Constants::usBrackets));
+
+ if (typeName->Equals(const_cast<System::String^>(Constants::sBoolean)))
+ buf->Append(const_cast<System::String^>(Constants::usBool));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sChar)))
+ buf->Append(const_cast<System::String^>(Constants::usChar));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sByte)))
+ buf->Append(const_cast<System::String^>(Constants::usByte));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sInt16)))
+ buf->Append(const_cast<System::String^>(Constants::usShort));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sUInt16)))
+ buf->Append(const_cast<System::String^>(Constants::usUShort));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sInt32)))
+ buf->Append(const_cast<System::String^>(Constants::usLong));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sUInt32)))
+ buf->Append(const_cast<System::String^>(Constants::usULong));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sInt64)))
+ buf->Append(const_cast<System::String^>(Constants::usHyper));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sUInt64)))
+ buf->Append(const_cast<System::String^>(Constants::usUHyper));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sSingle)))
+ buf->Append(const_cast<System::String^>(Constants::usFloat));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sDouble)))
+ buf->Append(const_cast<System::String^>(Constants::usDouble));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sString)))
+ buf->Append(const_cast<System::String^>(Constants::usString));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sVoid)))
+ buf->Append(const_cast<System::String^>(Constants::usVoid));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sType)))
+ buf->Append(const_cast<System::String^>(Constants::usType));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sObject)))
+ buf->Append(const_cast<System::String^>(Constants::usXInterface));
+ else if (typeName->Equals(const_cast<System::String^>(Constants::sAny)))
+ buf->Append(const_cast<System::String^>(Constants::usAny));
else
{
- System::String * sName = mapCliPolymorphicName(typeName);
+ System::String ^ sName = mapCliPolymorphicName(typeName);
int i= sName->IndexOf(L'.');
buf->Append(sName->Substring(i + 1));
}
@@ -721,20 +721,20 @@ OUString mapCliTypeName(System::String* typeName)
/** Maps uno types to dot net types.
* If uno_data is null then the type description is converted to System::Type
*/
-inline System::String* mapUnoString( rtl_uString const * data)
+inline System::String^ mapUnoString( rtl_uString const * data)
{
OSL_ASSERT(data);
- return new System::String((__wchar_t*) data->buffer, 0, data->length);
+ return gcnew System::String((__wchar_t*) data->buffer, 0, data->length);
}
-OUString mapCliString(System::String const * data)
+OUString mapCliString(System::String const ^ data)
{
- if (data != NULL)
+ if (data != nullptr)
{
OSL_ASSERT(sizeof(wchar_t) == sizeof(sal_Unicode));
- wchar_t const __pin * pdata= PtrToStringChars(data);
- return OUString(pdata, const_cast<System::String*>(data)->get_Length());
+ pin_ptr<wchar_t const> pdata= PtrToStringChars(data);
+ return OUString(pdata, const_cast<System::String^>(data)->Length);
}
else
{
@@ -745,7 +745,7 @@ OUString mapCliString(System::String const * data)
// ToDo convert cli types to expected types, e.g a long to a short where the uno type
// is a sal_Int16. This could be necessary if a scripting language (typeless) is used
// @param assign the uno_data has to be destructed (in/out args)
-void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
+void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
typelib_TypeDescriptionReference * type,
bool assign) const
{
@@ -756,67 +756,67 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
break;
case typelib_TypeClass_CHAR:
{
- System::Char aChar= *__try_cast<System::Char*>(cli_data);
+ System::Char aChar= *safe_cast<System::Char^>(cli_data);
*(sal_Unicode*) uno_data= aChar;
break;
}
case typelib_TypeClass_BOOLEAN:
{
- System::Boolean aBool= *__try_cast<System::Boolean*>(cli_data);
+ System::Boolean aBool= *safe_cast<System::Boolean^>(cli_data);
*(sal_Bool*)uno_data= aBool == true ? sal_True : sal_False;
break;
}
case typelib_TypeClass_BYTE:
{
- System::Byte aByte= *__try_cast<System::Byte*>(cli_data);
+ System::Byte aByte= *safe_cast<System::Byte^>(cli_data);
*(sal_Int8*) uno_data= aByte;
break;
}
case typelib_TypeClass_SHORT:
{
- System::Int16 aShort= *__try_cast<System::Int16*>(cli_data);
+ System::Int16 aShort= *safe_cast<System::Int16^>(cli_data);
*(sal_Int16*) uno_data= aShort;
break;
}
case typelib_TypeClass_UNSIGNED_SHORT:
{
- System::UInt16 aUShort= *__try_cast<System::UInt16*>(cli_data);
+ System::UInt16 aUShort= *safe_cast<System::UInt16^>(cli_data);
*(sal_uInt16*) uno_data= aUShort;
break;
}
case typelib_TypeClass_LONG:
{
- System::Int32 aLong= *__try_cast<System::Int32*>(cli_data);
+ System::Int32 aLong= *safe_cast<System::Int32^>(cli_data);
*(sal_Int32*) uno_data= aLong;
break;
}
case typelib_TypeClass_UNSIGNED_LONG:
{
- System::UInt32 aULong= *__try_cast<System::UInt32*>(cli_data);
+ System::UInt32 aULong= *safe_cast<System::UInt32^>(cli_data);
*(sal_uInt32*) uno_data= aULong;
break;
}
case typelib_TypeClass_HYPER:
{
- System::Int64 aHyper= *__try_cast<System::Int64*>(cli_data);
+ System::Int64 aHyper= *safe_cast<System::Int64^>(cli_data);
*(sal_Int64*) uno_data= aHyper;
break;
}
case typelib_TypeClass_UNSIGNED_HYPER:
{
- System::UInt64 aLong= *__try_cast<System::UInt64*>(cli_data);
+ System::UInt64 aLong= *safe_cast<System::UInt64^>(cli_data);
*(sal_uInt64*) uno_data= aLong;
break;
}
case typelib_TypeClass_FLOAT:
{
- System::Single aFloat= *__try_cast<System::Single*>(cli_data);
+ System::Single aFloat= *safe_cast<System::Single^>(cli_data);
*(float*) uno_data= aFloat;
break;
}
case typelib_TypeClass_DOUBLE:
{
- System::Double aDouble= *__try_cast<System::Double*>(cli_data);
+ System::Double aDouble= *safe_cast<System::Double^>(cli_data);
*(double*) uno_data= aDouble;
break;
}
@@ -826,22 +826,22 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
rtl_uString_release(*(rtl_uString**) uno_data);
*(rtl_uString **)uno_data = 0;
- if (cli_data == NULL)
+ if (cli_data == nullptr)
{
rtl_uString_new((rtl_uString**) uno_data);
}
else
{
- System::String *s= __try_cast<System::String*>(cli_data);
- wchar_t const __pin * pdata= PtrToStringChars(s);
+ System::String ^s= safe_cast<System::String^>(cli_data);
+ pin_ptr<const wchar_t> pdata= PtrToStringChars(s);
rtl_uString_newFromStr_WithLength( (rtl_uString**) uno_data,
- pdata, s->get_Length() );
+ pdata, s->Length );
}
break;
}
case typelib_TypeClass_TYPE:
{
- typelib_TypeDescriptionReference* td= mapCliType(__try_cast<System::Type*>(
+ typelib_TypeDescriptionReference* td= mapCliType(safe_cast<System::Type^>(
cli_data));
if (assign)
{
@@ -854,14 +854,14 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
case typelib_TypeClass_ANY:
{
uno_Any * pAny = (uno_Any *)uno_data;
- if (cli_data == NULL) // null-ref or uninitialized any maps to empty any
+ if (cli_data == nullptr) // null-ref or uninitialized any maps to empty any
{
if (assign)
uno_any_destruct( pAny, 0 );
uno_any_construct( pAny, 0, 0, 0 );
break;
}
- uno::Any aAny= *__try_cast<uno::Any*>(cli_data);
+ uno::Any aAny= *safe_cast<uno::Any^>(cli_data);
css::uno::Type value_td( mapCliType(aAny.Type), SAL_NO_ACQUIRE);
if (assign)
@@ -876,42 +876,42 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
break;
case typelib_TypeClass_CHAR:
pAny->pData = &pAny->pReserved;
- *(sal_Unicode*) &pAny->pReserved = *__try_cast<System::Char*>(aAny.Value);
+ *(sal_Unicode*) &pAny->pReserved = *safe_cast<System::Char^>(aAny.Value);
break;
case typelib_TypeClass_BOOLEAN:
pAny->pData = &pAny->pReserved;
- *(sal_Bool *) &pAny->pReserved = *__try_cast<System::Boolean*>(aAny.Value);
+ *(sal_Bool *) &pAny->pReserved = *safe_cast<System::Boolean^>(aAny.Value);
break;
case typelib_TypeClass_BYTE:
pAny->pData = &pAny->pReserved;
- *(sal_Int8*) &pAny->pReserved = *__try_cast<System::Byte*>(aAny.Value);
+ *(sal_Int8*) &pAny->pReserved = *safe_cast<System::Byte^>(aAny.Value);
break;
case typelib_TypeClass_SHORT:
pAny->pData = &pAny->pReserved;
- *(sal_Int16*) &pAny->pReserved = *__try_cast<System::Int16*>(aAny.Value);
+ *(sal_Int16*) &pAny->pReserved = *safe_cast<System::Int16^>(aAny.Value);
break;
case typelib_TypeClass_UNSIGNED_SHORT:
pAny->pData = &pAny->pReserved;
- *(sal_uInt16*) &pAny->pReserved = *__try_cast<System::UInt16*>(aAny.Value);
+ *(sal_uInt16*) &pAny->pReserved = *safe_cast<System::UInt16^>(aAny.Value);
break;
case typelib_TypeClass_LONG:
pAny->pData = &pAny->pReserved;
- *(sal_Int32*) &pAny->pReserved = *__try_cast<System::Int32*>(aAny.Value);
+ *(sal_Int32*) &pAny->pReserved = *safe_cast<System::Int32^>(aAny.Value);
break;
case typelib_TypeClass_UNSIGNED_LONG:
pAny->pData = &pAny->pReserved;
- *(sal_uInt32*) &pAny->pReserved = *__try_cast<System::UInt32*>(aAny.Value);
+ *(sal_uInt32*) &pAny->pReserved = *safe_cast<System::UInt32^>(aAny.Value);
break;
case typelib_TypeClass_HYPER:
if (sizeof (sal_Int64) <= sizeof (void *))
{
pAny->pData = &pAny->pReserved;
- *(sal_Int64*) &pAny->pReserved = *__try_cast<System::Int64*>(aAny.Value);
+ *(sal_Int64*) &pAny->pReserved = *safe_cast<System::Int64^>(aAny.Value);
}
else
{
auto_ptr< rtl_mem > mem( rtl_mem::allocate( sizeof (sal_Int64) ) );
- *(sal_Int64 *) mem.get()= *__try_cast<System::Int64*>(aAny.Value);
+ *(sal_Int64 *) mem.get()= *safe_cast<System::Int64^>(aAny.Value);
pAny->pData = mem.release();
}
break;
@@ -919,12 +919,12 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
if (sizeof (sal_uInt64) <= sizeof (void *))
{
pAny->pData = &pAny->pReserved;
- *(sal_uInt64*) &pAny->pReserved = *__try_cast<System::UInt64*>(aAny.Value);
+ *(sal_uInt64*) &pAny->pReserved = *safe_cast<System::UInt64^>(aAny.Value);
}
else
{
auto_ptr< rtl_mem > mem( rtl_mem::allocate( sizeof (sal_uInt64) ) );
- *(sal_uInt64 *) mem.get()= *__try_cast<System::UInt64*>(aAny.Value);
+ *(sal_uInt64 *) mem.get()= *safe_cast<System::UInt64^>(aAny.Value);
pAny->pData = mem.release();
}
break;
@@ -932,12 +932,12 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
if (sizeof (float) <= sizeof (void *))
{
pAny->pData = &pAny->pReserved;
- *(float*) &pAny->pReserved = *__try_cast<System::Single*>(aAny.Value);
+ *(float*) &pAny->pReserved = *safe_cast<System::Single^>(aAny.Value);
}
else
{
auto_ptr< rtl_mem > mem( rtl_mem::allocate( sizeof (float) ) );
- *(float*) mem.get() = *__try_cast<System::Single*>(aAny.Value);
+ *(float*) mem.get() = *safe_cast<System::Single^>(aAny.Value);
pAny->pData = mem.release();
}
break;
@@ -945,19 +945,19 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
if (sizeof (double) <= sizeof (void *))
{
pAny->pData = &pAny->pReserved;
- *(double*) &pAny->pReserved= *__try_cast<System::Double*>(aAny.Value);
+ *(double*) &pAny->pReserved= *safe_cast<System::Double^>(aAny.Value);
}
else
{
auto_ptr< rtl_mem > mem( rtl_mem::allocate( sizeof (double) ) );
- *(double*) mem.get()= *__try_cast<System::Double*>(aAny.Value);
+ *(double*) mem.get()= *safe_cast<System::Double^>(aAny.Value);
pAny->pData= mem.release();
}
break;
case typelib_TypeClass_STRING: // anies often contain strings; copy string directly
{
pAny->pData= &pAny->pReserved;
- OUString _s = mapCliString(static_cast<System::String*>(aAny.Value));
+ OUString _s = mapCliString(static_cast<System::String^>(aAny.Value));
pAny->pReserved= _s.pData;
rtl_uString_acquire(_s.pData);
break;
@@ -996,7 +996,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
}
}
}
- catch(System::InvalidCastException* )
+ catch(System::InvalidCastException^ )
{
// ToDo check this
if (assign)
@@ -1008,7 +1008,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
buf.append(value_td.getTypeName());
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" does not correspont "
"to its value type: ") );
- if(aAny.Value != NULL)
+ if(aAny.Value != nullptr)
{
css::uno::Type td(mapCliType(aAny.Value->GetType()), SAL_NO_ACQUIRE);
buf.append(td.getTypeName());
@@ -1058,7 +1058,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
sal_Int32 nMembers = comp_td->nMembers;
boolean bException= false;
- System::Type* cliType = NULL;
+ System::Type^ cliType = nullptr;
if (cli_data)
cliType = cli_data->GetType();
@@ -1084,10 +1084,10 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
__s = mapUnoString(comp_td->ppMemberNames[nPos]);
arFields = cliType != NULL ? cliType->GetFields() : NULL;
#endif
- System::Object* val= NULL;
- if (cli_data != NULL)
+ System::Object^ val= nullptr;
+ if (cli_data != nullptr)
{
- sr::FieldInfo* aField= cliType->GetField(
+ sr::FieldInfo^ aField= cliType->GetField(
mapUnoString(comp_td->ppMemberNames[nPos]));
// special case for Exception.Message property
// The com.sun.star.uno.Exception.Message field is mapped to the
@@ -1097,9 +1097,9 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
rtl::OUString usMessageMember(RTL_CONSTASCII_USTRINGPARAM("Message"));
if (usMessageMember.equals(comp_td->ppMemberNames[nPos]))
{
- sr::PropertyInfo* pi= cliType->GetProperty(
+ sr::PropertyInfo^ pi= cliType->GetProperty(
mapUnoString(comp_td->ppMemberNames[nPos]));
- val= pi->GetValue(cli_data, NULL);
+ val= pi->GetValue(cli_data, nullptr);
}
else
{
@@ -1120,75 +1120,75 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
bool bDefault = ((struct_td != NULL
&& struct_td->pParameterizedTypes != NULL
&& struct_td->pParameterizedTypes[nPos] == sal_True
- && val == NULL)
- || cli_data == NULL) ? true : false;
+ && val == nullptr)
+ || cli_data == nullptr) ? true : false;
switch (member_type->eTypeClass)
{
case typelib_TypeClass_CHAR:
if (bDefault)
*(sal_Unicode*) p = 0;
else
- *(sal_Unicode*) p = *__try_cast<System::Char*>(val);
+ *(sal_Unicode*) p = *safe_cast<System::Char^>(val);
break;
case typelib_TypeClass_BOOLEAN:
if (bDefault)
*(sal_Bool*) p = sal_False;
else
- *(sal_Bool*) p = *__try_cast<System::Boolean*>(val);
+ *(sal_Bool*) p = *safe_cast<System::Boolean^>(val);
break;
case typelib_TypeClass_BYTE:
if (bDefault)
*(sal_Int8*) p = 0;
else
- *(sal_Int8*) p = *__try_cast<System::Byte*>(val);
+ *(sal_Int8*) p = *safe_cast<System::Byte^>(val);
break;
case typelib_TypeClass_SHORT:
if (bDefault)
*(sal_Int16*) p = 0;
else
- *(sal_Int16*) p = *__try_cast<System::Int16*>(val);
+ *(sal_Int16*) p = *safe_cast<System::Int16^>(val);
break;
case typelib_TypeClass_UNSIGNED_SHORT:
if (bDefault)
*(sal_uInt16*) p = 0;
else
- *(sal_uInt16*) p = *__try_cast<System::UInt16*>(val);
+ *(sal_uInt16*) p = *safe_cast<System::UInt16^>(val);
break;
case typelib_TypeClass_LONG:
if (bDefault)
*(sal_Int32*) p = 0;
else
- *(sal_Int32*) p = *__try_cast<System::Int32*>(val);
+ *(sal_Int32*) p = *safe_cast<System::Int32^>(val);
break;
case typelib_TypeClass_UNSIGNED_LONG:
if (bDefault)
*(sal_uInt32*) p = 0;
else
- *(sal_uInt32*) p = *__try_cast<System::UInt32*>(val);
+ *(sal_uInt32*) p = *safe_cast<System::UInt32^>(val);
break;
case typelib_TypeClass_HYPER:
if (bDefault)
*(sal_Int64*) p = 0;
else
- *(sal_Int64*) p = *__try_cast<System::Int64*>(val);
+ *(sal_Int64*) p = *safe_cast<System::Int64^>(val);
break;
case typelib_TypeClass_UNSIGNED_HYPER:
if (bDefault)
*(sal_uInt64*) p = 0;
else
- *(sal_uInt64*) p= *__try_cast<System::UInt64*>(val);
+ *(sal_uInt64*) p= *safe_cast<System::UInt64^>(val);
break;
case typelib_TypeClass_FLOAT:
if (bDefault)
*(float*) p = 0.;
else
- *(float*) p = *__try_cast<System::Single*>(val);
+ *(float*) p = *safe_cast<System::Single^>(val);
break;
case typelib_TypeClass_DOUBLE:
if (bDefault)
*(double*) p = 0.;
else
- *(double*) p = *__try_cast<System::Double*>(val);
+ *(double*) p = *safe_cast<System::Double^>(val);
break;
default:
{ // ToDo enum, should be converted here
@@ -1205,7 +1205,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("[map_to_uno():"));
if (cliType)
{
- buf.append(mapCliString(cliType->get_FullName()));
+ buf.append(mapCliString(cliType->FullName));
buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("."));
buf.append(comp_td->ppMemberNames[nPos]);
buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(" "));
@@ -1213,14 +1213,14 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
buf.append(e.m_message);
throw BridgeRuntimeError(buf.makeStringAndClear());
}
- catch (System::InvalidCastException* )
+ catch (System::InvalidCastException^ )
{
bException= true;
OUStringBuffer buf( 256 );
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_uno():") );
if (cliType)
{
- buf.append(mapCliString(cliType->get_FullName()));
+ buf.append(mapCliString(cliType->FullName));
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("."));
buf.append(comp_td->ppMemberNames[nPos]);
}
@@ -1260,10 +1260,10 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
auto_ptr< rtl_mem > seq;
- System::Array* ar = NULL;
- if (cli_data != NULL)
+ System::Array^ ar = nullptr;
+ if (cli_data != nullptr)
{
- ar = __try_cast<System::Array*>(cli_data);
+ ar = safe_cast<System::Array^>(cli_data);
sal_Int32 nElements = ar->GetLength(0);
try
@@ -1272,74 +1272,74 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
{
case typelib_TypeClass_CHAR:
seq = seq_allocate(nElements, sizeof (sal_Unicode));
- sri::Marshal::Copy(__try_cast<System::Char[]>(cli_data), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(safe_cast<array<System::Char>^>(cli_data), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_BOOLEAN:
seq = seq_allocate(nElements, sizeof (sal_Bool));
- sri::Marshal::Copy(__try_cast<System::Boolean[]>(cli_data), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(safe_cast<array<System::Char>^>(cli_data), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_BYTE:
seq = seq_allocate( nElements, sizeof (sal_Int8) );
- sri::Marshal::Copy(__try_cast<System::Byte[]>(cli_data), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(safe_cast<array<System::Byte>^>(cli_data), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_SHORT:
seq = seq_allocate(nElements, sizeof (sal_Int16));
- sri::Marshal::Copy(__try_cast<System::Int16[]>(cli_data), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(safe_cast<array<System::Int16>^>(cli_data), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_UNSIGNED_SHORT:
seq = seq_allocate( nElements, sizeof (sal_uInt16) );
- sri::Marshal::Copy(static_cast<System::Int16[]>(
- __try_cast<System::UInt16[]>(cli_data)), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(dynamic_cast<array<System::Int16>^>(
+ safe_cast<array<System::UInt16>^>(cli_data)), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_LONG:
seq = seq_allocate(nElements, sizeof (sal_Int32));
- sri::Marshal::Copy(__try_cast<System::Int32[]>(cli_data), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(safe_cast<array<System::Int32>^>(cli_data), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_UNSIGNED_LONG:
seq = seq_allocate( nElements, sizeof (sal_uInt32) );
- sri::Marshal::Copy(static_cast<System::Int32[]>(
- __try_cast<System::UInt32[]>(cli_data)), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(dynamic_cast<array<System::Int32>^>(
+ safe_cast<array<System::UInt32>^>(cli_data)), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_HYPER:
seq = seq_allocate(nElements, sizeof (sal_Int64));
- sri::Marshal::Copy(__try_cast<System::Int64[]>(cli_data), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(safe_cast<array<System::Int64>^>(cli_data), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_UNSIGNED_HYPER:
seq = seq_allocate(nElements, sizeof (sal_uInt64));
- sri::Marshal::Copy(static_cast<System::Int64[]>(
- __try_cast<System::UInt64[]>(cli_data)), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(dynamic_cast<array<System::Int64>^>(
+ safe_cast<array<System::UInt64>^>(cli_data)), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_FLOAT:
seq = seq_allocate(nElements, sizeof (float));
- sri::Marshal::Copy(__try_cast<System::Single[]>(cli_data), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(safe_cast<array<System::Single>^>(cli_data), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_DOUBLE:
seq = seq_allocate(nElements, sizeof (double));
- sri::Marshal::Copy(__try_cast<System::Double[]>(cli_data), 0,
- & ((uno_Sequence*) seq.get())->elements, nElements);
+ sri::Marshal::Copy(safe_cast<array<System::Double>^>(cli_data), 0,
+ IntPtr(& ((uno_Sequence*) seq.get())->elements), nElements);
break;
case typelib_TypeClass_STRING:
{
seq = seq_allocate(nElements, sizeof (rtl_uString*));
- System::String* arStr[]= __try_cast<System::String*[]>(cli_data);
+ array<System::String^>^ arStr= safe_cast<array<System::String^>^>(cli_data);
for (int i= 0; i < nElements; i++)
{
- wchar_t const __pin * pdata= PtrToStringChars(arStr[i]);
+ pin_ptr<const wchar_t> pdata= PtrToStringChars(arStr[i]);
rtl_uString** pStr= & ((rtl_uString**) &
((uno_Sequence*) seq.get())->elements)[i];
*pStr= NULL;
rtl_uString_newFromStr_WithLength( pStr, pdata,
- arStr[i]->get_Length());
+ arStr[i]->Length);
}
break;
}
@@ -1367,7 +1367,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
{
void * p= ((uno_Sequence *) seq.get())->elements +
(nPos * element_td.get()->nSize);
- System::Object* elemData= dynamic_cast<System::Array*>(cli_data)->GetValue(nPos);
+ System::Object^ elemData= dynamic_cast<System::Array^>(cli_data)->GetValue(nPos);
map_to_uno(
p, elemData, element_td.get()->pWeakRef,
false /* no assign */);
@@ -1407,7 +1407,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
buf.append(e.m_message);
throw BridgeRuntimeError(buf.makeStringAndClear());
}
- catch (System::InvalidCastException* )
+ catch (System::InvalidCastException^ )
{
// Ok, checked
OUStringBuffer buf( 128 );
@@ -1443,7 +1443,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
if (0 != p)
(*p->release)( p );
}
- if (0 == cli_data) // null-ref
+ if (nullptr == cli_data) // null-ref
{
*(uno_Interface **)uno_data = 0;
}
@@ -1467,7 +1467,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
}
}
// BridgeRuntimeError are allowed to be thrown
- catch (System::InvalidCastException* )
+ catch (System::InvalidCastException^ )
{
//ToDo check
OUStringBuffer buf( 128 );
@@ -1476,12 +1476,12 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] could not convert type!") );
throw BridgeRuntimeError( buf.makeStringAndClear() );
}
- catch (System::NullReferenceException * e)
+ catch (System::NullReferenceException ^ e)
{
OUStringBuffer buf(512);
buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(
"[map_to_uno()] Illegal null reference passed!\n"));
- buf.append(mapCliString(e->get_StackTrace()));
+ buf.append(mapCliString(e->StackTrace));
throw BridgeRuntimeError( buf.makeStringAndClear() );
}
catch (BridgeRuntimeError& )
@@ -1510,50 +1510,50 @@ void Bridge::map_to_uno(void * uno_data, System::Object* cli_data,
newly created object is passed in cli_data.
*/
void Bridge::map_to_cli(
- System::Object* *cli_data, void const * uno_data,
- typelib_TypeDescriptionReference * type, System::Type* info,
+ System::Object^ *cli_data, void const * uno_data,
+ typelib_TypeDescriptionReference * type, System::Type^ info,
bool bDontCreateObj) const
{
switch (type->eTypeClass)
{
case typelib_TypeClass_CHAR:
- *cli_data= __box(*(__wchar_t const*)uno_data);
+ *cli_data= *(__wchar_t const*)uno_data;
break;
case typelib_TypeClass_BOOLEAN:
- *cli_data = __box((*(bool const*)uno_data) == sal_True ? true : false);
+ *cli_data = (*(bool const*)uno_data) == sal_True ? true : false;
break;
case typelib_TypeClass_BYTE:
- *cli_data = __box(*(unsigned char const*) uno_data);
+ *cli_data = *(unsigned char const*) uno_data;
break;
case typelib_TypeClass_SHORT:
- *cli_data= __box(*(short const*) uno_data);
+ *cli_data= *(short const*) uno_data;
break;
case typelib_TypeClass_UNSIGNED_SHORT:
- *cli_data= __box(*(unsigned short const*) uno_data);
+ *cli_data= *(unsigned short const*) uno_data;
break;
case typelib_TypeClass_LONG:
- *cli_data= __box(*(int const*) uno_data);
+ *cli_data= *(int const*) uno_data;
break;
case typelib_TypeClass_UNSIGNED_LONG:
- *cli_data= __box(*(unsigned int const*) uno_data);
+ *cli_data= *(unsigned int const*) uno_data;
break;
case typelib_TypeClass_HYPER:
- *cli_data= __box(*(__int64 const*) uno_data);
+ *cli_data= *(__int64 const*) uno_data;
break;
case typelib_TypeClass_UNSIGNED_HYPER:
- *cli_data= __box(*(unsigned __int64 const*) uno_data);
+ *cli_data= *(unsigned __int64 const*) uno_data;
break;
case typelib_TypeClass_FLOAT:
- *cli_data= __box(*(float const*) uno_data);
+ *cli_data= *(float const*) uno_data;
break;
case typelib_TypeClass_DOUBLE:
- *cli_data= __box(*(double const*) uno_data);
+ *cli_data= *(double const*) uno_data;
break;
case typelib_TypeClass_STRING:
{
rtl_uString const* sVal= NULL;
sVal= *(rtl_uString* const*) uno_data;
- *cli_data= new System::String((__wchar_t*) sVal->buffer,0, sVal->length);
+ *cli_data= gcnew System::String((__wchar_t*) sVal->buffer,0, sVal->length);
break;
}
case typelib_TypeClass_TYPE:
@@ -1566,23 +1566,23 @@ void Bridge::map_to_cli(
uno_Any const * pAny = (uno_Any const *)uno_data;
if (typelib_TypeClass_VOID != pAny->pType->eTypeClass)
{
- System::Object* objCli= NULL;
+ System::Object^ objCli= nullptr;
map_to_cli(
- &objCli, pAny->pData, pAny->pType, 0,
+ &objCli, pAny->pData, pAny->pType, nullptr,
false);
uno::Any anyVal(mapUnoType(pAny->pType), objCli);
- *cli_data= __box(anyVal);
+ *cli_data= anyVal;
}
else
{ // void any
- *cli_data= __box(uno::Any::VOID);
+ *cli_data= uno::Any::VOID;
}
break;
}
case typelib_TypeClass_ENUM:
{
- if (info != NULL)
+ if (info != nullptr)
{
OSL_ASSERT(info->get_IsByRef());
info= info->GetElementType();
@@ -1605,19 +1605,19 @@ void Bridge::map_to_cli(
//create the type
- System::Type* cliType= loadCliType(td.get()->pTypeName);
+ System::Type^ cliType= loadCliType(td.get()->pTypeName);
//detect if we recursivly convert inherited structures
//If this point is reached because of a recursive call during convering a
//struct then we must not create a new object rather we use the one in
// cli_data argument.
- System::Object* cliObj;
+ System::Object^ cliObj;
if (bDontCreateObj)
cliObj = *cli_data; // recursive call
else
{
//Special handling for Exception conversion. We must call constructor System::Exception
//to pass the message string
- if (__typeof(ucss::uno::Exception)->IsAssignableFrom(cliType))
+ if (ucss::uno::Exception::typeid->IsAssignableFrom(cliType))
{
//We need to get the Message field. Therefore we must obtain the offset from
//the typedescription. The base interface of all exceptions is
@@ -1643,20 +1643,20 @@ void Bridge::map_to_cli(
OSL_ASSERT (nPos != -1);
int offset = pCTD->pMemberOffsets[nPos];
//Whith the offset within the exception we can get the message string
- System::String* sMessage = mapUnoString(*(rtl_uString**)
+ System::String^ sMessage = mapUnoString(*(rtl_uString**)
((char*) uno_data + offset));
//We need to find a constructor for the exception that takes the message string
//We assume that the first argument is the message string
- sr::ConstructorInfo* arCtorInfo[] = cliType->GetConstructors();
- sr::ConstructorInfo* ctorInfo = NULL;
- int numCtors = arCtorInfo->get_Length();
+ array<sr::ConstructorInfo^>^ arCtorInfo = cliType->GetConstructors();
+ sr::ConstructorInfo^ ctorInfo = nullptr;
+ int numCtors = arCtorInfo->Length;
//Constructor must at least have 2 params for the base
//unoidl.com.sun.star.uno.Exception (String, Object);
- sr::ParameterInfo * arParamInfo[];
+ array<sr::ParameterInfo^>^ arParamInfo;
for (int i = 0; i < numCtors; i++)
{
arParamInfo = arCtorInfo[i]->GetParameters();
- if (arParamInfo->get_Length() < 2)
+ if (arParamInfo->Length < 2)
continue;
ctorInfo = arCtorInfo[i];
break;
@@ -1666,8 +1666,8 @@ void Bridge::map_to_cli(
&& arParamInfo[0]->get_Position() == 0
&& arParamInfo[1]->get_Position() == 1);
//Prepare parameters for constructor
- int numArgs = arParamInfo->get_Length();
- System::Object * args[] = new System::Object*[numArgs];
+ int numArgs = arParamInfo->Length;
+ array<System::Object^>^ args = gcnew array<System::Object^>(numArgs);
//only initialize the first argument with the message
args[0] = sMessage;
cliObj = ctorInfo->Invoke(args);
@@ -1684,15 +1684,15 @@ void Bridge::map_to_cli(
// cliObj is used by the callee instead of a newly created struct
map_to_cli(
&cliObj, uno_data,
- ((typelib_TypeDescription *)comp_td->pBaseTypeDescription)->pWeakRef, 0,
+ ((typelib_TypeDescription *)comp_td->pBaseTypeDescription)->pWeakRef, nullptr,
true);
}
rtl::OUString usUnoException(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception"));
for (sal_Int32 nPos = comp_td->nMembers; nPos--; )
{
typelib_TypeDescriptionReference * member_type = comp_td->ppTypeRefs[ nPos ];
- System::String* sMemberName= mapUnoString(comp_td->ppMemberNames[nPos]);
- sr::FieldInfo* aField= cliType->GetField(sMemberName);
+ System::String^ sMemberName= mapUnoString(comp_td->ppMemberNames[nPos]);
+ sr::FieldInfo^ aField= cliType->GetField(sMemberName);
// special case for Exception.Message. The field has already been
// set while constructing cli object
if ( ! aField && usUnoException.equals(td.get()->pTypeName))
@@ -1703,43 +1703,43 @@ void Bridge::map_to_cli(
switch (member_type->eTypeClass)
{
case typelib_TypeClass_CHAR:
- aField->SetValue(cliObj, __box(*(System::Char*) p));
+ aField->SetValue(cliObj, *(System::Char*) p);
break;
case typelib_TypeClass_BOOLEAN:
- aField->SetValue(cliObj, __box(*(System::Boolean*) p));
+ aField->SetValue(cliObj, *(System::Boolean*) p);
break;
case typelib_TypeClass_BYTE:
- aField->SetValue(cliObj, __box(*(System::Byte*) p));
+ aField->SetValue(cliObj, *(System::Byte*) p);
break;
case typelib_TypeClass_SHORT:
- aField->SetValue(cliObj, __box(*(System::Int16*) p));
+ aField->SetValue(cliObj, *(System::Int16*) p);
break;
case typelib_TypeClass_UNSIGNED_SHORT:
- aField->SetValue(cliObj, __box(*(System::UInt16*) p));
+ aField->SetValue(cliObj, *(System::UInt16*) p);
break;
case typelib_TypeClass_LONG:
- aField->SetValue(cliObj, __box(*(System::Int32*) p));
+ aField->SetValue(cliObj, *(System::Int32*) p);
break;
case typelib_TypeClass_UNSIGNED_LONG:
- aField->SetValue(cliObj, __box(*(System::UInt32*) p));
+ aField->SetValue(cliObj, *(System::UInt32*) p);
break;
case typelib_TypeClass_HYPER:
- aField->SetValue(cliObj, __box(*(System::Int64*) p));
+ aField->SetValue(cliObj, *(System::Int64*) p);
break;
case typelib_TypeClass_UNSIGNED_HYPER:
- aField->SetValue(cliObj, __box(*(System::UInt64*) p));
+ aField->SetValue(cliObj, *(System::UInt64*) p);
break;
case typelib_TypeClass_FLOAT:
- aField->SetValue(cliObj, __box(*(System::Single*) p));
+ aField->SetValue(cliObj, *(System::Single*) p);
break;
case typelib_TypeClass_DOUBLE:
- aField->SetValue(cliObj, __box(*(System::Double*) p));
+ aField->SetValue(cliObj, *(System::Double*) p);
break;
default:
{
- System::Object* cli_val;
+ System::Object^ cli_val;
map_to_cli(
- &cli_val, p, member_type, 0,
+ &cli_val, p, member_type, nullptr,
false);
aField->SetValue(cliObj, cli_val);
break;
@@ -1764,97 +1764,98 @@ void Bridge::map_to_cli(
{
case typelib_TypeClass_CHAR:
{
- System::Char arChar[]= new System::Char[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, arChar, 0, nElements);
+ array<System::Char>^ arChar= gcnew array<System::Char>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), arChar, 0, nElements);
*cli_data= arChar;
break;
}
case typelib_TypeClass_BOOLEAN:
{
- System::Boolean arBool[]= new System::Boolean[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, arBool, 0, nElements);
- *cli_data= arBool;
+ array<System::Byte>^ arBool= gcnew array<System::Byte>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), arBool, 0, nElements);
+ *cli_data= dynamic_cast<array<System::Boolean>^>(arBool);
break;
}
case typelib_TypeClass_BYTE:
{
- System::Byte arByte[]= new System::Byte[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, arByte, 0, nElements);
+ array<System::Byte>^ arByte= gcnew array<System::Byte>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), arByte, 0, nElements);
*cli_data= arByte;
break;
}
case typelib_TypeClass_SHORT:
{
- System::Int16 arShort[]= new System::Int16[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, arShort, 0, nElements);
+ array<System::Int16>^ arShort= gcnew array<System::Int16>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), arShort, 0, nElements);
*cli_data= arShort;
break;
}
case typelib_TypeClass_UNSIGNED_SHORT:
{
- System::UInt16 arUInt16[]= new System::UInt16[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, static_cast<System::Int16[]>(arUInt16),
+ array<System::UInt16>^ arUInt16= gcnew array<System::UInt16>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), dynamic_cast<array<System::Int16>^>(arUInt16),
0, nElements);
*cli_data= arUInt16;
break;
}
case typelib_TypeClass_LONG:
{
- System::Int32 arInt32[]= new System::Int32[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, arInt32, 0, nElements);
+ array<System::Int32>^ arInt32= gcnew array<System::Int32>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), arInt32, 0, nElements);
*cli_data= arInt32;
break;
}
case typelib_TypeClass_UNSIGNED_LONG:
{
- System::UInt32 arUInt32[]= new System::UInt32[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, static_cast<System::Int32[]>(arUInt32),
+ array<System::UInt32>^ arUInt32= gcnew array<System::UInt32>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), dynamic_cast<array<System::Int32>^>(arUInt32),
0, nElements);
*cli_data= arUInt32;
break;
}
case typelib_TypeClass_HYPER:
{
- System::Int64 arInt64[]= new System::Int64[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, arInt64, 0, nElements);
+ array<System::Int64>^ arInt64= gcnew array<System::Int64>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), arInt64, 0, nElements);
*cli_data= arInt64;
break;
}
+ //FIXME: Marshal::Copy of UInt64?
case typelib_TypeClass_UNSIGNED_HYPER:
{
- System::UInt64 arUInt64[]= new System::UInt64[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, arUInt64, 0, nElements);
- *cli_data= arUInt64;
+ array<System::IntPtr>^ arUInt64= gcnew array<System::IntPtr>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), arUInt64, 0, nElements);
+ *cli_data= dynamic_cast<array<System::UInt64>^>(arUInt64);
break;
}
case typelib_TypeClass_FLOAT:
{
- System::Single arSingle[]= new System::Single[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, arSingle, 0, nElements);
+ array<System::Single>^ arSingle= gcnew array<System::Single>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), arSingle, 0, nElements);
*cli_data= arSingle;
break;
}
case typelib_TypeClass_DOUBLE:
{
- System::Double arDouble[]= new System::Double[nElements];
- sri::Marshal::Copy( (void*) &seq->elements, arDouble, 0, nElements);
+ array<System::Double>^ arDouble= gcnew array<System::Double>(nElements);
+ sri::Marshal::Copy( IntPtr((void*) &seq->elements), arDouble, 0, nElements);
*cli_data= arDouble;
break;
}
case typelib_TypeClass_STRING:
{
- System::String* arString[]= new System::String*[nElements];
+ array<System::String^>^ arString= gcnew array<System::String^>(nElements);
for (int i= 0; i < nElements; i++)
{
rtl_uString *aStr= ((rtl_uString**)(&seq->elements))[i];
- arString[i]= new System::String( (__wchar_t *) &aStr->buffer, 0, aStr->length);
+ arString[i]= gcnew System::String( (__wchar_t *) &aStr->buffer, 0, aStr->length);
}
*cli_data= arString;
break;
}
case typelib_TypeClass_TYPE:
{
- System::Type* arType[]= new System::Type*[nElements];
+ array<System::Type^>^ arType= gcnew array<System::Type^>(nElements);
for (int i= 0; i < nElements; i++)
{
arType[i]=
@@ -1865,14 +1866,14 @@ void Bridge::map_to_cli(
}
case typelib_TypeClass_ANY:
{
- uno::Any arCli[]= new uno::Any[nElements];
+ array<uno::Any>^ arCli= gcnew array<uno::Any>(nElements);
uno_Any const * p = (uno_Any const *)seq->elements;
for (sal_Int32 nPos = 0; nPos < nElements; ++nPos )
{
- System::Object* cli_obj = NULL;
+ System::Object^ cli_obj = nullptr;
map_to_cli(
- &cli_obj, &p[ nPos ], element_type, 0, false);
- arCli[nPos]= *__try_cast<__box uno::Any*>(cli_obj);
+ &cli_obj, &p[ nPos ], element_type, nullptr, false);
+ arCli[nPos]= *safe_cast<uno::Any^>(cli_obj);
}
*cli_data= arCli;
break;
@@ -1880,8 +1881,8 @@ void Bridge::map_to_cli(
case typelib_TypeClass_ENUM:
{
//get the Enum type
- System::Type* enumType= NULL;
- if (info != NULL)
+ System::Type^ enumType= nullptr;
+ if (info != nullptr)
{
//info is EnumType[]&, remove &
OSL_ASSERT(info->IsByRef);
@@ -1892,7 +1893,7 @@ void Bridge::map_to_cli(
else
enumType= mapUnoType(element_type);
- System::Array* arEnum = System::Array::CreateInstance(
+ System::Array^ arEnum = System::Array::CreateInstance(
enumType, nElements);
for (int i= 0; i < nElements; i++)
{
@@ -1906,7 +1907,7 @@ void Bridge::map_to_cli(
case typelib_TypeClass_EXCEPTION:
{
TypeDescr element_td( element_type );
- System::Array* ar= System::Array::CreateInstance(
+ System::Array^ ar= System::Array::CreateInstance(
mapUnoType(element_type),nElements);
if (0 < nElements)
{
@@ -1915,9 +1916,9 @@ void Bridge::map_to_cli(
sal_Int32 nSize = element_td.get()->nSize;
for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos )
{
- System::Object* val;
+ System::Object^ val;
map_to_cli(
- &val, p + (nSize * nPos), element_type, 0, false);
+ &val, p + (nSize * nPos), element_type, nullptr, false);
ar->SetValue(val, nPos);
}
}
@@ -1927,7 +1928,7 @@ void Bridge::map_to_cli(
// ToDo, verify
case typelib_TypeClass_SEQUENCE:
{
- System::Array *ar= System::Array::CreateInstance(
+ System::Array ^ar= System::Array::CreateInstance(
mapUnoType(element_type), nElements);
if (0 < nElements)
{
@@ -1935,9 +1936,9 @@ void Bridge::map_to_cli(
uno_Sequence ** elements = (uno_Sequence**) seq->elements;
for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos )
{
- System::Object* val;
+ System::Object^ val;
map_to_cli(
- &val, &elements[nPos], element_type, 0, false);
+ &val, &elements[nPos], element_type, nullptr, false);
ar->SetValue(val, nPos);
}
}
@@ -1947,16 +1948,16 @@ void Bridge::map_to_cli(
case typelib_TypeClass_INTERFACE:
{
TypeDescr element_td( element_type );
- System::Type * ifaceType= mapUnoType(element_type);
- System::Array* ar= System::Array::CreateInstance(ifaceType, nElements);
+ System::Type ^ ifaceType= mapUnoType(element_type);
+ System::Array^ ar= System::Array::CreateInstance(ifaceType, nElements);
char * p = (char *)seq->elements;
sal_Int32 nSize = element_td.get()->nSize;
for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos )
{
- System::Object* val;
+ System::Object^ val;
map_to_cli(
- &val, p + (nSize * nPos), element_type, NULL, false);
+ &val, p + (nSize * nPos), element_type, nullptr, false);
ar->SetValue(val, nPos);
}
@@ -1985,7 +1986,7 @@ void Bridge::map_to_cli(
typelib_InterfaceTypeDescription*>(td.get())) ;
}
else
- *cli_data= NULL;
+ *cli_data= nullptr;
break;
}
default:
diff --git a/cli_ure/source/uno_bridge/cli_environment.cxx b/cli_ure/source/uno_bridge/cli_environment.cxx
index 165bcc5e2bbd..28149b921255 100644
--- a/cli_ure/source/uno_bridge/cli_environment.cxx
+++ b/cli_ure/source/uno_bridge/cli_environment.cxx
@@ -19,7 +19,6 @@
#include "Cli_environment.h"
-#using <mscorlib.dll>
#using <cli_ure.dll>
#using <system.dll>
#include "osl/diagnose.h"
@@ -35,9 +34,9 @@ using namespace System::Threading;
namespace cli_uno
{
-inline System::String* Cli_environment::createKey(System::String* oid, System::Type* t)
+inline System::String^ Cli_environment::createKey(System::String^ oid, System::Type^ t)
{
- return System::String::Concat(oid, t->get_FullName());
+ return System::String::Concat(oid, t->FullName);
}
@@ -55,8 +54,8 @@ Cli_environment::~Cli_environment()
}
-System::Object* Cli_environment::registerInterface(
- System::Object* obj, System::String* oid)
+System::Object^ Cli_environment::registerInterface(
+ System::Object^ obj, System::String^ oid)
{
#if OSL_DEBUG_LEVEL >= 1
//obj must be a transparent proxy
@@ -64,27 +63,27 @@ System::Object* Cli_environment::registerInterface(
_numRegisteredObjects ++;
#endif
OSL_ASSERT( ! m_objects->ContainsKey(oid));
- m_objects->Add(oid, new WeakReference(obj));
+ m_objects->Add(oid, gcnew WeakReference(obj));
return obj;
}
-System::Object* Cli_environment::registerInterface (
- System::Object* obj, System::String* oid, System::Type* type)
+System::Object^ Cli_environment::registerInterface (
+ System::Object^ obj, System::String^ oid, System::Type^ type)
{
#if OSL_DEBUG_LEVEL >= 1
//obj must be a real cli object
OSL_ASSERT( ! RemotingServices::IsTransparentProxy(obj));
_numRegisteredObjects ++;
#endif
- System::String* key = createKey(oid, type);
+ System::String^ key = createKey(oid, type);
//see synchronization in map_uno2cli in cli_data.cxx
OSL_ASSERT( ! m_objects->ContainsKey(key));
- m_objects->Add(key, new WeakReference(obj));
+ m_objects->Add(key, gcnew WeakReference(obj));
return obj;
}
-void Cli_environment::revokeInterface(System::String* oid, System::Type* type)
+void Cli_environment::revokeInterface(System::String^ oid, System::Type^ type)
{
- System::String* key = type != NULL ? createKey(oid, type) : oid;
+ System::String^ key = type != nullptr ? createKey(oid, type) : oid;
#if OSL_DEBUG_LEVEL >= 1
_numRegisteredObjects --;
#endif
@@ -103,55 +102,55 @@ void Cli_environment::revokeInterface(System::String* oid, System::Type* type)
m_objects->Remove(key);
}
-inline void Cli_environment::revokeInterface(System::String* oid)
+inline void Cli_environment::revokeInterface(System::String^ oid)
{
- return revokeInterface(oid, NULL);
+ return revokeInterface(oid, nullptr);
}
-System::Object* Cli_environment::getRegisteredInterface(System::String* oid,
- System::Type* type)
+System::Object^ Cli_environment::getRegisteredInterface(System::String^ oid,
+ System::Type^ type)
{
//try if it is a UNO interface
- System::Object* ret = NULL;
- ret = m_objects->get_Item(oid);
+ System::Object^ ret = nullptr;
+ ret = m_objects[oid];
if (! ret)
{
//try if if it is a proxy for a cli object
oid = createKey(oid, type);
- ret = m_objects->get_Item( oid );
+ ret = m_objects[ oid ];
}
- if (ret != 0)
+ if (ret != nullptr)
{
- System::WeakReference* weakIface =
- static_cast< System::WeakReference * >( ret );
+ System::WeakReference^ weakIface =
+ static_cast< System::WeakReference ^ >( ret );
ret = weakIface->Target;
}
- if (ret == 0)
+ if (ret == nullptr)
m_objects->Remove( oid );
return ret;
}
-System::String* Cli_environment::getObjectIdentifier(System::Object* obj)
+System::String^ Cli_environment::getObjectIdentifier(System::Object^ obj)
{
- System::String* oId= 0;
- RealProxy* aProxy= RemotingServices::GetRealProxy(obj);
+ System::String^ oId= nullptr;
+ RealProxy^ aProxy= RemotingServices::GetRealProxy(obj);
if (aProxy)
{
- UnoInterfaceProxy* proxyImpl= dynamic_cast<UnoInterfaceProxy*>(aProxy);
+ UnoInterfaceProxy^ proxyImpl= dynamic_cast<UnoInterfaceProxy^>(aProxy);
if (proxyImpl)
oId= proxyImpl->getOid();
}
- if (oId == 0)
+ if (oId == nullptr)
{
- StringBuilder * buf= new StringBuilder(256);
- bool bFirst = false;
- System::Threading::Monitor::Enter(__typeof(Cli_environment));
+ StringBuilder ^ buf= gcnew StringBuilder(256);
+ bool bFirst = new bool(false);
+ System::Threading::Monitor::Enter(Cli_environment::typeid);
try {
- buf->Append(m_IDGen->GetId(obj, & bFirst));
- } __finally
+ buf->Append(m_IDGen->GetId(obj, bFirst));
+ } finally
{
- System::Threading::Monitor::Exit(__typeof(Cli_environment));
+ System::Threading::Monitor::Exit(Cli_environment::typeid);
}
buf->Append(sOidPart);
diff --git a/cli_ure/source/uno_bridge/cli_environment.h b/cli_ure/source/uno_bridge/cli_environment.h
index 683ad84a6081..d04a92bcf194 100644
--- a/cli_ure/source/uno_bridge/cli_environment.h
+++ b/cli_ure/source/uno_bridge/cli_environment.h
@@ -21,7 +21,6 @@
#define INCLUDED_CLI_ENVIRONMENT_H
#include "cli_base.h"
-#using <mscorlib.dll>
using namespace System;
using namespace System::Collections;
@@ -30,12 +29,12 @@ using namespace System::Runtime::Serialization;
namespace cli_uno
{
-public __gc class Cli_environment
+public ref class Cli_environment
{
- static System::String* sOidPart;
- static Hashtable* m_objects;
- static System::Runtime::Serialization::ObjectIDGenerator* m_IDGen;
- inline static System::String* createKey(System::String* oid, System::Type* t);
+ static System::String^ sOidPart;
+ static Hashtable^ m_objects;
+ static System::Runtime::Serialization::ObjectIDGenerator^ m_IDGen;
+ inline static System::String^ createKey(System::String^ oid, System::Type^ t);
#if OSL_DEBUG_LEVEL >= 1
int _numRegisteredObjects;
@@ -45,11 +44,11 @@ public:
static Cli_environment()
{
- m_objects = Hashtable::Synchronized(new Hashtable());
- m_IDGen = new System::Runtime::Serialization::ObjectIDGenerator();
- System::Text::StringBuilder* buffer = new System::Text::StringBuilder(256);
+ m_objects = Hashtable::Synchronized(gcnew Hashtable());
+ m_IDGen = gcnew System::Runtime::Serialization::ObjectIDGenerator();
+ System::Text::StringBuilder^ buffer = gcnew System::Text::StringBuilder(256);
Guid gd = Guid::NewGuid();
- buffer->Append(S";cli[0];");
+ buffer->Append(";cli[0];");
buffer->Append(gd.ToString());
sOidPart = buffer->ToString();
}
@@ -63,21 +62,21 @@ public:
cli object is represents all interfaces of the UNO object. Therefore the
object can be registered only with its OID; a type is not necessary.
*/
- Object* registerInterface(Object* obj, System::String* oid);
+ Object^ registerInterface(Object^ obj, System::String^ oid);
/**
Registers a CLI object as being mapped by this bridge. The resulting
object represents exactly one UNO interface.
*/
- Object* registerInterface(Object* obj, System::String* oid, System::Type* type);
+ Object^ registerInterface(Object^ obj, System::String^ oid, System::Type^ type);
/**
By revoking an interface it is declared that the respective interface has
not been mapped. The proxy implementations call revoke interface in their
destructors.
*/
- inline void revokeInterface(System::String* oid);
+ inline void revokeInterface(System::String^ oid);
- void revokeInterface(System::String* oid, System::Type* type);
+ void revokeInterface(System::String^ oid, System::Type^ type);
/**
* Retrieves an interface identified by its object id and type from this
* environment.
@@ -86,7 +85,7 @@ public:
* @param type the type description of the interface to be retrieved
* @see com.sun.star.uno.IEnvironment#getRegisteredInterface
*/
- Object* getRegisteredInterface(System::String* oid, System::Type* type);
+ Object^ getRegisteredInterface(System::String^ oid, System::Type^ type);
/**
* Generates a worldwide unique object identifier (oid) for the given object. It is
@@ -96,7 +95,7 @@ public:
* @return the generated oid.
* @param object the object for which a Oid should be generated.
*/
- static System::String* getObjectIdentifier(Object* obj);
+ static System::String^ getObjectIdentifier(Object^ obj);
};
diff --git a/cli_ure/source/uno_bridge/cli_proxy.cxx b/cli_ure/source/uno_bridge/cli_proxy.cxx
index 2fd70fc5ede3..1e6ede2f78b6 100644
--- a/cli_ure/source/uno_bridge/cli_proxy.cxx
+++ b/cli_ure/source/uno_bridge/cli_proxy.cxx
@@ -25,7 +25,6 @@
#include "cli_base.h"
#include "cli_bridge.h"
-#using <mscorlib.dll>
#using <cli_ure.dll>
#using <cli_uretypes.dll>
@@ -111,16 +110,16 @@ UnoInterfaceProxy::UnoInterfaceProxy(
uno_Interface * pUnoI,
typelib_InterfaceTypeDescription* pTD,
const OUString& oid )
- :RealProxy(__typeof(MarshalByRefObject)),
+ :RealProxy(MarshalByRefObject::typeid),
m_bridge(bridge),
m_oid(mapUnoString(oid.pData)),
m_sTypeName(m_system_Object_String)
{
m_bridge->acquire();
// create the list that holds all UnoInterfaceInfos
- m_listIfaces = new ArrayList(10);
+ m_listIfaces = gcnew ArrayList(10);
m_numUnoIfaces = 0;
- m_listAdditionalProxies = new ArrayList();
+ m_listAdditionalProxies = gcnew ArrayList();
m_nlistAdditionalProxies = 0;
//put the information of the first UNO interface into the arraylist
#if OSL_DEBUG_LEVEL >= 2
@@ -148,15 +147,15 @@ UnoInterfaceProxy::~UnoInterfaceProxy()
}
-System::Object* UnoInterfaceProxy::create(
+System::Object^ UnoInterfaceProxy::create(
Bridge * bridge,
uno_Interface * pUnoI,
typelib_InterfaceTypeDescription* pTD,
const OUString& oid)
{
- UnoInterfaceProxy* proxyHandler=
- new UnoInterfaceProxy(bridge, pUnoI, pTD, oid);
- System::Object* proxy= proxyHandler->GetTransparentProxy();
+ UnoInterfaceProxy^ proxyHandler=
+ gcnew UnoInterfaceProxy(bridge, pUnoI, pTD, oid);
+ System::Object^ proxy= proxyHandler->GetTransparentProxy();
CliEnvHolder::g_cli_env->registerInterface(proxy, mapUnoString(oid.pData));
return proxy;
}
@@ -165,13 +164,13 @@ System::Object* UnoInterfaceProxy::create(
void UnoInterfaceProxy::addUnoInterface(uno_Interface* pUnoI,
typelib_InterfaceTypeDescription* pTd)
{
- sc::IEnumerator* enumInfos = m_listIfaces->GetEnumerator();
+ sc::IEnumerator^ enumInfos = m_listIfaces->GetEnumerator();
System::Threading::Monitor::Enter(this);
try
{
while (enumInfos->MoveNext())
{
- UnoInterfaceInfo* info = static_cast<UnoInterfaceInfo*>(
+ UnoInterfaceInfo^ info = static_cast<UnoInterfaceInfo^>(
enumInfos->Current);
#if OSL_DEBUG_LEVEL > 1
System::Type * t1;
@@ -193,7 +192,7 @@ void UnoInterfaceProxy::addUnoInterface(uno_Interface* pUnoI,
m_bridge->m_uno_env, reinterpret_cast< void ** >( &pUnoI ),
oid.pData, pTd);
//This proxy does not contain the uno_Interface. Add it.
- m_listIfaces->Add(new UnoInterfaceInfo(m_bridge, pUnoI, pTd));
+ m_listIfaces->Add(gcnew UnoInterfaceInfo(m_bridge, pUnoI, pTd));
m_numUnoIfaces = m_listIfaces->Count;
#if OSL_DEBUG_LEVEL >= 2
System::String * sInterfaceName = static_cast<UnoInterfaceInfo*>(
@@ -222,34 +221,34 @@ void UnoInterfaceProxy::addUnoInterface(uno_Interface* pUnoI,
// IRemotingTypeInfo
-bool UnoInterfaceProxy::CanCastTo(System::Type* fromType,
- System::Object*)
+bool UnoInterfaceProxy::CanCastTo(System::Type^ fromType,
+ System::Object^)
{
- if (fromType == __typeof(System::Object)) // trivial case
+ if (fromType == System::Object::typeid) // trivial case
return true;
System::Threading::Monitor::Enter(this);
try
{
- if (0 != findInfo( fromType )) // proxy supports demanded interface
+ if (nullptr != findInfo( fromType )) // proxy supports demanded interface
return true;
//query an uno interface for the required type
// we use the first interface in the list (m_listIfaces) to make
// the queryInterface call
- UnoInterfaceInfo* info =
- static_cast<UnoInterfaceInfo*>(m_listIfaces->get_Item(0));
+ UnoInterfaceInfo^ info =
+ static_cast<UnoInterfaceInfo^>(m_listIfaces[0]);
css::uno::TypeDescription membertd(
reinterpret_cast<typelib_InterfaceTypeDescription*>(
info->m_typeDesc)->ppAllMembers[0]);
- System::Object *args[] = new System::Object*[1];
+ array<System::Object^>^ args = gcnew array<System::Object^>(1);
args[0] = fromType;
- __box uno::Any * pAny;
- System::Object* pException = NULL;
+ uno::Any ^ pAny;
+ System::Object^ pException = nullptr;
- pAny= static_cast<__box uno::Any *>(
+ pAny= static_cast<uno::Any ^>(
m_bridge->call_uno(
info->m_unoI,
membertd.get(),
@@ -258,7 +257,7 @@ bool UnoInterfaceProxy::CanCastTo(System::Type* fromType,
1,
((typelib_InterfaceMethodTypeDescription*)
membertd.get())->pParams,
- args, NULL, &pException) );
+ args, nullptr, &pException) );
// handle regular exception from target
OSL_ENSURE(
@@ -267,9 +266,9 @@ bool UnoInterfaceProxy::CanCastTo(System::Type* fromType,
mapCliString( pException->ToString()),
RTL_TEXTENCODING_UTF8 ).getStr() );
- if (pAny->Type != __typeof (void)) // has value?
+ if (pAny->Type != void::typeid) // has value?
{
- if (0 != findInfo( fromType ))
+ if (nullptr != findInfo( fromType ))
{
// proxy now supports demanded interface
return true;
@@ -279,12 +278,12 @@ bool UnoInterfaceProxy::CanCastTo(System::Type* fromType,
// and interface with a different oid.
// That way, this type is supported for the CLI
// interpreter (CanCastTo() returns true)
- ::System::Object * obj = pAny->Value;
+ ::System::Object ^ obj = pAny->Value;
OSL_ASSERT( srr::RemotingServices::IsTransparentProxy( obj ) );
if (srr::RemotingServices::IsTransparentProxy( obj ))
{
- UnoInterfaceProxy * proxy =
- static_cast< UnoInterfaceProxy * >(
+ UnoInterfaceProxy ^ proxy =
+ static_cast< UnoInterfaceProxy ^ >(
srr::RemotingServices::GetRealProxy( obj ) );
OSL_ASSERT( 0 != proxy->findInfo( fromType ) );
m_listAdditionalProxies->Add( proxy );
@@ -301,13 +300,13 @@ bool UnoInterfaceProxy::CanCastTo(System::Type* fromType,
OUStringToOString(
e.m_message, RTL_TEXTENCODING_UTF8 ).getStr() );
}
- catch (System::Exception* e)
+ catch (System::Exception^ e)
{
- System::String* msg= new System::String(
- S"An unexpected CLI exception occurred in "
- S"UnoInterfaceProxy::CanCastTo(). Original"
- S"message: \n");
- msg= System::String::Concat(msg, e->get_Message());
+ System::String^ msg= gcnew System::String(
+ "An unexpected CLI exception occurred in "
+ "UnoInterfaceProxy::CanCastTo(). Original"
+ "message: \n");
+ msg= System::String::Concat(msg, e->Message);
OSL_FAIL(
OUStringToOString(
mapCliString(msg), RTL_TEXTENCODING_UTF8 ).getStr() );
@@ -325,57 +324,57 @@ bool UnoInterfaceProxy::CanCastTo(System::Type* fromType,
return false;
}
-srrm::IMessage* UnoInterfaceProxy::invokeObject(
- sc::IDictionary* props,
- srrm::LogicalCallContext* context,
- srrm::IMethodCallMessage* mcm)
+srrm::IMessage^ UnoInterfaceProxy::invokeObject(
+ sc::IDictionary^ props,
+ srrm::LogicalCallContext^ context,
+ srrm::IMethodCallMessage^ mcm)
{
- System::Object* retMethod = 0;
- System::String* sMethod = static_cast<System::String*>
- (props->get_Item(m_methodNameString));
- System::Object* args[] = static_cast<System::Object*[]>(
- props->get_Item(m_ArgsString));
+ System::Object^ retMethod = nullptr;
+ System::String^ sMethod = static_cast<System::String^>
+ (props[m_methodNameString]);
+ array<System::Object^>^ args = static_cast<array<System::Object^>^>(
+ props[m_ArgsString]);
if (m_Equals_String->Equals(sMethod))
{
// Object.Equals
OSL_ASSERT(args->get_Length() == 1);
- srrp::RealProxy* rProxy = srr::RemotingServices::GetRealProxy(args[0]);
+ srrp::RealProxy^ rProxy = srr::RemotingServices::GetRealProxy(args[0]);
bool bDone = false;
if (rProxy)
{
- UnoInterfaceProxy* unoProxy =
- dynamic_cast<UnoInterfaceProxy*>(rProxy);
+ UnoInterfaceProxy^ unoProxy =
+ dynamic_cast<UnoInterfaceProxy^>(rProxy);
if (unoProxy)
{
bool b = m_oid->Equals(unoProxy->getOid());
- retMethod = __box(b);
+ retMethod = b;
bDone = true;
}
}
if (bDone == false)
{
//no proxy or not our proxy, therefore Equals must be false
- retMethod = __box(false);
+ retMethod = false;
}
}
else if (m_GetHashCode_String->Equals(sMethod))
{
// Object.GetHashCode
int nHash = m_oid->GetHashCode();
- retMethod = __box(nHash);
+ retMethod = nHash;
}
else if (m_GetType_String->Equals(sMethod))
{
// Object.GetType
- retMethod = __typeof(System::Object);
+ retMethod = System::Object::typeid;
}
else if (m_ToString_String->Equals(sMethod))
{
// Object.ToString
- st::StringBuilder* sb = new st::StringBuilder(256);
+ st::StringBuilder^ sb = gcnew st::StringBuilder(256);
// sb->AppendFormat(S"Uno object proxy. Implemented interface: {0}"
// S". OID: {1}", m_type->ToString(), m_oid);
- sb->AppendFormat(S"Uno object proxy. OID: {0}", m_oid);
+ sb->AppendFormat("Uno object proxy. OID: {0}", m_oid);
retMethod = sb->ToString();
}
else
@@ -384,46 +383,46 @@ srrm::IMessage* UnoInterfaceProxy::invokeObject(
//which should not be possible
OSL_ASSERT(0);
}
- srrm::IMessage* retVal= new srrm::ReturnMessage(
- retMethod, new System::Object*[0], 0, context, mcm);
+ srrm::IMessage^ retVal= gcnew srrm::ReturnMessage(
+ retMethod, gcnew array<System::Object^>(0), 0, context, mcm);
return retVal;
}
-UnoInterfaceInfo * UnoInterfaceProxy::findInfo( ::System::Type * type )
+UnoInterfaceInfo ^ UnoInterfaceProxy::findInfo( ::System::Type ^ type )
{
for (int i = 0; i < m_numUnoIfaces; i++)
{
- UnoInterfaceInfo* tmpInfo = static_cast<UnoInterfaceInfo*>(
- m_listIfaces->get_Item(i));
+ UnoInterfaceInfo^ tmpInfo = static_cast<UnoInterfaceInfo^>(
+ m_listIfaces[i]);
if (type->IsAssignableFrom(tmpInfo->m_type))
return tmpInfo;
}
for ( int i = 0; i < m_nlistAdditionalProxies; ++i )
{
- UnoInterfaceProxy * proxy =
- static_cast< UnoInterfaceProxy * >(
- m_listAdditionalProxies->get_Item( i ) );
- UnoInterfaceInfo * info = proxy->findInfo( type );
- if (0 != info)
+ UnoInterfaceProxy ^ proxy =
+ static_cast< UnoInterfaceProxy ^ >(
+ m_listAdditionalProxies[ i ] );
+ UnoInterfaceInfo ^ info = proxy->findInfo( type );
+ if (nullptr != info)
return info;
}
- return 0;
+ return nullptr;
}
-srrm::IMessage* UnoInterfaceProxy::Invoke(srrm::IMessage* callmsg)
+srrm::IMessage^ UnoInterfaceProxy::Invoke(srrm::IMessage^ callmsg)
{
try
{
- sc::IDictionary* props= callmsg->Properties;
- srrm::LogicalCallContext* context=
- static_cast<srrm::LogicalCallContext*>(
- props->get_Item(m_CallContextString));
- srrm::IMethodCallMessage* mcm=
- static_cast<srrm::IMethodCallMessage*>(callmsg);
+ sc::IDictionary^ props= callmsg->Properties;
+ srrm::LogicalCallContext^ context=
+ static_cast<srrm::LogicalCallContext^>(
+ props[m_CallContextString]);
+ srrm::IMethodCallMessage^ mcm=
+ static_cast<srrm::IMethodCallMessage^>(callmsg);
//Find out which UNO interface is being called
- System::String* sTypeName = static_cast<System::String*>(
- props->get_Item(m_typeNameString));
+ System::String^ sTypeName = static_cast<System::String^>(
+ props[m_typeNameString]);
sTypeName = sTypeName->Substring(0, sTypeName->IndexOf(','));
// Special Handling for System.Object methods
@@ -432,14 +431,14 @@ srrm::IMessage* UnoInterfaceProxy::Invoke(srrm::IMessage* callmsg)
return invokeObject(props, context, mcm);
}
- System::Type* typeBeingCalled = loadCliType(sTypeName);
- UnoInterfaceInfo* info = findInfo( typeBeingCalled );
+ System::Type^ typeBeingCalled = loadCliType(sTypeName);
+ UnoInterfaceInfo^ info = findInfo( typeBeingCalled );
OSL_ASSERT( 0 != info );
// ToDo do without string conversion, a OUString is not needed here
// get the type description of the call
- OUString usMethodName(mapCliString(static_cast<System::String*>(
- props->get_Item(m_methodNameString))));
+ OUString usMethodName(mapCliString(static_cast<System::String^>(
+ props[m_methodNameString])));
typelib_TypeDescriptionReference ** ppAllMembers =
info->m_typeDesc->ppAllMembers;
sal_Int32 numberMembers = info->m_typeDesc->nAllMembers;
@@ -475,12 +474,12 @@ srrm::IMessage* UnoInterfaceProxy::Invoke(srrm::IMessage* callmsg)
(typelib_InterfaceMethodTypeDescription *)
member_td.get();
- System::Object* args[] = static_cast<System::Object*[]>(
- props->get_Item(m_ArgsString));
- System::Type* argTypes[] = static_cast<System::Type*[]>(
- props->get_Item(m_methodSignatureString));
- System::Object* pExc = NULL;
- System::Object * cli_ret = m_bridge->call_uno(
+ array<System::Object^>^ args = static_cast<array<System::Object^>^>(
+ props[m_ArgsString]);
+ array<System::Type^>^ argTypes = static_cast<array<System::Type^>^>(
+ props[m_methodSignatureString]);
+ System::Object^ pExc = nullptr;
+ System::Object ^ cli_ret = m_bridge->call_uno(
info->m_unoI, member_td.get(),
method_td->pReturnTypeRef, method_td->nParams,
method_td->pParams, args, argTypes, &pExc);
@@ -511,13 +510,13 @@ srrm::IMessage* UnoInterfaceProxy::Invoke(srrm::IMessage* callmsg)
(typelib_InterfaceAttributeTypeDescription*)
member_td.get();
- System::Object* pExc = NULL;
- System::Object* cli_ret= m_bridge->call_uno(
+ System::Object^ pExc = nullptr;
+ System::Object^ cli_ret= m_bridge->call_uno(
info->m_unoI, member_td.get(),
attribute_td->pAttributeTypeRef,
0, 0,
- NULL, NULL, &pExc);
- return constructReturnMessage(cli_ret, NULL, NULL,
+ nullptr, nullptr, &pExc);
+ return constructReturnMessage(cli_ret, nullptr, NULL,
callmsg, pExc);
}
else if ('s' == usMethodName[0])
@@ -533,21 +532,21 @@ srrm::IMessage* UnoInterfaceProxy::Invoke(srrm::IMessage* callmsg)
param.bIn = sal_True;
param.bOut = sal_False;
- System::Object* args[] =
- static_cast<System::Object*[]>(
- props->get_Item(m_ArgsString));
- System::Object* pExc = NULL;
+ array<System::Object^>^ args =
+ static_cast<array<System::Object^>^>(
+ props[m_ArgsString]);
+ System::Object^ pExc = nullptr;
m_bridge->call_uno(
info->m_unoI, member_td.get(),
::getCppuVoidType().getTypeLibType(),
- 1, &param, args, NULL, &pExc);
- return constructReturnMessage(NULL, NULL, NULL,
+ 1, &param, args, nullptr, &pExc);
+ return constructReturnMessage(nullptr, nullptr, NULL,
callmsg, pExc);
}
else
{
- return constructReturnMessage(NULL, NULL, NULL,
- callmsg, NULL);
+ return constructReturnMessage(nullptr, nullptr, NULL,
+ callmsg, nullptr);
}
}
break;
@@ -568,66 +567,66 @@ srrm::IMessage* UnoInterfaceProxy::Invoke(srrm::IMessage* callmsg)
}
catch (BridgeRuntimeError & err)
{
- srrm::IMethodCallMessage* mcm =
- static_cast<srrm::IMethodCallMessage*>(callmsg);
- return new srrm::ReturnMessage(new ucss::uno::RuntimeException(
- mapUnoString(err.m_message.pData), NULL), mcm);
+ srrm::IMethodCallMessage^ mcm =
+ static_cast<srrm::IMethodCallMessage^>(callmsg);
+ return gcnew srrm::ReturnMessage(gcnew ucss::uno::RuntimeException(
+ mapUnoString(err.m_message.pData), nullptr), mcm);
}
- catch (System::Exception* e)
+ catch (System::Exception^ e)
{
- st::StringBuilder * sb = new st::StringBuilder(512);
- sb->Append(new System::String(
- S"An unexpected CLI exception occurred in "
- S"UnoInterfaceProxy::Invoke. Original"
- S"message: \n"));
- sb->Append(e->get_Message());
+ st::StringBuilder ^ sb = gcnew st::StringBuilder(512);
+ sb->Append(gcnew System::String(
+ "An unexpected CLI exception occurred in "
+ "UnoInterfaceProxy::Invoke. Original"
+ "message: \n"));
+ sb->Append(e->Message);
sb->Append((__wchar_t) '\n');
- sb->Append(e->get_StackTrace());
- srrm::IMethodCallMessage* mcm =
- static_cast<srrm::IMethodCallMessage*>(callmsg);
- return new srrm::ReturnMessage(new ucss::uno::RuntimeException(
- sb->ToString(), NULL), mcm);
+ sb->Append(e->StackTrace);
+ srrm::IMethodCallMessage^ mcm =
+ static_cast<srrm::IMethodCallMessage^>(callmsg);
+ return gcnew srrm::ReturnMessage(gcnew ucss::uno::RuntimeException(
+ sb->ToString(), nullptr), mcm);
}
catch (...)
{
- System::String* msg = new System::String(
- S"An unexpected native C++ exception occurred in "
- S"UnoInterfaceProxy::Invoke.");
- srrm::IMethodCallMessage* mcm =
- static_cast<srrm::IMethodCallMessage*>(callmsg);
- return new srrm::ReturnMessage(new ucss::uno::RuntimeException(
- msg, NULL), mcm);
+ System::String^ msg = gcnew System::String(
+ "An unexpected native C++ exception occurred in "
+ "UnoInterfaceProxy::Invoke.");
+ srrm::IMethodCallMessage^ mcm =
+ static_cast<srrm::IMethodCallMessage^>(callmsg);
+ return gcnew srrm::ReturnMessage(gcnew ucss::uno::RuntimeException(
+ msg, nullptr), mcm);
}
- return NULL;
+ return nullptr;
}
/** If the argument args is NULL then this function is called for an attribute
method (either setXXX or getXXX).
For attributes the argument mtd is also NULL.
*/
-srrm::IMessage* UnoInterfaceProxy::constructReturnMessage(
- System::Object* cliReturn,
- System::Object* args[],
+srrm::IMessage^ UnoInterfaceProxy::constructReturnMessage(
+ System::Object^ cliReturn,
+ array<System::Object^>^ args,
typelib_InterfaceMethodTypeDescription* mtd,
- srrm::IMessage* msg, System::Object* exc)
+ srrm::IMessage^ msg, System::Object^ exc)
{
- srrm::IMessage * retVal= NULL;
- srrm::IMethodCallMessage* mcm = static_cast<srrm::IMethodCallMessage*>(msg);
+ srrm::IMessage ^ retVal= nullptr;
+ srrm::IMethodCallMessage^ mcm = static_cast<srrm::IMethodCallMessage^>(msg);
if (exc)
{
- retVal = new srrm::ReturnMessage(
- dynamic_cast<System::Exception*>(exc), mcm);
+ retVal = gcnew srrm::ReturnMessage(
+ dynamic_cast<System::Exception^>(exc), mcm);
}
else
{
- sc::IDictionary* props= msg->get_Properties();
- srrm::LogicalCallContext* context=
- static_cast<srrm::LogicalCallContext*>(
- props->get_Item(m_CallContextString));
- if (args != NULL)
+ sc::IDictionary^ props= msg->Properties;
+ srrm::LogicalCallContext^ context=
+ static_cast<srrm::LogicalCallContext^>(
+ props[m_CallContextString]);
+ if (args != nullptr)
{
// Method
//build the array of out parameters, allocate max length
- System::Object* arOut[]= new System::Object*[mtd->nParams];
+ array<System::Object^>^ arOut= gcnew array<System::Object^>(mtd->nParams);
int nOut = 0;
for (int i= 0; i < mtd->nParams; i++)
{
@@ -637,13 +636,13 @@ srrm::IMessage* UnoInterfaceProxy::constructReturnMessage(
nOut++;
}
}
- retVal= new srrm::ReturnMessage(cliReturn, arOut, nOut,
+ retVal= gcnew srrm::ReturnMessage(cliReturn, arOut, nOut,
context, mcm);
}
else
{
// Attribute (getXXX)
- retVal= new srrm::ReturnMessage(cliReturn, NULL, 0,
+ retVal= gcnew srrm::ReturnMessage(cliReturn, nullptr, 0,
context, mcm);
}
}
@@ -651,7 +650,7 @@ srrm::IMessage* UnoInterfaceProxy::constructReturnMessage(
}
//################################################################################
-CliProxy::CliProxy(Bridge const* bridge, System::Object* cliI,
+CliProxy::CliProxy(Bridge const* bridge, System::Object^ cliI,
typelib_TypeDescription const* td,
const rtl::OUString& usOid):
m_ref(1),
@@ -688,29 +687,29 @@ void CliProxy::makeMethodInfos()
type = m_type;
#endif
- if (m_type->get_IsInterface() == false)
+ if (m_type->IsInterface == false)
return;
- sr::MethodInfo* arThisMethods[] = m_type->GetMethods();
+ array<sr::MethodInfo^>^ arThisMethods = m_type->GetMethods();
//get the inherited interfaces
- System::Type* arInheritedIfaces[] = m_type->GetInterfaces();
- m_nInheritedInterfaces = arInheritedIfaces->get_Length();
+ array<System::Type^>^ arInheritedIfaces = m_type->GetInterfaces();
+ m_nInheritedInterfaces = arInheritedIfaces->Length;
//array containing the number of methods for the interface and its
//inherited interfaces
- m_arInterfaceMethodCount = new int __gc [m_nInheritedInterfaces + 1];
+ m_arInterfaceMethodCount = gcnew array<int^>(m_nInheritedInterfaces + 1);
//determine the number of all interface methods, including the inherited
//interfaces
- int numMethods = arThisMethods->get_Length();
+ int numMethods = arThisMethods->Length;
for (int i= 0; i < m_nInheritedInterfaces; i++)
{
- numMethods += arInheritedIfaces[i]->GetMethods()->get_Length();
+ numMethods += arInheritedIfaces[i]->GetMethods()->Length;
}
//array containing MethodInfos of the cli object
- m_arMethodInfos = new sr::MethodInfo*[numMethods];
+ m_arMethodInfos = gcnew array<sr::MethodInfo^>(numMethods);
//array containing MethodInfos of the interface
- m_arInterfaceMethodInfos = new sr::MethodInfo*[numMethods];
+ m_arInterfaceMethodInfos = gcnew array<sr::MethodInfo^>(numMethods);
//array containing the mapping of Uno interface pos to pos in
//m_arMethodInfos
- m_arUnoPosToCliPos = new System::Int32[numMethods];
+ m_arUnoPosToCliPos = gcnew array<System::Int32>(numMethods);
// initialize with -1
for (int i = 0; i < numMethods; i++)
m_arUnoPosToCliPos[i] = -1;
@@ -729,7 +728,7 @@ void CliProxy::makeMethodInfos()
// !!! InterfaceMapping.TargetMethods should be MethodInfo*[] according
// to documentation
// but it is Type*[] instead. Bug in the framework?
- System::Type* objType = m_cliI->GetType();
+ System::Type^ objType = m_cliI->GetType();
try
{
int index = 0;
@@ -737,35 +736,35 @@ void CliProxy::makeMethodInfos()
//arInheritedIfaces[0] is the direct base interface
//arInheritedIfaces[n] is the furthest inherited interface
//Start with the base interface
- int nArLength = arInheritedIfaces->get_Length();
+ int nArLength = arInheritedIfaces->Length;
for (;nArLength > 0; nArLength--)
{
sr::InterfaceMapping mapInherited = objType->GetInterfaceMap(
arInheritedIfaces[nArLength - 1]);
- int numMethods = mapInherited.TargetMethods->get_Length();
+ int numMethods = mapInherited.TargetMethods->Length;
m_arInterfaceMethodCount[nArLength - 1] = numMethods;
for (int i = 0; i < numMethods; i++, index++)
{
- m_arMethodInfos[index] = __try_cast<sr::MethodInfo*>(
+ m_arMethodInfos[index] = safe_cast<sr::MethodInfo^>(
mapInherited.TargetMethods[i]);
- m_arInterfaceMethodInfos[index] = __try_cast<sr::MethodInfo*>(
+ m_arInterfaceMethodInfos[index] = safe_cast<sr::MethodInfo^>(
mapInherited.InterfaceMethods[i]);
}
}
//At last come the methods of the furthest derived interface
sr::InterfaceMapping map = objType->GetInterfaceMap(m_type);
- nArLength = map.TargetMethods->get_Length();
+ nArLength = map.TargetMethods->Length;
m_arInterfaceMethodCount[m_nInheritedInterfaces] = nArLength;
for (int i = 0; i < nArLength; i++,index++)
{
- m_arMethodInfos[index]= __try_cast<sr::MethodInfo*>(
+ m_arMethodInfos[index]= safe_cast<sr::MethodInfo^>(
map.TargetMethods[i]);
- m_arInterfaceMethodInfos[index]= __try_cast<sr::MethodInfo*>(
+ m_arInterfaceMethodInfos[index]= safe_cast<sr::MethodInfo^>(
map.InterfaceMethods[i]);
}
}
- catch (System::InvalidCastException* )
+ catch (System::InvalidCastException^ )
{
OUStringBuffer buf( 128 );
buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(
@@ -777,10 +776,10 @@ void CliProxy::makeMethodInfos()
}
}
-sr::MethodInfo* CliProxy::getMethodInfo(int nUnoFunctionPos,
+sr::MethodInfo^ CliProxy::getMethodInfo(int nUnoFunctionPos,
const rtl::OUString& usMethodName, MethodKind methodKind)
{
- sr::MethodInfo* ret = NULL;
+ sr::MethodInfo^ ret = nullptr;
#if OSL_DEBUG_LEVEL >= 2
System::String* sMethodNameDbg;
sr::MethodInfo* arMethodInfosDbg[];
@@ -803,19 +802,19 @@ sr::MethodInfo* CliProxy::getMethodInfo(int nUnoFunctionPos,
return m_arMethodInfos[cliPos];
//create the method function name
- System::String* sMethodName = mapUnoString(usMethodName.pData);
+ System::String^ sMethodName = mapUnoString(usMethodName.pData);
switch (methodKind)
{
case MK_METHOD:
break;
case MK_SET:
sMethodName = System::String::Concat(
- const_cast<System::String*>(Constants::sAttributeSet),
+ const_cast<System::String^>(Constants::sAttributeSet),
sMethodName);
break;
case MK_GET:
sMethodName = System::String::Concat(
- const_cast<System::String*>(Constants::sAttributeGet),
+ const_cast<System::String^>(Constants::sAttributeGet),
sMethodName);
break;
default:
@@ -832,10 +831,10 @@ sr::MethodInfo* CliProxy::getMethodInfo(int nUnoFunctionPos,
indexCliMethod = nUnoFunctionPos;
else
{
- int cMethods = m_arInterfaceMethodInfos->get_Length();
+ int cMethods = m_arInterfaceMethodInfos->Length;
for (int i = 0; i < cMethods; i++)
{
- System::String* cliMethod = m_arInterfaceMethodInfos[i]->Name;
+ System::String^ cliMethod = m_arInterfaceMethodInfos[i]->Name;
if (cliMethod->Equals(sMethodName))
{
indexCliMethod = i;
@@ -877,7 +876,7 @@ CliProxy::~CliProxy()
}
uno_Interface* CliProxy::create(Bridge const * bridge,
- System::Object* cliI,
+ System::Object^ cliI,
typelib_TypeDescription const* pTD,
const rtl::OUString& ousOid)
{
@@ -1004,7 +1003,7 @@ void SAL_CALL cli_proxy_dispatch(
OUString const& usAttrName= *(rtl_uString**)&
((typelib_InterfaceMemberTypeDescription*) member_td)
->pMemberName;
- sr::MethodInfo* info = proxy->getMethodInfo(function_pos,
+ sr::MethodInfo^ info = proxy->getMethodInfo(function_pos,
usAttrName, CliProxy::MK_GET);
bridge->call_cli(
proxy->m_cliI,
@@ -1019,7 +1018,7 @@ void SAL_CALL cli_proxy_dispatch(
OUString const& usAttrName= *(rtl_uString**) &
((typelib_InterfaceMemberTypeDescription*) member_td)
->pMemberName;
- sr::MethodInfo* info = proxy->getMethodInfo(function_pos + 1,
+ sr::MethodInfo^ info = proxy->getMethodInfo(function_pos + 1,
usAttrName, CliProxy::MK_SET);
typelib_MethodParameter param;
param.pTypeRef =
@@ -1074,7 +1073,7 @@ void SAL_CALL cli_proxy_dispatch(
if (0 == pInterface)
{
- System::Type* mgdDemandedType =
+ System::Type^ mgdDemandedType =
mapUnoType(demanded_td.get());
if (mgdDemandedType->IsInstanceOfType( proxy->m_cliI ))
{
@@ -1125,7 +1124,7 @@ void SAL_CALL cli_proxy_dispatch(
((typelib_InterfaceMemberTypeDescription*) member_td)
->pMemberName;
- sr::MethodInfo* info = proxy->getMethodInfo(function_pos,
+ sr::MethodInfo^ info = proxy->getMethodInfo(function_pos,
usMethodName, CliProxy::MK_METHOD);
bridge->call_cli(
proxy->m_cliI,
diff --git a/cli_ure/source/uno_bridge/cli_proxy.h b/cli_ure/source/uno_bridge/cli_proxy.h
index ae2e09fb74cd..5155e46baf4a 100644
--- a/cli_ure/source/uno_bridge/cli_proxy.h
+++ b/cli_ure/source/uno_bridge/cli_proxy.h
@@ -28,7 +28,6 @@
#include "cli_bridge.h"
#include "cli_environment.h"
-#using <mscorlib.dll>
#using <cli_ure.dll>
namespace srrp = System::Runtime::Remoting::Proxies;
@@ -41,30 +40,30 @@ using namespace uno;
namespace cli_uno
{
-public __gc class UnoInterfaceInfo
+public ref class UnoInterfaceInfo
{
public:
UnoInterfaceInfo(Bridge const * bridge, uno_Interface* unoI,
typelib_InterfaceTypeDescription* td);
~UnoInterfaceInfo();
uno_Interface * m_unoI; // wrapped interface
- System::Type * m_type;
+ System::Type ^ m_type;
typelib_InterfaceTypeDescription* m_typeDesc;
Bridge const* m_bridge;
};
-public __gc class UnoInterfaceProxy: public srrp::RealProxy,
+public ref class UnoInterfaceProxy: public srrp::RealProxy,
public srr::IRemotingTypeInfo
{
/** used for IRemotingTypeInfo.TypeName
*/
- System::String* m_sTypeName;
+ System::String^ m_sTypeName;
/** The list is filled with UnoInterfaceInfo objects. The list can only
grow and elements are never changed. If an element was added it
must not be changed!
*/
- sc::ArrayList* m_listIfaces;
+ sc::ArrayList^ m_listIfaces;
/** The number of UNO interfaces this proxy represents. It corresponds
to the the number of elements in m_listIfaces.
*/
@@ -73,13 +72,13 @@ public __gc class UnoInterfaceProxy: public srrp::RealProxy,
to aggregation via bridges. Though the latter is strongly
discouraged, this has to be supported.
*/
- sc::ArrayList* m_listAdditionalProxies;
+ sc::ArrayList^ m_listAdditionalProxies;
int m_nlistAdditionalProxies;
- UnoInterfaceInfo * findInfo( ::System::Type * type );
+ UnoInterfaceInfo ^ findInfo( ::System::Type ^ type );
Bridge const* m_bridge;
- System::String* m_oid;
+ System::String^ m_oid;
#if OSL_DEBUG_LEVEL >= 2
/** The string contains all names of UNO interfaces which are
@@ -97,13 +96,13 @@ public:
/** Creates a proxy and registers it on the dot NET side.
*/
- static System::Object* create(Bridge * bridge,
+ static System::Object^ create(Bridge * bridge,
uno_Interface * pUnoI,
typelib_InterfaceTypeDescription* pTd,
const rtl::OUString& oid);
/** RealProxy::Invoke */
- srrm::IMessage* Invoke(srrm::IMessage* msg);
+ virtual srrm::IMessage^ Invoke(srrm::IMessage^ msg) override;
/** Must be called from within a synchronized section.
Add only the interface if it is not already contained.
@@ -116,19 +115,22 @@ public:
/**
*/
- inline System::String * getOid()
+ inline System::String ^ getOid()
{ return m_oid; }
//IRemotingTypeInfo ----------------------------------------------
- bool CanCastTo(System::Type* fromType, System::Object* o);
+ virtual bool CanCastTo(System::Type^ fromType, System::Object^ o);
- __property System::String* get_TypeName()
+ virtual property System::String^ TypeName
{
- return m_sTypeName;
- }
- __property void set_TypeName(System::String* name)
- {
- m_sTypeName = name;
+ System::String^ get()
+ {
+ return m_sTypeName;
+ };
+ void set(System::String^ name)
+ {
+ m_sTypeName = name;
+ };
}
@@ -139,31 +141,31 @@ private:
typelib_InterfaceTypeDescription* pTD,
const rtl::OUString& oid );
- static srrm::IMessage* constructReturnMessage(System::Object* retVal,
- System::Object* outArgs[],
+ static srrm::IMessage^ constructReturnMessage(System::Object^ retVal,
+ array<System::Object^>^ outArgs,
typelib_InterfaceMethodTypeDescription* mtd,
- srrm::IMessage* msg, System::Object* exc);
-
- static System::String* m_methodNameString =
- new System::String("__MethodName");
- static System::String* m_typeNameString = new System::String("__TypeName");
- static System::String* m_ArgsString = new System::String("__Args");
- static System::String* m_CallContextString =
- new System::String("__CallContext");
- static System::String* m_system_Object_String =
- new System::String("System.Object");
- static System::String* m_methodSignatureString =
- new System::String("__MethodSignature");
- static System::String* m_Equals_String = new System::String("Equals");
- static System::String* m_GetHashCode_String =
- new System::String("GetHashCode");
- static System::String* m_GetType_String = new System::String("GetType");
- static System::String* m_ToString_String = new System::String("ToString");
+ srrm::IMessage^ msg, System::Object^ exc);
+
+ static System::String^ m_methodNameString =
+ gcnew System::String("__MethodName");
+ static System::String^ m_typeNameString = gcnew System::String("__TypeName");
+ static System::String^ m_ArgsString = gcnew System::String("__Args");
+ static System::String^ m_CallContextString =
+ gcnew System::String("__CallContext");
+ static System::String^ m_system_Object_String =
+ gcnew System::String("System.Object");
+ static System::String^ m_methodSignatureString =
+ gcnew System::String("__MethodSignature");
+ static System::String^ m_Equals_String = gcnew System::String("Equals");
+ static System::String^ m_GetHashCode_String =
+ gcnew System::String("GetHashCode");
+ static System::String^ m_GetType_String = gcnew System::String("GetType");
+ static System::String^ m_ToString_String = gcnew System::String("ToString");
protected:
- srrm::IMessage* invokeObject(sc::IDictionary* properties,
- srrm::LogicalCallContext* context,
- srrm::IMethodCallMessage* mcm);
+ srrm::IMessage^ invokeObject(sc::IDictionary^ properties,
+ srrm::LogicalCallContext^ context,
+ srrm::IMethodCallMessage^ mcm);
};
@@ -172,10 +174,10 @@ struct CliProxy: public uno_Interface
{
mutable oslInterlockedCount m_ref;
const Bridge* m_bridge;
- const gcroot<System::Object*> m_cliI;
- gcroot<System::Type*> m_type;
+ const gcroot<System::Object^> m_cliI;
+ gcroot<System::Type^> m_type;
const com::sun::star::uno::TypeDescription m_unoType;
- const gcroot<System::String*> m_oid;
+ const gcroot<System::String^> m_oid;
const rtl::OUString m_usOid;
enum MethodKind {MK_METHOD = 0, MK_SET, MK_GET};
@@ -200,7 +202,7 @@ struct CliProxy: public uno_Interface
This is becaus, the cli interface does not contain the XInterface
methods.
*/
- gcroot<sr::MethodInfo*[]> m_arMethodInfos;
+ gcroot<array<sr::MethodInfo^>^> m_arMethodInfos;
/** 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
@@ -209,7 +211,7 @@ struct CliProxy: public uno_Interface
array. The name of the actual implemented method may not be the same as
the interface method.
*/
- gcroot<sr::MethodInfo*[]> m_arInterfaceMethodInfos;
+ gcroot<array<sr::MethodInfo^>^> m_arInterfaceMethodInfos;
/** Maps the position of the method in the UNO interface to the position of
the corresponding MethodInfo in m_arMethodInfos. The Uno position must
@@ -222,22 +224,22 @@ struct CliProxy: public uno_Interface
arUnoPosToCliPos[pos] contains the index for m_arMethodInfos.
*/
- gcroot<System::Int32[]> m_arUnoPosToCliPos;
+ gcroot<array<System::Int32>^> m_arUnoPosToCliPos;
/** Count of inherited interfaces of the cli interface.
*/
int m_nInheritedInterfaces;
/** Contains the number of methods of each interface.
*/
- gcroot<System::Int32[]> m_arInterfaceMethodCount;
+ gcroot<array<System::Int32^>^> m_arInterfaceMethodCount;
- CliProxy( Bridge const* bridge, System::Object* cliI,
+ CliProxy( Bridge const* bridge, System::Object^ cliI,
typelib_TypeDescription const* pTD,
const rtl::OUString& usOid);
~CliProxy();
static uno_Interface* create(Bridge const * bridge,
- System::Object* cliI,
+ System::Object^ cliI,
typelib_TypeDescription const * TD,
rtl::OUString const & usOid );
@@ -273,7 +275,7 @@ struct CliProxy: public uno_Interface
@param nUnoFunctionPos
Position of the method in the uno interface.
*/
- sr::MethodInfo* getMethodInfo(int nUnoFunctionPos,
+ sr::MethodInfo^ getMethodInfo(int nUnoFunctionPos,
const rtl::OUString & usMethodName,
MethodKind mk);
diff --git a/cli_ure/source/uno_bridge/cli_uno.cxx b/cli_ure/source/uno_bridge/cli_uno.cxx
index d16668a09e6d..0ada41d9fd30 100644
--- a/cli_ure/source/uno_bridge/cli_uno.cxx
+++ b/cli_ure/source/uno_bridge/cli_uno.cxx
@@ -38,12 +38,12 @@ union largest
uno_Any a;
};
-System::Object* Bridge::call_uno(uno_Interface * pUnoI,
+System::Object^ Bridge::call_uno(uno_Interface * pUnoI,
typelib_TypeDescription* member_td,
typelib_TypeDescriptionReference * return_type,
sal_Int32 nParams, typelib_MethodParameter const * pParams,
- System::Object * args[], System::Type* argTypes[],
- System::Object** ppExc) const
+ array<System::Object^>^ args, array<System::Type^>^ argTypes,
+ System::Object^* ppExc) const
{
// return mem
sal_Int32 return_size = sizeof (largest);
@@ -133,9 +133,10 @@ System::Object* Bridge::call_uno(uno_Interface * pUnoI,
{
try
{
+ pin_ptr<System::Object^> ptr = &args[nPos];
map_to_cli(
- &args[nPos], uno_args[nPos], param.pTypeRef,
- argTypes != NULL ? argTypes[nPos] : NULL, false );
+ ptr, uno_args[nPos], param.pTypeRef,
+ argTypes != nullptr ? argTypes[nPos] : nullptr, false );
}
catch (...)
{
@@ -163,9 +164,9 @@ System::Object* Bridge::call_uno(uno_Interface * pUnoI,
// convert uno return value
try
{
- System::Object* cli_ret;
+ System::Object^ cli_ret;
map_to_cli(
- &cli_ret, uno_ret, return_type, 0, false);
+ &cli_ret, uno_ret, return_type, nullptr, false);
uno_type_destructData(uno_ret, return_type, 0);
return cli_ret;
}
@@ -175,7 +176,7 @@ System::Object* Bridge::call_uno(uno_Interface * pUnoI,
throw;
}
}
- return 0; // void return
+ return nullptr; // void return
}
else // exception occurred
{
@@ -189,36 +190,37 @@ System::Object* Bridge::call_uno(uno_Interface * pUnoI,
}
}
map_to_cli(ppExc, uno_exc_holder.pData,
- uno_exc_holder.pType, NULL, false);
- return 0;
+ uno_exc_holder.pType, nullptr, false);
+ return nullptr;
}
}
void Bridge::call_cli(
- System::Object* cliI,
- sr::MethodInfo* method,
+ System::Object^ cliI,
+ sr::MethodInfo^ method,
typelib_TypeDescriptionReference * return_type,
typelib_MethodParameter * params, int nParams,
void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) const
{
- System::Object *args[]= new System::Object*[nParams];
+ array<System::Object^>^ args= gcnew array<System::Object^>(nParams);
for (int nPos= 0; nPos < nParams; nPos++)
{
typelib_MethodParameter const & param= params[nPos];
if (param.bIn)
{
- map_to_cli( &args[nPos],
- uno_args[nPos], param.pTypeRef, 0, false);
+ pin_ptr<System::Object^> ptr = &args[nPos];
+ map_to_cli( ptr,
+ uno_args[nPos], param.pTypeRef, nullptr, false);
}
}
- System::Object* retInvoke= NULL;
+ System::Object^ retInvoke= nullptr;
try
{
retInvoke= method->Invoke(cliI, args);
}
- catch (sr::TargetInvocationException* e)
+ catch (sr::TargetInvocationException^ e)
{
- System::Exception* exc= e->get_InnerException();
+ System::Exception^ exc= e->InnerException;
css::uno::TypeDescription td(mapCliType(exc->GetType()));
// memory for exception
std::auto_ptr< rtl_mem > memExc(rtl_mem::allocate(td.get()->nSize));
@@ -227,13 +229,13 @@ void Bridge::call_cli(
(*uno_exc)->pData= memExc.release();
return;
}
- catch (System::Exception* e)
+ catch (System::Exception^ e)
{
OUStringBuffer buf( 128 );
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(
"Unexspected exception during invocation of cli object. "
"Original message is: \n") );
- buf.append(mapCliString(e->get_Message()));
+ buf.append(mapCliString(e->Message));
throw BridgeRuntimeError( buf.makeStringAndClear() );
}