diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-12-19 08:44:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-12-19 10:27:01 +0000 |
commit | 6600552f80064d548fab86e2e18ca649c6dc3cf0 (patch) | |
tree | 715cd6a3dbbc9a560435f4cfc6f0af8c52dcda0f | |
parent | 40ea23ecdb46dfe4f4677ddbe5cb82d7f71ee592 (diff) |
loplugin:implinheritancehelper in stoc
use more ImplInheritanceHelper to reduce boilerplate
Change-Id: I2b4937ebee2e8cc16759df0eacdeb160343a7001
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144440
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | stoc/source/corereflection/base.hxx | 15 | ||||
-rw-r--r-- | stoc/source/corereflection/crarray.cxx | 34 | ||||
-rw-r--r-- | stoc/source/corereflection/crcomp.cxx | 54 | ||||
-rw-r--r-- | stoc/source/corereflection/crenum.cxx | 54 | ||||
-rw-r--r-- | stoc/source/corereflection/criface.cxx | 94 |
5 files changed, 15 insertions, 236 deletions
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index d0793c1877aa..05975d3d24b7 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -255,9 +255,8 @@ public: }; -class ArrayIdlClassImpl - : public IdlClassImpl - , public css::reflection::XIdlArray +typedef cppu::ImplInheritanceHelper<IdlClassImpl, css::reflection::XIdlArray> ArrayIdlClassImpl_Base; +class ArrayIdlClassImpl : public ArrayIdlClassImpl_Base { public: typelib_IndirectTypeDescription * getTypeDescr() const @@ -267,17 +266,9 @@ public: ArrayIdlClassImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName, typelib_TypeClass eTypeClass, typelib_TypeDescription * pTypeDescr ) - : IdlClassImpl( pReflection, rName, eTypeClass, pTypeDescr ) + : ArrayIdlClassImpl_Base( pReflection, rName, eTypeClass, pTypeDescr ) {} - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - - // XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - // IdlClassImpl modifications virtual sal_Bool SAL_CALL isAssignableFrom( const css::uno::Reference< css::reflection::XIdlClass > & xType ) override; virtual css::uno::Reference< css::reflection::XIdlClass > SAL_CALL getComponentType() override; diff --git a/stoc/source/corereflection/crarray.cxx b/stoc/source/corereflection/crarray.cxx index 8a402c489899..ca8d159ef721 100644 --- a/stoc/source/corereflection/crarray.cxx +++ b/stoc/source/corereflection/crarray.cxx @@ -31,40 +31,6 @@ using namespace css::uno; namespace stoc_corefl { -// XInterface - -Any ArrayIdlClassImpl::queryInterface( const Type & rType ) -{ - Any aRet( ::cppu::queryInterface( rType, static_cast< XIdlArray * >( this ) ) ); - return (aRet.hasValue() ? aRet : IdlClassImpl::queryInterface( rType )); -} - -void ArrayIdlClassImpl::acquire() noexcept -{ - IdlClassImpl::acquire(); -} - -void ArrayIdlClassImpl::release() noexcept -{ - IdlClassImpl::release(); -} - -// XTypeProvider - -Sequence< Type > ArrayIdlClassImpl::getTypes() -{ - static cppu::OTypeCollection s_aTypes( - cppu::UnoType<XIdlArray>::get(), - IdlClassImpl::getTypes() ); - - return s_aTypes.getTypes(); -} - -Sequence< sal_Int8 > ArrayIdlClassImpl::getImplementationId() -{ - return css::uno::Sequence<sal_Int8>(); -} - // XIdlArray void ArrayIdlClassImpl::realloc( Any & rArray, sal_Int32 nLen ) diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx index 51cf4a6f02e4..990e5a63aa1a 100644 --- a/stoc/source/corereflection/crcomp.cxx +++ b/stoc/source/corereflection/crcomp.cxx @@ -35,10 +35,8 @@ namespace stoc_corefl namespace { -class IdlCompFieldImpl - : public IdlMemberImpl - , public XIdlField - , public XIdlField2 +typedef cppu::ImplInheritanceHelper<IdlMemberImpl, XIdlField, XIdlField2> IdlCompFieldImpl_Base; +class IdlCompFieldImpl : public IdlCompFieldImpl_Base { sal_Int32 _nOffset; @@ -46,19 +44,10 @@ public: IdlCompFieldImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName, typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr, sal_Int32 nOffset ) - : IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr ) + : IdlCompFieldImpl_Base( pReflection, rName, pTypeDescr, pDeclTypeDescr ) , _nOffset( nOffset ) {} - // XInterface - virtual Any SAL_CALL queryInterface( const Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - - // XTypeProvider - virtual Sequence< Type > SAL_CALL getTypes() override; - virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - // XIdlMember virtual Reference< XIdlClass > SAL_CALL getDeclaringClass() override; virtual OUString SAL_CALL getName() override; @@ -73,43 +62,6 @@ public: } -// XInterface - -Any IdlCompFieldImpl::queryInterface( const Type & rType ) -{ - Any aRet( ::cppu::queryInterface( rType, - static_cast< XIdlField * >( this ), - static_cast< XIdlField2 * >( this ) ) ); - return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType )); -} - -void IdlCompFieldImpl::acquire() noexcept -{ - IdlMemberImpl::acquire(); -} - -void IdlCompFieldImpl::release() noexcept -{ - IdlMemberImpl::release(); -} - -// XTypeProvider - -Sequence< Type > IdlCompFieldImpl::getTypes() -{ - static cppu::OTypeCollection s_aTypes( - cppu::UnoType<XIdlField2>::get(), - cppu::UnoType<XIdlField>::get(), - IdlMemberImpl::getTypes() ); - - return s_aTypes.getTypes(); -} - -Sequence< sal_Int8 > IdlCompFieldImpl::getImplementationId() -{ - return css::uno::Sequence<sal_Int8>(); -} - // XIdlMember Reference< XIdlClass > IdlCompFieldImpl::getDeclaringClass() diff --git a/stoc/source/corereflection/crenum.cxx b/stoc/source/corereflection/crenum.cxx index dae3449d3b2c..f61ab565609a 100644 --- a/stoc/source/corereflection/crenum.cxx +++ b/stoc/source/corereflection/crenum.cxx @@ -33,29 +33,18 @@ namespace stoc_corefl namespace { -class IdlEnumFieldImpl - : public IdlMemberImpl - , public XIdlField - , public XIdlField2 +typedef cppu::ImplInheritanceHelper<IdlMemberImpl, XIdlField, XIdlField2> IdlEnumFieldImpl_Base; +class IdlEnumFieldImpl : public IdlEnumFieldImpl_Base { sal_Int32 _nValue; public: IdlEnumFieldImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName, typelib_TypeDescription * pTypeDescr, sal_Int32 nValue ) - : IdlMemberImpl( pReflection, rName, pTypeDescr, pTypeDescr ) + : IdlEnumFieldImpl_Base( pReflection, rName, pTypeDescr, pTypeDescr ) , _nValue( nValue ) {} - // XInterface - virtual Any SAL_CALL queryInterface( const Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - - // XTypeProvider - virtual Sequence< Type > SAL_CALL getTypes() override; - virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - // XIdlMember virtual Reference< XIdlClass > SAL_CALL getDeclaringClass() override; virtual OUString SAL_CALL getName() override; @@ -70,43 +59,6 @@ public: } -// XInterface - -Any IdlEnumFieldImpl::queryInterface( const Type & rType ) -{ - Any aRet( ::cppu::queryInterface( rType, - static_cast< XIdlField * >( this ), - static_cast< XIdlField2 * >( this ) ) ); - return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType )); -} - -void IdlEnumFieldImpl::acquire() noexcept -{ - IdlMemberImpl::acquire(); -} - -void IdlEnumFieldImpl::release() noexcept -{ - IdlMemberImpl::release(); -} - -// XTypeProvider - -Sequence< Type > IdlEnumFieldImpl::getTypes() -{ - static cppu::OTypeCollection s_aTypes( - cppu::UnoType<XIdlField2>::get(), - cppu::UnoType<XIdlField>::get(), - IdlMemberImpl::getTypes() ); - - return s_aTypes.getTypes(); -} - -Sequence< sal_Int8 > IdlEnumFieldImpl::getImplementationId() -{ - return css::uno::Sequence<sal_Int8>(); -} - // XIdlMember Reference< XIdlClass > IdlEnumFieldImpl::getDeclaringClass() diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx index 88dcc29ffdb7..612b87106f3b 100644 --- a/stoc/source/corereflection/criface.cxx +++ b/stoc/source/corereflection/criface.cxx @@ -57,10 +57,8 @@ namespace stoc_corefl namespace { -class IdlAttributeFieldImpl - : public IdlMemberImpl - , public XIdlField - , public XIdlField2 +typedef cppu::ImplInheritanceHelper<IdlMemberImpl, XIdlField, XIdlField2> IdlAttributeFieldImpl_Base; +class IdlAttributeFieldImpl : public IdlAttributeFieldImpl_Base { public: typelib_InterfaceAttributeTypeDescription * getAttributeTypeDescr() const @@ -68,18 +66,9 @@ public: IdlAttributeFieldImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName, typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr ) - : IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr ) + : IdlAttributeFieldImpl_Base( pReflection, rName, pTypeDescr, pDeclTypeDescr ) {} - // XInterface - virtual Any SAL_CALL queryInterface( const Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - - // XTypeProvider - virtual Sequence< Type > SAL_CALL getTypes() override; - virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - // XIdlMember virtual Reference< XIdlClass > SAL_CALL getDeclaringClass() override; virtual OUString SAL_CALL getName() override; @@ -98,43 +87,6 @@ private: } -// XInterface - -Any IdlAttributeFieldImpl::queryInterface( const Type & rType ) -{ - Any aRet( ::cppu::queryInterface( rType, - static_cast< XIdlField * >( this ), - static_cast< XIdlField2 * >( this ) ) ); - return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType )); -} - -void IdlAttributeFieldImpl::acquire() noexcept -{ - IdlMemberImpl::acquire(); -} - -void IdlAttributeFieldImpl::release() noexcept -{ - IdlMemberImpl::release(); -} - -// XTypeProvider - -Sequence< Type > IdlAttributeFieldImpl::getTypes() -{ - static cppu::OTypeCollection s_aTypes( - cppu::UnoType<XIdlField2>::get(), - cppu::UnoType<XIdlField>::get(), - IdlMemberImpl::getTypes() ); - - return s_aTypes.getTypes(); -} - -Sequence< sal_Int8 > IdlAttributeFieldImpl::getImplementationId() -{ - return css::uno::Sequence<sal_Int8>(); -} - // XIdlMember Reference< XIdlClass > IdlAttributeFieldImpl::getDeclaringClass() @@ -318,9 +270,8 @@ void IdlAttributeFieldImpl::checkException( namespace { -class IdlInterfaceMethodImpl - : public IdlMemberImpl - , public XIdlMethod +typedef cppu::ImplInheritanceHelper<IdlMemberImpl, XIdlMethod> IdlInterfaceMethodImpl_Base; +class IdlInterfaceMethodImpl : public IdlInterfaceMethodImpl_Base { std::optional<Sequence< Reference< XIdlClass > >> m_xExceptionTypes; std::optional<Sequence< Reference< XIdlClass > >> m_xParamTypes; @@ -332,16 +283,10 @@ public: IdlInterfaceMethodImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName, typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr ) - : IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr ) + : IdlInterfaceMethodImpl_Base( pReflection, rName, pTypeDescr, pDeclTypeDescr ) {} - // XInterface - virtual Any SAL_CALL queryInterface( const Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - // XTypeProvider - virtual Sequence< Type > SAL_CALL getTypes() override; virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; // XIdlMember @@ -358,35 +303,8 @@ public: } -// XInterface - -Any IdlInterfaceMethodImpl::queryInterface( const Type & rType ) -{ - Any aRet( ::cppu::queryInterface( rType, static_cast< XIdlMethod * >( this ) ) ); - return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType )); -} - -void IdlInterfaceMethodImpl::acquire() noexcept -{ - IdlMemberImpl::acquire(); -} - -void IdlInterfaceMethodImpl::release() noexcept -{ - IdlMemberImpl::release(); -} - // XTypeProvider -Sequence< Type > IdlInterfaceMethodImpl::getTypes() -{ - static cppu::OTypeCollection s_aTypes( - cppu::UnoType<XIdlMethod>::get(), - IdlMemberImpl::getTypes() ); - - return s_aTypes.getTypes(); -} - Sequence< sal_Int8 > IdlInterfaceMethodImpl::getImplementationId() { return css::uno::Sequence<sal_Int8>(); |