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))
# in CLR meta-data - use of this type may lead to a runtime exception":
$(eval $(call gb_Library_add_cxxflags,cli_cppuhelper_native,\
-AI $(gb_Helper_OUTDIRLIBDIR) \
-clr:oldSyntax \
-clr \
-wd4339 \
))
......
......@@ -17,8 +17,6 @@
* 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::AssemblyDescription( "CLI-UNO Helper Library" )];
[assembly:System::Reflection::AssemblyDelaySign(true)];
......
......@@ -315,7 +315,7 @@ namespace util
These contain a named value UREINSTALLLOCATION which holds a path to the URE
installation folder.
*/
public __sealed __gc class Bootstrap
public ref class Bootstrap sealed
{
inline Bootstrap() {}
......@@ -325,7 +325,7 @@ public:
@see cppuhelper/bootstrap.hxx:defaultBootstrap_InitialComponentContext()
*/
static ::unoidl::com::sun::star::uno::XComponentContext *
static ::unoidl::com::sun::star::uno::XComponentContext ^
defaultBootstrap_InitialComponentContext();
/** Bootstraps the initial component context from a native UNO installation.
......@@ -338,37 +338,37 @@ public:
@see cppuhelper/bootstrap.hxx:defaultBootstrap_InitialComponentContext()
*/
static ::unoidl::com::sun::star::uno::XComponentContext *
static ::unoidl::com::sun::star::uno::XComponentContext ^
defaultBootstrap_InitialComponentContext(
::System::String * ini_file,
::System::Collections::IDictionaryEnumerator *
::System::String ^ ini_file,
::System::Collections::IDictionaryEnumerator ^
bootstrap_parameters );
/** Bootstraps the initial component context from a native UNO installation.
@see cppuhelper/bootstrap.hxx:bootstrap()
*/
static ::unoidl::com::sun::star::uno::XComponentContext *
static ::unoidl::com::sun::star::uno::XComponentContext ^
bootstrap();
};
//______________________________________________________________________________
::unoidl::com::sun::star::uno::XComponentContext *
::unoidl::com::sun::star::uno::XComponentContext ^
Bootstrap::defaultBootstrap_InitialComponentContext(
::System::String * ini_file,
::System::Collections::IDictionaryEnumerator * bootstrap_parameters )
::System::String ^ ini_file,
::System::Collections::IDictionaryEnumerator ^ bootstrap_parameters )
{
if (0 != bootstrap_parameters)
if (nullptr != bootstrap_parameters)
{
bootstrap_parameters->Reset();
while (bootstrap_parameters->MoveNext())
{
OUString key(
String_to_ustring( __try_cast< ::System::String * >(
bootstrap_parameters->get_Key() ) ) );
String_to_ustring( safe_cast< ::System::String ^ >(
bootstrap_parameters->Key ) ) );
OUString value(
String_to_ustring( __try_cast< ::System::String * >(
bootstrap_parameters->get_Value() ) ) );
String_to_ustring( safe_cast< ::System::String ^ >(
bootstrap_parameters->Value ) ) );
::rtl::Bootstrap::set( key, value );
}
......@@ -376,31 +376,31 @@ Bootstrap::defaultBootstrap_InitialComponentContext(
// bootstrap native uno
Reference< XComponentContext > xContext;
if (0 == ini_file)
if (nullptr == ini_file)
{
xContext = ::cppu::defaultBootstrap_InitialComponentContext();
}
else
{
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 ) );
}
//______________________________________________________________________________
::unoidl::com::sun::star::uno::XComponentContext *
::unoidl::com::sun::star::uno::XComponentContext ^
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();
return __try_cast< ::unoidl::com::sun::star::uno::XComponentContext * >(
return safe_cast< ::unoidl::com::sun::star::uno::XComponentContext ^ >(
to_cli( xContext ) );
}
......
......@@ -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) );
......
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