summaryrefslogtreecommitdiff
path: root/cli_ure
diff options
context:
space:
mode:
authorKrisztian Pinter <pin.terminator@gmail.com>2015-03-28 05:18:46 +0000
committerNoel Grandin <noelgrandin@gmail.com>2015-03-30 09:55:37 +0000
commitf863d2602fca7d180f49cc4b6fb1bdba57e6a012 (patch)
tree82cee740e5dd30d5e2d79771571e67804736da06 /cli_ure
parent25c5bf88255fa02c1dab515dfb95736826f7b326 (diff)
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@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'cli_ure')
-rw-r--r--cli_ure/source/climaker/climaker_app.cxx7
-rw-r--r--cli_ure/source/climaker/climaker_emit.cxx5
-rw-r--r--cli_ure/source/uno_bridge/cli_data.cxx104
-rw-r--r--cli_ure/source/uno_bridge/cli_proxy.cxx36
-rw-r--r--cli_ure/source/uno_bridge/cli_uno.cxx6
5 files changed, 35 insertions, 123 deletions
diff --git a/cli_ure/source/climaker/climaker_app.cxx b/cli_ure/source/climaker/climaker_app.cxx
index 42381ad6e477..efff92ded838 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 8706c3c91a39..51bed9ab4ac0 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 3efd7a426a52..68cd3aa20936 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 c5734c1af935..90add1df52b1 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 aa1a1a03a0ca..82c4f818757d 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