From 44a46d4f3bc2852851f092b168e4b84d37719ca9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 6 Oct 2015 15:07:04 +0200 Subject: loplugin:mergeclasses Change-Id: I28d8bd79f266df7e9ea420f7238ed332ec4205a9 --- store/source/object.hxx | 48 +++++++---------------------------------------- store/source/stordir.hxx | 4 ++-- store/source/store.cxx | 6 +++--- store/source/storlckb.hxx | 4 ++-- store/source/storpage.hxx | 4 ++-- 5 files changed, 16 insertions(+), 50 deletions(-) (limited to 'store') diff --git a/store/source/object.hxx b/store/source/object.hxx index 40bc287652ad..b44d83bef675 100644 --- a/store/source/object.hxx +++ b/store/source/object.hxx @@ -27,48 +27,21 @@ namespace store { -/*======================================================================== - * - * IStoreHandle interface. - * - *======================================================================*/ -class IStoreHandle : public virtual salhelper::SimpleReferenceObject -{ -public: - /** Replaces dynamic_cast type checking. - */ - virtual bool isKindOf (sal_uInt32 nTypeId) = 0; - -protected: - virtual ~IStoreHandle() {} -}; - -/** Template helper function as dynamic_cast replacement. - */ -template -store_handle_type * SAL_CALL query ( - IStoreHandle * pHandle, store_handle_type *); - /*======================================================================== * * OStoreObject interface. * *======================================================================*/ -class OStoreObject : public store::IStoreHandle +class OStoreObject : public virtual salhelper::SimpleReferenceObject { - /** Template function specialization as dynamic_cast replacement. - */ - friend OStoreObject* - SAL_CALL query<> (IStoreHandle *pHandle, OStoreObject*); - public: /** Construction. */ OStoreObject() {} - /** IStoreHandle. + /** Replaces dynamic_cast type checking. */ - virtual bool isKindOf (sal_uInt32 nTypeId) SAL_OVERRIDE; + virtual bool isKindOf (sal_uInt32 nTypeId); protected: /** Destruction. @@ -83,18 +56,11 @@ private: OStoreObject& operator= (const OStoreObject&) SAL_DELETED_FUNCTION; }; -/** Template function specialization as dynamic_cast replacement. +/** Template helper function as dynamic_cast replacement. */ -template<> inline OStoreObject* -SAL_CALL query (IStoreHandle *pHandle, OStoreObject*) -{ - if (pHandle && pHandle->isKindOf (OStoreObject::m_nTypeId)) - { - // Handle is kind of OStoreObject. - return static_cast(pHandle); - } - return 0; -} +template +store_handle_type * SAL_CALL query ( + OStoreObject * pHandle, store_handle_type *); /*======================================================================== * diff --git a/store/source/stordir.hxx b/store/source/stordir.hxx index 8fb9de74798e..43ba3dc2badf 100644 --- a/store/source/stordir.hxx +++ b/store/source/stordir.hxx @@ -85,7 +85,7 @@ private: /** IStoreHandle query() template function specialization. */ friend OStoreDirectory_Impl* - SAL_CALL query<> (IStoreHandle *pHandle, OStoreDirectory_Impl*); + SAL_CALL query<> (OStoreObject *pHandle, OStoreDirectory_Impl*); /** Representation. */ @@ -103,7 +103,7 @@ private: }; template<> inline OStoreDirectory_Impl* -SAL_CALL query (IStoreHandle *pHandle, SAL_UNUSED_PARAMETER OStoreDirectory_Impl*) +SAL_CALL query (OStoreObject *pHandle, SAL_UNUSED_PARAMETER OStoreDirectory_Impl*) { if (pHandle && pHandle->isKindOf (OStoreDirectory_Impl::m_nTypeId)) { diff --git a/store/source/store.cxx b/store/source/store.cxx index c6e79a85e5a2..1b5107fc3837 100644 --- a/store/source/store.cxx +++ b/store/source/store.cxx @@ -48,7 +48,7 @@ public: static store_handle_type * SAL_CALL query (void * pHandle) { return store::query ( - static_cast(pHandle), + static_cast(pHandle), static_cast(0)); } }; @@ -68,7 +68,7 @@ storeError SAL_CALL store_acquireHandle ( storeHandle Handle ) SAL_THROW_EXTERN_C() { - IStoreHandle *pHandle = static_cast(Handle); + OStoreObject *pHandle = static_cast(Handle); if (!pHandle) return store_E_InvalidHandle; @@ -83,7 +83,7 @@ storeError SAL_CALL store_releaseHandle ( storeHandle Handle ) SAL_THROW_EXTERN_C() { - IStoreHandle *pHandle = static_cast(Handle); + OStoreObject *pHandle = static_cast(Handle); if (!pHandle) return store_E_InvalidHandle; diff --git a/store/source/storlckb.hxx b/store/source/storlckb.hxx index 67c4a14aea4d..4fffb471dd04 100644 --- a/store/source/storlckb.hxx +++ b/store/source/storlckb.hxx @@ -120,7 +120,7 @@ private: /** IStoreHandle query() template specialization. */ friend OStoreLockBytes* - SAL_CALL query<> (IStoreHandle *pHandle, OStoreLockBytes*); + SAL_CALL query<> (OStoreObject *pHandle, OStoreLockBytes*); /** Representation. */ @@ -139,7 +139,7 @@ private: }; template<> inline OStoreLockBytes* -SAL_CALL query (IStoreHandle *pHandle, SAL_UNUSED_PARAMETER OStoreLockBytes*) +SAL_CALL query (OStoreObject *pHandle, SAL_UNUSED_PARAMETER OStoreLockBytes*) { if (pHandle && pHandle->isKindOf (OStoreLockBytes::m_nTypeId)) { diff --git a/store/source/storpage.hxx b/store/source/storpage.hxx index f400a3fbd25e..f57d720076d6 100644 --- a/store/source/storpage.hxx +++ b/store/source/storpage.hxx @@ -157,7 +157,7 @@ private: /** IStoreHandle query() template function specialization. */ friend OStorePageManager* - SAL_CALL query<> (IStoreHandle *pHandle, OStorePageManager*); + SAL_CALL query<> (OStoreObject *pHandle, OStorePageManager*); /** Representation. */ @@ -194,7 +194,7 @@ inline bool OStorePageManager::isValid() const } template<> inline OStorePageManager* -SAL_CALL query (IStoreHandle *pHandle, SAL_UNUSED_PARAMETER OStorePageManager*) +SAL_CALL query (OStoreObject *pHandle, SAL_UNUSED_PARAMETER OStorePageManager*) { if (pHandle && pHandle->isKindOf (OStorePageManager::m_nTypeId)) { -- cgit