summaryrefslogtreecommitdiff
path: root/cli_ure
diff options
context:
space:
mode:
authorDaniel Boelzle <dbo@openoffice.org>2003-04-11 16:08:46 +0000
committerDaniel Boelzle <dbo@openoffice.org>2003-04-11 16:08:46 +0000
commitf405a5e9f08e23e768b2e074b5f007813190697e (patch)
tree358d8157ea587b834bee2640db0065c5249ab2c3 /cli_ure
parent4a6534d5aee13ff29b7dc9d36ae08d3e425831b8 (diff)
#107130# minor changes
Diffstat (limited to 'cli_ure')
-rw-r--r--cli_ure/source/native/native_share.h34
1 files changed, 25 insertions, 9 deletions
diff --git a/cli_ure/source/native/native_share.h b/cli_ure/source/native/native_share.h
index 4f9f6652f96c..0f594ed5b5c7 100644
--- a/cli_ure/source/native/native_share.h
+++ b/cli_ure/source/native/native_share.h
@@ -2,9 +2,9 @@
*
* $RCSfile: native_share.h,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dbo $ $Date: 2003-04-07 09:40:43 $
+ * last change: $Author: dbo $ $Date: 2003-04-11 17:08:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -89,18 +89,24 @@ inline ::rtl::OUString String_to_ustring( ::System::String * str )
return ::rtl::OUString( chars, str->get_Length() );
}
-//------------------------------------------------------------------------------
-::com::sun::star::uno::Mapping const & get_uno_to_cli();
-//------------------------------------------------------------------------------
-::com::sun::star::uno::Mapping const & get_cli_to_uno();
-
template< typename T >
inline ::System::Object * to_cli(
::com::sun::star::uno::Reference< T > const & x )
{
+ ::com::sun::star::uno::Mapping mapping(
+ OUSTR(CPPU_CURRENT_LANGUAGE_BINDING_NAME), OUSTR(UNO_LB_CLI) );
+ OSL_ASSERT( mapping.is() );
+ if (! mapping.is())
+ {
+ throw ::com::sun::star::uno::RuntimeException(
+ OUSTR("cannot get mapping from C++ to CLI!"),
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >() );
+ }
+
intptr_t intptr =
reinterpret_cast< intptr_t >(
- get_uno_to_cli().mapInterface( x.get(), ::getCppuType( &x ) ) );
+ mapping.mapInterface( x.get(), ::getCppuType( &x ) ) );
::System::Runtime::InteropServices::GCHandle handle(
::System::Runtime::InteropServices::GCHandle::op_Explicit( intptr ) );
::System::Object * ret = handle.get_Target();
@@ -112,7 +118,17 @@ template< typename T >
inline void to_uno(
::com::sun::star::uno::Reference< T > * pRet, ::System::Object * x )
{
- ::com::sun::star::uno::Mapping const & mapping = get_cli_to_uno();
+ ::com::sun::star::uno::Mapping mapping(
+ OUSTR(UNO_LB_CLI), OUSTR(CPPU_CURRENT_LANGUAGE_BINDING_NAME) );
+ OSL_ASSERT( mapping.is() );
+ if (! mapping.is())
+ {
+ throw ::com::sun::star::uno::RuntimeException(
+ OUSTR("cannot get mapping from CLI to C++!"),
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >() );
+ }
+
::System::Runtime::InteropServices::GCHandle handle(
::System::Runtime::InteropServices::GCHandle::Alloc( x ) );
T * ret = 0;