diff options
author | Peter Foley <pefoley2@verizon.net> | 2012-08-27 15:28:23 -0400 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2012-10-07 10:42:14 +0200 |
commit | 4b56d82c7d20ba5897d87aaf7fc94da5356b8eec (patch) | |
tree | cf07b915fb3a6c76b992b28cdeeddeb346bad888 /cli_ure/source/uno_bridge/cli_data.cxx | |
parent | b5bc77572338d04f8ff165ca85111096ce1d4804 (diff) |
convert uno_bridge to new syntax
Change-Id: Iac5e9a860f7ef68104c4cfc19abe686b754190af
Diffstat (limited to 'cli_ure/source/uno_bridge/cli_data.cxx')
-rw-r--r-- | cli_ure/source/uno_bridge/cli_data.cxx | 687 |
1 files changed, 344 insertions, 343 deletions
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 prfix 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 prfix 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: |