[PATCH] Remove more STRINGPARAM macros from dbaccess

Marcos Souza (via Code Review) gerrit at gerrit.libreoffice.org
Sat Jan 19 07:40:41 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1771

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/71/1771/1

Remove more STRINGPARAM macros from dbaccess

Change-Id: I5a5af27d7c980f6b71011c33531a49a82d79fbc8
---
M dbaccess/source/core/dataaccess/ContentHelper.cxx
M dbaccess/source/core/dataaccess/ModelImpl.cxx
M dbaccess/source/core/dataaccess/ModelImpl.hxx
M dbaccess/source/core/dataaccess/SharedConnection.hxx
M dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
M dbaccess/source/core/dataaccess/commandcontainer.cxx
M dbaccess/source/core/dataaccess/commanddefinition.cxx
M dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
8 files changed, 48 insertions(+), 77 deletions(-)



diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index 20a535f..87b6480 100644
--- a/dbaccess/source/core/dataaccess/ContentHelper.cxx
+++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx
@@ -93,10 +93,8 @@
 Reference< XContentIdentifier > SAL_CALL OContentHelper::getIdentifier(  ) throw (RuntimeException)
 {
     ::osl::MutexGuard aGuard(m_aMutex);
-    ::rtl::OUStringBuffer aIdentifier;
-    aIdentifier.appendAscii( "private:" );
-    aIdentifier.append( impl_getHierarchicalName( true ) );
-    return new ::ucbhelper::ContentIdentifier( aIdentifier.makeStringAndClear() );
+    OUString aIdentifier( "private:" + impl_getHierarchicalName( true ) );
+    return new ::ucbhelper::ContentIdentifier( aIdentifier );
 }
 
 ::rtl::OUString OContentHelper::impl_getHierarchicalName( bool _includingRootContainer ) const
@@ -114,9 +112,7 @@
             xProp->getPropertyValue( PROPERTY_NAME ) >>= sName;
 
             ::rtl::OUString sPrevious = aHierarchicalName.makeStringAndClear();
-            aHierarchicalName.append( sName );
-            aHierarchicalName.append( sal_Unicode( '/' ) );
-            aHierarchicalName.append( sPrevious );
+            aHierarchicalName.append( sName + "/" + sPrevious );
         }
     }
     ::rtl::OUString sHierarchicalName( aHierarchicalName.makeStringAndClear() );
@@ -352,28 +348,19 @@
         if ( rValue.Name == "ContentType" )
         {
             // Read-only property!
-            aRet[ n ] <<= IllegalAccessException(
-                            ::rtl::OUString(
-                                RTL_CONSTASCII_USTRINGPARAM("Property is read-only!")
-                            ),
+            aRet[ n ] <<= IllegalAccessException("Property is read-only!",
                             static_cast< cppu::OWeakObject * >( this ) );
         }
         else if ( rValue.Name == "IsDocument" )
         {
             // Read-only property!
-            aRet[ n ] <<= IllegalAccessException(
-                            ::rtl::OUString(
-                                RTL_CONSTASCII_USTRINGPARAM("Property is read-only!")
-                            ),
+            aRet[ n ] <<= IllegalAccessException("Property is read-only!",
                             static_cast< cppu::OWeakObject * >( this ) );
         }
         else if ( rValue.Name == "IsFolder" )
         {
             // Read-only property!
-            aRet[ n ] <<= IllegalAccessException(
-                            ::rtl::OUString(
-                                RTL_CONSTASCII_USTRINGPARAM("Property is read-only!")
-                            ),
+            aRet[ n ] <<= IllegalAccessException("Property is read-only!",
                             static_cast< cppu::OWeakObject * >( this ) );
         }
         else if ( rValue.Name == "Title" )
@@ -407,20 +394,14 @@
             }
             else
             {
-                aRet[ n ] <<= IllegalTypeException(
-                                ::rtl::OUString(
-                                    RTL_CONSTASCII_USTRINGPARAM("Property value has wrong type!")
-                                ),
+                aRet[ n ] <<= IllegalTypeException("Property value has wrong type!",
                                 static_cast< cppu::OWeakObject * >( this ) );
             }
         }
 
         else
         {
-            aRet[ n ] <<= Exception(
-                            ::rtl::OUString(
-                                    RTL_CONSTASCII_USTRINGPARAM("No property set for storing the value!")
-                            ),
+            aRet[ n ] <<= Exception("No property set for storing the value!",
                             static_cast< cppu::OWeakObject * >( this ) );
         }
     }
@@ -478,28 +459,24 @@
     {
         // Append all Core Properties.
         xRow->appendString (
-            Property( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ContentType")),
-                      -1,
+            Property( "ContentType", -1,
                       getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
                       PropertyAttribute::BOUND
                         | PropertyAttribute::READONLY ),
             getContentType() );
         xRow->appendString (
-            Property( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title" )),
-                      -1,
+            Property( "Title", -1,
                       getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
                       PropertyAttribute::BOUND ),
             m_pImpl->m_aProps.aTitle );
         xRow->appendBoolean(
-            Property( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsDocument")),
-                      -1,
+            Property( "IsDocument", -1,
                       getCppuBooleanType(),
                       PropertyAttribute::BOUND
                         | PropertyAttribute::READONLY ),
             m_pImpl->m_aProps.bIsDocument );
         xRow->appendBoolean(
-            Property( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsFolder")),
-                      -1,
+            Property( "IsFolder", -1,
                       getCppuBooleanType(),
                       PropertyAttribute::BOUND
                         | PropertyAttribute::READONLY ),
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 01546fa..49a0736 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -294,7 +294,7 @@
     bool bSuccess = false;
     try
     {
-        NamedStorages::const_iterator pos = m_aExposedStorages.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "database" ) ) );
+        NamedStorages::const_iterator pos = m_aExposedStorages.find( "database" );
         if ( pos != m_aExposedStorages.end() )
             bSuccess = tools::stor::commitStorageIfWriteable( pos->second );
     }
@@ -360,7 +360,7 @@
         Reference< XStorage > xStorage( aEvent.Source, UNO_QUERY );
 
         // check if this is the dedicated "database" sub storage
-        NamedStorages::const_iterator pos = m_aExposedStorages.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "database" ) ) );
+        NamedStorages::const_iterator pos = m_aExposedStorages.find( "database" );
         if  (   ( pos != m_aExposedStorages.end() )
             &&  ( pos->second == xStorage )
             )
@@ -430,9 +430,9 @@
 {
     // some kind of default
     DBG_CTOR(ODatabaseModelImpl,NULL);
-    m_sConnectURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("jdbc:"));
+    m_sConnectURL = "jdbc:";
     m_aTableFilter.realloc(1);
-    m_aTableFilter[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%"));
+    m_aTableFilter[0] = "%";
     impl_construct_nothrow();
 }
 
@@ -490,14 +490,8 @@
         *pAllowedType++ = ::getCppuType( static_cast< Sequence< Any >* >( NULL ) );
 
         Sequence< Any > aInitArgs( 2 );
-        aInitArgs[0] <<= NamedValue(
-            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutomaticAddition" ) ),
-            makeAny( (sal_Bool)sal_True )
-        );
-        aInitArgs[1] <<= NamedValue(
-            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowedTypes" ) ),
-            makeAny( aAllowedTypes )
-        );
+        aInitArgs[0] <<= NamedValue("AutomaticAddition", makeAny( (sal_Bool)sal_True ));
+        aInitArgs[1] <<= NamedValue("AllowedTypes", makeAny( aAllowedTypes ));
 
         m_xSettings.set( m_aContext.createComponentWithArguments( "com.sun.star.beans.PropertyBag", aInitArgs ), UNO_QUERY_THROW );
 
@@ -1050,9 +1044,9 @@
         AsciiPropertyValue( "Extension",                  makeAny( ::rtl::OUString() ) ),
         AsciiPropertyValue( "CharSet",                    makeAny( ::rtl::OUString() ) ),
         AsciiPropertyValue( "HeaderLine",                 makeAny( (sal_Bool)sal_True ) ),
-        AsciiPropertyValue( "FieldDelimiter",             makeAny( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "," ) ) ) ),
-        AsciiPropertyValue( "StringDelimiter",            makeAny( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\"" ) ) ) ),
-        AsciiPropertyValue( "DecimalDelimiter",           makeAny( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ) ),
+        AsciiPropertyValue( "FieldDelimiter",             makeAny( OUString( "," ) ) ),
+        AsciiPropertyValue( "StringDelimiter",            makeAny( OUString( "\"" ) ) ),
+        AsciiPropertyValue( "DecimalDelimiter",           makeAny( OUString( "." ) ) ),
         AsciiPropertyValue( "ThousandDelimiter",          makeAny( ::rtl::OUString() ) ),
         AsciiPropertyValue( "ShowDeleted",                makeAny( (sal_Bool)sal_False ) ),
         // known ODBC settings
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx
index e3c94e3..2bff3c2 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -561,7 +561,7 @@
     inline void checkDisposed() const
     {
         if ( !m_pImpl.is() )
-            throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Component is already disposed.")), getThis() );
+            throw ::com::sun::star::lang::DisposedException( "Component is already disposed.", getThis() );
     }
 
     inline void lockModify()
diff --git a/dbaccess/source/core/dataaccess/SharedConnection.hxx b/dbaccess/source/core/dataaccess/SharedConnection.hxx
index 2237d2a..d81e501 100644
--- a/dbaccess/source/core/dataaccess/SharedConnection.hxx
+++ b/dbaccess/source/core/dataaccess/SharedConnection.hxx
@@ -90,23 +90,23 @@
         // XConnection
         virtual void SAL_CALL setAutoCommit( sal_Bool /*autoCommit*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
         {
-            throw ::com::sun::star::sdbc::SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("This call is not allowed when sharing connections.")),*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S10000")),0,::com::sun::star::uno::Any());
+            throw ::com::sun::star::sdbc::SQLException("This call is not allowed when sharing connections.",*this,"S10000",0,::com::sun::star::uno::Any());
         }
         virtual void SAL_CALL setReadOnly( sal_Bool /*readOnly*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
         {
-            throw ::com::sun::star::sdbc::SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("This call is not allowed when sharing connections.")),*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S10000")),0,::com::sun::star::uno::Any());
+            throw ::com::sun::star::sdbc::SQLException("This call is not allowed when sharing connections.",*this,"S10000",0,::com::sun::star::uno::Any());
         }
         virtual void SAL_CALL setCatalog( const ::rtl::OUString& /*catalog*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
         {
-            throw ::com::sun::star::sdbc::SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("This call is not allowed when sharing connections.")),*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S10000")),0,::com::sun::star::uno::Any());
+            throw ::com::sun::star::sdbc::SQLException("This call is not allowed when sharing connections.",*this,"S10000",0,::com::sun::star::uno::Any());
         }
         virtual void SAL_CALL setTransactionIsolation( sal_Int32 /*level*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
         {
-            throw ::com::sun::star::sdbc::SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("This call is not allowed when sharing connections.")),*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S10000")),0,::com::sun::star::uno::Any());
+            throw ::com::sun::star::sdbc::SQLException("This call is not allowed when sharing connections.",*this,"S10000",0,::com::sun::star::uno::Any());
         }
         virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
         {
-            throw ::com::sun::star::sdbc::SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("This call is not allowed when sharing connections.")),*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S10000")),0,::com::sun::star::uno::Any());
+            throw ::com::sun::star::sdbc::SQLException("This call is not allowed when sharing connections.",*this,"S10000",0,::com::sun::star::uno::Any());
         }
         // XConnection
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
index dfd80d978..d58f5c3 100644
--- a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
@@ -85,9 +85,9 @@
 }
 
 // XServiceInfo
-::rtl::OUString SAL_CALL OBookmarkContainer::getImplementationName(  ) throw(RuntimeException)
+OUString SAL_CALL OBookmarkContainer::getImplementationName(  ) throw(RuntimeException)
 {
-    return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.dba.OBookmarkContainer"));
+    return OUString("com.sun.star.comp.dba.OBookmarkContainer");
 }
 
 sal_Bool SAL_CALL OBookmarkContainer::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
@@ -97,10 +97,10 @@
     return findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
 }
 
-Sequence< ::rtl::OUString > SAL_CALL OBookmarkContainer::getSupportedServiceNames(  ) throw(RuntimeException)
+Sequence< OUString > SAL_CALL OBookmarkContainer::getSupportedServiceNames(  ) throw(RuntimeException)
 {
-    Sequence< ::rtl::OUString > aReturn(1);
-    aReturn.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DefinitionContainer"));
+    Sequence< OUString > aReturn(1);
+    aReturn.getArray()[0] = "com.sun.star.sdb.DefinitionContainer";
     return aReturn;
 }
 
diff --git a/dbaccess/source/core/dataaccess/commandcontainer.cxx b/dbaccess/source/core/dataaccess/commandcontainer.cxx
index 91683f7..5258372 100644
--- a/dbaccess/source/core/dataaccess/commandcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/commandcontainer.cxx
@@ -81,9 +81,9 @@
     return m_aContext.createComponent( (::rtl::OUString)( m_bTables ? SERVICE_SDB_TABLEDEFINITION : SERVICE_SDB_COMMAND_DEFINITION ) );
 }
 
-::rtl::OUString OCommandContainer::determineContentType() const
+OUString OCommandContainer::determineContentType() const
 {
-    return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseCommandDefinitionContainer" ) );
+    return OUString( "application/vnd.org.openoffice.DatabaseCommandDefinitionContainer" );
 }
 
 }   // namespace dbaccess
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.cxx b/dbaccess/source/core/dataaccess/commanddefinition.cxx
index 964e6df..a6998f4 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.cxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.cxx
@@ -102,9 +102,9 @@
 IMPLEMENT_FORWARD_XINTERFACE2( OCommandDefinition,OComponentDefinition,OCommandDefinition_Base)
 IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2(OCommandDefinition,OCommandDefinition_PROP)
 
-::rtl::OUString OCommandDefinition::getImplementationName_static(  ) throw(RuntimeException)
+OUString OCommandDefinition::getImplementationName_static(  ) throw(RuntimeException)
 {
-    return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.dba.OCommandDefinition"));
+    return OUString("com.sun.star.comp.dba.OCommandDefinition");
 }
 
 ::rtl::OUString SAL_CALL OCommandDefinition::getImplementationName(  ) throw(RuntimeException)
@@ -112,12 +112,12 @@
     return getImplementationName_static();
 }
 
-Sequence< ::rtl::OUString > OCommandDefinition::getSupportedServiceNames_static(  ) throw(RuntimeException)
+Sequence< OUString > OCommandDefinition::getSupportedServiceNames_static(  ) throw(RuntimeException)
 {
-    Sequence< ::rtl::OUString > aServices(3);
+    Sequence< OUString > aServices(3);
     aServices.getArray()[0] = SERVICE_SDB_QUERYDEFINITION;
     aServices.getArray()[1] = SERVICE_SDB_COMMAND_DEFINITION;
-    aServices.getArray()[2] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.Content"));
+    aServices.getArray()[2] = "com.sun.star.ucb.Content";
     return aServices;
 }
 
diff --git a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
index 27f7b18..197742c 100644
--- a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
+++ b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
@@ -182,9 +182,9 @@
 
     IMPLEMENT_FORWARD_XTYPEPROVIDER2( DataAccessDescriptor, DataAccessDescriptor_TypeBase, DataAccessDescriptor_PropertyBase );
 
-    ::rtl::OUString SAL_CALL DataAccessDescriptor::getImplementationName() throw (RuntimeException)
+    OUString SAL_CALL DataAccessDescriptor::getImplementationName() throw (RuntimeException)
     {
-        return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.dba.DataAccessDescriptor" ) );
+        return OUString( "com.sun.star.comp.dba.DataAccessDescriptor" );
     }
 
     ::sal_Bool SAL_CALL DataAccessDescriptor::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
@@ -195,10 +195,10 @@
         return ::std::find( pStart, pEnd, rServiceName ) != pEnd;
     }
 
-    Sequence< ::rtl::OUString > SAL_CALL DataAccessDescriptor::getSupportedServiceNames(  ) throw (RuntimeException)
+    Sequence< OUString > SAL_CALL DataAccessDescriptor::getSupportedServiceNames(  ) throw (RuntimeException)
     {
-        Sequence< ::rtl::OUString > aServices(1);
-        aServices[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DataAccessDescriptor" ) );
+        Sequence< OUString > aServices(1);
+        aServices[0] = "com.sun.star.sdb.DataAccessDescriptor";
         return aServices;
     }
 
@@ -260,9 +260,9 @@
     {
     }
 
-    ::rtl::OUString DataAccessDescriptorFactory::getSingletonName_static()
+    OUString DataAccessDescriptorFactory::getSingletonName_static()
     {
-        return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DataAccessDescriptorFactory" ) );
+        return OUString( "com.sun.star.sdb.DataAccessDescriptorFactory" );
     }
 
     Sequence< ::rtl::OUString > DataAccessDescriptorFactory::getSupportedServiceNames_static() throw( RuntimeException )
@@ -272,9 +272,9 @@
         return aServices;
     }
 
-    ::rtl::OUString DataAccessDescriptorFactory::getImplementationName_static() throw( RuntimeException )
+    OUString DataAccessDescriptorFactory::getImplementationName_static() throw( RuntimeException )
     {
-        return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.dba.DataAccessDescriptorFactory" ) );
+        return OUString( "com.sun.star.comp.dba.DataAccessDescriptorFactory" );
     }
 
     Reference< XInterface > DataAccessDescriptorFactory::Create( const Reference< XComponentContext >& _rxContext )

-- 
To view, visit https://gerrit.libreoffice.org/1771
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a5af27d7c980f6b71011c33531a49a82d79fbc8
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Marcos Souza <marcos.souza.org at gmail.com>



More information about the LibreOffice mailing list