diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-04-21 21:39:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-04-22 12:10:18 +0200 |
commit | 6adef53aa9870c8f3c8cc1bb6c475e253d41077b (patch) | |
tree | 91ff85404bdbdff4b38d73ba93e6604de591e73e /dbaccess | |
parent | 4b6e0f2c88debaedb514c868e061c21e15215b6e (diff) |
use more OUString literal
convert some functions which merely create an OUString on the fly
from a char literal to 'constexpr OUString' literals
Change-Id: I617490baf2d976291b324cc991b59cd18f4b242c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166392
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/databaseregistrations.cxx | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx index 9e53a8429ef3..3b19de41c366 100644 --- a/dbaccess/source/core/dataaccess/databaseregistrations.cxx +++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx @@ -51,20 +51,9 @@ namespace dbaccess using ::com::sun::star::sdb::DatabaseRegistrationEvent; using ::com::sun::star::uno::XAggregation; - static OUString getConfigurationRootPath() - { - return "org.openoffice.Office.DataAccess/RegisteredNames"; - } - - static OUString getLocationNodeName() - { - return "Location"; - } - - static OUString getNameNodeName() - { - return "Name"; - } + constexpr OUString CONF_ROOT_PATH = u"org.openoffice.Office.DataAccess/RegisteredNames"_ustr; + constexpr OUString LOCATION = u"Location"_ustr; + constexpr OUString NAME = u"Name"_ustr; // DatabaseRegistrations - declaration typedef ::cppu::WeakImplHelper< XDatabaseRegistrations @@ -147,7 +136,7 @@ namespace dbaccess ,m_aRegistrationListeners( m_aMutex ) { m_aConfigurationRoot = ::utl::OConfigurationTreeRoot::createWithComponentContext( - m_aContext, getConfigurationRootPath() ); + m_aContext, CONF_ROOT_PATH ); } DatabaseRegistrations::~DatabaseRegistrations() @@ -162,7 +151,7 @@ namespace dbaccess ::utl::OConfigurationNode aNodeForName = m_aConfigurationRoot.openNode( nodeName ); OUString sTestName; - OSL_VERIFY( aNodeForName.getNodeValue( getNameNodeName() ) >>= sTestName ); + OSL_VERIFY( aNodeForName.getNodeValue( NAME ) >>= sTestName ); if ( sTestName == _rName ) return aNodeForName; } @@ -196,7 +185,7 @@ namespace dbaccess } ::utl::OConfigurationNode aNewNode( m_aConfigurationRoot.createNode( sNewNodeName ) ); - aNewNode.setNodeValue( getNameNodeName(), Any( _rName ) ); + aNewNode.setNodeValue( NAME, Any( _rName ) ); return aNewNode; } @@ -251,7 +240,7 @@ namespace dbaccess for ( auto const & name : aProgrammaticNames ) { ::utl::OConfigurationNode aRegistrationNode = m_aConfigurationRoot.openNode( name ); - OSL_VERIFY( aRegistrationNode.getNodeValue( getNameNodeName() ) >>= *pDisplayName ); + OSL_VERIFY( aRegistrationNode.getNodeValue( NAME ) >>= *pDisplayName ); ++pDisplayName; } @@ -265,7 +254,7 @@ namespace dbaccess ::utl::OConfigurationNode aNodeForName = impl_checkValidName_throw_must_exist(Name); OUString sLocation; - OSL_VERIFY( aNodeForName.getNodeValue( getLocationNodeName() ) >>= sLocation ); + OSL_VERIFY( aNodeForName.getNodeValue( LOCATION ) >>= sLocation ); sLocation = SvtPathOptions().SubstituteVariable( sLocation ); return sLocation; @@ -280,7 +269,7 @@ namespace dbaccess ::utl::OConfigurationNode aDataSourceRegistration = impl_checkValidName_throw_must_not_exist(Name); // register - aDataSourceRegistration.setNodeValue( getLocationNodeName(), Any( Location ) ); + aDataSourceRegistration.setNodeValue( LOCATION, Any( Location ) ); m_aConfigurationRoot.commit(); // notify @@ -298,7 +287,7 @@ namespace dbaccess // obtain properties for notification OUString sLocation; - OSL_VERIFY( aNodeForName.getNodeValue( getLocationNodeName() ) >>= sLocation ); + OSL_VERIFY( aNodeForName.getNodeValue( LOCATION ) >>= sLocation ); // revoke if ( aNodeForName.isReadonly() @@ -327,10 +316,10 @@ namespace dbaccess // obtain properties for notification OUString sOldLocation; - OSL_VERIFY( aDataSourceRegistration.getNodeValue( getLocationNodeName() ) >>= sOldLocation ); + OSL_VERIFY( aDataSourceRegistration.getNodeValue( LOCATION ) >>= sOldLocation ); // change - aDataSourceRegistration.setNodeValue( getLocationNodeName(), Any( NewLocation ) ); + aDataSourceRegistration.setNodeValue( LOCATION, Any( NewLocation ) ); m_aConfigurationRoot.commit(); // notify |