summaryrefslogtreecommitdiffstats
path: root/dbaccess/source/core/dataaccess/databaseregistrations.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/core/dataaccess/databaseregistrations.cxx')
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.cxx51
1 files changed, 20 insertions, 31 deletions
diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
index bd215b397852..3b19de41c366 100644
--- a/dbaccess/source/core/dataaccess/databaseregistrations.cxx
+++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
@@ -27,7 +27,7 @@
#include <cppuhelper/basemutex.hxx>
#include <comphelper/interfacecontainer3.hxx>
-#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase.hxx>
#include <osl/diagnose.h>
#include <unotools/pathoptions.hxx>
#include <tools/urlobj.hxx>
@@ -39,7 +39,7 @@ namespace dbaccess
{
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::container::NoSuchElementException;
@@ -51,24 +51,13 @@ 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::WeakAggImplHelper1 < XDatabaseRegistrations
- > DatabaseRegistrations_Base;
+ typedef ::cppu::WeakImplHelper< XDatabaseRegistrations
+ > DatabaseRegistrations_Base;
namespace {
@@ -100,7 +89,7 @@ namespace dbaccess
::utl::OConfigurationNode
impl_checkValidName_throw_must_not_exist(const OUString& _rName);
- void impl_checkValidLocation_throw( const OUString& _rLocation );
+ void impl_checkValidLocation_throw( std::u16string_view _rLocation );
/** retrieves the configuration node whose "Name" sub node has the given value
@@ -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(), makeAny( _rName ) );
+ aNewNode.setNodeValue( NAME, Any( _rName ) );
return aNewNode;
}
@@ -221,9 +210,9 @@ namespace dbaccess
return impl_getNodeForName_throw_must_not_exist(_rName);
}
- void DatabaseRegistrations::impl_checkValidLocation_throw( const OUString& _rLocation )
+ void DatabaseRegistrations::impl_checkValidLocation_throw( std::u16string_view _rLocation )
{
- if ( _rLocation.isEmpty() )
+ if ( _rLocation.empty() )
throw IllegalArgumentException( OUString(), *this, 2 );
INetURLObject aURL( _rLocation );
@@ -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(), makeAny( 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(), makeAny( NewLocation ) );
+ aDataSourceRegistration.setNodeValue( LOCATION, Any( NewLocation ) );
m_aConfigurationRoot.commit();
// notify
@@ -359,7 +348,7 @@ namespace dbaccess
}
// DatabaseRegistrations - factory
- Reference< XAggregation > createDataSourceRegistrations( const Reference<XComponentContext> & _rxContext )
+ Reference< XDatabaseRegistrations > createDataSourceRegistrations( const Reference<XComponentContext> & _rxContext )
{
return new DatabaseRegistrations( _rxContext );
}