diff options
Diffstat (limited to 'cli_ure/source/native/native_share.h')
-rw-r--r-- | cli_ure/source/native/native_share.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/cli_ure/source/native/native_share.h b/cli_ure/source/native/native_share.h index 8b24e1f5bbf6..23977dfb0f00 100644 --- a/cli_ure/source/native/native_share.h +++ b/cli_ure/source/native/native_share.h @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#using <mscorlib.dll> #using "cli_ure.dll" #using "cli_uretypes.dll" @@ -35,20 +34,20 @@ namespace util { //------------------------------------------------------------------------------ -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<wchar_t const> chars = PtrToStringChars( str ); + return ::rtl::OUString( chars, str->Length ); } template< typename T > -inline ::System::Object * to_cli( +inline ::System::Object ^ to_cli( ::com::sun::star::uno::Reference< T > const & x ) { ::com::sun::star::uno::Mapping mapping( @@ -65,16 +64,15 @@ inline ::System::Object * to_cli( intptr_t intptr = reinterpret_cast< intptr_t >( mapping.mapInterface( x.get(), ::getCppuType( &x ) ) ); - ::System::Runtime::InteropServices::GCHandle handle( - ::System::Runtime::InteropServices::GCHandle::op_Explicit( intptr ) ); - ::System::Object * ret = handle.get_Target(); - handle.Free(); + ::System::Runtime::InteropServices::GCHandle ^ handle = (::System::Runtime::InteropServices::GCHandle ^)(gcnew ::System::IntPtr(intptr)); + ::System::Object ^ ret = handle->Target; + handle->Free(); return ret; } template< typename T > inline void to_uno( - ::com::sun::star::uno::Reference< T > * pRet, ::System::Object * x ) + ::com::sun::star::uno::Reference< T > * pRet, ::System::Object ^ x ) { ::com::sun::star::uno::Mapping mapping( OUSTR(UNO_LB_CLI), OUSTR(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ); |