summaryrefslogtreecommitdiff
path: root/cli_ure/source/uno_bridge/cli_uno.cxx
diff options
context:
space:
mode:
authorPeter Foley <pefoley2@verizon.net>2012-08-27 15:28:23 -0400
committerDavid Tardon <dtardon@redhat.com>2012-10-07 10:42:14 +0200
commit4b56d82c7d20ba5897d87aaf7fc94da5356b8eec (patch)
treecf07b915fb3a6c76b992b28cdeeddeb346bad888 /cli_ure/source/uno_bridge/cli_uno.cxx
parentb5bc77572338d04f8ff165ca85111096ce1d4804 (diff)
convert uno_bridge to new syntax
Change-Id: Iac5e9a860f7ef68104c4cfc19abe686b754190af
Diffstat (limited to 'cli_ure/source/uno_bridge/cli_uno.cxx')
-rw-r--r--cli_ure/source/uno_bridge/cli_uno.cxx42
1 files changed, 22 insertions, 20 deletions
diff --git a/cli_ure/source/uno_bridge/cli_uno.cxx b/cli_ure/source/uno_bridge/cli_uno.cxx
index d16668a09e6d..0ada41d9fd30 100644
--- a/cli_ure/source/uno_bridge/cli_uno.cxx
+++ b/cli_ure/source/uno_bridge/cli_uno.cxx
@@ -38,12 +38,12 @@ union largest
uno_Any a;
};
-System::Object* Bridge::call_uno(uno_Interface * pUnoI,
+System::Object^ Bridge::call_uno(uno_Interface * pUnoI,
typelib_TypeDescription* member_td,
typelib_TypeDescriptionReference * return_type,
sal_Int32 nParams, typelib_MethodParameter const * pParams,
- System::Object * args[], System::Type* argTypes[],
- System::Object** ppExc) const
+ array<System::Object^>^ args, array<System::Type^>^ argTypes,
+ System::Object^* ppExc) const
{
// return mem
sal_Int32 return_size = sizeof (largest);
@@ -133,9 +133,10 @@ System::Object* Bridge::call_uno(uno_Interface * pUnoI,
{
try
{
+ pin_ptr<System::Object^> ptr = &args[nPos];
map_to_cli(
- &args[nPos], uno_args[nPos], param.pTypeRef,
- argTypes != NULL ? argTypes[nPos] : NULL, false );
+ ptr, uno_args[nPos], param.pTypeRef,
+ argTypes != nullptr ? argTypes[nPos] : nullptr, false );
}
catch (...)
{
@@ -163,9 +164,9 @@ System::Object* Bridge::call_uno(uno_Interface * pUnoI,
// convert uno return value
try
{
- System::Object* cli_ret;
+ System::Object^ cli_ret;
map_to_cli(
- &cli_ret, uno_ret, return_type, 0, false);
+ &cli_ret, uno_ret, return_type, nullptr, false);
uno_type_destructData(uno_ret, return_type, 0);
return cli_ret;
}
@@ -175,7 +176,7 @@ System::Object* Bridge::call_uno(uno_Interface * pUnoI,
throw;
}
}
- return 0; // void return
+ return nullptr; // void return
}
else // exception occurred
{
@@ -189,36 +190,37 @@ System::Object* Bridge::call_uno(uno_Interface * pUnoI,
}
}
map_to_cli(ppExc, uno_exc_holder.pData,
- uno_exc_holder.pType, NULL, false);
- return 0;
+ uno_exc_holder.pType, nullptr, false);
+ return nullptr;
}
}
void Bridge::call_cli(
- System::Object* cliI,
- sr::MethodInfo* method,
+ System::Object^ cliI,
+ sr::MethodInfo^ method,
typelib_TypeDescriptionReference * return_type,
typelib_MethodParameter * params, int nParams,
void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) const
{
- System::Object *args[]= new System::Object*[nParams];
+ array<System::Object^>^ args= gcnew array<System::Object^>(nParams);
for (int nPos= 0; nPos < nParams; nPos++)
{
typelib_MethodParameter const & param= params[nPos];
if (param.bIn)
{
- map_to_cli( &args[nPos],
- uno_args[nPos], param.pTypeRef, 0, false);
+ pin_ptr<System::Object^> ptr = &args[nPos];
+ map_to_cli( ptr,
+ uno_args[nPos], param.pTypeRef, nullptr, false);
}
}
- System::Object* retInvoke= NULL;
+ System::Object^ retInvoke= nullptr;
try
{
retInvoke= method->Invoke(cliI, args);
}
- catch (sr::TargetInvocationException* e)
+ catch (sr::TargetInvocationException^ e)
{
- System::Exception* exc= e->get_InnerException();
+ System::Exception^ exc= e->InnerException;
css::uno::TypeDescription td(mapCliType(exc->GetType()));
// memory for exception
std::auto_ptr< rtl_mem > memExc(rtl_mem::allocate(td.get()->nSize));
@@ -227,13 +229,13 @@ void Bridge::call_cli(
(*uno_exc)->pData= memExc.release();
return;
}
- catch (System::Exception* e)
+ catch (System::Exception^ e)
{
OUStringBuffer buf( 128 );
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(
"Unexspected exception during invocation of cli object. "
"Original message is: \n") );
- buf.append(mapCliString(e->get_Message()));
+ buf.append(mapCliString(e->Message));
throw BridgeRuntimeError( buf.makeStringAndClear() );
}