From ba0a57702cdef7a0389c06841711d7e3079d471c Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Sat, 29 Jun 2013 21:24:12 +0200 Subject: remove OUString wrap for string literals For some functions and all kinds of Exceptions. CannotConvertException CloseVetoException DisposedException EmptyUndoStackException ErrorCodeIOException Exception GridInvalidDataException GridInvalidModelException IOException IllegalAccessException IllegalArgumentException IllegalTypeException IndexOutOfBoundsException NoMasterException NoSuchElementException NoSupportException PropertyVetoException RuntimeException SAXException ScannerException StorageWrappedTargetException UnsupportedFlavorException VetoException WrappedTargetException ZipIOException throwGenericSQLException throwIllegallArgumentException createInstance createInstanceWithContext forName getByName getPackageManager getPropertyValue getUnpackedValueOrDefault getValueByName hasPropertyByName openKey setName setPropertyValue supportsService bash command: for i in `cat list`; do git grep "$i\s*(\s*OUString(\s*\"" -- '*.[hc]xx' | cut -d ':' -f1 | sort -u | xargs sed -i -e "s/\(\<$i\s*(\)\s*OUString(\s*\(\"[^\")\\]*\"\)\s*)\s*/\1\2/g" -e "s/\($i.*\)\"+ /\1\" + /g"; done Change-Id: Iaf8e641b0abf28c082906014f87a183517630535 Reviewed-on: https://gerrit.libreoffice.org/4624 Tested-by: LibreOffice gerrit bot Reviewed-by: Thomas Arnhold Tested-by: Thomas Arnhold --- io/test/stm/datatest.cxx | 88 +++++++++++++++++++++++----------------------- io/test/stm/marktest.cxx | 4 +-- io/test/testconnection.cxx | 6 ++-- 3 files changed, 49 insertions(+), 49 deletions(-) (limited to 'io/test') diff --git a/io/test/stm/datatest.cxx b/io/test/stm/datatest.cxx index 96b4ef3b0f51..00eb8857db21 100644 --- a/io/test/stm/datatest.cxx +++ b/io/test/stm/datatest.cxx @@ -142,7 +142,7 @@ void ODataStreamTest::testInvariant( if( info.is() ) { ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" ); - ERROR_ASSERT( ! info->supportsService( OUString("bla bluzb") ) , "XServiceInfo test failed" ); + ERROR_ASSERT( ! info->supportsService("bla bluzb") , "XServiceInfo test failed" ); } } @@ -694,7 +694,7 @@ void OObjectStreamTest::testInvariant( const OUString& TestName, if( info.is() ) { ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" ); - ERROR_ASSERT( ! info->supportsService( OUString("bla bluzb") ) , "XServiceInfo test failed" ); + ERROR_ASSERT( ! info->supportsService("bla bluzb") , "XServiceInfo test failed" ); } } @@ -812,57 +812,57 @@ sal_Bool compareMyPropertySet( Reference< XPropertySet > &r1 , Reference < XProp { sal_Bool b = sal_True; - if( r1->getPropertyValue( OUString("long") ).getValueType() == getCppuVoidType() || - r2->getPropertyValue( OUString("long") ).getValueType() == getCppuVoidType() ) { + if( r1->getPropertyValue("long").getValueType() == getCppuVoidType() || + r2->getPropertyValue("long").getValueType() == getCppuVoidType() ) { // one of the objects is not the correct propertyset ! fprintf( stderr, "compareMyPropertySet: 1\n" ); return sal_False; } - b = b && ( r1->getPropertyValue( OUString("long") ) == - r2->getPropertyValue( OUString("long") ) ); + b = b && ( r1->getPropertyValue("long") == + r2->getPropertyValue("long") ); if( ! b ) fprintf( stderr, "compareMyPropertySet: 2\n" ); - b = b && ( r1->getPropertyValue( OUString("float") ) == - r2->getPropertyValue( OUString("float") ) ); + b = b && ( r1->getPropertyValue("float") == + r2->getPropertyValue("float") ); if( ! b ){ float f1(0.0); float f2(0.0); - r1->getPropertyValue( OUString("float") ) >>= f1; - r2->getPropertyValue( OUString("float") ) >>= f2; + r1->getPropertyValue("float") >>= f1; + r2->getPropertyValue("float") >>= f2; fprintf( stderr, "compareMyPropertySet: %f %f 3\n",f1,f2 ); } - b = b && ( r1->getPropertyValue( OUString("double") ) == - r2->getPropertyValue( OUString("double" )) ); + b = b && ( r1->getPropertyValue("double") == + r2->getPropertyValue("double") ); if( ! b ) fprintf( stderr, "compareMyPropertySet: 4\n" ); sal_Bool b1(sal_False), b2(sal_False); - Any a =r1->getPropertyValue( OUString("bool") ); + Any a =r1->getPropertyValue("bool"); a >>= b1; - a = r2->getPropertyValue( OUString("bool") ); + a = r2->getPropertyValue("bool"); a >>= b2; b = b && ( (b1 && b2) || b1 == b2 ); if( ! b ) fprintf( stderr, "compareMyPropertySet: 5\n" ); -// b = b && r1->getPropertyValue( OUString("bool") ) == -// r2->getPropertyValue( OUString("bool") ) ); +// b = b && r1->getPropertyValue("bool") == +// r2->getPropertyValue("bool") ); - b = b && ( r1->getPropertyValue( OUString("byte") ) == - r2->getPropertyValue( OUString("byte") ) ); + b = b && ( r1->getPropertyValue("byte") == + r2->getPropertyValue("byte") ); if( ! b ) fprintf( stderr, "compareMyPropertySet: 6\n" ); - b = b && ( r1->getPropertyValue( OUString("char") ) == - r2->getPropertyValue( OUString("char") ) ); + b = b && ( r1->getPropertyValue("char") == + r2->getPropertyValue("char") ); if( ! b ) fprintf( stderr, "compareMyPropertySet: 7\n" ); - b = b && ( r1->getPropertyValue( OUString("string") ) == - r2->getPropertyValue( OUString("string") )); + b = b && ( r1->getPropertyValue("string") == + r2->getPropertyValue("string")); if( ! b ) fprintf( stderr, "compareMyPropertySet: 8\n" ); - Any o1 = r1->getPropertyValue( OUString("object") ); - Any o2 = r2->getPropertyValue( OUString("object") ); + Any o1 = r1->getPropertyValue("object"); + Any o2 = r2->getPropertyValue("object"); if( o1.getValueType() == getCppuType( (Reference*)0 ) ) { @@ -943,34 +943,34 @@ void OObjectStreamTest::testObject( const Reference< XObjectOutputStream > Any any; sal_Int32 i = 0x83482; any <<= i; - rProp->setPropertyValue( OUString( "long") , any ); + rProp->setPropertyValue("long", any ); float f = (float)42.23; any <<= f; - rProp->setPropertyValue( OUString( "float") , any ); + rProp->setPropertyValue("float", any ); double d = 233.321412; any <<= d; - rProp->setPropertyValue( OUString( "double") , any ); + rProp->setPropertyValue("double", any ); sal_Bool b = sal_True; any.setValue( &b , getCppuBooleanType() ); - rProp->setPropertyValue( OUString( "bool") , any ); + rProp->setPropertyValue("bool", any ); sal_Int8 by = 120; any <<= by; - rProp->setPropertyValue( OUString( "byte") , any ); + rProp->setPropertyValue("byte", any ); sal_Unicode c = 'h'; any.setValue( &c , getCppuCharType() ); - rProp->setPropertyValue( OUString( "char") , any ); + rProp->setPropertyValue("char", any ); OUString str( "hi du !" ); any <<= str; - rProp->setPropertyValue( OUString( "string") , any ); + rProp->setPropertyValue("string", any ); any <<= persistRef; - rProp->setPropertyValue( OUString( "object") , any ); + rProp->setPropertyValue("object", any ); // do read and write rOut->writeObject( persistRef ); @@ -981,8 +981,8 @@ void OObjectStreamTest::testObject( const Reference< XObjectOutputStream > ERROR_ASSERT( compareMyPropertySet( rProp , rPropRead ) , "objects has not been read properly !" ); // destroy selfreferences - rProp->setPropertyValue( OUString("object"), Any() ); - rPropRead->setPropertyValue( OUString("object"), Any() ); + rProp->setPropertyValue("object", Any() ); + rPropRead->setPropertyValue("object", Any() ); } { @@ -993,7 +993,7 @@ void OObjectStreamTest::testObject( const Reference< XObjectOutputStream > // buffering and marks work correctly for( int i = 0 ; i < 2000 ; i ++ ) { - Reference < XInterface > x = m_rFactory->createInstance(OUString("test.com.sun.star.io.PersistTest")); + Reference < XInterface > x = m_rFactory->createInstance("test.com.sun.star.io.PersistTest"); Reference< XPersistObject > persistRef( x , UNO_QUERY ); Reference < XPropertySet > rProp( persistRef , UNO_QUERY ); @@ -1002,39 +1002,39 @@ void OObjectStreamTest::testObject( const Reference< XObjectOutputStream > Any any; sal_Int32 i = 0x83482; any <<= i; - rProp->setPropertyValue( OUString( "long") , any ); + rProp->setPropertyValue("long", any ); float f = 42.23; any <<= f; - rProp->setPropertyValue( OUString( "float") , any ); + rProp->setPropertyValue("float", any ); double d = 233.321412; any <<= d; - rProp->setPropertyValue( OUString( "double") , any ); + rProp->setPropertyValue("double", any ); sal_Bool b = sal_True; any.setValue( &b , getCppuBooleanType() ); - rProp->setPropertyValue( OUString( "bool") , any ); + rProp->setPropertyValue("bool", any ); sal_Int8 by = 120; any <<= by; - rProp->setPropertyValue( OUString( "byte") , any ); + rProp->setPropertyValue("byte", any ); sal_Unicode c = 'h'; any.setValue( &c , getCppuCharType() ); - rProp->setPropertyValue( OUString( "char") , any ); + rProp->setPropertyValue("char", any ); OUString str( "hi du !" ); any <<= str; - rProp->setPropertyValue( OUString( "string") , any ); + rProp->setPropertyValue("string", any ); - x = m_rFactory->createInstance(OUString("test.com.sun.star.io.PersistTest")); + x = m_rFactory->createInstance("test.com.sun.star.io.PersistTest"); Reference persist2ndRef( x , UNO_QUERY ); // Note : persist2ndRef contains coincident values, but also coincident values must be // saved properly ! any <<= persist2ndRef; - rProp->setPropertyValue( OUString("object") , any ); + rProp->setPropertyValue("object", any ); // simply test, if markable operations and object operations do not interfere sal_Int32 nMark = markableOut->createMark(); diff --git a/io/test/stm/marktest.cxx b/io/test/stm/marktest.cxx index f4b94bb4444e..6730d2d49c85 100644 --- a/io/test/stm/marktest.cxx +++ b/io/test/stm/marktest.cxx @@ -131,7 +131,7 @@ sal_Int32 OMarkableOutputStreamTest::test( } else { - Reference < XInterface > x = m_rFactory->createInstance( OUString("com.sun.star.io.Pipe")); + Reference < XInterface > x = m_rFactory->createInstance("com.sun.star.io.Pipe"); Reference< XOutputStream > rPipeOutput( x , UNO_QUERY ); Reference < XInputStream > rPipeInput( x , UNO_QUERY ); @@ -498,7 +498,7 @@ sal_Int32 OMarkableInputStreamTest::test( testInvariant( TestName , TestObject ); } else { - Reference < XInterface > x = m_rFactory->createInstance( OUString("com.sun.star.io.Pipe")); + Reference < XInterface > x = m_rFactory->createInstance("com.sun.star.io.Pipe"); Reference< XOutputStream > rPipeOutput( x , UNO_QUERY ); Reference < XInputStream > rPipeInput( x , UNO_QUERY ); diff --git a/io/test/testconnection.cxx b/io/test/testconnection.cxx index 2b6369674c05..aa91a2aeb0b4 100644 --- a/io/test/testconnection.cxx +++ b/io/test/testconnection.cxx @@ -174,7 +174,7 @@ int SAL_CALL main( int argc, char * argv[] ) createRegistryServiceFactory( OUString( "applicat.rdb") ) ); Reference< XImplementationRegistration > xImplReg( - xMgr->createInstance( OUString("com.sun.star.registry.ImplementationRegistration") ), UNO_QUERY ); + xMgr->createInstance("com.sun.star.registry.ImplementationRegistration"), UNO_QUERY ); OSL_ENSURE( xImplReg.is(), "### no impl reg!" ); OUString aLibName = @@ -195,7 +195,7 @@ int SAL_CALL main( int argc, char * argv[] ) OUString("com.sun.star.connection.Acceptor") ) , UNO_QUERY ); Reference < XConnector > rConnector( - xMgr->createInstance( OUString("com.sun.star.connection.Connector") ) , UNO_QUERY ); + xMgr->createInstance("com.sun.star.connection.Connector") , UNO_QUERY ); printf( "Testing sockets" ); @@ -210,7 +210,7 @@ int SAL_CALL main( int argc, char * argv[] ) // check, if errornous strings make any problem rAcceptor = Reference< XAcceptor > ( - xMgr->createInstance( OUString("com.sun.star.connection.Acceptor") ), + xMgr->createInstance("com.sun.star.connection.Acceptor"), UNO_QUERY ); try -- cgit