diff options
author | Peter Foley <pefoley2@verizon.net> | 2012-08-19 17:53:57 -0400 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-08-22 04:15:32 +0000 |
commit | 6fa1a74ec4bb5820d1638ff3b872476f8652efe0 (patch) | |
tree | bf05a9e08216fb14b366a120542474b5e777da00 /cli_ure | |
parent | 84d1ff7be178ec3572710e092e85fe548ce3042b (diff) |
convert climaker to new syntax
Change-Id: Ic8b202c339806e4cf4dc621a4730593724175fca
Reviewed-on: https://gerrit.libreoffice.org/447
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
Diffstat (limited to 'cli_ure')
-rwxr-xr-x[-rw-r--r--] | cli_ure/source/climaker/climaker_app.cxx | 110 | ||||
-rwxr-xr-x[-rw-r--r--] | cli_ure/source/climaker/climaker_emit.cxx | 1005 | ||||
-rwxr-xr-x[-rw-r--r--] | cli_ure/source/climaker/climaker_share.h | 187 | ||||
-rw-r--r-- | cli_ure/source/climaker/makefile.mk | 2 |
4 files changed, 646 insertions, 658 deletions
diff --git a/cli_ure/source/climaker/climaker_app.cxx b/cli_ure/source/climaker/climaker_app.cxx index d215a57ca867..7d5ad48169c3 100644..100755 --- a/cli_ure/source/climaker/climaker_app.cxx +++ b/cli_ure/source/climaker/climaker_app.cxx @@ -530,21 +530,21 @@ SAL_IMPLEMENT_MAIN() filename += OUSTR(".dll"); else name = name.copy( 0, dot ); - ::System::String * output_dir = ustring_to_String( sys_output_dir ); - ::System::String * output_file = ustring_to_String( filename ); + ::System::String ^ output_dir = ustring_to_String( sys_output_dir ); + ::System::String ^ output_file = ustring_to_String( filename ); //Get the key pair for making a strong name - StrongNameKeyPair* kp = NULL; + StrongNameKeyPair^ kp = nullptr; if (keyfile.getLength() > 0) { - ::System::String * sKeyFile = ustring_to_String(keyfile); + ::System::String ^ sKeyFile = ustring_to_String(keyfile); try { - System::IO::FileStream* fs = new System::IO::FileStream( + System::IO::FileStream^ fs = gcnew System::IO::FileStream( sKeyFile, System::IO::FileMode::Open); - kp = new StrongNameKeyPair(fs); + kp = gcnew StrongNameKeyPair(fs); fs->Close(); } - catch (System::IO::FileNotFoundException * ) + catch (System::IO::FileNotFoundException ^ ) { throw Exception(OUSTR("Could not find the keyfile. Verify the --keyfile argument!"), 0); } @@ -554,88 +554,88 @@ SAL_IMPLEMENT_MAIN() if (g_verbose) { ::System::Console::Write( - S"> no key file specified. Cannot create strong name!\n"); + "> no key file specified. Cannot create strong name!\n"); } } // setup assembly info: xxx todo set more? e.g. avoid strong versioning - AssemblyName * assembly_name = new AssemblyName(); - assembly_name->set_CodeBase( output_dir ); - assembly_name->set_Name( name.getStr() ); - if (kp != NULL) - assembly_name->set_KeyPair(kp); + AssemblyName ^ assembly_name = gcnew AssemblyName(); + assembly_name->CodeBase = output_dir; + assembly_name->Name = gcnew ::System::String(name.getStr()); + if (kp != nullptr) + assembly_name->KeyPair= kp; if (version.getLength() != 0) { - assembly_name->set_Version( - new ::System::Version( ustring_to_String( version ) ) ); + assembly_name->Version= + gcnew ::System::Version( ustring_to_String( version ) ); } // app domain - ::System::AppDomain * current_appdomain = - ::System::AppDomain::get_CurrentDomain(); + ::System::AppDomain ^ current_appdomain = + ::System::AppDomain::CurrentDomain; // target assembly - Emit::AssemblyBuilder * assembly_builder = + Emit::AssemblyBuilder ^ assembly_builder = current_appdomain->DefineDynamicAssembly( assembly_name, Emit::AssemblyBuilderAccess::Save, output_dir ); if (product.getLength() != 0) { - ::System::Type * params __gc [] = new ::System::Type * __gc [ 1 ]; - ::System::Object * args __gc [] = new ::System::Object * __gc [ 1 ]; - params[ 0 ] = __typeof (::System::String); + array< ::System::Type^>^ params = gcnew array< ::System::Type^> (1); + array< ::System::Object^>^args = gcnew array< ::System::Object^>(1); + params[ 0 ] = ::System::String::typeid; args[ 0 ] = ustring_to_String( product ); assembly_builder->SetCustomAttribute( - new Emit::CustomAttributeBuilder( - __typeof (AssemblyProductAttribute)->GetConstructor( + gcnew Emit::CustomAttributeBuilder( + (AssemblyProductAttribute::typeid)->GetConstructor( params ), args ) ); } if (description.getLength() != 0) { - ::System::Type * params __gc [] = new ::System::Type * __gc [ 1 ]; - ::System::Object * args __gc [] = new ::System::Object * __gc [ 1 ]; - params[ 0 ] = __typeof (::System::String); + array< ::System::Type^>^ params = gcnew array< ::System::Type^>(1); + array< ::System::Object^>^ args = gcnew array< ::System::Object^>(1); + params[ 0 ] = ::System::String::typeid; args[ 0 ] = ustring_to_String( description ); assembly_builder->SetCustomAttribute( - new Emit::CustomAttributeBuilder( - __typeof (AssemblyDescriptionAttribute)->GetConstructor( + gcnew Emit::CustomAttributeBuilder( + (AssemblyDescriptionAttribute::typeid)->GetConstructor( params ), args ) ); } if (company.getLength() != 0) { - ::System::Type * params __gc [] = new ::System::Type * __gc [ 1 ]; - ::System::Object * args __gc [] = new ::System::Object * __gc [ 1 ]; - params[ 0 ] = __typeof (::System::String); + array< ::System::Type^>^ params = gcnew array< ::System::Type^>(1); + array< ::System::Object^>^ args = gcnew array< ::System::Object^>(1); + params[ 0 ] = ::System::String::typeid; args[ 0 ] = ustring_to_String( company ); assembly_builder->SetCustomAttribute( - new Emit::CustomAttributeBuilder( - __typeof (AssemblyCompanyAttribute)->GetConstructor( + gcnew Emit::CustomAttributeBuilder( + (AssemblyCompanyAttribute::typeid)->GetConstructor( params ), args ) ); } if (copyright.getLength() != 0) { - ::System::Type * params __gc [] = new ::System::Type * __gc [ 1 ]; - ::System::Object * args __gc [] = new ::System::Object * __gc [ 1 ]; - params[ 0 ] = __typeof (::System::String); + array< ::System::Type^>^ params = gcnew array< ::System::Type^>(1); + array< ::System::Object^>^ args = gcnew array< ::System::Object^>(1); + params[ 0 ] = ::System::String::typeid; args[ 0 ] = ustring_to_String( copyright ); assembly_builder->SetCustomAttribute( - new Emit::CustomAttributeBuilder( - __typeof (AssemblyCopyrightAttribute)->GetConstructor( + gcnew Emit::CustomAttributeBuilder( + (AssemblyCopyrightAttribute::typeid)->GetConstructor( params ), args ) ); } if (trademark.getLength() != 0) { - ::System::Type * params __gc [] = new ::System::Type * __gc [ 1 ]; - ::System::Object * args __gc [] = new ::System::Object * __gc [ 1 ]; - params[ 0 ] = __typeof (::System::String); + array< ::System::Type^>^ params = gcnew array< ::System::Type^>(1); + array< ::System::Object^>^ args = gcnew array< ::System::Object^>(1); + params[ 0 ] = ::System::String::typeid; args[ 0 ] = ustring_to_String( trademark ); assembly_builder->SetCustomAttribute( - new Emit::CustomAttributeBuilder( - __typeof (AssemblyTrademarkAttribute)->GetConstructor( + gcnew Emit::CustomAttributeBuilder( + (AssemblyTrademarkAttribute::typeid)->GetConstructor( params ), args ) ); } // load extra assemblies - Assembly * assemblies __gc [] = - new Assembly * __gc [ extra_assemblies.size() ]; + array<Assembly^>^ assemblies = + gcnew array<Assembly^>(extra_assemblies.size()); for ( size_t pos = 0; pos < extra_assemblies.size(); ++pos ) { assemblies[ pos ] = Assembly::LoadFrom( @@ -643,13 +643,13 @@ SAL_IMPLEMENT_MAIN() } // type emitter - TypeEmitter * type_emitter = new TypeEmitter( + TypeEmitter ^ type_emitter = gcnew TypeEmitter( assembly_builder->DefineDynamicModule( output_file ), assemblies ); // add handler resolving assembly's types - ::System::ResolveEventHandler * type_resolver = - new ::System::ResolveEventHandler( + ::System::ResolveEventHandler ^ type_resolver = + gcnew ::System::ResolveEventHandler( type_emitter, &TypeEmitter::type_resolve ); - current_appdomain->add_TypeResolve( type_resolver ); + current_appdomain->TypeResolve += type_resolver; // and emit types to it if (explicit_types.empty()) @@ -678,23 +678,23 @@ SAL_IMPLEMENT_MAIN() UNO_QUERY_THROW ) ); } } - type_emitter->Dispose(); + type_emitter->~TypeEmitter(); if (g_verbose) { ::System::Console::Write( - S"> saving assembly {0}{1}{2}...", + "> saving assembly {0}{1}{2}...", output_dir, - new ::System::String( + gcnew ::System::String( ::System::IO::Path::DirectorySeparatorChar, 1 ), output_file ); } assembly_builder->Save( output_file ); if (g_verbose) { - ::System::Console::WriteLine( S"ok." ); + ::System::Console::WriteLine( "ok." ); } - current_appdomain->remove_TypeResolve( type_resolver ); + current_appdomain->TypeResolve -= type_resolver; } catch (Exception & exc) { @@ -704,7 +704,7 @@ SAL_IMPLEMENT_MAIN() stderr, "\n> error: %s\n> dying abnormally...\n", msg.getStr() ); ret = 1; } - catch (::System::Exception * exc) + catch (::System::Exception ^ exc) { OString msg( OUStringToOString( String_to_ustring( exc->ToString() ), diff --git a/cli_ure/source/climaker/climaker_emit.cxx b/cli_ure/source/climaker/climaker_emit.cxx index cdc4035fe28b..db1e6abbf98e 100644..100755 --- a/cli_ure/source/climaker/climaker_emit.cxx +++ b/cli_ure/source/climaker/climaker_emit.cxx @@ -37,9 +37,9 @@ using namespace ::com::sun::star::uno; namespace climaker { -System::String* mapUnoPolymorphicName(System::String* unoName); +System::String^ mapUnoPolymorphicName(System::String^ unoName); //------------------------------------------------------------------------------ -static inline ::System::String * to_cts_name( +static inline ::System::String ^ to_cts_name( OUString const & uno_name ) { OUStringBuffer buf( 7 + uno_name.getLength() ); @@ -49,54 +49,43 @@ static inline ::System::String * to_cts_name( } //------------------------------------------------------------------------------ -static inline ::System::Object * to_cli_constant( Any const & value ) +static inline ::System::Object ^ to_cli_constant( Any const & value ) { switch (value.getValueTypeClass()) { case TypeClass_CHAR: - return __box - ((::System::Char) *reinterpret_cast< sal_Unicode const * >( + return ((::System::Char) *reinterpret_cast< sal_Unicode const * >( value.getValue() )); case TypeClass_BOOLEAN: - return __box - ((::System::Boolean) + return ((::System::Boolean) sal_False != *reinterpret_cast< sal_Bool const * >( value.getValue() )); case TypeClass_BYTE: - return __box - ((::System::Byte) *reinterpret_cast< sal_Int8 const * >( + return ((::System::Byte) *reinterpret_cast< sal_Int8 const * >( value.getValue() )); case TypeClass_SHORT: - return __box - ((::System::Int16) *reinterpret_cast< sal_Int16 const * >( + return ((::System::Int16) *reinterpret_cast< sal_Int16 const * >( value.getValue() )); case TypeClass_UNSIGNED_SHORT: - return __box - ((::System::UInt16) *reinterpret_cast< sal_uInt16 const * >( + return ((::System::UInt16) *reinterpret_cast< sal_uInt16 const * >( value.getValue() )); case TypeClass_LONG: - return __box - ((::System::Int32) *reinterpret_cast< sal_Int32 const * >( + return ((::System::Int32) *reinterpret_cast< sal_Int32 const * >( value.getValue() )); case TypeClass_UNSIGNED_LONG: - return __box - ((::System::UInt32) *reinterpret_cast< sal_uInt32 const * >( + return ((::System::UInt32) *reinterpret_cast< sal_uInt32 const * >( value.getValue() )); case TypeClass_HYPER: - return __box - ((::System::Int64) *reinterpret_cast< sal_Int64 const * >( + return ((::System::Int64) *reinterpret_cast< sal_Int64 const * >( value.getValue() )); case TypeClass_UNSIGNED_HYPER: - return __box - ((::System::UInt64) *reinterpret_cast< sal_uInt64 const * >( + return ((::System::UInt64) *reinterpret_cast< sal_uInt64 const * >( value.getValue() )); case TypeClass_FLOAT: - return __box - ((::System::Single) *reinterpret_cast< float const * >( + return ((::System::Single) *reinterpret_cast< float const * >( value.getValue() )); case TypeClass_DOUBLE: - return __box - ((::System::Double) *reinterpret_cast< double const * >( + return ((::System::Double) *reinterpret_cast< double const * >( value.getValue() )); default: throw RuntimeException( @@ -107,7 +96,7 @@ static inline ::System::Object * to_cli_constant( Any const & value ) } //------------------------------------------------------------------------------ -static inline void emit_ldarg( Emit::ILGenerator * code, ::System::Int32 index ) +static inline void emit_ldarg( Emit::ILGenerator ^ code, ::System::Int32 index ) { switch (index) { @@ -134,9 +123,9 @@ static inline void emit_ldarg( Emit::ILGenerator * code, ::System::Int32 index ) } } -void polymorphicStructNameToStructName(::System::String ** sPolyName) +void polymorphicStructNameToStructName(::System::String ^* sPolyName) { - if ((*sPolyName)->EndsWith(S">") == false) + if ((*sPolyName)->EndsWith(">") == false) return; int index = (*sPolyName)->IndexOf('<'); @@ -145,67 +134,67 @@ void polymorphicStructNameToStructName(::System::String ** sPolyName) } -System::String* mapUnoTypeName(System::String * typeName) +System::String^ mapUnoTypeName(System::String ^ typeName) { - ::System::Text::StringBuilder* buf= new System::Text::StringBuilder(); - ::System::String * sUnoName = ::System::String::Copy(typeName); + ::System::Text::StringBuilder^ buf= gcnew System::Text::StringBuilder(); + ::System::String ^ sUnoName = ::System::String::Copy(typeName); //determine if the type is a sequence and its dimensions int dims= 0; - if (typeName->StartsWith(S"["))//if (usUnoName[0] == '[') + if (typeName->StartsWith("["))//if (usUnoName[0] == '[') { int index= 1; while (true) { - if (typeName->get_Chars(index++) == ']')//if (usUnoName[index++] == ']') + if (typeName[index++] == ']')//if (usUnoName[index++] == ']') dims++; - if (typeName->get_Chars(index++) != '[')//usUnoName[index++] != '[') + if (typeName[index++] != '[')//usUnoName[index++] != '[') break; } sUnoName = sUnoName->Substring(index - 1);//usUnoName = usUnoName.copy(index - 1); } - if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoBool))) - buf->Append(const_cast<System::String*>(Constants::sBoolean)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoChar))) - buf->Append(const_cast<System::String*>(Constants::sChar)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoByte))) - buf->Append(const_cast<System::String*>(Constants::sByte)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoShort))) - buf->Append(const_cast<System::String*>(Constants::sInt16)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoUShort))) - buf->Append(const_cast<System::String*>(Constants::sUInt16)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoLong))) - buf->Append(const_cast<System::String*>(Constants::sInt32)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoULong))) - buf->Append(const_cast<System::String*>(Constants::sUInt32)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoHyper))) - buf->Append(const_cast<System::String*>(Constants::sInt64)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoUHyper))) - buf->Append(const_cast<System::String*>(Constants::sUInt64)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoFloat))) - buf->Append(const_cast<System::String*>(Constants::sSingle)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoDouble))) - buf->Append(const_cast<System::String*>(Constants::sDouble)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoString))) - buf->Append(const_cast<System::String*>(Constants::sString)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoVoid))) - buf->Append(const_cast<System::String*>(Constants::sVoid)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoType))) - buf->Append(const_cast<System::String*>(Constants::sType)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoXInterface))) - buf->Append(const_cast<System::String*>(Constants::sObject)); - else if (sUnoName->Equals(const_cast<System::String*>(Constants::sUnoAny))) + if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoBool))) + buf->Append(const_cast<System::String^>(Constants::sBoolean)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoChar))) + buf->Append(const_cast<System::String^>(Constants::sChar)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoByte))) + buf->Append(const_cast<System::String^>(Constants::sByte)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoShort))) + buf->Append(const_cast<System::String^>(Constants::sInt16)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoUShort))) + buf->Append(const_cast<System::String^>(Constants::sUInt16)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoLong))) + buf->Append(const_cast<System::String^>(Constants::sInt32)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoULong))) + buf->Append(const_cast<System::String^>(Constants::sUInt32)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoHyper))) + buf->Append(const_cast<System::String^>(Constants::sInt64)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoUHyper))) + buf->Append(const_cast<System::String^>(Constants::sUInt64)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoFloat))) + buf->Append(const_cast<System::String^>(Constants::sSingle)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoDouble))) + buf->Append(const_cast<System::String^>(Constants::sDouble)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoString))) + buf->Append(const_cast<System::String^>(Constants::sString)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoVoid))) + buf->Append(const_cast<System::String^>(Constants::sVoid)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoType))) + buf->Append(const_cast<System::String^>(Constants::sType)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoXInterface))) + buf->Append(const_cast<System::String^>(Constants::sObject)); + else if (sUnoName->Equals(const_cast<System::String^>(Constants::sUnoAny))) { - 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)); buf->Append(mapUnoPolymorphicName(sUnoName)); } // apend [] for (;dims--;) - buf->Append(const_cast<System::String*>(Constants::sBrackets)); + buf->Append(const_cast<System::String^>(Constants::sBrackets)); return buf->ToString(); } @@ -220,14 +209,14 @@ System::String* mapUnoTypeName(System::String * typeName) Strings can be as complicated as this test.MyStruct<char,test.MyStruct<long, []string>> */ -System::String* mapUnoPolymorphicName(System::String* unoName) +System::String^ mapUnoPolymorphicName(System::String^ unoName) { int index = unoName->IndexOf('<'); if (index == -1) return unoName; - System::Text::StringBuilder * builder = - new System::Text::StringBuilder(unoName->Substring(0, index +1 )); + System::Text::StringBuilder ^ builder = + gcnew System::Text::StringBuilder(unoName->Substring(0, index +1 )); //Find the first occurrence of ',' //If the parameter is a polymorphic struct then we neede to ignore everything @@ -239,14 +228,14 @@ System::String* mapUnoPolymorphicName(System::String* unoName) 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 @@ -260,7 +249,7 @@ System::String* mapUnoPolymorphicName(System::String* unoName) int numNested = 0; for (;;cur++) { - System::Char curChar = unoName->Chars[cur]; + System::Char curChar = unoName[cur]; if (curChar == '<') { numNested ++; @@ -284,48 +273,48 @@ System::String* mapUnoPolymorphicName(System::String* unoName) //______________________________________________________________________________ -Assembly * TypeEmitter::type_resolve( - ::System::Object *, ::System::ResolveEventArgs * args ) +Assembly ^ TypeEmitter::type_resolve( + ::System::Object ^, ::System::ResolveEventArgs ^ args ) { - ::System::String * cts_name = args->get_Name(); - ::System::Type * ret_type = m_module_builder->GetType( + ::System::String ^ cts_name = args->Name; + ::System::Type ^ ret_type = m_module_builder->GetType( cts_name, false /* no exc */ ); - if (0 == ret_type) + if (nullptr == ret_type) { - iface_entry * entry = dynamic_cast< iface_entry * >( - m_incomplete_ifaces->get_Item( cts_name ) ); - if (0 != entry) + iface_entry ^ entry = dynamic_cast< iface_entry ^ >( + m_incomplete_ifaces[cts_name] ); + if (nullptr != entry) ret_type = entry->m_type_builder; } - if (0 == ret_type) + if (nullptr == ret_type) { - sal_Int32 len = m_extra_assemblies->get_Length(); + sal_Int32 len = m_extra_assemblies->Length; for ( sal_Int32 pos = 0; pos < len; ++pos ) { ret_type = m_extra_assemblies[ pos ]->GetType( cts_name, false /* no exc */ ); - if (0 != ret_type) + if (nullptr != ret_type) { if (g_verbose) { ::System::Console::WriteLine( "> resolving type {0} from {1}.", - cts_name, ret_type->get_Assembly()->get_FullName() ); + cts_name, ret_type->Assembly->FullName ); } break; } } } - if (0 != ret_type) - return ret_type->get_Assembly(); - return 0; + if (nullptr != ret_type) + return ret_type->Assembly; + return nullptr; } //______________________________________________________________________________ -::System::Type * TypeEmitter::get_type( - ::System::String * cts_name, bool throw_exc ) +::System::Type ^ TypeEmitter::get_type( + ::System::String ^ cts_name, bool throw_exc ) { - ::System::Type * ret_type = m_module_builder->GetType( cts_name, false ); + ::System::Type ^ ret_type = m_module_builder->GetType( cts_name, false ); //We get the type from the ModuleBuilder even if the type is not complete //but have been defined. //if (ret_type == 0) @@ -336,31 +325,31 @@ Assembly * TypeEmitter::type_resolve( // ret_type = entry->m_type_builder; //} //try the cli_basetypes assembly - if (ret_type == 0) + if (ret_type == nullptr) { - ::System::Text::StringBuilder * builder = new ::System::Text::StringBuilder(cts_name); - builder->Append(S",cli_basetypes"); + ::System::Text::StringBuilder ^ builder = gcnew ::System::Text::StringBuilder(cts_name); + builder->Append(",cli_basetypes"); ret_type = ::System::Type::GetType(builder->ToString()); } - if (ret_type == 0) + if (ret_type == nullptr) { try { // may call on type_resolve() return ::System::Type::GetType( cts_name, throw_exc ); } - catch (::System::Exception* exc) + catch (::System::Exception^ exc) { //If the type is not found one may have forgotten to specify assemblies with //additional types - ::System::Text::StringBuilder * sb = new ::System::Text::StringBuilder(); - sb->Append(new ::System::String(S"\nThe type ")); + ::System::Text::StringBuilder ^ sb = gcnew ::System::Text::StringBuilder(); + sb->Append(gcnew ::System::String("\nThe type ")); sb->Append(cts_name); - sb->Append(new ::System::String(S" \n could not be found. Did you forget to " \ - S"specify an additional assembly with the --reference option?\n")); + sb->Append(gcnew ::System::String(" \n could not be found. Did you forget to " \ + "specify an additional assembly with the --reference option?\n")); if (throw_exc) - throw new ::System::Exception(sb->ToString(), exc); + throw gcnew ::System::Exception(sb->ToString(), exc); } } else @@ -370,48 +359,48 @@ Assembly * TypeEmitter::type_resolve( } //______________________________________________________________________________ -::System::Type * TypeEmitter::get_type_Exception() +::System::Type ^ TypeEmitter::get_type_Exception() { - if (0 == m_type_Exception) + if (nullptr == m_type_Exception) { m_type_Exception = get_type( - S"unoidl.com.sun.star.uno.Exception", false /* no exc */ ); - if (0 == m_type_Exception) + "unoidl.com.sun.star.uno.Exception", false /* no exc */ ); + if (nullptr == m_type_Exception) { // define hardcoded type unoidl.com.sun.star.uno.Exception - Emit::TypeBuilder * type_builder = + Emit::TypeBuilder ^ type_builder = m_module_builder->DefineType( - S"unoidl.com.sun.star.uno.Exception", + "unoidl.com.sun.star.uno.Exception", (TypeAttributes) (TypeAttributes::Public | TypeAttributes::BeforeFieldInit | TypeAttributes::AnsiClass), - __typeof (::System::Exception) ); - Emit::FieldBuilder * field_Context = type_builder->DefineField( - S"Context", __typeof (::System::Object), + (::System::Exception::typeid) ); + Emit::FieldBuilder ^ field_Context = type_builder->DefineField( + "Context", (::System::Object::typeid), FieldAttributes::Public ); // default .ctor type_builder->DefineDefaultConstructor( c_ctor_method_attr ); // .ctor - ::System::Type * param_types[] = - new ::System::Type *[ 2 ]; - param_types[ 0 ] = __typeof (::System::String); - param_types[ 1 ] = __typeof (::System::Object); - Emit::ConstructorBuilder * ctor_builder = + array< ::System::Type^>^ param_types = + gcnew array< ::System::Type^>(2); + param_types[ 0 ] = ::System::String::typeid; + param_types[ 1 ] = ::System::Object::typeid; + Emit::ConstructorBuilder ^ ctor_builder = type_builder->DefineConstructor( c_ctor_method_attr, CallingConventions::Standard, param_types ); ctor_builder->DefineParameter( - 1, ParameterAttributes::In, S"Message" ); + 1, ParameterAttributes::In, "Message" ); ctor_builder->DefineParameter( - 2, ParameterAttributes::In, S"Context" ); - Emit::ILGenerator * code = ctor_builder->GetILGenerator(); + 2, ParameterAttributes::In, "Context" ); + Emit::ILGenerator ^ code = ctor_builder->GetILGenerator(); code->Emit( Emit::OpCodes::Ldarg_0 ); code->Emit( Emit::OpCodes::Ldarg_1 ); - param_types = new ::System::Type * [ 1 ]; - param_types[ 0 ] = __typeof (::System::String); + param_types = gcnew array< ::System::Type^>(1); + param_types[ 0 ] = ::System::String::typeid; code->Emit( Emit::OpCodes::Call, - __typeof (::System::Exception) + (::System::Exception::typeid) ->GetConstructor( param_types ) ); code->Emit( Emit::OpCodes::Ldarg_0 ); code->Emit( Emit::OpCodes::Ldarg_2 ); @@ -431,19 +420,19 @@ Assembly * TypeEmitter::type_resolve( } //______________________________________________________________________________ -::System::Type * TypeEmitter::get_type_RuntimeException() +::System::Type ^ TypeEmitter::get_type_RuntimeException() { - if (0 == m_type_RuntimeException) + if (nullptr == m_type_RuntimeException) { m_type_RuntimeException = get_type( - S"unoidl.com.sun.star.uno.RuntimeException", false /* no exc */ ); - if (0 == m_type_RuntimeException) + "unoidl.com.sun.star.uno.RuntimeException", false /* no exc */ ); + if (nullptr == m_type_RuntimeException) { // define hardcoded type unoidl.com.sun.star.uno.RuntimeException - ::System::Type * type_Exception = get_type_Exception(); - Emit::TypeBuilder * type_builder = + ::System::Type ^ type_Exception = get_type_Exception(); + Emit::TypeBuilder ^ type_builder = m_module_builder->DefineType( - S"unoidl.com.sun.star.uno.RuntimeException", + "unoidl.com.sun.star.uno.RuntimeException", (TypeAttributes) (TypeAttributes::Public | TypeAttributes::BeforeFieldInit | TypeAttributes::AnsiClass), @@ -451,19 +440,19 @@ Assembly * TypeEmitter::type_resolve( // default .ctor type_builder->DefineDefaultConstructor( c_ctor_method_attr ); // .ctor - ::System::Type * param_types [] = - new ::System::Type * [ 2 ]; - param_types[ 0 ] = __typeof (::System::String); - param_types[ 1 ] = __typeof (::System::Object); - Emit::ConstructorBuilder * ctor_builder = + array< ::System::Type^>^ param_types = + gcnew array< ::System::Type^>(2); + param_types[ 0 ] = ::System::String::typeid; + param_types[ 1 ] = ::System::Object::typeid; + Emit::ConstructorBuilder ^ ctor_builder = type_builder->DefineConstructor( c_ctor_method_attr, CallingConventions::Standard, param_types ); ctor_builder->DefineParameter( - 1, ParameterAttributes::In, S"Message" ); + 1, ParameterAttributes::In, "Message" ); ctor_builder->DefineParameter( - 2, ParameterAttributes::In, S"Context" ); - Emit::ILGenerator * code = ctor_builder->GetILGenerator(); + 2, ParameterAttributes::In, "Context" ); + Emit::ILGenerator ^ code = ctor_builder->GetILGenerator(); code->Emit( Emit::OpCodes::Ldarg_0 ); code->Emit( Emit::OpCodes::Ldarg_1 ); code->Emit( Emit::OpCodes::Ldarg_2 ); @@ -485,18 +474,18 @@ Assembly * TypeEmitter::type_resolve( } //______________________________________________________________________________ -::System::Type * TypeEmitter::get_type( +::System::Type ^ TypeEmitter::get_type( Reference< reflection::XConstantTypeDescription > const & xType ) { - ::System::String * cts_name = to_cts_name( xType->getName() ); - ::System::Type * ret_type = get_type( cts_name, false /* no exc */ ); - if (0 == ret_type) + ::System::String ^ cts_name = to_cts_name( xType->getName() ); + ::System::Type ^ ret_type = get_type( cts_name, false /* no exc */ ); + if (nullptr == ret_type) { Reference< reflection::XConstantTypeDescription > xConstant( xType, UNO_QUERY_THROW ); - ::System::Object * constant = + ::System::Object ^ constant = to_cli_constant( xConstant->getConstantValue() ); - Emit::TypeBuilder * type_builder = + Emit::TypeBuilder ^ type_builder = m_module_builder->DefineType( cts_name, (TypeAttributes) (TypeAttributes::Public | @@ -504,7 +493,7 @@ Assembly * TypeEmitter::type_resolve( TypeAttributes::BeforeFieldInit | TypeAttributes::AnsiClass) ); - Emit::FieldBuilder * field_builder = type_builder->DefineField( + Emit::FieldBuilder ^ field_builder = type_builder->DefineField( cts_name->Substring( cts_name->LastIndexOf( '.' ) +1 ), constant->GetType(), (FieldAttributes) (FieldAttributes::Public | @@ -523,14 +512,14 @@ Assembly * TypeEmitter::type_resolve( } //______________________________________________________________________________ -::System::Type * TypeEmitter::get_type( +::System::Type ^ TypeEmitter::get_type( Reference< reflection::XConstantsTypeDescription > const & xType ) { - ::System::String * cts_name = to_cts_name( xType->getName() ); - ::System::Type * ret_type = get_type( cts_name, false /* no exc */ ); - if (0 == ret_type) + ::System::String ^ cts_name = to_cts_name( xType->getName() ); + ::System::Type ^ ret_type = get_type( cts_name, false /* no exc */ ); + if (nullptr == ret_type) { - Emit::TypeBuilder * type_builder = + Emit::TypeBuilder ^ type_builder = m_module_builder->DefineType( cts_name, (TypeAttributes) (TypeAttributes::Public | @@ -550,11 +539,11 @@ Assembly * TypeEmitter::type_resolve( Reference< reflection::XConstantTypeDescription > const & xConstant = constants[ constants_pos ]; - ::System::Object * constant = + ::System::Object ^ constant = to_cli_constant( xConstant->getConstantValue() ); - ::System::String * uno_name = + ::System::String ^ uno_name = ustring_to_String( xConstant->getName() ); - Emit::FieldBuilder * field_builder = type_builder->DefineField( + Emit::FieldBuilder ^ field_builder = type_builder->DefineField( uno_name->Substring( uno_name->LastIndexOf( '.' ) +1 ), constant->GetType(), (FieldAttributes) (FieldAttributes::Public | @@ -574,12 +563,12 @@ Assembly * TypeEmitter::type_resolve( } //______________________________________________________________________________ -::System::Type * TypeEmitter::get_type( +::System::Type ^ TypeEmitter::get_type( Reference< reflection::XEnumTypeDescription > const & xType ) { - ::System::String * cts_name = to_cts_name( xType->getName() ); - ::System::Type * ret_type = get_type( cts_name, false /* no exc */ ); - if (0 == ret_type) + ::System::String ^ cts_name = to_cts_name( xType->getName() ); + ::System::Type ^ ret_type = get_type( cts_name, false /* no exc */ ); + if (nullptr == ret_type) { // Emit::EnumBuilder * enum_builder = // m_module_builder->DefineEnum( @@ -589,14 +578,14 @@ Assembly * TypeEmitter::type_resolve( // TypeAttributes::AnsiClass), // __typeof (::System::Int32) ); // workaround enum builder bug - Emit::TypeBuilder * enum_builder = + Emit::TypeBuilder ^ enum_builder = m_module_builder->DefineType( cts_name, (TypeAttributes) (TypeAttributes::Public | TypeAttributes::Sealed), - __typeof (::System::Enum) ); + ::System::Enum::typeid ); enum_builder->DefineField( - S"value__", __typeof (::System::Int32), + "value__", ::System::Int32::typeid, (FieldAttributes) (FieldAttributes::Private | FieldAttributes::SpecialName | FieldAttributes::RTSpecialName) ); @@ -611,7 +600,7 @@ Assembly * TypeEmitter::type_resolve( // enum_builder->DefineLiteral( // ustring_to_String( enum_names[ enum_pos ] ), // __box ((::System::Int32) enum_values[ enum_pos ]) ); - Emit::FieldBuilder * field_builder = + Emit::FieldBuilder ^ field_builder = enum_builder->DefineField( ustring_to_String( enum_names[ enum_pos ] ), enum_builder, @@ -619,7 +608,7 @@ Assembly * TypeEmitter::type_resolve( FieldAttributes::Static | FieldAttributes::Literal) ); field_builder->SetConstant( - __box ((::System::Int32) enum_values[ enum_pos ]) ); + ((::System::Int32) enum_values[ enum_pos ]) ); } if (g_verbose) @@ -633,7 +622,7 @@ Assembly * TypeEmitter::type_resolve( } //______________________________________________________________________________ -::System::Type * TypeEmitter::get_type( +::System::Type ^ TypeEmitter::get_type( Reference< reflection::XCompoundTypeDescription > const & xType ) { OUString uno_name( xType->getName() ); @@ -648,22 +637,22 @@ Assembly * TypeEmitter::type_resolve( return get_type_RuntimeException(); } } - ::System::String * cts_name = to_cts_name( uno_name ); + ::System::String ^ cts_name = to_cts_name( uno_name ); // if the struct is an instantiated polymorpic struct then we create the simple struct name // For example: // void func ([in] PolyStruct<boolean> arg); //PolyStruct<boolean> will be converted to PolyStruct polymorphicStructNameToStructName( & cts_name); - ::System::Type * ret_type = get_type( cts_name, false /* no exc */ ); - if (0 == ret_type) + ::System::Type ^ ret_type = get_type( cts_name, false /* no exc */ ); + if (nullptr == ret_type) { Reference< reflection::XCompoundTypeDescription > xBaseType( xType->getBaseType(), UNO_QUERY ); - ::System::Type * base_type = (xBaseType.is() + ::System::Type ^ base_type = (xBaseType.is() ? get_type( xBaseType ) - : __typeof (::System::Object)); - Emit::TypeBuilder * type_builder = + : ::System::Object::typeid); + Emit::TypeBuilder ^ type_builder = m_module_builder->DefineType( cts_name, (TypeAttributes) (TypeAttributes::Public | @@ -673,7 +662,7 @@ Assembly * TypeEmitter::type_resolve( // insert to be completed - struct_entry * entry = new struct_entry(); + struct_entry ^ entry = gcnew struct_entry(); xType->acquire(); entry->m_xType = xType.get(); entry->m_type_builder = type_builder; @@ -687,7 +676,7 @@ Assembly * TypeEmitter::type_resolve( //In case of an instantiated polymorphic struct we want to return a //uno.PolymorphicType (inherits Type) rather then Type. This is neaded for constructing //the service code. We can only do that if the struct is completed. - if (m_generated_structs->get_Item(cts_name)) + if (m_generated_structs[cts_name]) { Reference< reflection::XStructTypeDescription> xStructTypeDesc( xType, UNO_QUERY); @@ -699,7 +688,7 @@ Assembly * TypeEmitter::type_resolve( if (numTypes > 0) { //it is an instantiated polymorphic struct - ::System::String * sCliName = mapUnoTypeName(ustring_to_String(xType->getName())); + ::System::String ^ sCliName = mapUnoTypeName(ustring_to_String(xType->getName())); ret_type = ::uno::PolymorphicType::GetType(ret_type, sCliName); } } @@ -708,20 +697,20 @@ Assembly * TypeEmitter::type_resolve( } //______________________________________________________________________________ -::System::Type * TypeEmitter::get_type( +::System::Type ^ TypeEmitter::get_type( Reference< reflection::XInterfaceTypeDescription2 > const & xType ) { OUString uno_name( xType->getName() ); if ( uno_name == "com.sun.star.uno.XInterface" ) { - return __typeof (::System::Object); + return ::System::Object::typeid; } - ::System::String * cts_name = to_cts_name( xType->getName() ); - ::System::Type * ret_type = get_type( cts_name, false /* no exc */ ); - if (0 == ret_type) + ::System::String ^ cts_name = to_cts_name( xType->getName() ); + ::System::Type ^ ret_type = get_type( cts_name, false /* no exc */ ); + if (nullptr == ret_type) { - Emit::TypeBuilder * type_builder; + Emit::TypeBuilder ^ type_builder; TypeAttributes attr = (TypeAttributes) (TypeAttributes::Public | TypeAttributes::Interface | @@ -744,15 +733,15 @@ Assembly * TypeEmitter::type_resolve( } } - ::System::Type * base_interfaces [] = - new ::System::Type * [ vecBaseTypes.size() ]; + array< ::System::Type^>^ base_interfaces = + gcnew array< ::System::Type^>( vecBaseTypes.size() ); typedef std::vector<Reference<reflection::XInterfaceTypeDescription2> >::const_iterator it; int index = 0; for (it i = vecBaseTypes.begin(); i != vecBaseTypes.end(); ++i, ++index) base_interfaces[ index ] = get_type( *i ); type_builder = m_module_builder->DefineType( - cts_name, attr, 0, base_interfaces ); + cts_name, attr, nullptr, base_interfaces ); } else { @@ -765,7 +754,7 @@ Assembly * TypeEmitter::type_resolve( } // insert to be completed - iface_entry * entry = new iface_entry(); + iface_entry ^ entry = gcnew iface_entry(); xType->acquire(); entry->m_xType = xType.get(); entry->m_type_builder = type_builder; @@ -779,15 +768,15 @@ Assembly * TypeEmitter::type_resolve( //______________________________________________________________________________ -::System::Type * TypeEmitter::get_type( +::System::Type ^ TypeEmitter::get_type( Reference< reflection::XServiceTypeDescription2 > const & xType ) { if (xType->isSingleInterfaceBased() == sal_False) - return NULL; + return nullptr; - System::String * cts_name = to_cts_name( xType->getName() ); - System::Type * ret_type = get_type( cts_name, false /* no exc */ ); - if (ret_type != NULL) + System::String ^ cts_name = to_cts_name( xType->getName() ); + System::Type ^ ret_type = get_type( cts_name, false /* no exc */ ); + if (ret_type != nullptr) return ret_type; TypeAttributes attr = (TypeAttributes) (TypeAttributes::Public | @@ -795,11 +784,11 @@ Assembly * TypeEmitter::type_resolve( TypeAttributes::BeforeFieldInit | TypeAttributes::AnsiClass); - Emit::TypeBuilder * type_builder = m_module_builder->DefineType( + Emit::TypeBuilder ^ type_builder = m_module_builder->DefineType( cts_name, attr); // insert to be completed - service_entry * entry = new service_entry(); + service_entry ^ entry = gcnew service_entry(); xType->acquire(); entry->m_xType = xType.get(); entry->m_type_builder = type_builder; @@ -808,15 +797,15 @@ Assembly * TypeEmitter::type_resolve( return type_builder; } -::System::Type * TypeEmitter::get_type( +::System::Type ^ TypeEmitter::get_type( Reference<reflection::XSingletonTypeDescription2 > const & xType ) { if (xType->isInterfaceBased() == sal_False) - return NULL; + return nullptr; - ::System::String* cts_name = to_cts_name( xType->getName() ); - ::System::Type * ret_type = get_type( cts_name, false /* no exc */ ); - if (ret_type != NULL) + ::System::String^ cts_name = to_cts_name( xType->getName() ); + ::System::Type ^ ret_type = get_type( cts_name, false /* no exc */ ); + if (ret_type != nullptr) return ret_type; TypeAttributes attr = static_cast<TypeAttributes>( @@ -825,11 +814,11 @@ Assembly * TypeEmitter::type_resolve( TypeAttributes::BeforeFieldInit | TypeAttributes::AnsiClass); - Emit::TypeBuilder * type_builder = m_module_builder->DefineType( + Emit::TypeBuilder ^ type_builder = m_module_builder->DefineType( cts_name, attr); // insert to be completed - singleton_entry * entry = new singleton_entry(); + singleton_entry ^ entry = gcnew singleton_entry(); xType->acquire(); entry->m_xType = xType.get(); entry->m_type_builder = type_builder; @@ -840,9 +829,9 @@ Assembly * TypeEmitter::type_resolve( } //______________________________________________________________________________ -::System::Type * TypeEmitter::complete_iface_type( iface_entry * entry ) +::System::Type ^ TypeEmitter::complete_iface_type( iface_entry ^ entry ) { - Emit::TypeBuilder * type_builder = entry->m_type_builder; + Emit::TypeBuilder ^ type_builder = entry->m_type_builder; reflection::XInterfaceTypeDescription2 * xType = entry->m_xType; Sequence<Reference< reflection::XTypeDescription > > seqBaseTypes( xType->getBaseTypes() ); @@ -856,10 +845,10 @@ Assembly * TypeEmitter::type_resolve( if ( aBaseType->getName() != "com.sun.star.uno.XInterface" ) { - ::System::String * basetype_name = to_cts_name( aBaseType->getName() ); - iface_entry * base_entry = dynamic_cast< iface_entry * >( - m_incomplete_ifaces->get_Item( basetype_name ) ); - if (0 != base_entry) + ::System::String ^ basetype_name = to_cts_name( aBaseType->getName() ); + iface_entry ^ base_entry = dynamic_cast< iface_entry ^ >( + m_incomplete_ifaces[basetype_name] ); + if (nullptr != base_entry) { // complete uncompleted base type first complete_iface_type( base_entry ); @@ -881,9 +870,9 @@ Assembly * TypeEmitter::type_resolve( reflection::XInterfaceMemberTypeDescription > const & xMember = members[ members_pos ]; Sequence< Reference< reflection::XTypeDescription > > seq_exceptions; - Emit::MethodBuilder * method_builder; + Emit::MethodBuilder ^ method_builder; - const MethodAttributes c_method_attr = (MethodAttributes) + MethodAttributes c_method_attr = (MethodAttributes) (MethodAttributes::Public | MethodAttributes::Abstract | MethodAttributes::Virtual | @@ -904,8 +893,8 @@ Assembly * TypeEmitter::type_resolve( Reference< reflection::XMethodParameter > > seq_parameters( xMethod->getParameters() ); sal_Int32 params_length = seq_parameters.getLength(); - ::System::Type * param_types [] = - new ::System::Type * [ params_length ]; + array< ::System::Type^>^ param_types = + gcnew array< ::System::Type^>( params_length ); Reference< reflection::XMethodParameter > const * parameters = seq_parameters.getConstArray(); // first determine all types @@ -915,13 +904,13 @@ Assembly * TypeEmitter::type_resolve( { Reference< reflection::XMethodParameter > const & xParam = parameters[ params_pos ]; - ::System::Type * param_type = get_type( xParam->getType() ); - ::System::String * param_type_name = param_type->get_FullName(); + ::System::Type ^ param_type = get_type( xParam->getType() ); + ::System::String ^ param_type_name = param_type->FullName; if (xParam->isOut()) { param_type = get_type( ::System::String::Concat( - param_type_name, S"&" ), true ); + param_type_name, "&" ), true ); } param_types[ xParam->getPosition() ] = param_type; } @@ -946,9 +935,9 @@ Assembly * TypeEmitter::type_resolve( parameters[ params_pos ]; long param_flags = 0; if (xParam->isIn()) - param_flags |= ParameterAttributes::In; + param_flags |= (long)ParameterAttributes::In; if (xParam->isOut()) - param_flags |= ParameterAttributes::Out; + param_flags |= (long)ParameterAttributes::Out; OSL_ASSERT( 0 != param_flags ); method_builder->DefineParameter( xParam->getPosition() +1 /* starts with 1 */, @@ -967,19 +956,19 @@ Assembly * TypeEmitter::type_resolve( if (seq_type_args.getLength() != 0) { //get th ctor of the attribute - ::System::Type * arCtor[] = {::System::Type::GetType(S"System.Type[]")}; + array< ::System::Type^>^ arCtor = {::System::Type::GetType("System.Type[]")}; //Get the arguments for the attribute's ctor Reference<reflection::XTypeDescription> const * arXTypeArgs = seq_type_args.getConstArray(); int numTypes = seq_type_args.getLength(); - ::System::Type * arCtsTypes[] = new ::System::Type*[numTypes]; + array< ::System::Type^>^ arCtsTypes = gcnew array< ::System::Type^>(numTypes); for (int i = 0; i < numTypes; i++) arCtsTypes[i] = get_type(arXTypeArgs[i]); - ::System::Object * arArgs[] = {arCtsTypes}; + array< ::System::Object^>^ arArgs = {arCtsTypes}; - Emit::CustomAttributeBuilder * attrBuilder = - new Emit::CustomAttributeBuilder( - __typeof(::uno::TypeArgumentsAttribute) + Emit::CustomAttributeBuilder ^ attrBuilder = + gcnew Emit::CustomAttributeBuilder( + ::uno::TypeArgumentsAttribute::typeid ->GetConstructor( arCtor), arArgs); @@ -988,19 +977,19 @@ Assembly * TypeEmitter::type_resolve( } //define UNO exception attribute (exceptions)-------------------------------------- - Emit::CustomAttributeBuilder* attrBuilder = + Emit::CustomAttributeBuilder^ attrBuilder = get_iface_method_exception_attribute(xMethod); - if (attrBuilder != NULL) + if (attrBuilder != nullptr) method_builder->SetCustomAttribute(attrBuilder); // oneway attribute if (xMethod->isOneway()) { - ::System::Type * arCtorOneway[] = new ::System::Type*[0]; - ::System::Object * arArgs[] = new ::System::Object*[0]; - Emit::CustomAttributeBuilder * attrBuilder = - new Emit::CustomAttributeBuilder( - __typeof(::uno::OnewayAttribute)->GetConstructor( arCtorOneway), + array< ::System::Type^>^ arCtorOneway = gcnew array< ::System::Type^>(0); + array< ::System::Object^>^ arArgs = gcnew array< ::System::Object^>(0); + Emit::CustomAttributeBuilder ^ attrBuilder = + gcnew Emit::CustomAttributeBuilder( + ::uno::OnewayAttribute::typeid->GetConstructor( arCtorOneway), arArgs); method_builder->SetCustomAttribute(attrBuilder); } @@ -1013,14 +1002,14 @@ Assembly * TypeEmitter::type_resolve( reflection::XInterfaceAttributeTypeDescription2 > xAttribute( xMember, UNO_QUERY_THROW ); - const MethodAttributes c_property_method_attr = (MethodAttributes) + MethodAttributes c_property_method_attr = (MethodAttributes) (c_method_attr | MethodAttributes::SpecialName); - ::System::Type * attribute_type = get_type( xAttribute->getType() ); - ::System::Type * parameters [] = - new ::System::Type * [ 0 ]; + ::System::Type ^ attribute_type = get_type( xAttribute->getType() ); + array< ::System::Type^>^ parameters = + gcnew array< ::System::Type^> ( 0 ); - Emit::PropertyBuilder * property_builder = + Emit::PropertyBuilder ^ property_builder = type_builder->DefineProperty( ustring_to_String( xAttribute->getMemberName() ), PropertyAttributes::None, @@ -1029,26 +1018,26 @@ Assembly * TypeEmitter::type_resolve( //set BoundAttribute, if necessary if (xAttribute->isBound()) { - ConstructorInfo * ctorBoundAttr = - __typeof(::uno::BoundAttribute)->GetConstructor( - new System::Type*[0]); - Emit::CustomAttributeBuilder * attrBuilderBound = - new Emit::CustomAttributeBuilder( - ctorBoundAttr, new ::System::Object*[0]); + ConstructorInfo ^ ctorBoundAttr = + ::uno::BoundAttribute::typeid->GetConstructor( + gcnew array<System::Type^>(0)); + Emit::CustomAttributeBuilder ^ attrBuilderBound = + gcnew Emit::CustomAttributeBuilder( + ctorBoundAttr, gcnew array< ::System::Object^>(0)); property_builder->SetCustomAttribute(attrBuilderBound); } // getter - Emit::MethodBuilder * method_builder = + Emit::MethodBuilder ^ method_builder = type_builder->DefineMethod( ustring_to_String( OUSTR("get_") + xAttribute->getMemberName() ), c_property_method_attr, attribute_type, parameters ); //define UNO exception attribute (exceptions)-------------------------------------- - Emit::CustomAttributeBuilder* attrBuilder = + Emit::CustomAttributeBuilder^ attrBuilder = get_exception_attribute(xAttribute->getGetExceptions()); - if (attrBuilder != NULL) + if (attrBuilder != nullptr) method_builder->SetCustomAttribute(attrBuilder); property_builder->SetGetMethod( method_builder ); @@ -1056,20 +1045,20 @@ Assembly * TypeEmitter::type_resolve( if (! xAttribute->isReadOnly()) { // setter - parameters = new ::System::Type * [ 1 ]; + parameters = gcnew array< ::System::Type^> ( 1 ); parameters[ 0 ] = attribute_type; method_builder = type_builder->DefineMethod( ustring_to_String( OUSTR("set_") + xAttribute->getMemberName() ), - c_property_method_attr, 0, parameters ); + c_property_method_attr, nullptr, parameters ); // define parameter info method_builder->DefineParameter( - 1 /* starts with 1 */, ParameterAttributes::In, S"value" ); + 1 /* starts with 1 */, ParameterAttributes::In, "value" ); //define UNO exception attribute (exceptions)-------------------------------------- - Emit::CustomAttributeBuilder* attrBuilder = + Emit::CustomAttributeBuilder^ attrBuilder = get_exception_attribute(xAttribute->getSetExceptions()); - if (attrBuilder != NULL) + if (attrBuilder != nullptr) method_builder->SetCustomAttribute(attrBuilder); property_builder->SetSetMethod( method_builder ); @@ -1078,7 +1067,7 @@ Assembly * TypeEmitter::type_resolve( } // remove from incomplete types map - ::System::String * cts_name = type_builder->get_FullName(); + ::System::String ^ cts_name = type_builder->FullName; m_incomplete_ifaces->Remove( cts_name ); xType->release(); @@ -1090,10 +1079,10 @@ Assembly * TypeEmitter::type_resolve( return type_builder->CreateType(); } -::System::Type * TypeEmitter::complete_struct_type( struct_entry * entry ) +::System::Type ^ TypeEmitter::complete_struct_type( struct_entry ^ entry ) { OSL_ASSERT(entry); - ::System::String * cts_name = entry->m_type_builder->get_FullName(); + ::System::String ^ cts_name = entry->m_type_builder->FullName; //Polymorphic struct, define uno.TypeParametersAttribute //A polymorphic struct cannot have a basetype. @@ -1108,30 +1097,30 @@ Assembly * TypeEmitter::type_resolve( int numTypes = 0; if ((numTypes = seq_type_parameters.getLength()) > 0) { - ::System::Object * aArg[] = new ::System::Object*[numTypes]; + array< ::System::Object^>^ aArg = gcnew array< ::System::Object^>(numTypes); for (int i = 0; i < numTypes; i++) aArg[i] = ustring_to_String(seq_type_parameters.getConstArray()[i]); - ::System::Object * args[] = {aArg}; + array< ::System::Object^>^ args = {aArg}; - ::System::Type * arTypesCtor[] = - {::System::Type::GetType(S"System.String[]")}; - Emit::CustomAttributeBuilder * attrBuilder = - new Emit::CustomAttributeBuilder( - __typeof(::uno::TypeParametersAttribute)->GetConstructor(arTypesCtor), + array< ::System::Type^>^ arTypesCtor = + {::System::Type::GetType("System.String[]")}; + Emit::CustomAttributeBuilder ^ attrBuilder = + gcnew Emit::CustomAttributeBuilder( + ::uno::TypeParametersAttribute::typeid->GetConstructor(arTypesCtor), args); entry->m_type_builder->SetCustomAttribute(attrBuilder); } } // optional: lookup base type whether generated entry of this session - struct_entry * base_type_entry = 0; - if (0 != entry->m_base_type) + struct_entry ^ base_type_entry = nullptr; + if (nullptr != entry->m_base_type) { //ToDo maybe get from incomplete structs base_type_entry = - dynamic_cast< struct_entry * >( - m_generated_structs->get_Item( - entry->m_base_type->get_FullName() ) ); + dynamic_cast< struct_entry ^ >( + m_generated_structs[ + entry->m_base_type->FullName ] ); } // members @@ -1161,14 +1150,14 @@ Assembly * TypeEmitter::type_resolve( sal_Int32 type_param_pos = 0; // collect base types; wrong order - ::System::Collections::ArrayList * base_types_list = - new ::System::Collections::ArrayList( 3 /* initial capacity */ ); - for (::System::Type * base_type_pos = entry->m_base_type; - ! base_type_pos->Equals( __typeof (::System::Object) ); - base_type_pos = base_type_pos->get_BaseType() ) + ::System::Collections::ArrayList ^ base_types_list = + gcnew ::System::Collections::ArrayList( 3 /* initial capacity */ ); + for (::System::Type ^ base_type_pos = entry->m_base_type; + ! base_type_pos->Equals( ::System::Object::typeid ); + base_type_pos = base_type_pos->BaseType ) { base_types_list->Add( base_type_pos ); - if (base_type_pos->Equals( __typeof (::System::Exception) )) + if (base_type_pos->Equals( ::System::Exception::typeid )) { // special Message member all_members_length += 1; @@ -1177,61 +1166,61 @@ Assembly * TypeEmitter::type_resolve( else { //ensure the base type is complete. Otherwise GetFields won't work - get_complete_struct(base_type_pos->get_FullName()); + get_complete_struct(base_type_pos->FullName); all_members_length += base_type_pos->GetFields( (BindingFlags) (BindingFlags::Instance | BindingFlags::Public | BindingFlags::DeclaredOnly) ) - ->get_Length(); + ->Length; } } // create all_members arrays; right order - ::System::String * all_member_names[] = - new ::System::String * [all_members_length + members_length ]; - ::System::Type * all_param_types[] = - new ::System::Type * [all_members_length + members_length ]; + array< ::System::String^>^ all_member_names = + gcnew array< ::System::String^> (all_members_length + members_length ); + array< ::System::Type^>^ all_param_types = + gcnew array< ::System::Type^> (all_members_length + members_length ); member_pos = 0; - for ( sal_Int32 pos = base_types_list->get_Count(); pos--; ) + for ( sal_Int32 pos = base_types_list->Count; pos--; ) { - ::System::Type * base_type = __try_cast< ::System::Type * >( - base_types_list->get_Item( pos ) ); - if (base_type->Equals( __typeof (::System::Exception) )) + ::System::Type ^ base_type = safe_cast< ::System::Type ^ >( + base_types_list[pos] ); + if (base_type->Equals( ::System::Exception::typeid )) { - all_member_names[ member_pos ] = S"Message"; - all_param_types[ member_pos ] = __typeof (::System::String); + all_member_names[ member_pos ] = "Message"; + all_param_types[ member_pos ] = ::System::String::typeid; ++member_pos; } else { - ::System::String * base_type_name = base_type->get_FullName(); + ::System::String ^ base_type_name = base_type->FullName; //ToDo m_generated_structs? - struct_entry * entry = - dynamic_cast< struct_entry * >( - m_generated_structs->get_Item( base_type_name ) ); - if (0 == entry) + struct_entry ^ entry = + dynamic_cast< struct_entry ^ >( + m_generated_structs[base_type_name] ); + if (nullptr == entry) { // complete type - FieldInfo * fields [] = + array<FieldInfo^>^ fields = base_type->GetFields( (BindingFlags) (BindingFlags::Instance | BindingFlags::Public | BindingFlags::DeclaredOnly) ); - sal_Int32 len = fields->get_Length(); + sal_Int32 len = fields->Length; for ( sal_Int32 pos = 0; pos < len; ++pos ) { - FieldInfo * field = fields[ pos ]; - all_member_names[ member_pos ] = field->get_Name(); - all_param_types[ member_pos ] = field->get_FieldType(); + FieldInfo ^ field = fields[ pos ]; + all_member_names[ member_pos ] = field->Name; + all_param_types[ member_pos ] = field->FieldType; ++member_pos; } } else // generated during this session: // members may be incomplete ifaces { - sal_Int32 len = entry->m_member_names->get_Length(); + sal_Int32 len = entry->m_member_names->Length; for ( sal_Int32 pos = 0; pos < len; ++pos ) { all_member_names[ member_pos ] = @@ -1247,11 +1236,11 @@ Assembly * TypeEmitter::type_resolve( // build up entry // struct_entry * entry = new struct_entry(); - entry->m_member_names = new ::System::String * [ members_length ]; - entry->m_param_types = new ::System::Type * [ members_length ]; + entry->m_member_names = gcnew array< ::System::String^> ( members_length ); + entry->m_param_types = gcnew array< ::System::Type^> ( members_length ); // add members - Emit::FieldBuilder * members[] = new Emit::FieldBuilder * [ members_length ]; + array<Emit::FieldBuilder^>^ members = gcnew array<Emit::FieldBuilder^> ( members_length ); //Reference< reflection::XTypeDescription > const * pseq_members = // seq_members.getConstArray(); //OUString const * pseq_member_names = @@ -1260,9 +1249,9 @@ Assembly * TypeEmitter::type_resolve( int curParamIndex = 0; //count the fields which have parameterized types for ( member_pos = 0; member_pos < members_length; ++member_pos ) { - ::System::String * field_name = + ::System::String ^ field_name = ustring_to_String( pseq_member_names[ member_pos ] ); - ::System::Type * field_type; + ::System::Type ^ field_type; //Special handling of struct parameter types bool bParameterizedType = false; if (pseq_members[ member_pos ]->getTypeClass() == TypeClass_UNKNOWN) @@ -1270,7 +1259,7 @@ Assembly * TypeEmitter::type_resolve( bParameterizedType = true; if (type_param_pos < seq_type_parameters.getLength()) { - field_type = __typeof(::System::Object); + field_type = ::System::Object::typeid; type_param_pos++; } else @@ -1294,15 +1283,15 @@ Assembly * TypeEmitter::type_resolve( { //get the name OSL_ASSERT(seq_type_parameters.getLength() > curParamIndex); - ::System::String* sTypeName = ustring_to_String( + ::System::String^ sTypeName = ustring_to_String( seq_type_parameters.getConstArray()[curParamIndex++]); - ::System::Object * args[] = {sTypeName}; + array< ::System::Object^>^ args = {sTypeName}; //set ParameterizedTypeAttribute - ::System::Type * arCtorTypes[] = {__typeof(::System::String)}; + array< ::System::Type^>^ arCtorTypes = {::System::String::typeid}; - Emit::CustomAttributeBuilder * attrBuilder = - new Emit::CustomAttributeBuilder( - __typeof(::uno::ParameterizedTypeAttribute) + Emit::CustomAttributeBuilder ^ attrBuilder = + gcnew Emit::CustomAttributeBuilder( + ::uno::ParameterizedTypeAttribute::typeid ->GetConstructor(arCtorTypes), args); @@ -1318,47 +1307,47 @@ Assembly * TypeEmitter::type_resolve( all_members_length += members_length; // default .ctor - Emit::ConstructorBuilder * ctor_builder = + Emit::ConstructorBuilder ^ ctor_builder = entry->m_type_builder->DefineConstructor( c_ctor_method_attr, CallingConventions::Standard, - new ::System::Type * [ 0 ] ); - Emit::ILGenerator * code = ctor_builder->GetILGenerator(); + gcnew array< ::System::Type^> ( 0 ) ); + Emit::ILGenerator ^ code = ctor_builder->GetILGenerator(); code->Emit( Emit::OpCodes::Ldarg_0 ); code->Emit( Emit::OpCodes::Call, - 0 == base_type_entry - ? entry->m_base_type->GetConstructor( new ::System::Type * [ 0 ] ) + nullptr == base_type_entry + ? entry->m_base_type->GetConstructor( gcnew array< ::System::Type^> ( 0 ) ) : base_type_entry->m_default_ctor ); // default initialize members for ( member_pos = 0; member_pos < members_length; ++member_pos ) { - FieldInfo * field = members[ member_pos ]; - ::System::Type * field_type = field->get_FieldType(); + FieldInfo ^ field = members[ member_pos ]; + ::System::Type ^ field_type = field->FieldType; // ::System::Type * new_field_type = m_module_builder->GetType(field_type->FullName, false); // default initialize: // string, type, enum, sequence, struct, exception, any - if (field_type->Equals( __typeof (::System::String) )) + if (field_type->Equals( ::System::String::typeid )) { code->Emit( Emit::OpCodes::Ldarg_0 ); - code->Emit( Emit::OpCodes::Ldstr, S"" ); + code->Emit( Emit::OpCodes::Ldstr, "" ); code->Emit( Emit::OpCodes::Stfld, field ); } - else if (field_type->Equals( __typeof (::System::Type) )) + else if (field_type->Equals( ::System::Type::typeid )) { code->Emit( Emit::OpCodes::Ldarg_0 ); code->Emit( - Emit::OpCodes::Ldtoken, __typeof (::System::Void) ); + Emit::OpCodes::Ldtoken, ::System::Void::typeid ); code->Emit( Emit::OpCodes::Call, m_method_info_Type_GetTypeFromHandle ); code->Emit( Emit::OpCodes::Stfld, field ); } - else if (field_type->get_IsArray()) + else if (field_type->IsArray) { //Find the value type. In case of sequence<sequence< ... > > find the actual value type - ::System::Type * value = field_type; - while ((value = value->GetElementType())->get_IsArray()); + ::System::Type ^ value = field_type; + while ((value = value->GetElementType())->IsArray); //If the value type is a struct then make sure it is fully created. - get_complete_struct(value->get_FullName()); + get_complete_struct(value->FullName); code->Emit( Emit::OpCodes::Ldarg_0 ); code->Emit( Emit::OpCodes::Ldc_I4_0 ); @@ -1366,29 +1355,29 @@ Assembly * TypeEmitter::type_resolve( Emit::OpCodes::Newarr, field_type->GetElementType() ); code->Emit( Emit::OpCodes::Stfld, field ); } - else if (field_type->get_IsValueType()) + else if (field_type->IsValueType) { - if (field_type->get_FullName()->Equals( S"uno.Any" )) + if (field_type->FullName->Equals( "uno.Any" )) { code->Emit( Emit::OpCodes::Ldarg_0 ); - code->Emit( Emit::OpCodes::Ldsfld, __typeof(::uno::Any)->GetField(S"VOID")); + code->Emit( Emit::OpCodes::Ldsfld, ::uno::Any::typeid->GetField("VOID")); code->Emit( Emit::OpCodes::Stfld, field ); } } - else if (field_type->get_IsClass()) + else if (field_type->IsClass) { /* may be XInterface */ - if (! field_type->Equals( __typeof (::System::Object) )) + if (! field_type->Equals( ::System::Object::typeid )) { // struct, exception //make sure the struct is already complete. - get_complete_struct(field_type->get_FullName()); + get_complete_struct(field_type->FullName); code->Emit( Emit::OpCodes::Ldarg_0 ); code->Emit( Emit::OpCodes::Newobj, //GetConstructor requies that the member types of the object which is to be constructed are already known. field_type->GetConstructor( - new ::System::Type * [ 0 ] ) ); + gcnew array< ::System::Type^> ( 0 ) ) ); code->Emit( Emit::OpCodes::Stfld, field ); } } @@ -1409,8 +1398,8 @@ Assembly * TypeEmitter::type_resolve( // call base .ctor code->Emit( Emit::OpCodes::Ldarg_0 ); // push this sal_Int32 base_members_length = all_members_length - members_length; - ::System::Type * param_types [] = - new ::System::Type * [ base_members_length ]; + array< ::System::Type^>^ param_types = + gcnew array< ::System::Type^> ( base_members_length ); for ( member_pos = 0; member_pos < base_members_length; ++member_pos ) { emit_ldarg( code, member_pos +1 ); @@ -1418,7 +1407,7 @@ Assembly * TypeEmitter::type_resolve( } code->Emit( Emit::OpCodes::Call, - 0 == base_type_entry + nullptr == base_type_entry ? entry->m_base_type->GetConstructor( param_types ) : base_type_entry->m_ctor ); // initialize members @@ -1436,13 +1425,13 @@ Assembly * TypeEmitter::type_resolve( ::System::Console::WriteLine( "> emitting {0} type {1}", TypeClass_STRUCT == entry->m_xType->getTypeClass() - ? S"struct" - : S"exception", + ? "struct" + : "exception", cts_name); } // new entry m_generated_structs->Add(cts_name, entry ); - ::System::Type * ret_type = entry->m_type_builder->CreateType(); + ::System::Type ^ ret_type = entry->m_type_builder->CreateType(); // remove from incomplete types map m_incomplete_structs->Remove( cts_name ); @@ -1485,25 +1474,25 @@ Assembly * TypeEmitter::type_resolve( // throw new com.sun.star.uno.DeploymentException("bla", null); // return (XWeak) factory.createInstanceWithArgumentsAndContext("service_specifier", c, ctx); // } -::System::Type * TypeEmitter::complete_service_type(service_entry * entry) +::System::Type ^ TypeEmitter::complete_service_type(service_entry ^ entry) { - Emit::TypeBuilder * type_builder = entry->m_type_builder; + Emit::TypeBuilder ^ type_builder = entry->m_type_builder; reflection::XServiceTypeDescription2 * xServiceType = entry->m_xType; //Create the private default constructor - Emit::ConstructorBuilder* ctor_builder = + Emit::ConstructorBuilder^ ctor_builder = type_builder->DefineConstructor( (MethodAttributes) (MethodAttributes::Private | MethodAttributes::HideBySig | MethodAttributes::SpecialName | MethodAttributes::RTSpecialName), - CallingConventions::Standard, NULL); + CallingConventions::Standard, nullptr); - Emit::ILGenerator* ilGen = ctor_builder->GetILGenerator(); + Emit::ILGenerator^ ilGen = ctor_builder->GetILGenerator(); ilGen->Emit( Emit::OpCodes::Ldarg_0 ); // push this ilGen->Emit( Emit::OpCodes::Call, - type_builder->BaseType->GetConstructor(new ::System::Type*[0])); + type_builder->BaseType->GetConstructor(gcnew array< ::System::Type^>(0))); ilGen->Emit( Emit::OpCodes::Ret ); @@ -1514,26 +1503,26 @@ Assembly * TypeEmitter::type_resolve( xServiceType->getInterface(), UNO_QUERY); if (xIfaceType.is () == sal_False) xIfaceType = resolveInterfaceTypedef(xServiceType->getInterface()); - System::Type * retType = get_type(xIfaceType); + System::Type ^ retType = get_type(xIfaceType); //Create the ConstructorInfo for a DeploymentException - ::System::Type * typeDeploymentExc = - get_type(S"unoidl.com.sun.star.uno.DeploymentException", true); + ::System::Type ^ typeDeploymentExc = + get_type("unoidl.com.sun.star.uno.DeploymentException", true); - ::System::Type * arTypeCtor[] = {__typeof(::System::String), - __typeof(::System::Object)}; - ::System::Reflection::ConstructorInfo * ctorDeploymentException = + array< ::System::Type^>^ arTypeCtor = {::System::String::typeid, + ::System::Object::typeid}; + ::System::Reflection::ConstructorInfo ^ ctorDeploymentException = typeDeploymentExc->GetConstructor(arTypeCtor); Sequence<Reference<reflection::XServiceConstructorDescription> > seqCtors = xServiceType->getConstructors(); - ::System::Type * type_uno_exception = get_type(S"unoidl.com.sun.star.uno.Exception", true); + ::System::Type ^ type_uno_exception = get_type("unoidl.com.sun.star.uno.Exception", true); for (int i = seqCtors.getLength() - 1; i >= 0; i--) { bool bParameterArray = false; - ::System::Type * typeAny = __typeof(::uno::Any); + ::System::Type ^ typeAny = ::uno::Any::typeid; const Reference<reflection::XServiceConstructorDescription> & ctorDes = seqCtors[i]; //obtain the parameter types @@ -1541,12 +1530,12 @@ Assembly * TypeEmitter::type_resolve( ctorDes->getParameters(); Reference<reflection::XParameter> const * arXParams = seqParams.getConstArray(); sal_Int32 cParams = seqParams.getLength(); - ::System::Type * arTypeParameters[] = new ::System::Type* [cParams + 1]; - arTypeParameters[0] = get_type(S"unoidl.com.sun.star.uno.XComponentContext", true); + array< ::System::Type^>^ arTypeParameters = gcnew array< ::System::Type^> (cParams + 1); + arTypeParameters[0] = get_type("unoidl.com.sun.star.uno.XComponentContext", true); for (int iparam = 0; iparam != cParams; iparam++) { if (arXParams[iparam]->isRestParameter()) - arTypeParameters[iparam + 1] = __typeof(::uno::Any[]); + arTypeParameters[iparam + 1] = array< ::uno::Any>::typeid; else arTypeParameters[iparam + 1] = get_type(arXParams[iparam]->getType()); } @@ -1557,23 +1546,23 @@ Assembly * TypeEmitter::type_resolve( //Maybe we need no override another Type method in PolymorphicType ... //Until we have figured this out, we will create another array of System.Type which //we pass on to DefineMethod. - ::System::Type * arParamTypes[] = new ::System::Type * [cParams + 1]; -// arParamTypes[0] = get_type(S"unoidl.com.sun.star.uno.XComponentContext", true); + array< ::System::Type^>^ arParamTypes = gcnew array< ::System::Type^> (cParams + 1); +// arParamTypes[0] = get_type("unoidl.com.sun.star.uno.XComponentContext", true); for (int i = 0; i < cParams + 1; i++) { - ::uno::PolymorphicType * pT = dynamic_cast< ::uno::PolymorphicType * >(arTypeParameters[i]); + ::uno::PolymorphicType ^ pT = dynamic_cast< ::uno::PolymorphicType ^ >(arTypeParameters[i]); if (pT) arParamTypes[i] = pT->OriginalType; else arParamTypes[i] = arTypeParameters[i]; } //define method - System::String * ctorName; + System::String ^ ctorName; if (ctorDes->isDefaultConstructor()) - ctorName = new ::System::String(S"create"); + ctorName = gcnew ::System::String("create"); else ctorName = ustring_to_String(ctorDes->getName()); - Emit::MethodBuilder* method_builder = type_builder->DefineMethod( + Emit::MethodBuilder^ method_builder = type_builder->DefineMethod( ctorName, static_cast<MethodAttributes>(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), @@ -1582,8 +1571,8 @@ Assembly * TypeEmitter::type_resolve( arParamTypes); //define UNO exception attribute (exceptions)-------------------------------------- - Emit::CustomAttributeBuilder* attrBuilder = get_service_exception_attribute(ctorDes); - if (attrBuilder != NULL) + Emit::CustomAttributeBuilder^ attrBuilder = get_service_exception_attribute(ctorDes); + if (attrBuilder != nullptr) method_builder->SetCustomAttribute(attrBuilder); //------------------------------------------------------------- @@ -1592,14 +1581,14 @@ Assembly * TypeEmitter::type_resolve( //from reflection. //The context is not part of the idl description method_builder->DefineParameter( - 1, ParameterAttributes::In, S"the_context"); + 1, ParameterAttributes::In, "the_context"); - Emit::ParameterBuilder * arParameterBuilder[] = - new Emit::ParameterBuilder * [cParams]; + array<Emit::ParameterBuilder^>^ arParameterBuilder = + gcnew array<Emit::ParameterBuilder^> (cParams); for (int iparam = 0; iparam != cParams; iparam++) { Reference<reflection::XParameter> const & aParam = arXParams[iparam]; - ::System::String * sParamName = ustring_to_String(aParam->getName()); + ::System::String ^ sParamName = ustring_to_String(aParam->getName()); arParameterBuilder[iparam] = method_builder->DefineParameter( iparam + 2, ParameterAttributes::In, sParamName); @@ -1608,44 +1597,44 @@ Assembly * TypeEmitter::type_resolve( { bParameterArray = true; //set the ParameterArrayAttribute - ::System::Reflection::ConstructorInfo* ctor_info = - __typeof(System::ParamArrayAttribute)->GetConstructor( - new ::System::Type*[0]); - Emit::CustomAttributeBuilder * attr_builder = - new Emit::CustomAttributeBuilder(ctor_info, new ::System::Object*[0]); + ::System::Reflection::ConstructorInfo^ ctor_info = + System::ParamArrayAttribute::typeid->GetConstructor( + gcnew array< ::System::Type^>(0)); + Emit::CustomAttributeBuilder ^ attr_builder = + gcnew Emit::CustomAttributeBuilder(ctor_info, gcnew array< ::System::Object^>(0)); arParameterBuilder[iparam]->SetCustomAttribute(attr_builder); break; } } - Emit::ILGenerator * ilGen = method_builder->GetILGenerator(); + Emit::ILGenerator ^ ilGen = method_builder->GetILGenerator(); //Define locals --------------------------------- //XMultiComponentFactory - Emit::LocalBuilder* local_factory = + Emit::LocalBuilder^ local_factory = ilGen->DeclareLocal( - get_type(S"unoidl.com.sun.star.lang.XMultiComponentFactory", true)); + get_type("unoidl.com.sun.star.lang.XMultiComponentFactory", true)); //The return type - Emit::LocalBuilder* local_return_val = + Emit::LocalBuilder^ local_return_val = ilGen->DeclareLocal(retType); //Obtain the XMultiComponentFactory and throw an exception if we do not get one ilGen->Emit(Emit::OpCodes::Ldarg_0); - ::System::Reflection::MethodInfo * methodGetServiceManager = get_type( - S"unoidl.com.sun.star.uno.XComponentContext", true) - ->GetMethod(S"getServiceManager"); + ::System::Reflection::MethodInfo ^ methodGetServiceManager = get_type( + "unoidl.com.sun.star.uno.XComponentContext", true) + ->GetMethod("getServiceManager"); ilGen->Emit(Emit::OpCodes::Callvirt, methodGetServiceManager); ilGen->Emit(Emit::OpCodes::Stloc, local_factory); ilGen->Emit(Emit::OpCodes::Ldloc, local_factory); Emit::Label label1 = ilGen->DefineLabel(); ilGen->Emit(Emit::OpCodes::Brtrue, label1); //The string for the exception - ::System::Text::StringBuilder * strbuilder = new ::System::Text::StringBuilder(256); - strbuilder->Append(S"The service "); + ::System::Text::StringBuilder ^ strbuilder = gcnew ::System::Text::StringBuilder(256); + strbuilder->Append("The service "); strbuilder->Append(to_cts_name(xServiceType->getName())); - strbuilder->Append(S" could not be created. The context failed to supply the service manager."); + strbuilder->Append(" could not be created. The context failed to supply the service manager."); ilGen->Emit(Emit::OpCodes::Ldstr, strbuilder->ToString()); ilGen->Emit(Emit::OpCodes::Ldarg_0); @@ -1663,7 +1652,7 @@ Assembly * TypeEmitter::type_resolve( //In case there are no parameters we call //XMultiComponentFactory.createInstanceWithContext - ::System::Collections::ArrayList * arExceptionTypes = + ::System::Collections::ArrayList ^ arExceptionTypes = get_service_ctor_method_exceptions_reduced(ctorDes->getExceptions()); if (arExceptionTypes->Contains( type_uno_exception) == false) @@ -1676,8 +1665,8 @@ Assembly * TypeEmitter::type_resolve( ilGen->Emit(Emit::OpCodes::Ldstr, ustring_to_String(xServiceType->getName())); ilGen->Emit(Emit::OpCodes::Ldarg_0); - ::System::Reflection::MethodInfo * methodCreate = - local_factory->get_LocalType()->GetMethod(S"createInstanceWithContext"); + ::System::Reflection::MethodInfo ^ methodCreate = + local_factory->LocalType->GetMethod("createInstanceWithContext"); ilGen->Emit(Emit::OpCodes::Callvirt, methodCreate); } else if(bParameterArray) @@ -1687,8 +1676,8 @@ Assembly * TypeEmitter::type_resolve( ilGen->Emit(Emit::OpCodes::Ldstr, ustring_to_String(xServiceType->getName())); ilGen->Emit(Emit::OpCodes::Ldarg_1); ilGen->Emit(Emit::OpCodes::Ldarg_0); - ::System::Reflection::MethodInfo * methodCreate = - local_factory->get_LocalType()->GetMethod(S"createInstanceWithArgumentsAndContext"); + ::System::Reflection::MethodInfo ^ methodCreate = + local_factory->LocalType->GetMethod("createInstanceWithArgumentsAndContext"); ilGen->Emit(Emit::OpCodes::Callvirt, methodCreate); } else @@ -1696,7 +1685,7 @@ Assembly * TypeEmitter::type_resolve( // Any param1, Any param2, etc. // For each parameter,except the component context, and parameter array // and Any is created. - Emit::LocalBuilder * arLocalAny[] = new Emit::LocalBuilder* [cParams]; + array<Emit::LocalBuilder^>^ arLocalAny = gcnew array<Emit::LocalBuilder^> (cParams); for (int iParam = 0; iParam < cParams; iParam ++) { @@ -1705,25 +1694,25 @@ Assembly * TypeEmitter::type_resolve( //Any[]. This array is filled with the created Anys which contain the parameters //and the values contained in the parameter array - Emit::LocalBuilder * local_anyParams = - ilGen->DeclareLocal(__typeof(::uno::Any[])); + Emit::LocalBuilder ^ local_anyParams = + ilGen->DeclareLocal(array< ::uno::Any>::typeid); //Create the Any for every argument, except for the parameter array //arLocalAny contains the LocalBuilder for all these parameters. //we call the ctor Any(Type, Object) //If the parameter is an Any then the Any is created with Any(param.Type, param.Value); - ::System::Type * arTypesCtorAny[] = {__typeof(::System::Type), - __typeof(::System::Object)}; - ::System::Reflection::ConstructorInfo * ctorAny = + array< ::System::Type^>^ arTypesCtorAny = {::System::Type::typeid, + ::System::Object::typeid}; + ::System::Reflection::ConstructorInfo ^ ctorAny = typeAny->GetConstructor( arTypesCtorAny); - ::System::Reflection::MethodInfo * methodAnyGetType = - typeAny->GetProperty(S"Type")->GetGetMethod(); - ::System::Reflection::MethodInfo * methodAnyGetValue = - typeAny->GetProperty(S"Value")->GetGetMethod(); + ::System::Reflection::MethodInfo ^ methodAnyGetType = + typeAny->GetProperty("Type")->GetGetMethod(); + ::System::Reflection::MethodInfo ^ methodAnyGetValue = + typeAny->GetProperty("Value")->GetGetMethod(); for (int i = 0; i < arLocalAny->Length; i ++) { //check if the parameter is a polymorphic struct - ::uno::PolymorphicType *polyType = dynamic_cast< ::uno::PolymorphicType* >(arTypeParameters[i+1]); + ::uno::PolymorphicType ^polyType = dynamic_cast< ::uno::PolymorphicType^ >(arTypeParameters[i+1]); //arTypeParameters[i+1] = polyType->OriginalType; if (polyType) { @@ -1732,18 +1721,18 @@ Assembly * TypeEmitter::type_resolve( ilGen->Emit(Emit::OpCodes::Ldloca, arLocalAny[i]); // Call PolymorphicType PolymorphicType::GetType(Type t, String polyName) // Prepare the first parameter - ilGen->Emit(Emit::OpCodes::Ldtoken, polyType->get_OriginalType()); - ::System::Type * arTypeParams[] = {__typeof(::System::RuntimeTypeHandle)}; + ilGen->Emit(Emit::OpCodes::Ldtoken, polyType->OriginalType); + array< ::System::Type^>^ arTypeParams = {::System::RuntimeTypeHandle::typeid}; ilGen->Emit(Emit::OpCodes::Call, - __typeof(::System::Type)->GetMethod( - S"GetTypeFromHandle", arTypeParams)); + ::System::Type::typeid->GetMethod( + "GetTypeFromHandle", arTypeParams)); // Prepare the second parameter - ilGen->Emit(Emit::OpCodes::Ldstr, polyType->get_PolymorphicName()); + ilGen->Emit(Emit::OpCodes::Ldstr, polyType->PolymorphicName); // Make the actual call - ::System::Type * arTypeParam_GetType[] = { - __typeof(::System::Type), __typeof(::System::String) }; + array< ::System::Type^>^ arTypeParam_GetType = { + ::System::Type::typeid, ::System::String::typeid }; ilGen->Emit(Emit::OpCodes::Call, - __typeof(::uno::PolymorphicType)->GetMethod(new System::String(S"GetType"), + ::uno::PolymorphicType::typeid->GetMethod(gcnew System::String("GetType"), arTypeParam_GetType)); //Stack is: localAny, PolymorphicType @@ -1776,10 +1765,10 @@ Assembly * TypeEmitter::type_resolve( ilGen->Emit(Emit::OpCodes::Ldloca, arLocalAny[i]); ilGen->Emit(Emit::OpCodes::Ldtoken, arTypeParameters[i+1]); - ::System::Type * arTypeParams[] = {__typeof(::System::RuntimeTypeHandle)}; + array< ::System::Type^>^ arTypeParams = {::System::RuntimeTypeHandle::typeid}; ilGen->Emit(Emit::OpCodes::Call, - __typeof(::System::Type)->GetMethod( - S"GetTypeFromHandle", arTypeParams)); + ::System::Type::typeid->GetMethod( + "GetTypeFromHandle", arTypeParams)); ilGen->Emit(Emit::OpCodes::Ldarg, i + 1); // if the parameter is a value type then we need to box it, because // the Any ctor takes an Object @@ -1810,8 +1799,8 @@ Assembly * TypeEmitter::type_resolve( ilGen->Emit(Emit::OpCodes::Ldstr, ustring_to_String(xServiceType->getName())); ilGen->Emit(Emit::OpCodes::Ldloc, local_anyParams); ilGen->Emit(Emit::OpCodes::Ldarg_0); - ::System::Reflection::MethodInfo * methodCreate = - local_factory->get_LocalType()->GetMethod(S"createInstanceWithArgumentsAndContext"); + ::System::Reflection::MethodInfo ^ methodCreate = + local_factory->LocalType->GetMethod("createInstanceWithArgumentsAndContext"); ilGen->Emit(Emit::OpCodes::Callvirt, methodCreate); } //cast the object returned by the functions createInstanceWithContext or @@ -1823,17 +1812,17 @@ Assembly * TypeEmitter::type_resolve( if (arExceptionTypes->Contains(type_uno_exception) == false) { // catch (unoidl.com.sun.star.uno.RuntimeException) {throw;} - ilGen->BeginCatchBlock(get_type(S"unoidl.com.sun.star.uno.RuntimeException", true)); + ilGen->BeginCatchBlock(get_type("unoidl.com.sun.star.uno.RuntimeException", true)); ilGen->Emit(Emit::OpCodes::Pop); ilGen->Emit(Emit::OpCodes::Rethrow); //catch and rethrow all other defined Exceptions for (int i = 0; i < arExceptionTypes->Count; i++) { - ::System::Type * excType = __try_cast< ::System::Type* >( - arExceptionTypes->get_Item(i)); + ::System::Type ^ excType = safe_cast< ::System::Type^ >( + arExceptionTypes[i]); if (excType->IsInstanceOfType( - get_type(S"unoidl.com.sun.star.uno.RuntimeException", true))) + get_type("unoidl.com.sun.star.uno.RuntimeException", true))) {// we have a catch for RuntimeException already defined continue; } @@ -1847,28 +1836,28 @@ Assembly * TypeEmitter::type_resolve( ilGen->BeginCatchBlock(type_uno_exception); //Define the local variabe that keeps the exception - Emit::LocalBuilder * local_exception = ilGen->DeclareLocal( + Emit::LocalBuilder ^ local_exception = ilGen->DeclareLocal( type_uno_exception); //Store the exception ilGen->Emit(Emit::OpCodes::Stloc, local_exception); //prepare the construction of the exception - strbuilder = new ::System::Text::StringBuilder(256); - strbuilder->Append(S"The context (com.sun.star.uno.XComponentContext) failed to supply the service "); + strbuilder = gcnew ::System::Text::StringBuilder(256); + strbuilder->Append("The context (com.sun.star.uno.XComponentContext) failed to supply the service "); strbuilder->Append(to_cts_name(xServiceType->getName())); - strbuilder->Append(S": "); + strbuilder->Append(": "); ilGen->Emit(Emit::OpCodes::Ldstr, strbuilder->ToString()); //add to the string the Exception.Message ilGen->Emit(Emit::OpCodes::Ldloc, local_exception); ilGen->Emit(Emit::OpCodes::Callvirt, - type_uno_exception->GetProperty(S"Message")->GetGetMethod()); - ::System::Type * arConcatParams [] = {__typeof(System::String), - __typeof(System::String)}; + type_uno_exception->GetProperty("Message")->GetGetMethod()); + array< ::System::Type^>^ arConcatParams = {System::String::typeid, + System::String::typeid}; ilGen->Emit(Emit::OpCodes::Call, - __typeof(System::String)->GetMethod(S"Concat", arConcatParams)); + System::String::typeid->GetMethod("Concat", arConcatParams)); //load contex argument ilGen->Emit(Emit::OpCodes::Ldarg_0); ilGen->Emit(Emit::OpCodes::Newobj, ctorDeploymentException); @@ -1883,10 +1872,10 @@ Assembly * TypeEmitter::type_resolve( ilGen->Emit(Emit::OpCodes::Ldloc, local_return_val); ilGen->Emit(Emit::OpCodes::Brtrue_S, label_service_created); - strbuilder = new ::System::Text::StringBuilder(256); - strbuilder->Append(S"The context (com.sun.star.uno.XComponentContext) failed to supply the service "); + strbuilder = gcnew ::System::Text::StringBuilder(256); + strbuilder->Append("The context (com.sun.star.uno.XComponentContext) failed to supply the service "); strbuilder->Append(to_cts_name(xServiceType->getName())); - strbuilder->Append(S"."); + strbuilder->Append("."); ilGen->Emit(Emit::OpCodes::Ldstr, strbuilder->ToString()); ilGen->Emit(Emit::OpCodes::Ldarg_0); ilGen->Emit(Emit::OpCodes::Newobj, ctorDeploymentException); @@ -1898,7 +1887,7 @@ Assembly * TypeEmitter::type_resolve( } // remove from incomplete types map - ::System::String * cts_name = type_builder->get_FullName(); + ::System::String ^ cts_name = type_builder->FullName; m_incomplete_services->Remove( cts_name ); xServiceType->release(); if (g_verbose) @@ -1910,13 +1899,13 @@ Assembly * TypeEmitter::type_resolve( } -Emit::CustomAttributeBuilder* TypeEmitter::get_service_exception_attribute( +Emit::CustomAttributeBuilder^ TypeEmitter::get_service_exception_attribute( const Reference<reflection::XServiceConstructorDescription> & ctorDes ) { return get_exception_attribute(ctorDes->getExceptions()); } -Emit::CustomAttributeBuilder* TypeEmitter::get_iface_method_exception_attribute( +Emit::CustomAttributeBuilder^ TypeEmitter::get_iface_method_exception_attribute( const Reference< reflection::XInterfaceMethodTypeDescription >& xMethod ) { @@ -1929,58 +1918,58 @@ Emit::CustomAttributeBuilder* TypeEmitter::get_iface_method_exception_attribute( return get_exception_attribute(seqCTD); } -Emit::CustomAttributeBuilder* TypeEmitter::get_exception_attribute( +Emit::CustomAttributeBuilder^ TypeEmitter::get_exception_attribute( const Sequence<Reference< reflection::XCompoundTypeDescription > >& seq_exceptionsTd ) { - Emit::CustomAttributeBuilder * attr_builder = NULL; + Emit::CustomAttributeBuilder ^ attr_builder = nullptr; Reference< reflection::XCompoundTypeDescription > const * exceptions = seq_exceptionsTd.getConstArray(); - ::System::Type * arTypesCtor[] = {::System::Type::GetType(S"System.Type[]")}; - ConstructorInfo * ctor_ExceptionAttribute = - __typeof(::uno::ExceptionAttribute)->GetConstructor(arTypesCtor); + array< ::System::Type^>^ arTypesCtor = {::System::Type::GetType("System.Type[]")}; + ConstructorInfo ^ ctor_ExceptionAttribute = + ::uno::ExceptionAttribute::typeid->GetConstructor(arTypesCtor); sal_Int32 exc_length = seq_exceptionsTd.getLength(); if (exc_length != 0) // opt { - ::System::Type * exception_types [] = - new ::System::Type * [ exc_length ]; + array< ::System::Type^>^ exception_types = + gcnew array< ::System::Type^> ( exc_length ); for ( sal_Int32 exc_pos = 0; exc_pos < exc_length; ++exc_pos ) { Reference< reflection::XCompoundTypeDescription > const & xExc = exceptions[ exc_pos ]; exception_types[ exc_pos ] = get_type( xExc ); } - ::System::Object * args [] = {exception_types}; - attr_builder = new Emit::CustomAttributeBuilder( + array< ::System::Object^>^ args = {exception_types}; + attr_builder = gcnew Emit::CustomAttributeBuilder( ctor_ExceptionAttribute, args ); } return attr_builder; } -::System::Type * TypeEmitter::complete_singleton_type(singleton_entry * entry) +::System::Type ^ TypeEmitter::complete_singleton_type(singleton_entry ^ entry) { - Emit::TypeBuilder * type_builder = entry->m_type_builder; + Emit::TypeBuilder ^ type_builder = entry->m_type_builder; reflection::XSingletonTypeDescription2 * xSingletonType = entry->m_xType; - ::System::String* sSingletonName = to_cts_name(xSingletonType->getName()); + ::System::String^ sSingletonName = to_cts_name(xSingletonType->getName()); //Create the private default constructor - Emit::ConstructorBuilder* ctor_builder = + Emit::ConstructorBuilder^ ctor_builder = type_builder->DefineConstructor( static_cast<MethodAttributes>(MethodAttributes::Private | MethodAttributes::HideBySig | MethodAttributes::SpecialName | MethodAttributes::RTSpecialName), - CallingConventions::Standard, NULL); + CallingConventions::Standard, nullptr); - Emit::ILGenerator* ilGen = ctor_builder->GetILGenerator(); + Emit::ILGenerator^ ilGen = ctor_builder->GetILGenerator(); ilGen->Emit( Emit::OpCodes::Ldarg_0 ); // push this ilGen->Emit( Emit::OpCodes::Call, - type_builder->BaseType->GetConstructor(new ::System::Type*[0])); + type_builder->BaseType->GetConstructor(gcnew array< ::System::Type^>(0))); ilGen->Emit( Emit::OpCodes::Ret ); @@ -1990,12 +1979,12 @@ Emit::CustomAttributeBuilder* TypeEmitter::get_exception_attribute( xSingletonType->getInterface(), UNO_QUERY); if (xIfaceType.is () == sal_False) xIfaceType = resolveInterfaceTypedef(xSingletonType->getInterface()); - System::Type * retType = get_type(xIfaceType); + System::Type ^ retType = get_type(xIfaceType); //define method - ::System::Type * arTypeParameters[] = {get_type(S"unoidl.com.sun.star.uno.XComponentContext", true)}; - Emit::MethodBuilder* method_builder = type_builder->DefineMethod( - new System::String(S"get"), + array< ::System::Type^>^ arTypeParameters = {get_type("unoidl.com.sun.star.uno.XComponentContext", true)}; + Emit::MethodBuilder^ method_builder = type_builder->DefineMethod( + gcnew System::String("get"), static_cast<MethodAttributes>(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), retType, @@ -2007,61 +1996,61 @@ Emit::CustomAttributeBuilder* TypeEmitter::get_exception_attribute( //The first parameter is the XComponentContext, which cannot be obtained //from reflection. //The context is not part of the idl description - method_builder->DefineParameter(1, ParameterAttributes::In, S"the_context"); + method_builder->DefineParameter(1, ParameterAttributes::In, "the_context"); ilGen = method_builder->GetILGenerator(); //Define locals --------------------------------- // Any, returned by XComponentContext.getValueByName - Emit::LocalBuilder* local_any = - ilGen->DeclareLocal(__typeof(::uno::Any)); + Emit::LocalBuilder^ local_any = + ilGen->DeclareLocal(::uno::Any::typeid); //Call XContext::getValueByName ilGen->Emit(Emit::OpCodes::Ldarg_0); // build the singleton name : /singleton/unoidl.com.sun.star.XXX - ::System::Text::StringBuilder* sBuilder = - new ::System::Text::StringBuilder(S"/singletons/"); + ::System::Text::StringBuilder^ sBuilder = + gcnew ::System::Text::StringBuilder("/singletons/"); sBuilder->Append(sSingletonName); ilGen->Emit(Emit::OpCodes::Ldstr, sBuilder->ToString()); - ::System::Reflection::MethodInfo * methodGetValueByName = - get_type(S"unoidl.com.sun.star.uno.XComponentContext", true)->GetMethod(S"getValueByName"); + ::System::Reflection::MethodInfo ^ methodGetValueByName = + get_type("unoidl.com.sun.star.uno.XComponentContext", true)->GetMethod("getValueByName"); ilGen->Emit(Emit::OpCodes::Callvirt, methodGetValueByName); ilGen->Emit(Emit::OpCodes::Stloc_0); //Contains the returned Any a value? ilGen->Emit(Emit::OpCodes::Ldloca_S, local_any); - ::System::Reflection::MethodInfo * methodHasValue = - __typeof(::uno::Any)->GetMethod(S"hasValue"); + ::System::Reflection::MethodInfo ^ methodHasValue = + ::uno::Any::typeid->GetMethod("hasValue"); ilGen->Emit(Emit::OpCodes::Call, methodHasValue); //If not, then throw an DeploymentException Emit::Label label_singleton_exists = ilGen->DefineLabel(); ilGen->Emit(Emit::OpCodes::Brtrue_S, label_singleton_exists); - sBuilder = new ::System::Text::StringBuilder( - S"Component context fails to supply singleton "); + sBuilder = gcnew ::System::Text::StringBuilder( + "Component context fails to supply singleton "); sBuilder->Append(sSingletonName); - sBuilder->Append(S" of type "); + sBuilder->Append(" of type "); sBuilder->Append(retType->FullName); - sBuilder->Append(S"."); + sBuilder->Append("."); ilGen->Emit(Emit::OpCodes::Ldstr, sBuilder->ToString()); ilGen->Emit(Emit::OpCodes::Ldarg_0); - ::System::Type * arTypesCtorDeploymentException[] = { - __typeof(::System::String), __typeof(::System::Object)}; + array< ::System::Type^>^ arTypesCtorDeploymentException = { + ::System::String::typeid, ::System::Object::typeid}; ilGen->Emit(Emit::OpCodes::Newobj, - get_type(S"unoidl.com.sun.star.uno.DeploymentException",true) + get_type("unoidl.com.sun.star.uno.DeploymentException",true) ->GetConstructor(arTypesCtorDeploymentException)); ilGen->Emit(Emit::OpCodes::Throw); ilGen->MarkLabel(label_singleton_exists); //Cast the singleton contained in the Any to the expected interface and return it. ilGen->Emit(Emit::OpCodes::Ldloca_S, local_any); - ilGen->Emit(Emit::OpCodes::Call, __typeof(::uno::Any)->GetProperty(S"Value")->GetGetMethod()); + ilGen->Emit(Emit::OpCodes::Call, ::uno::Any::typeid->GetProperty("Value")->GetGetMethod()); ilGen->Emit(Emit::OpCodes::Castclass, retType); ilGen->Emit(Emit::OpCodes::Ret); // remove from incomplete types map - ::System::String * cts_name = type_builder->get_FullName(); + ::System::String ^ cts_name = type_builder->FullName; m_incomplete_singletons->Remove( cts_name ); xSingletonType->release(); if (g_verbose) @@ -2074,41 +2063,41 @@ Emit::CustomAttributeBuilder* TypeEmitter::get_exception_attribute( //______________________________________________________________________________ -::System::Type * TypeEmitter::get_type( +::System::Type ^ TypeEmitter::get_type( Reference< reflection::XTypeDescription > const & xType ) { switch (xType->getTypeClass()) { case TypeClass_VOID: - return __typeof (::System::Void); + return ::System::Void::typeid; case TypeClass_CHAR: - return __typeof (::System::Char); + return ::System::Char::typeid; case TypeClass_BOOLEAN: - return __typeof (::System::Boolean); + return ::System::Boolean::typeid; case TypeClass_BYTE: - return __typeof (::System::Byte); + return ::System::Byte::typeid; case TypeClass_SHORT: - return __typeof (::System::Int16); + return ::System::Int16::typeid; case TypeClass_UNSIGNED_SHORT: - return __typeof (::System::UInt16); + return ::System::UInt16::typeid; case TypeClass_LONG: - return __typeof (::System::Int32); + return ::System::Int32::typeid; case TypeClass_UNSIGNED_LONG: - return __typeof (::System::UInt32); + return ::System::UInt32::typeid; case TypeClass_HYPER: - return __typeof (::System::Int64); + return ::System::Int64::typeid; case TypeClass_UNSIGNED_HYPER: - return __typeof (::System::UInt64); + return ::System::UInt64::typeid; case TypeClass_FLOAT: - return __typeof (::System::Single); + return ::System::Single::typeid; case TypeClass_DOUBLE: - return __typeof (::System::Double); + return ::System::Double::typeid; case TypeClass_STRING: - return __typeof (::System::String); + return ::System::String::typeid; case TypeClass_TYPE: - return __typeof (::System::Type); + return ::System::Type::typeid; case TypeClass_ANY: - return __typeof(::uno::Any); + return ::uno::Any::typeid; case TypeClass_ENUM: return get_type( Reference< reflection::XEnumTypeDescription >( xType, UNO_QUERY_THROW ) ); @@ -2124,17 +2113,17 @@ Emit::CustomAttributeBuilder* TypeEmitter::get_exception_attribute( xType, UNO_QUERY_THROW ) ); case TypeClass_SEQUENCE: { - ::System::Type * element_type = get_type( + ::System::Type ^ element_type = get_type( Reference< reflection::XIndirectTypeDescription >( xType, UNO_QUERY_THROW )->getReferencedType() ); - ::System::Type * retType = get_type( + ::System::Type ^ retType = get_type( ::System::String::Concat( - element_type->get_FullName(), S"[]" ), true ); + element_type->FullName, "[]" ), true ); - ::uno::PolymorphicType * pt = dynamic_cast< ::uno::PolymorphicType * >(element_type); + ::uno::PolymorphicType ^ pt = dynamic_cast< ::uno::PolymorphicType ^ >(element_type); if (pt) { - ::System::String * sName = ::System::String::Concat(pt->PolymorphicName, S"[]"); + ::System::String ^ sName = ::System::String::Concat(pt->PolymorphicName, "[]"); retType = ::uno::PolymorphicType::GetType(retType, sName); } return retType; @@ -2161,7 +2150,7 @@ Emit::CustomAttributeBuilder* TypeEmitter::get_exception_attribute( xType, UNO_QUERY_THROW) ); case TypeClass_MODULE: // ignore these - return 0; + return nullptr; default: throw RuntimeException( OUSTR("unexpected type ") + xType->getName(), @@ -2170,10 +2159,10 @@ Emit::CustomAttributeBuilder* TypeEmitter::get_exception_attribute( } //______________________________________________________________________________ -::System::Type * TypeEmitter::get_complete_struct( ::System::String * sName) +::System::Type ^ TypeEmitter::get_complete_struct( ::System::String ^ sName) { - struct_entry * pStruct = __try_cast< struct_entry *>( - m_incomplete_structs->get_Item(sName)); + struct_entry ^ pStruct = safe_cast< struct_entry ^>( + m_incomplete_structs[sName]); if (pStruct) { complete_struct_type(pStruct); @@ -2181,78 +2170,78 @@ Emit::CustomAttributeBuilder* TypeEmitter::get_exception_attribute( //get_type will asked the module builder for the type or otherwise all known assemblies. return get_type(sName, true); } -void TypeEmitter::Dispose() +TypeEmitter::~TypeEmitter() { while (true) { - ::System::Collections::IDictionaryEnumerator * enumerator = + ::System::Collections::IDictionaryEnumerator ^ enumerator = m_incomplete_ifaces->GetEnumerator(); if (! enumerator->MoveNext()) break; complete_iface_type( - __try_cast< iface_entry * >( enumerator->get_Value() ) ); + safe_cast< iface_entry ^ >( enumerator->Value ) ); } while (true) { - ::System::Collections::IDictionaryEnumerator * enumerator = + ::System::Collections::IDictionaryEnumerator ^ enumerator = m_incomplete_structs->GetEnumerator(); if (! enumerator->MoveNext()) break; complete_struct_type( - __try_cast< struct_entry * >( enumerator->get_Value() ) ); + safe_cast< struct_entry ^ >( enumerator->Value ) ); } while (true) { - ::System::Collections::IDictionaryEnumerator * enumerator = + ::System::Collections::IDictionaryEnumerator ^ enumerator = m_incomplete_services->GetEnumerator(); if (! enumerator->MoveNext()) break; complete_service_type( - __try_cast< service_entry * >( enumerator->get_Value() ) ); + safe_cast< service_entry ^ >( enumerator->Value ) ); } while (true) { - ::System::Collections::IDictionaryEnumerator * enumerator = + ::System::Collections::IDictionaryEnumerator ^ enumerator = m_incomplete_singletons->GetEnumerator(); if (! enumerator->MoveNext()) break; complete_singleton_type( - __try_cast< singleton_entry * >( enumerator->get_Value() ) ); + safe_cast< singleton_entry ^ >( enumerator->Value ) ); } } //______________________________________________________________________________ TypeEmitter::TypeEmitter( - ::System::Reflection::Emit::ModuleBuilder * module_builder, - ::System::Reflection::Assembly * extra_assemblies [] ) + ::System::Reflection::Emit::ModuleBuilder ^ module_builder, + array< ::System::Reflection::Assembly^>^ extra_assemblies ) : m_module_builder( module_builder ), m_extra_assemblies( extra_assemblies ), - m_method_info_Type_GetTypeFromHandle( 0 ), - m_type_Exception( 0 ), - m_type_RuntimeException( 0 ), - m_incomplete_ifaces( new ::System::Collections::Hashtable() ), - m_incomplete_structs( new ::System::Collections::Hashtable() ), - m_incomplete_services(new ::System::Collections::Hashtable() ), - m_incomplete_singletons(new ::System::Collections::Hashtable() ), - m_generated_structs( new ::System::Collections::Hashtable() ) + m_method_info_Type_GetTypeFromHandle( nullptr ), + m_type_Exception( nullptr ), + m_type_RuntimeException( nullptr ), + m_incomplete_ifaces( gcnew ::System::Collections::Hashtable() ), + m_incomplete_structs( gcnew ::System::Collections::Hashtable() ), + m_incomplete_services(gcnew ::System::Collections::Hashtable() ), + m_incomplete_singletons(gcnew ::System::Collections::Hashtable() ), + m_generated_structs( gcnew ::System::Collections::Hashtable() ) { - ::System::Type * param_types[] = new ::System::Type * [ 1 ]; - param_types[ 0 ] = __typeof (::System::RuntimeTypeHandle); + array< ::System::Type^>^ param_types = gcnew array< ::System::Type^> ( 1 ); + param_types[ 0 ] = ::System::RuntimeTypeHandle::typeid; m_method_info_Type_GetTypeFromHandle = - __typeof (::System::Type) + ::System::Type::typeid ->GetMethod( "GetTypeFromHandle", param_types ); } -::System::Collections::ArrayList * TypeEmitter::get_service_ctor_method_exceptions_reduced( +::System::Collections::ArrayList ^ TypeEmitter::get_service_ctor_method_exceptions_reduced( const Sequence<Reference<reflection::XCompoundTypeDescription> > & seqExceptionsTd) { if (seqExceptionsTd.getLength() == 0) - return new ::System::Collections::ArrayList(); + return gcnew ::System::Collections::ArrayList(); - ::System::Collections::ArrayList * arTypes = new ::System::Collections::ArrayList(); + ::System::Collections::ArrayList ^ arTypes = gcnew ::System::Collections::ArrayList(); for (int i = 0; i < seqExceptionsTd.getLength(); i++) arTypes->Add(get_type(to_cts_name(seqExceptionsTd[i]->getName()), true)); @@ -2262,10 +2251,10 @@ TypeEmitter::TypeEmitter( bool bRemove = false; for (int i = start; i < arTypes->Count; i++) { - ::System::Type * t = __try_cast< ::System::Type* >(arTypes->get_Item(i)); + ::System::Type ^ t = safe_cast< ::System::Type^ >(arTypes[i]); for (int j = 0; j < arTypes->Count; j++) { - if (t->IsSubclassOf(__try_cast< ::System::Type* >(arTypes->get_Item(j)))) + if (t->IsSubclassOf(safe_cast< ::System::Type^ >(arTypes[j]))) { arTypes->RemoveAt(i); bRemove = true; diff --git a/cli_ure/source/climaker/climaker_share.h b/cli_ure/source/climaker/climaker_share.h index 83695425b648..f70fe705d514 100644..100755 --- a/cli_ure/source/climaker/climaker_share.h +++ b/cli_ure/source/climaker/climaker_share.h @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#using <mscorlib.dll> #using <cli_basetypes.dll> #include <vcclr.h> @@ -43,59 +42,59 @@ namespace climaker //------------------------------------------------------------------------------ extern bool g_verbose; -__gc struct Constants +ref struct Constants { - static const ::System::String * sUnoVoid = S"void"; - static const ::System::String * sUnoType = S"type"; - static const ::System::String * sUnoAny = S"any"; - static const ::System::String * sUnoBool = S"boolean"; - static const ::System::String * sUnoByte = S"byte"; - static const ::System::String * sUnoChar = S"char"; - static const ::System::String * sUnoShort = S"short"; - static const ::System::String * sUnoUShort = S"unsigned short"; - static const ::System::String * sUnoLong = S"long"; - static const ::System::String * sUnoULong = S"unsigned long"; - static const ::System::String * sUnoHyper = S"hyper"; - static const ::System::String * sUnoUHyper = S"unsigned hyper"; - static const ::System::String * sUnoString = S"string"; - static const ::System::String * sUnoFloat = S"float"; - static const ::System::String * sUnoDouble = S"double"; - static const ::System::String * sUnoXInterface = S"com.sun.star.uno.XInterface"; - static const ::System::String * sBrackets = S"[]"; - - static const System::String* sObject = S"System.Object"; - static const System::String* sType = S"System.Type"; - static const System::String* sUnoidl = S"unoidl."; - static const System::String* sVoid = S"System.Void"; - static const System::String* sAny = S"uno.Any"; - static const System::String* sBoolean = S"System.Boolean"; - static const System::String* sChar = S"System.Char"; - static const System::String* sByte = S"System.Byte"; - static const System::String* sInt16 = S"System.Int16"; - static const System::String* sUInt16 = S"System.UInt16"; - static const System::String* sInt32 = S"System.Int32"; - static const System::String* sUInt32 = S"System.UInt32"; - static const System::String* sInt64 = S"System.Int64"; - static const System::String* sUInt64 = S"System.UInt64"; - static const System::String* sString = S"System.String"; - static const System::String* sSingle = S"System.Single"; - static const System::String* sDouble = S"System.Double"; - static const System::String* sComma = new System::String(S","); + static ::System::String ^ sUnoVoid = "void"; + static ::System::String ^ sUnoType = "type"; + static ::System::String ^ sUnoAny = "any"; + static ::System::String ^ sUnoBool = "boolean"; + static ::System::String ^ sUnoByte = "byte"; + static ::System::String ^ sUnoChar = "char"; + static ::System::String ^ sUnoShort = "short"; + static ::System::String ^ sUnoUShort = "unsigned short"; + static ::System::String ^ sUnoLong = "long"; + static ::System::String ^ sUnoULong = "unsigned long"; + static ::System::String ^ sUnoHyper = "hyper"; + static ::System::String ^ sUnoUHyper = "unsigned hyper"; + static ::System::String ^ sUnoString = "string"; + static ::System::String ^ sUnoFloat = "float"; + static ::System::String ^ sUnoDouble = "double"; + static ::System::String ^ sUnoXInterface = "com.sun.star.uno.XInterface"; + static ::System::String ^ sBrackets = "[]"; + + static System::String^ sObject = "System.Object"; + static System::String^ sType = "System.Type"; + static System::String^ sUnoidl = "unoidl."; + static System::String^ sVoid = "System.Void"; + static System::String^ sAny = "uno.Any"; + static System::String^ sBoolean = "System.Boolean"; + static System::String^ sChar = "System.Char"; + static System::String^ sByte = "System.Byte"; + static System::String^ sInt16 = "System.Int16"; + static System::String^ sUInt16 = "System.UInt16"; + static System::String^ sInt32 = "System.Int32"; + static System::String^ sUInt32 = "System.UInt32"; + static System::String^ sInt64 = "System.Int64"; + static System::String^ sUInt64 = "System.UInt64"; + static System::String^ sString = "System.String"; + static System::String^ sSingle = "System.Single"; + static System::String^ sDouble = "System.Double"; + static System::String^ sComma = gcnew System::String(","); }; //------------------------------------------------------------------------------ -inline ::System::String * ustring_to_String( ::rtl::OUString const & ustr ) +inline ::System::String ^ ustring_to_String( ::rtl::OUString const & ustr ) { - return new ::System::String( ustr.getStr(), 0, ustr.getLength() ); + return gcnew ::System::String( ustr.getStr(), 0, ustr.getLength() ); } //------------------------------------------------------------------------------ -inline ::rtl::OUString String_to_ustring( ::System::String * str ) +inline ::rtl::OUString String_to_ustring( ::System::String ^ str ) { OSL_ASSERT( sizeof (wchar_t) == sizeof (sal_Unicode) ); - wchar_t const __pin * chars = PtrToStringChars( str ); - return ::rtl::OUString( chars, str->get_Length() ); + pin_ptr<const wchar_t> chars = PtrToStringChars( str ); + return ::rtl::OUString( chars, str->Length ); } /* If the argument type is a typedef for an interface then the interface @@ -104,7 +103,7 @@ inline ::rtl::OUString String_to_ustring( ::System::String * str ) css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > resolveInterfaceTypedef(const css::uno::Reference<css::reflection::XTypeDescription>& type); -const ::System::Reflection::MethodAttributes c_ctor_method_attr = +static ::System::Reflection::MethodAttributes c_ctor_method_attr = (::System::Reflection::MethodAttributes) (::System::Reflection::MethodAttributes::Public | ::System::Reflection::MethodAttributes::HideBySig | @@ -114,23 +113,23 @@ const ::System::Reflection::MethodAttributes c_ctor_method_attr = ::System::Reflection::MethodAttributes::Instance*/); //============================================================================== -__gc class TypeEmitter : public ::System::IDisposable +ref class TypeEmitter : public ::System::IDisposable { - ::System::Reflection::Emit::ModuleBuilder * m_module_builder; - ::System::Reflection::Assembly * m_extra_assemblies __gc []; + ::System::Reflection::Emit::ModuleBuilder ^ m_module_builder; + array< ::System::Reflection::Assembly^>^ m_extra_assemblies; - ::System::Reflection::MethodInfo * m_method_info_Type_GetTypeFromHandle; + ::System::Reflection::MethodInfo ^ m_method_info_Type_GetTypeFromHandle; - ::System::Type * m_type_Exception; - ::System::Type * get_type_Exception(); - ::System::Type * m_type_RuntimeException; - ::System::Type * get_type_RuntimeException(); + ::System::Type ^ m_type_Exception; + ::System::Type ^ get_type_Exception(); + ::System::Type ^ m_type_RuntimeException; + ::System::Type ^ get_type_RuntimeException(); - ::System::Reflection::Emit::CustomAttributeBuilder* get_service_exception_attribute( + ::System::Reflection::Emit::CustomAttributeBuilder^ get_service_exception_attribute( const css::uno::Reference<css::reflection::XServiceConstructorDescription> & ctorDesc); - ::System::Reflection::Emit::CustomAttributeBuilder* get_iface_method_exception_attribute( + ::System::Reflection::Emit::CustomAttributeBuilder^ get_iface_method_exception_attribute( const css::uno::Reference< css::reflection::XInterfaceMethodTypeDescription >& xMethod ); - ::System::Reflection::Emit::CustomAttributeBuilder* get_exception_attribute( + ::System::Reflection::Emit::CustomAttributeBuilder^ get_exception_attribute( const css::uno::Sequence<css::uno::Reference< css::reflection::XCompoundTypeDescription > >& seq_exceptionsTd ); /* Creates ::System::Type object for UNO exceptions. The UNO exceptions are @@ -147,34 +146,34 @@ __gc class TypeEmitter : public ::System::IDisposable It is always an instance of an ArrayList returned, even if the sequence argument does not contain elements. */ - ::System::Collections::ArrayList * get_service_ctor_method_exceptions_reduced( + ::System::Collections::ArrayList ^ get_service_ctor_method_exceptions_reduced( const css::uno::Sequence< css::uno::Reference<css::reflection::XCompoundTypeDescription> > & seqExceptionsTd); - __gc class iface_entry + ref class iface_entry { public: css::reflection::XInterfaceTypeDescription2 * m_xType; - ::System::Reflection::Emit::TypeBuilder * m_type_builder; + ::System::Reflection::Emit::TypeBuilder ^ m_type_builder; }; - ::System::Collections::Hashtable * m_incomplete_ifaces; - ::System::Type * complete_iface_type( iface_entry * entry ); + ::System::Collections::Hashtable ^ m_incomplete_ifaces; + ::System::Type ^ complete_iface_type( iface_entry ^ entry ); - __gc class struct_entry + ref class struct_entry { public: css::reflection::XCompoundTypeDescription * m_xType; - ::System::Reflection::Emit::TypeBuilder * m_type_builder; - ::System::Type * m_base_type; + ::System::Reflection::Emit::TypeBuilder ^ m_type_builder; + ::System::Type ^ m_base_type; - ::System::String * m_member_names __gc []; - ::System::Type * m_param_types __gc []; - ::System::Reflection::ConstructorInfo * m_default_ctor; - ::System::Reflection::ConstructorInfo * m_ctor; + array< ::System::String^>^ m_member_names; + array< ::System::Type^>^ m_param_types; + ::System::Reflection::ConstructorInfo ^ m_default_ctor; + ::System::Reflection::ConstructorInfo ^ m_ctor; }; - ::System::Collections::Hashtable * m_incomplete_structs; - ::System::Type * complete_struct_type( struct_entry * entry ); + ::System::Collections::Hashtable ^ m_incomplete_structs; + ::System::Type ^ complete_struct_type( struct_entry ^ entry ); /* returns the type for the name. If it is a struct then it may complete the struct if not already done. This also refers to its @@ -184,53 +183,53 @@ __gc class TypeEmitter : public ::System::IDisposable the full name of the type. @return the type object for sName. Not necessarily a struct. */ - ::System::Type * get_complete_struct( ::System::String * sName); + ::System::Type ^ get_complete_struct( ::System::String ^ sName); - __gc class service_entry + ref class service_entry { public: - ::System::Reflection::Emit::TypeBuilder * m_type_builder; + ::System::Reflection::Emit::TypeBuilder ^ m_type_builder; css::reflection::XServiceTypeDescription2 * m_xType; }; - ::System::Collections::Hashtable * m_incomplete_services; - ::System::Type * complete_service_type(service_entry * entry); + ::System::Collections::Hashtable ^ m_incomplete_services; + ::System::Type ^ complete_service_type(service_entry ^ entry); - __gc class singleton_entry + ref class singleton_entry { public: - ::System::Reflection::Emit::TypeBuilder * m_type_builder; + ::System::Reflection::Emit::TypeBuilder ^ m_type_builder; css::reflection::XSingletonTypeDescription2 * m_xType; }; - ::System::Collections::Hashtable * m_incomplete_singletons; - ::System::Type * complete_singleton_type(singleton_entry * entry); + ::System::Collections::Hashtable ^ m_incomplete_singletons; + ::System::Type ^ complete_singleton_type(singleton_entry ^ entry); - ::System::Collections::Hashtable * m_generated_structs; + ::System::Collections::Hashtable ^ m_generated_structs; - ::System::Type * get_type( - ::System::String * cli_name, bool throw_exc ); - ::System::Type * get_type( + ::System::Type ^ get_type( + ::System::String ^ cli_name, bool throw_exc ); + ::System::Type ^ get_type( css::uno::Reference< css::reflection::XConstantTypeDescription > const & xType ); - ::System::Type * get_type( + ::System::Type ^ get_type( css::uno::Reference< css::reflection::XConstantsTypeDescription > const & xType ); - ::System::Type * get_type( + ::System::Type ^ get_type( css::uno::Reference< css::reflection::XEnumTypeDescription > const & xType ); /* returns the type for a struct or exception. In case of a polymorphic struct it may return a ::uno::PolymorphicType (cli_basetypes.dll) only if the struct is already complete. */ - ::System::Type * get_type( + ::System::Type ^ get_type( css::uno::Reference< css::reflection::XCompoundTypeDescription > const & xType ); - ::System::Type * get_type( + ::System::Type ^ get_type( css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > const & xType ); - ::System::Type * get_type( + ::System::Type ^ get_type( css::uno::Reference< css::reflection::XSingletonTypeDescription2 > const & xType ); @@ -239,20 +238,20 @@ __gc class TypeEmitter : public ::System::IDisposable description of com.sun.star.reflection.XServiceTypeDescription2.isSingleInterfaceBased */ - ::System::Type * get_type( + ::System::Type ^ get_type( css::uno::Reference< css::reflection::XServiceTypeDescription2 > const & xType ); public: TypeEmitter( - ::System::Reflection::Emit::ModuleBuilder * module_builder, - ::System::Reflection::Assembly * assemblies __gc [] ); + ::System::Reflection::Emit::ModuleBuilder ^ module_builder, + array< ::System::Reflection::Assembly^>^ assemblies ); // must be called to finish up uncompleted types - void Dispose(); + ~TypeEmitter(); - ::System::Reflection::Assembly * type_resolve( - ::System::Object * sender, ::System::ResolveEventArgs * args ); + ::System::Reflection::Assembly ^ type_resolve( + ::System::Object ^ sender, ::System::ResolveEventArgs ^ args ); - ::System::Type * get_type( + ::System::Type ^ get_type( css::uno::Reference< css::reflection::XTypeDescription > const & xType ); }; diff --git a/cli_ure/source/climaker/makefile.mk b/cli_ure/source/climaker/makefile.mk index 9dc51b001164..f151987dc0f0 100644 --- a/cli_ure/source/climaker/makefile.mk +++ b/cli_ure/source/climaker/makefile.mk @@ -71,7 +71,7 @@ CFLAGSCXX +=-AI$(BIN) # When compiling for CLR, disable "warning C4339: use of undefined type detected # in CLR meta-data - use of this type may lead to a runtime exception": -CFLAGSCXX += -clr:oldSyntax -LN -wd4339 -wd4715 +CFLAGSCXX += -clr -LN -wd4339 -wd4715 OBJFILES = \ $(OBJ)$/climaker_app.obj \ |