diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-30 15:21:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-30 17:34:39 +0200 |
commit | 0c1b49048f1127d352b43847353392f0512f19e3 (patch) | |
tree | 81bbe680c12a5a1fa5e4c98f73881ca14e4fc1e2 /include/comphelper | |
parent | ASan/UBSan build still needs DateField RTTI (diff) | |
download | core-0c1b49048f1127d352b43847353392f0512f19e3.tar.gz core-0c1b49048f1127d352b43847353392f0512f19e3.zip |
loplugin:unusedmethods
and tweak the plugin a little to speed it up
Change-Id: Ia59456232602184c4f1b5d1d75ad94a9a2e2d0be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99799
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/comphelper')
-rw-r--r-- | include/comphelper/componentmodule.hxx | 43 | ||||
-rw-r--r-- | include/comphelper/servicedecl.hxx | 179 |
2 files changed, 0 insertions, 222 deletions
diff --git a/include/comphelper/componentmodule.hxx b/include/comphelper/componentmodule.hxx index 78d71138d519..1d52cfd067b9 100644 --- a/include/comphelper/componentmodule.hxx +++ b/include/comphelper/componentmodule.hxx @@ -34,45 +34,6 @@ namespace comphelper { - /** factory declaration - */ - typedef css::uno::Reference< css::lang::XSingleComponentFactory > (*FactoryInstantiation) - ( - ::cppu::ComponentFactoryFunc _pFactoryFunc, - OUString const& _rComponentName, - css::uno::Sequence< OUString > const & _rServiceNames, - rtl_ModuleCount* - ); - - - //= ComponentDescription - - struct COMPHELPER_DLLPUBLIC ComponentDescription - { - /// the implementation name of the component - OUString const sImplementationName; - /// the services supported by the component implementation - css::uno::Sequence< OUString > const aSupportedServices; - /// the function to create an instance of the component - ::cppu::ComponentFactoryFunc const pComponentCreationFunc; - /// the function to create a factory for the component (usually <code>::cppu::createSingleComponentFactory</code>) - FactoryInstantiation const pFactoryCreationFunc; - - ComponentDescription( - const OUString& _rImplementationName, - const css::uno::Sequence< OUString >& _rSupportedServices, - ::cppu::ComponentFactoryFunc _pComponentCreationFunc, - FactoryInstantiation _pFactoryCreationFunc - ) - :sImplementationName( _rImplementationName ) - ,aSupportedServices( _rSupportedServices ) - ,pComponentCreationFunc( _pComponentCreationFunc ) - ,pFactoryCreationFunc( _pFactoryCreationFunc ) - { - } - }; - - //= OModule class OModuleImpl; @@ -89,10 +50,6 @@ namespace comphelper virtual ~OModule(); - /** registers a component given by ComponentDescription - */ - void registerImplementation( const ComponentDescription& _rComp ); - private: OModule( const OModule& ) = delete; OModule& operator=( const OModule& ) = delete; diff --git a/include/comphelper/servicedecl.hxx b/include/comphelper/servicedecl.hxx index 8a25d8e5a911..6cd24699cd2b 100644 --- a/include/comphelper/servicedecl.hxx +++ b/include/comphelper/servicedecl.hxx @@ -140,188 +140,9 @@ template <bool> struct with_args; /// @internal namespace detail { -template <typename ImplT> -class OwnServiceImpl - : public ImplT -{ - typedef ImplT BaseT; - -public: - OwnServiceImpl( const OwnServiceImpl& ) = delete; - OwnServiceImpl& operator=( const OwnServiceImpl& ) = delete; - OwnServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Sequence<css::uno::Any> const& args, - css::uno::Reference<css::uno::XComponentContext> const& xContext ) - :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {} - OwnServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Reference<css::uno::XComponentContext> const& xContext ) - : BaseT(xContext), m_rServiceDecl(rServiceDecl) {} - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override { - return m_rServiceDecl.getImplementationName(); - } - virtual sal_Bool SAL_CALL supportsService( OUString const& name ) override { - return m_rServiceDecl.supportsService(name); - } - virtual css::uno::Sequence< OUString> - SAL_CALL getSupportedServiceNames() override { - return m_rServiceDecl.getSupportedServiceNames(); - } - -private: - ServiceDecl const& m_rServiceDecl; -}; - -template <typename ImplT> -class ServiceImpl final : public OwnServiceImpl< ::cppu::ImplInheritanceHelper<ImplT,css::lang::XServiceInfo> > -{ -typedef OwnServiceImpl< ::cppu::ImplInheritanceHelper<ImplT,css::lang::XServiceInfo> > ServiceImpl_BASE; -public: - ServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Sequence<css::uno::Any> const& args, - css::uno::Reference<css::uno::XComponentContext> const& xContext ) - : ServiceImpl_BASE(rServiceDecl, args, xContext) {} - ServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Reference<css::uno::XComponentContext> const& xContext ) - : ServiceImpl_BASE(rServiceDecl, xContext) {} -}; - -template <typename ImplT> -class InheritingServiceImpl final : public OwnServiceImpl< ImplT > -{ -typedef OwnServiceImpl< ImplT > ServiceImpl_BASE; -public: - InheritingServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Sequence<css::uno::Any> const& args, - css::uno::Reference<css::uno::XComponentContext> const& xContext ) - : ServiceImpl_BASE(rServiceDecl, args, xContext) {} -}; - -template <typename ServiceImplT> -struct PostProcessDefault { - css::uno::Reference<css::uno::XInterface> - operator()( ServiceImplT * p ) const { - return static_cast<css::lang::XServiceInfo *>(p); - } -}; - -template <typename ImplT, typename PostProcessFuncT, typename WithArgsT> -struct CreateFunc; - -template <typename ImplT, typename PostProcessFuncT> -struct CreateFunc<ImplT, PostProcessFuncT, with_args<false> > { - PostProcessFuncT const m_postProcessFunc; - explicit CreateFunc( PostProcessFuncT const& postProcessFunc ) - : m_postProcessFunc(postProcessFunc) {} - - css::uno::Reference<css::uno::XInterface> - operator()( ServiceDecl const& rServiceDecl, - css::uno::Sequence<css::uno::Any> const&, - css::uno::Reference<css::uno::XComponentContext> - const& xContext ) const - { - return m_postProcessFunc( - new ImplT( rServiceDecl, xContext ) ); - } -}; - -template <typename ImplT, typename PostProcessFuncT> -struct CreateFunc<ImplT, PostProcessFuncT, with_args<true> > { - PostProcessFuncT const m_postProcessFunc; - explicit CreateFunc( PostProcessFuncT const& postProcessFunc ) - : m_postProcessFunc(postProcessFunc) {} - - css::uno::Reference<css::uno::XInterface> - operator()( ServiceDecl const& rServiceDecl, - css::uno::Sequence<css::uno::Any> const& args, - css::uno::Reference<css::uno::XComponentContext> - const& xContext ) const - { - return m_postProcessFunc( - new ImplT( rServiceDecl, args, xContext ) ); - } -}; } // namespace detail -/** Defines a service implementation class. - - @tpl ImplT_ service implementation class - @WithArgsT whether the implementation class ctor expects arguments - (uno::Sequence<uno::Any>, uno::Reference<uno::XComponentContext>) - or just (uno::Reference<uno::XComponentContext>) -*/ -template <typename ImplT_, typename WithArgsT = with_args<false> > -struct serviceimpl_base { - typedef ImplT_ ImplT; - - detail::CreateFuncF const m_createFunc; - - typedef detail::PostProcessDefault<ImplT> PostProcessDefaultT; - - /** Default ctor. Implementation class without args, expecting - component context as single argument. - */ - serviceimpl_base() : m_createFunc( - detail::CreateFunc<ImplT, PostProcessDefaultT, WithArgsT>( - PostProcessDefaultT() ) ) {} - - /** Ctor to pass a post processing function/functor. - - @tpl PostProcessDefaultT let your compiler deduce this - @param postProcessFunc function/functor that gets the yet unacquired - ImplT_ pointer returning a - uno::Reference<uno::XInterface> - */ - template <typename PostProcessFuncT> - explicit serviceimpl_base( PostProcessFuncT const& postProcessFunc ) - : m_createFunc( detail::CreateFunc<ImplT, PostProcessFuncT, WithArgsT>( - postProcessFunc ) ) {} -}; - -template <typename ImplT_, typename WithArgsT = with_args<false> > -struct class_ : public serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT > -{ - typedef serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT > baseT; - /** Default ctor. Implementation class without args, expecting - component context as single argument. - */ - class_() : baseT() {} - template <typename PostProcessFuncT> - /** Ctor to pass a post processing function/functor. - - @tpl PostProcessDefaultT let your compiler deduce this - @param postProcessFunc function/functor that gets the yet unacquired - ImplT_ pointer returning a - uno::Reference<uno::XInterface> - */ - explicit class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {} -}; - -template <typename ImplT_, typename WithArgsT = with_args<false> > -struct inheritingClass_ : public serviceimpl_base< detail::InheritingServiceImpl<ImplT_>, WithArgsT > -{ - typedef serviceimpl_base< detail::InheritingServiceImpl<ImplT_>, WithArgsT > baseT; - /** Default ctor. Implementation class without args, expecting - component context as single argument. - */ - inheritingClass_() : baseT() {} - template <typename PostProcessFuncT> - /** Ctor to pass a post processing function/functor. - - @tpl PostProcessDefaultT let your compiler deduce this - @param postProcessFunc function/functor that gets the yet unacquired - ImplT_ pointer returning a - uno::Reference<uno::XInterface> - */ - explicit inheritingClass_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {} -}; COMPHELPER_DLLPUBLIC void* component_getFactoryHelper( const char* pImplName, |