diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-01-11 08:35:48 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-01-11 14:27:51 +0100 |
commit | 74b3924a98dfeeec719f7bc27a2e0a2e1a597167 (patch) | |
tree | f2375ba227971ed7b080b3fa7259e6a741435282 /connectivity | |
parent | 4a0f40113d83742792d765eb1abcbb239cbbf2dd (diff) |
connectivity: various small cleanups in the Writer driver
Change-Id: I91735c3e92262fd37966c53f973d5eee1522cd61
Reviewed-on: https://gerrit.libreoffice.org/47741
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/writer/WConnection.cxx | 23 | ||||
-rw-r--r-- | connectivity/source/drivers/writer/WDatabaseMetaData.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/writer/WDriver.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/writer/WTable.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/writer/Wservices.cxx | 16 | ||||
-rw-r--r-- | connectivity/source/inc/writer/WCatalog.hxx | 2 | ||||
-rw-r--r-- | connectivity/source/inc/writer/WConnection.hxx | 29 | ||||
-rw-r--r-- | connectivity/source/inc/writer/WDatabaseMetaData.hxx | 6 | ||||
-rw-r--r-- | connectivity/source/inc/writer/WDriver.hxx | 6 | ||||
-rw-r--r-- | connectivity/source/inc/writer/WTable.hxx | 8 | ||||
-rw-r--r-- | connectivity/source/inc/writer/WTables.hxx | 4 |
11 files changed, 52 insertions, 56 deletions
diff --git a/connectivity/source/drivers/writer/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx index d0e6b2983c14..bbcd869f2271 100644 --- a/connectivity/source/drivers/writer/WConnection.cxx +++ b/connectivity/source/drivers/writer/WConnection.cxx @@ -34,10 +34,10 @@ #include <cppuhelper/exc_hlp.hxx> #include <comphelper/processfactory.hxx> -typedef connectivity::file::OConnection OConnection_BASE; - using namespace ::com::sun::star; +using OConnection_BASE = connectivity::file::OConnection; + namespace connectivity { namespace writer @@ -45,20 +45,17 @@ namespace writer OWriterConnection::OWriterConnection(ODriver* _pDriver) : OConnection(_pDriver),m_nDocCount(0) { - // m_aFilenameExtension is not used } -OWriterConnection::~OWriterConnection() -{ -} +OWriterConnection::~OWriterConnection() = default; -void OWriterConnection::construct(const OUString& url,const uno::Sequence< beans::PropertyValue >& info) +void OWriterConnection::construct(const OUString& rURL, const uno::Sequence< beans::PropertyValue >& rInfo) { // open file - sal_Int32 nLen = url.indexOf(':'); - nLen = url.indexOf(':',nLen+1); - OUString aDSN(url.copy(nLen+1)); + sal_Int32 nLen = rURL.indexOf(':'); + nLen = rURL.indexOf(':',nLen+1); + OUString aDSN(rURL.copy(nLen+1)); m_aFileName = aDSN; INetURLObject aURL; @@ -78,8 +75,8 @@ void OWriterConnection::construct(const OUString& url,const uno::Sequence< beans m_sPassword.clear(); const char pPwd[] = "password"; - const beans::PropertyValue* pIter = info.getConstArray(); - const beans::PropertyValue* pEnd = pIter + info.getLength(); + const beans::PropertyValue* pIter = rInfo.getConstArray(); + const beans::PropertyValue* pEnd = pIter + rInfo.getLength(); for (; pIter != pEnd; ++pIter) { if (pIter->Name == pPwd) @@ -210,7 +207,7 @@ css::uno::Reference< css::sdbcx::XTablesSupplier > OWriterConnection::createCata uno::Reference< css::sdbcx::XTablesSupplier > xTab = m_xCatalog; if (!xTab.is()) { - OWriterCatalog* pCat = new OWriterCatalog(this); + auto pCat = new OWriterCatalog(this); xTab = pCat; m_xCatalog = xTab; } diff --git a/connectivity/source/drivers/writer/WDatabaseMetaData.cxx b/connectivity/source/drivers/writer/WDatabaseMetaData.cxx index 5dcad41d3eb2..f811205666a2 100644 --- a/connectivity/source/drivers/writer/WDatabaseMetaData.cxx +++ b/connectivity/source/drivers/writer/WDatabaseMetaData.cxx @@ -32,9 +32,7 @@ OWriterDatabaseMetaData::OWriterDatabaseMetaData(file::OConnection* pConnection) { } -OWriterDatabaseMetaData::~OWriterDatabaseMetaData() -{ -} +OWriterDatabaseMetaData::~OWriterDatabaseMetaData() = default; OUString SAL_CALL OWriterDatabaseMetaData::getURL() { @@ -50,7 +48,7 @@ uno::Reference<sdbc::XResultSet> SAL_CALL OWriterDatabaseMetaData::getTables( { ::osl::MutexGuard aGuard(m_aMutex); - ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables); + auto pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables); uno::Reference<sdbc::XResultSet> xRef = pResult; // check if ORowSetValue type is given diff --git a/connectivity/source/drivers/writer/WDriver.cxx b/connectivity/source/drivers/writer/WDriver.cxx index d07d2f326b31..55b5111b7e55 100644 --- a/connectivity/source/drivers/writer/WDriver.cxx +++ b/connectivity/source/drivers/writer/WDriver.cxx @@ -60,7 +60,7 @@ uno::Reference< sdbc::XConnection > SAL_CALL ODriver::connect(const OUString& ur if (! acceptsURL(url)) return nullptr; - OWriterConnection* pCon = new OWriterConnection(this); + auto pCon = new OWriterConnection(this); pCon->construct(url, info); uno::Reference< sdbc::XConnection > xCon = pCon; m_xConnections.push_back(uno::WeakReferenceHelper(*pCon)); diff --git a/connectivity/source/drivers/writer/WTable.cxx b/connectivity/source/drivers/writer/WTable.cxx index 2c3618cfb1e2..89e7720bdfb4 100644 --- a/connectivity/source/drivers/writer/WTable.cxx +++ b/connectivity/source/drivers/writer/WTable.cxx @@ -159,7 +159,7 @@ void OWriterTable::fillColumns() // check if the column name already exists OUString aAlias = aColumnName; - OSQLColumns::Vector::const_iterator aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase); + auto aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase); sal_Int32 nExprCnt = 0; while (aFind != m_aColumns->get().end()) { @@ -261,8 +261,8 @@ bool OWriterTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, // fields - OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); - OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end(); + auto aIter = _rCols.get().begin(); + auto aEnd = _rCols.get().end(); const OValueRefVector::Vector::size_type nCount = _rRow->get().size(); for (OValueRefVector::Vector::size_type i = 1; aIter != aEnd && i < nCount; ++aIter, i++) diff --git a/connectivity/source/drivers/writer/Wservices.cxx b/connectivity/source/drivers/writer/Wservices.cxx index ad59d7639153..6d77471f65b5 100644 --- a/connectivity/source/drivers/writer/Wservices.cxx +++ b/connectivity/source/drivers/writer/Wservices.cxx @@ -22,14 +22,14 @@ using namespace com::sun::star; -typedef uno::Reference< lang::XSingleServiceFactory > (* createFactoryFunc) -( - const uno::Reference< lang::XMultiServiceFactory >& rServiceManager, - const OUString& rComponentName, - ::cppu::ComponentInstantiation pCreateFunction, - const uno::Sequence< OUString >& rServiceNames, - rtl_ModuleCount* -); +using createFactoryFunc = uno::Reference<lang::XSingleServiceFactory> (*) + ( + const uno::Reference< lang::XMultiServiceFactory >& rServiceManager, + const OUString& rComponentName, + ::cppu::ComponentInstantiation pCreateFunction, + const uno::Sequence< OUString >& rServiceNames, + rtl_ModuleCount* + ); struct ProviderRequest diff --git a/connectivity/source/inc/writer/WCatalog.hxx b/connectivity/source/inc/writer/WCatalog.hxx index 6a12d2424b64..53ac36a5d838 100644 --- a/connectivity/source/inc/writer/WCatalog.hxx +++ b/connectivity/source/inc/writer/WCatalog.hxx @@ -34,7 +34,7 @@ public: void refreshTables() override; public: - OWriterCatalog(OWriterConnection* _pCon); + OWriterCatalog(OWriterConnection* pConnection); }; } // namespace writer diff --git a/connectivity/source/inc/writer/WConnection.hxx b/connectivity/source/inc/writer/WConnection.hxx index 69e59409f7ef..99d28ddee45b 100644 --- a/connectivity/source/inc/writer/WConnection.hxx +++ b/connectivity/source/inc/writer/WConnection.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/uno/DeploymentException.hpp> #include <unotools/closeveto.hxx> +#include <o3tl/make_unique.hxx> namespace com { @@ -80,7 +81,7 @@ class OWriterConnection : public file::OConnection { m_xDesktop = rDesktop; m_xDesktop->addTerminateListener(this); - m_pCloseListener.reset(new utl::CloseVeto(rCloseable, true)); + m_pCloseListener = o3tl::make_unique<utl::CloseVeto>(rCloseable, true); } void stop() @@ -93,22 +94,22 @@ class OWriterConnection : public file::OConnection } // XTerminateListener - virtual void SAL_CALL queryTermination(const css::lang::EventObject& /*rEvent*/) override + void SAL_CALL queryTermination(const css::lang::EventObject& /*rEvent*/) override { } - virtual void SAL_CALL notifyTermination(const css::lang::EventObject& /*rEvent*/) override + void SAL_CALL notifyTermination(const css::lang::EventObject& /*rEvent*/) override { stop(); } - virtual void SAL_CALL disposing() override + void SAL_CALL disposing() override { stop(); cppu::WeakComponentImplHelperBase::disposing(); } - virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override + void SAL_CALL disposing(const css::lang::EventObject& rEvent) override { const bool bShutDown = (rEvent.Source == m_xDesktop); if (bShutDown) @@ -120,23 +121,23 @@ class OWriterConnection : public file::OConnection public: OWriterConnection(ODriver* _pDriver); - virtual ~OWriterConnection() override; + ~OWriterConnection() override; - virtual void construct(const OUString& _rUrl, - const css::uno::Sequence< css::beans::PropertyValue >& _rInfo) override; + void construct(const OUString& rURL, + const css::uno::Sequence< css::beans::PropertyValue >& rInfo) override; // XServiceInfo DECLARE_SERVICE_INFO(); // OComponentHelper - virtual void SAL_CALL disposing() override; + void SAL_CALL disposing() override; // XConnection - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData() override; - virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override; - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement() override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement(const OUString& sql) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall(const OUString& sql) override; + css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData() override; + css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override; + css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement() override; + css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement(const OUString& sql) override; + css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall(const OUString& sql) override; // no interface methods css::uno::Reference< css::text::XTextDocument> const& acquireDoc(); diff --git a/connectivity/source/inc/writer/WDatabaseMetaData.hxx b/connectivity/source/inc/writer/WDatabaseMetaData.hxx index 7d0bad7deb60..46f47b328e5e 100644 --- a/connectivity/source/inc/writer/WDatabaseMetaData.hxx +++ b/connectivity/source/inc/writer/WDatabaseMetaData.hxx @@ -29,10 +29,10 @@ namespace writer class OWriterDatabaseMetaData : public component::OComponentDatabaseMetaData { - virtual OUString SAL_CALL getURL() override; - virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables(const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types) override; + OUString SAL_CALL getURL() override; + css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables(const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types) override; protected: - virtual ~OWriterDatabaseMetaData() override; + ~OWriterDatabaseMetaData() override; public: OWriterDatabaseMetaData(file::OConnection* pConnection); }; diff --git a/connectivity/source/inc/writer/WDriver.hxx b/connectivity/source/inc/writer/WDriver.hxx index 614c8321d1a0..ea457290b74c 100644 --- a/connectivity/source/inc/writer/WDriver.hxx +++ b/connectivity/source/inc/writer/WDriver.hxx @@ -44,11 +44,11 @@ public: OUString SAL_CALL getImplementationName() override; // XDriver - virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL + css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect(const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info) override; - virtual sal_Bool SAL_CALL acceptsURL(const OUString& url) override; - virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info) override; + sal_Bool SAL_CALL acceptsURL(const OUString& url) override; + css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info) override; }; } } diff --git a/connectivity/source/inc/writer/WTable.hxx b/connectivity/source/inc/writer/WTable.hxx index aed3e5a8ca4c..b11bc1a27541 100644 --- a/connectivity/source/inc/writer/WTable.hxx +++ b/connectivity/source/inc/writer/WTable.hxx @@ -56,7 +56,7 @@ namespace connectivity { namespace writer { -typedef component::OComponentTable OWriterTable_BASE; +using OWriterTable_BASE = component::OComponentTable; class OWriterConnection; class OWriterTable : public OWriterTable_BASE @@ -80,12 +80,12 @@ public: const OUString& Type ); - virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override; + bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override; - virtual void SAL_CALL disposing() override; + void SAL_CALL disposing() override; // css::lang::XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& aIdentifier) override; + sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& rId) override; static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); void construct() override; diff --git a/connectivity/source/inc/writer/WTables.hxx b/connectivity/source/inc/writer/WTables.hxx index 3112623e5046..939178a90bd2 100644 --- a/connectivity/source/inc/writer/WTables.hxx +++ b/connectivity/source/inc/writer/WTables.hxx @@ -26,12 +26,12 @@ namespace connectivity { namespace writer { -typedef file::OTables OWriterTables_BASE; +using OWriterTables_BASE = file::OTables; class OWriterTables : public OWriterTables_BASE { protected: - virtual sdbcx::ObjectType createObject(const OUString& _rName) override; + sdbcx::ObjectType createObject(const OUString& rName) override; public: OWriterTables(const css::uno::Reference<css::sdbc::XDatabaseMetaData>& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const ::std::vector< OUString>& _rVector) : OWriterTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) |