[Libreoffice-commits] core.git: cli_ure/source
Krisztian Pinter
pin.terminator at gmail.com
Mon Mar 30 02:56:07 PDT 2015
cli_ure/source/climaker/climaker_app.cxx | 7 --
cli_ure/source/climaker/climaker_emit.cxx | 5 -
cli_ure/source/uno_bridge/cli_data.cxx | 104 +++++++-----------------------
cli_ure/source/uno_bridge/cli_proxy.cxx | 36 ++--------
cli_ure/source/uno_bridge/cli_uno.cxx | 6 -
5 files changed, 35 insertions(+), 123 deletions(-)
New commits:
commit f863d2602fca7d180f49cc4b6fb1bdba57e6a012
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date: Sat Mar 28 05:18:46 2015 +0000
fdo#57950 Replace chained append() with operator+
Replaced all in cli_ure
Change-Id: I144542f386fe26444c290edd9e23b26cb07941a6
Reviewed-on: https://gerrit.libreoffice.org/15040
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/cli_ure/source/climaker/climaker_app.cxx b/cli_ure/source/climaker/climaker_app.cxx
index 42381ad..efff92d 100644
--- a/cli_ure/source/climaker/climaker_app.cxx
+++ b/cli_ure/source/climaker/climaker_app.cxx
@@ -368,12 +368,7 @@ SAL_IMPLEMENT_MAIN()
}
if (option_info == 0)
{
- OUStringBuffer buf;
- buf.append("unknown option ");
- buf.append( cmd_arg );
- buf.append( "! Use climaker --help to print all options." );
- throw RuntimeException(
- buf.makeStringAndClear() );
+ throw RuntimeException("unknown option " + cmd_arg + "! Use climaker --help to print all options.");
}
else
{
diff --git a/cli_ure/source/climaker/climaker_emit.cxx b/cli_ure/source/climaker/climaker_emit.cxx
index 8706c3c..51bed9a 100644
--- a/cli_ure/source/climaker/climaker_emit.cxx
+++ b/cli_ure/source/climaker/climaker_emit.cxx
@@ -41,10 +41,7 @@ System::String^ mapUnoPolymorphicName(System::String^ unoName);
static inline ::System::String ^ to_cts_name(
OUString const & uno_name )
{
- OUStringBuffer buf( 7 + uno_name.getLength() );
- buf.append( "unoidl." );
- buf.append( uno_name );
- return ustring_to_String( buf.makeStringAndClear() );
+ return ustring_to_String("unoidl." + uno_name);
}
diff --git a/cli_ure/source/uno_bridge/cli_data.cxx b/cli_ure/source/uno_bridge/cli_data.cxx
index 3efd7a4..68cd3aa 100644
--- a/cli_ure/source/uno_bridge/cli_data.cxx
+++ b/cli_ure/source/uno_bridge/cli_data.cxx
@@ -443,10 +443,7 @@ typelib_TypeDescriptionReference* mapCliType(System::Type^ cliType)
}
if (retVal == NULL)
{
- OUStringBuffer buf( 128 );
- buf.append( "[cli_uno bridge] mapCliType():could not map type: " );
- buf.append(mapCliString(cliType->FullName));
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[cli_uno bridge] mapCliType():could not map type: " + mapCliString(cliType->FullName));
}
return retVal;
}
@@ -975,11 +972,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
}
default:
{
- OUStringBuffer buf( 128 );
- buf.append( "[map_to_uno():" );
- buf.append(value_td.getTypeName());
- buf.append( "] unsupported value type of any!" );
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[map_to_uno():" + value_td.getTypeName() + "] unsupported value type of any!");
}
}
}
@@ -988,20 +981,15 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
// ToDo check this
if (assign)
uno_any_construct( pAny, 0, 0, 0 ); // restore some valid any
- OUStringBuffer buf( 256 );
- buf.append( "[map_to_uno():Any" );
- buf.append(value_td.getTypeName());
- buf.append( "]The Any type ");
- buf.append(value_td.getTypeName());
- buf.append( " does not correspond to its value type: " );
+ OUString str = "[map_to_uno():Any" + value_td.getTypeName() + "]The Any type " + value_td.getTypeName() + " does not correspond to its value type: ";
if(aAny.Value != nullptr)
{
css::uno::Type td(mapCliType(aAny.Value->GetType()), SAL_NO_ACQUIRE);
- buf.append(td.getTypeName());
+ str += td.getTypeName();
}
if (assign)
uno_any_construct( pAny, 0, 0, 0 ); // restore some valid any
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError(str);
}
catch (BridgeRuntimeError& )
{
@@ -1081,10 +1069,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
}
else
{
- OUStringBuffer buf(512);
- buf.append("[map_to_uno(): Member: ");
- buf.append(comp_td->ppMemberNames[nPos]);
- throw BridgeRuntimeError(buf.makeStringAndClear());
+ throw BridgeRuntimeError("[map_to_uno(): Member: " + *reinterpret_cast< OUString const * >(comp_td->ppMemberNames[nPos]));
}
}
else
@@ -1179,31 +1164,24 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
catch (BridgeRuntimeError& e)
{
bException= true;
- OUStringBuffer buf(512);
- buf.append("[map_to_uno():");
+ OUString str = "[map_to_uno():";
if (cliType)
{
- buf.append(mapCliString(cliType->FullName));
- buf.append(".");
- buf.append(comp_td->ppMemberNames[nPos]);
- buf.append(" ");
+ str += mapCliString(cliType->FullName) + "." + *reinterpret_cast< OUString const * >(comp_td->ppMemberNames[nPos]) + " ";
}
- buf.append(e.m_message);
- throw BridgeRuntimeError(buf.makeStringAndClear());
+ str += e.m_message;
+ throw BridgeRuntimeError(str);
}
catch (System::InvalidCastException^ )
{
bException= true;
- OUStringBuffer buf( 256 );
- buf.append( "[map_to_uno():" );
+ OUString str = "[map_to_uno():";
if (cliType)
{
- buf.append(mapCliString(cliType->FullName));
- buf.append( "." );
- buf.append(comp_td->ppMemberNames[nPos]);
+ str += mapCliString(cliType->FullName) + "." + *reinterpret_cast< OUString const * >(comp_td->ppMemberNames[nPos]);
}
- buf.append( "] Value has not the required type." );
- throw BridgeRuntimeError(buf.makeStringAndClear());
+ str += "] Value has not the required type.";
+ throw BridgeRuntimeError(str);
}
catch (...)
{
@@ -1367,33 +1345,20 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
}
default:
{
- OUStringBuffer buf( 128 );
- buf.append( "[map_to_uno():" );
- buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ) );
- buf.append( "] unsupported sequence element type: " );
- buf.append( *reinterpret_cast< OUString const * >( &element_type->pTypeName ) );
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[map_to_uno():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) +
+ "] unsupported sequence element type: " + *reinterpret_cast< OUString const * >( &element_type->pTypeName ));
}
}
}
catch (BridgeRuntimeError& e)
{
- OUStringBuffer buf( 128 );
- buf.append( "[map_to_uno():" );
- buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ));
- buf.append( "] conversion failed\n ");
- buf.append(e.m_message);
- throw BridgeRuntimeError(buf.makeStringAndClear());
+ throw BridgeRuntimeError("[map_to_uno():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) + "] conversion failed\n " + e.m_message);
}
catch (System::InvalidCastException^ )
{
// Ok, checked
- OUStringBuffer buf( 128 );
- buf.append( "[map_to_uno():" );
- buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName) );
- buf.append( "] could not convert sequence element type: " );
- buf.append( *reinterpret_cast< OUString const * >( &element_type->pTypeName ) );
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[map_to_uno():" + *reinterpret_cast< OUString const * >( &type->pTypeName) +
+ "] could not convert sequence element type: " + *reinterpret_cast< OUString const * >( &element_type->pTypeName ));
}
catch (...)
{
@@ -1436,11 +1401,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
default:
{
//ToDo check
- OUStringBuffer buf( 128 );
- buf.append( "[map_to_uno():" );
- buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ) );
- buf.append( "] unsupported type!" );
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[map_to_uno():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) + "] unsupported type!");
}
}
}
@@ -1448,18 +1409,11 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
catch (System::InvalidCastException^ )
{
//ToDo check
- OUStringBuffer buf( 128 );
- buf.append( "[map_to_uno():" );
- buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ) );
- buf.append( "] could not convert type!" );
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[map_to_uno():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) + "] could not convert type!");
}
catch (System::NullReferenceException ^ e)
{
- OUStringBuffer buf(512);
- buf.append( "[map_to_uno()] Illegal null reference passed!\n" );
- buf.append(mapCliString(e->StackTrace));
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[map_to_uno()] Illegal null reference passed!\n" + mapCliString(e->StackTrace));
}
catch (BridgeRuntimeError& )
{
@@ -1938,12 +1892,8 @@ void Bridge::map_to_cli(
}
default:
{
- OUStringBuffer buf( 128 );
- buf.append( "[map_to_cli():" );
- buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ) );
- buf.append( "] unsupported element type: " );
- buf.append( *reinterpret_cast< OUString const * >( &element_type->pTypeName ) );
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[map_to_cli():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) +
+ "] unsupported element type: " + *reinterpret_cast< OUString const * >( &element_type->pTypeName ));
}
}
break;
@@ -1964,11 +1914,7 @@ void Bridge::map_to_cli(
default:
{
//ToDo check this exception. The String is probably crippled
- OUStringBuffer buf( 128 );
- buf.append( "[map_to_cli():" );
- buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ) );
- buf.append( "] unsupported type!" );
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[map_to_cli():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) + "] unsupported type!");
}
} //switch
} // method
diff --git a/cli_ure/source/uno_bridge/cli_proxy.cxx b/cli_ure/source/uno_bridge/cli_proxy.cxx
index c5734c1..90add1d 100644
--- a/cli_ure/source/uno_bridge/cli_proxy.cxx
+++ b/cli_ure/source/uno_bridge/cli_proxy.cxx
@@ -79,11 +79,7 @@ UnoInterfaceInfo::UnoInterfaceInfo(Bridge const * bridge, uno_Interface* unoI,
sal_Bool bComplete = ::typelib_typedescription_complete( & _pt);
if( ! bComplete)
{
- OUStringBuffer buf( 128 );
- buf.append( "cannot make type complete: " );
- buf.append( *reinterpret_cast< OUString const * >(
- & m_typeDesc->aBase.pTypeName));
- throw BridgeRuntimeError(buf.makeStringAndClear());
+ throw BridgeRuntimeError("cannot make type complete: " + *reinterpret_cast< OUString const * >(& m_typeDesc->aBase.pTypeName));
}
}
}
@@ -198,13 +194,7 @@ void UnoInterfaceProxy::addUnoInterface(uno_Interface* pUnoI,
"id:\n\t{0}\n\t{1}"), m_oid, sInterfaceName));
// add to the string that contains all interface names
_numInterfaces++;
- OUStringBuffer buf(512);
- buf.append("\t");
- buf.append( OUString::number(_numInterfaces));
- buf.append(". ");
- buf.append(mapCliString(sInterfaceName));
- buf.append("\n");
- OUString _sNewInterface = buf.makeStringAndClear();
+ OUString _sNewInterface = "\t" + OUString::number(_numInterfaces) + ". " + mapCliString(sInterfaceName) + "\n";
pin_ptr<rtl_uString *> pp_sInterfaces = &_sInterfaces;
rtl_uString_newConcat( pp_sInterfaces, * pp_sInterfaces,
_sNewInterface.pData);
@@ -551,13 +541,9 @@ srrm::IMessage^ UnoInterfaceProxy::Invoke(srrm::IMessage^ callmsg)
}
// ToDo check if the message of the exception is not crippled
// the thing that should not be... no method info found!
- OUStringBuffer buf( 64 );
- buf.append( "[cli_uno bridge]calling undeclared function on interface " );
- buf.append( *reinterpret_cast< OUString const * >(
- & ((typelib_TypeDescription *)info->m_typeDesc)->pTypeName));
- buf.append( ": " );
- buf.append( usMethodName );
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[cli_uno bridge]calling undeclared function on interface " +
+ *reinterpret_cast< OUString const * >(& ((typelib_TypeDescription *)info->m_typeDesc)->pTypeName) +
+ ": " + usMethodName);
}
catch (BridgeRuntimeError & err)
{
@@ -750,11 +736,7 @@ void CliProxy::makeMethodInfos()
}
catch (System::InvalidCastException^ )
{
- OUStringBuffer buf( 128 );
- buf.append( "[cli_uno bridge] preparing proxy for cli interface: " );
- buf.append(mapCliString(m_type->ToString() ));
- buf.append( " \nfailed!" );
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("[cli_uno bridge] preparing proxy for cli interface: " + mapCliString(m_type->ToString()) + " \nfailed!");
}
}
@@ -814,11 +796,7 @@ sr::MethodInfo^ CliProxy::getMethodInfo(int nUnoFunctionPos,
}
if (indexCliMethod == -1)
{
- OUStringBuffer buf(256);
- buf.append( "[cli_uno bridge] CliProxy::getMethodInfo():"
- "cli object does not implement interface method: " );
- buf.append(usMethodName);
- throw BridgeRuntimeError(buf.makeStringAndClear());
+ throw BridgeRuntimeError("[cli_uno bridge] CliProxy::getMethodInfo():cli object does not implement interface method: " + usMethodName);
}
m_arUnoPosToCliPos[nUnoFunctionPos] = indexCliMethod;
ret = m_arMethodInfos[indexCliMethod];
diff --git a/cli_ure/source/uno_bridge/cli_uno.cxx b/cli_ure/source/uno_bridge/cli_uno.cxx
index aa1a1a0..82c4f81 100644
--- a/cli_ure/source/uno_bridge/cli_uno.cxx
+++ b/cli_ure/source/uno_bridge/cli_uno.cxx
@@ -230,11 +230,7 @@ void Bridge::call_cli(
}
catch (System::Exception^ e)
{
- OUStringBuffer buf( 128 );
- buf.append( "Unexpected exception during invocation of cli object. "
- "Original message is: \n" );
- buf.append(mapCliString(e->Message));
- throw BridgeRuntimeError( buf.makeStringAndClear() );
+ throw BridgeRuntimeError("Unexpected exception during invocation of cli object. Original message is: \n" + mapCliString(e->Message));
}
//convert out, in/out params
More information about the Libreoffice-commits
mailing list