diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-13 11:29:37 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-15 06:08:14 +0200 |
commit | 3f65724ec5fc92d5a0078a99932358ef7091435c (patch) | |
tree | 94dd9bf1d0ecd42dbf7f94db45bc7e1bf29b83ce /dbaccess | |
parent | 6444b026b4039458d01ada5fee58eae98166585b (diff) |
Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 4
- Change implementations of getSomething to use getSomethingImpl
Or where that's impossible, use getSomething_cast to unify this and
reduce number of places where we reinterpret_cast.
All static methods getting tunnel ids were renamed to getUnoTunnelId,
to comply with the convention used in <comphelper/servicehelper.hxx>.
TODO (in separate commits):
- Revise uses of getSomething to use getFromUnoTunnel
Change-Id: Ifde9e214b52e5df678de71fcc32d2199c82e85cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122100
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 10 | ||||
-rw-r--r-- | dbaccess/source/core/api/TableDeco.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/core/api/querydescriptor.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/api/table.cxx | 10 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/ContentHelper.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/databasecontext.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/JoinExchange.cxx | 6 |
7 files changed, 9 insertions, 38 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 22369333205a..fb10287e9d3f 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -437,10 +437,7 @@ void SAL_CALL ORowSet::release() noexcept // css::XUnoTunnel sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) { - if (comphelper::isUnoTunnelId<ORowSet>(rId)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(rId, this); } Sequence< sal_Int8 > ORowSet::getUnoTunnelId() @@ -2907,10 +2904,7 @@ Sequence< sal_Int8 > ORowSetClone::getUnoTunnelId() // css::XUnoTunnel sal_Int64 SAL_CALL ORowSetClone::getSomething( const Sequence< sal_Int8 >& rId ) { - if (comphelper::isUnoTunnelId<ORowSetClone>(rId)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(rId, this); } void SAL_CALL ORowSetClone::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx index 9cf3538de89c..60cbce747e01 100644 --- a/dbaccess/source/core/api/TableDeco.cxx +++ b/dbaccess/source/core/api/TableDeco.cxx @@ -26,7 +26,6 @@ #include <osl/diagnose.h> #include <sal/log.hxx> -#include <cppuhelper/typeprovider.hxx> #include <comphelper/property.hxx> #include <comphelper/servicehelper.hxx> #include <com/sun/star/sdbc/SQLException.hpp> @@ -452,7 +451,7 @@ OUString SAL_CALL ODBTableDecorator::getName() sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& rId ) { if (comphelper::isUnoTunnelId<ODBTableDecorator>(rId)) - return reinterpret_cast<sal_Int64>(this); + return comphelper::getSomething_cast(this); sal_Int64 nRet = 0; Reference<XUnoTunnel> xTunnel(m_xTable,UNO_QUERY); diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx index 012efe81793f..9a70092512e0 100644 --- a/dbaccess/source/core/api/querydescriptor.cxx +++ b/dbaccess/source/core/api/querydescriptor.cxx @@ -22,7 +22,6 @@ #include <stringconstants.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> using namespace ::com::sun::star::uno; @@ -140,10 +139,7 @@ OQueryDescriptor_Base::~OQueryDescriptor_Base() sal_Int64 SAL_CALL OQueryDescriptor_Base::getSomething( const Sequence< sal_Int8 >& _rIdentifier ) { - if (comphelper::isUnoTunnelId<OQueryDescriptor_Base>(_rIdentifier)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(_rIdentifier, this); } css::uno::Sequence<sal_Int8> OQueryDescriptor_Base::getUnoTunnelId() diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index 11ca5852b99a..f11008555ca9 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -26,7 +26,6 @@ #include "CIndexes.hxx" #include <osl/diagnose.h> -#include <cppuhelper/typeprovider.hxx> #include <comphelper/servicehelper.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/sdbc/SQLException.hpp> @@ -296,13 +295,8 @@ void SAL_CALL ODBTable::alterColumnByName( const OUString& _rName, const Referen sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet(0); - if (comphelper::isUnoTunnelId<ODBTable>(rId)) - nRet = reinterpret_cast<sal_Int64>(this); - else - nRet = OTable_Base::getSomething(rId); - - return nRet; + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OTable_Base>{}); } Sequence< sal_Int8 > ODBTable::getUnoTunnelId() diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index 0cb510dc3dd5..1035a2e6260a 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -33,7 +33,6 @@ #include <ucbhelper/contentidentifier.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> #include <tools/diagnose_ex.h> #include <apitools.hxx> #include <sdbcoretools.hxx> @@ -545,10 +544,7 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent // css::lang::XUnoTunnel sal_Int64 OContentHelper::getSomething( const Sequence< sal_Int8 > & rId ) { - if (comphelper::isUnoTunnelId<OContentHelper>(rId)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(rId, this); } Reference< XInterface > SAL_CALL OContentHelper::getParent( ) diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index d47fa88c3f16..79c657db3054 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -52,7 +52,6 @@ #include <comphelper/servicehelper.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/weak.hxx> #include <rtl/uri.hxx> @@ -709,10 +708,7 @@ void ODatabaseContext::databaseDocumentURLChange( const OUString& _rOldURL, cons sal_Int64 SAL_CALL ODatabaseContext::getSomething( const Sequence< sal_Int8 >& rId ) { - if (comphelper::isUnoTunnelId<ODatabaseContext>(rId)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(rId, this); } Sequence< sal_Int8 > ODatabaseContext::getUnoTunnelId() diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx index 051fbd8c4928..9a06fa7ab488 100644 --- a/dbaccess/source/ui/querydesign/JoinExchange.cxx +++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx @@ -20,7 +20,6 @@ #include <JoinExchange.hxx> #include <sot/formats.hxx> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> namespace dbaui { @@ -70,10 +69,7 @@ namespace dbaui sal_Int64 SAL_CALL OJoinExchObj::getSomething( const Sequence< sal_Int8 >& _rIdentifier ) { - if (comphelper::isUnoTunnelId<OJoinExchObj>(_rIdentifier)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(_rIdentifier, this); } void OJoinExchObj::AddSupportedFormats() |