Kaydet (Commit) a4df4e91 authored tarafından Peter Foley's avatar Peter Foley Kaydeden (comit) David Tardon

convert cli_ure/source/native to new syntax

Change-Id: I7dbb065c8b1b2fef85e6e7f42ef80991102785e0
üst 1eec5566
...@@ -13,7 +13,7 @@ $(eval $(call gb_Library_Library,cli_cppuhelper_native)) ...@@ -13,7 +13,7 @@ $(eval $(call gb_Library_Library,cli_cppuhelper_native))
# in CLR meta-data - use of this type may lead to a runtime exception": # in CLR meta-data - use of this type may lead to a runtime exception":
$(eval $(call gb_Library_add_cxxflags,cli_cppuhelper_native,\ $(eval $(call gb_Library_add_cxxflags,cli_cppuhelper_native,\
-AI $(gb_Helper_OUTDIRLIBDIR) \ -AI $(gb_Helper_OUTDIRLIBDIR) \
-clr:oldSyntax \ -clr \
-wd4339 \ -wd4339 \
)) ))
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#using <mscorlib.dll>
[assembly:System::Reflection::AssemblyProduct( "CLI-UNO Language Binding" )]; [assembly:System::Reflection::AssemblyProduct( "CLI-UNO Language Binding" )];
[assembly:System::Reflection::AssemblyDescription( "CLI-UNO Helper Library" )]; [assembly:System::Reflection::AssemblyDescription( "CLI-UNO Helper Library" )];
[assembly:System::Reflection::AssemblyDelaySign(true)]; [assembly:System::Reflection::AssemblyDelaySign(true)];
......
...@@ -315,7 +315,7 @@ namespace util ...@@ -315,7 +315,7 @@ namespace util
These contain a named value UREINSTALLLOCATION which holds a path to the URE These contain a named value UREINSTALLLOCATION which holds a path to the URE
installation folder. installation folder.
*/ */
public __sealed __gc class Bootstrap public ref class Bootstrap sealed
{ {
inline Bootstrap() {} inline Bootstrap() {}
...@@ -325,7 +325,7 @@ public: ...@@ -325,7 +325,7 @@ public:
@see cppuhelper/bootstrap.hxx:defaultBootstrap_InitialComponentContext() @see cppuhelper/bootstrap.hxx:defaultBootstrap_InitialComponentContext()
*/ */
static ::unoidl::com::sun::star::uno::XComponentContext * static ::unoidl::com::sun::star::uno::XComponentContext ^
defaultBootstrap_InitialComponentContext(); defaultBootstrap_InitialComponentContext();
/** Bootstraps the initial component context from a native UNO installation. /** Bootstraps the initial component context from a native UNO installation.
...@@ -338,37 +338,37 @@ public: ...@@ -338,37 +338,37 @@ public:
@see cppuhelper/bootstrap.hxx:defaultBootstrap_InitialComponentContext() @see cppuhelper/bootstrap.hxx:defaultBootstrap_InitialComponentContext()
*/ */
static ::unoidl::com::sun::star::uno::XComponentContext * static ::unoidl::com::sun::star::uno::XComponentContext ^
defaultBootstrap_InitialComponentContext( defaultBootstrap_InitialComponentContext(
::System::String * ini_file, ::System::String ^ ini_file,
::System::Collections::IDictionaryEnumerator * ::System::Collections::IDictionaryEnumerator ^
bootstrap_parameters ); bootstrap_parameters );
/** Bootstraps the initial component context from a native UNO installation. /** Bootstraps the initial component context from a native UNO installation.
@see cppuhelper/bootstrap.hxx:bootstrap() @see cppuhelper/bootstrap.hxx:bootstrap()
*/ */
static ::unoidl::com::sun::star::uno::XComponentContext * static ::unoidl::com::sun::star::uno::XComponentContext ^
bootstrap(); bootstrap();
}; };
//______________________________________________________________________________ //______________________________________________________________________________
::unoidl::com::sun::star::uno::XComponentContext * ::unoidl::com::sun::star::uno::XComponentContext ^
Bootstrap::defaultBootstrap_InitialComponentContext( Bootstrap::defaultBootstrap_InitialComponentContext(
::System::String * ini_file, ::System::String ^ ini_file,
::System::Collections::IDictionaryEnumerator * bootstrap_parameters ) ::System::Collections::IDictionaryEnumerator ^ bootstrap_parameters )
{ {
if (0 != bootstrap_parameters) if (nullptr != bootstrap_parameters)
{ {
bootstrap_parameters->Reset(); bootstrap_parameters->Reset();
while (bootstrap_parameters->MoveNext()) while (bootstrap_parameters->MoveNext())
{ {
OUString key( OUString key(
String_to_ustring( __try_cast< ::System::String * >( String_to_ustring( safe_cast< ::System::String ^ >(
bootstrap_parameters->get_Key() ) ) ); bootstrap_parameters->Key ) ) );
OUString value( OUString value(
String_to_ustring( __try_cast< ::System::String * >( String_to_ustring( safe_cast< ::System::String ^ >(
bootstrap_parameters->get_Value() ) ) ); bootstrap_parameters->Value ) ) );
::rtl::Bootstrap::set( key, value ); ::rtl::Bootstrap::set( key, value );
} }
...@@ -376,31 +376,31 @@ Bootstrap::defaultBootstrap_InitialComponentContext( ...@@ -376,31 +376,31 @@ Bootstrap::defaultBootstrap_InitialComponentContext(
// bootstrap native uno // bootstrap native uno
Reference< XComponentContext > xContext; Reference< XComponentContext > xContext;
if (0 == ini_file) if (nullptr == ini_file)
{ {
xContext = ::cppu::defaultBootstrap_InitialComponentContext(); xContext = ::cppu::defaultBootstrap_InitialComponentContext();
} }
else else
{ {
xContext = ::cppu::defaultBootstrap_InitialComponentContext( xContext = ::cppu::defaultBootstrap_InitialComponentContext(
String_to_ustring( __try_cast< ::System::String * >( ini_file ) ) ); String_to_ustring( safe_cast< ::System::String ^ >( ini_file ) ) );
} }
return __try_cast< ::unoidl::com::sun::star::uno::XComponentContext * >( return safe_cast< ::unoidl::com::sun::star::uno::XComponentContext ^ >(
to_cli( xContext ) ); to_cli( xContext ) );
} }
//______________________________________________________________________________ //______________________________________________________________________________
::unoidl::com::sun::star::uno::XComponentContext * ::unoidl::com::sun::star::uno::XComponentContext ^
Bootstrap::defaultBootstrap_InitialComponentContext() Bootstrap::defaultBootstrap_InitialComponentContext()
{ {
return defaultBootstrap_InitialComponentContext( 0, 0 ); return defaultBootstrap_InitialComponentContext( nullptr, nullptr );
} }
::unoidl::com::sun::star::uno::XComponentContext * Bootstrap::bootstrap() ::unoidl::com::sun::star::uno::XComponentContext ^ Bootstrap::bootstrap()
{ {
Reference<XComponentContext> xContext = ::cppu::bootstrap(); Reference<XComponentContext> xContext = ::cppu::bootstrap();
return __try_cast< ::unoidl::com::sun::star::uno::XComponentContext * >( return safe_cast< ::unoidl::com::sun::star::uno::XComponentContext ^ >(
to_cli( xContext ) ); to_cli( xContext ) );
} }
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#using <mscorlib.dll>
#using "cli_ure.dll" #using "cli_ure.dll"
#using "cli_uretypes.dll" #using "cli_uretypes.dll"
...@@ -35,20 +34,20 @@ namespace util ...@@ -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) ); OSL_ASSERT( sizeof (wchar_t) == sizeof (sal_Unicode) );
wchar_t const __pin * chars = PtrToStringChars( str ); pin_ptr<wchar_t const> chars = PtrToStringChars( str );
return ::rtl::OUString( chars, str->get_Length() ); return ::rtl::OUString( chars, str->Length );
} }
template< typename T > 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::Reference< T > const & x )
{ {
::com::sun::star::uno::Mapping mapping( ::com::sun::star::uno::Mapping mapping(
...@@ -65,16 +64,15 @@ inline ::System::Object * to_cli( ...@@ -65,16 +64,15 @@ inline ::System::Object * to_cli(
intptr_t intptr = intptr_t intptr =
reinterpret_cast< intptr_t >( reinterpret_cast< intptr_t >(
mapping.mapInterface( x.get(), ::getCppuType( &x ) ) ); mapping.mapInterface( x.get(), ::getCppuType( &x ) ) );
::System::Runtime::InteropServices::GCHandle handle( ::System::Runtime::InteropServices::GCHandle ^ handle = (::System::Runtime::InteropServices::GCHandle ^)(gcnew ::System::IntPtr(intptr));
::System::Runtime::InteropServices::GCHandle::op_Explicit( intptr ) ); ::System::Object ^ ret = handle->Target;
::System::Object * ret = handle.get_Target(); handle->Free();
handle.Free();
return ret; return ret;
} }
template< typename T > template< typename T >
inline void to_uno( 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( ::com::sun::star::uno::Mapping mapping(
OUSTR(UNO_LB_CLI), OUSTR(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ); OUSTR(UNO_LB_CLI), OUSTR(CPPU_CURRENT_LANGUAGE_BINDING_NAME) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment