From 8fba7530a9ee5e96b21afa88e3eb177b41cba951 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Fri, 18 Sep 2009 15:24:22 +0000 Subject: initial commit of code reorg, existing files that are modified --- comphelper/inc/comphelper/servicedecl.hxx | 60 +++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 14 deletions(-) (limited to 'comphelper') diff --git a/comphelper/inc/comphelper/servicedecl.hxx b/comphelper/inc/comphelper/servicedecl.hxx index a11598bdca85..7b77d3ba29e7 100644 --- a/comphelper/inc/comphelper/servicedecl.hxx +++ b/comphelper/inc/comphelper/servicedecl.hxx @@ -169,21 +169,20 @@ template struct with_args; /// @internal namespace detail { - template -class ServiceImpl - : public ::cppu::ImplInheritanceHelper1, +class OwnServiceImpl + : public ImplT, private ::boost::noncopyable { - typedef ::cppu::ImplInheritanceHelper1 BaseT; + typedef ImplT BaseT; public: - ServiceImpl( + OwnServiceImpl( ServiceDecl const& rServiceDecl, css::uno::Sequence const& args, css::uno::Reference const& xContext ) - : BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {} - ServiceImpl( + :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {} + OwnServiceImpl( ServiceDecl const& rServiceDecl, css::uno::Reference const& xContext ) : BaseT(xContext), m_rServiceDecl(rServiceDecl) {} @@ -206,6 +205,22 @@ private: ServiceDecl const& m_rServiceDecl; }; +template +class ServiceImpl : public OwnServiceImpl< ::cppu::ImplInheritanceHelper1 > +{ +typedef OwnServiceImpl< ::cppu::ImplInheritanceHelper1 > ServiceImpl_BASE; +public: + ServiceImpl( + ServiceDecl const& rServiceDecl, + css::uno::Sequence const& args, + css::uno::Reference const& xContext ) + : ServiceImpl_BASE(rServiceDecl, args, xContext) {} + ServiceImpl( + ServiceDecl const& rServiceDecl, + css::uno::Reference const& xContext ) + : ServiceImpl_BASE(rServiceDecl, xContext) {} +}; + template struct PostProcessDefault { css::uno::Reference @@ -230,7 +245,7 @@ struct CreateFunc > { const& xContext ) const { return m_postProcessFunc( - new ServiceImpl( rServiceDecl, xContext ) ); + new ImplT( rServiceDecl, xContext ) ); } }; @@ -247,7 +262,7 @@ struct CreateFunc > { const& xContext ) const { return m_postProcessFunc( - new ServiceImpl( rServiceDecl, args, xContext ) ); + new ImplT( rServiceDecl, args, xContext ) ); } }; @@ -261,18 +276,17 @@ struct CreateFunc > { or just (uno::Reference) */ template > -struct class_ { +struct serviceimpl_base { typedef ImplT_ ImplT; - typedef detail::ServiceImpl ServiceImplT; detail::CreateFuncF const m_createFunc; - typedef detail::PostProcessDefault PostProcessDefaultT; + typedef detail::PostProcessDefault PostProcessDefaultT; /** Default ctor. Implementation class without args, expecting component context as single argument. */ - class_() : m_createFunc( + serviceimpl_base() : m_createFunc( detail::CreateFunc( PostProcessDefaultT() ) ) {} @@ -284,11 +298,29 @@ struct class_ { uno::Reference */ template - explicit class_( PostProcessFuncT const& postProcessFunc ) + explicit serviceimpl_base( PostProcessFuncT const& postProcessFunc ) : m_createFunc( detail::CreateFunc( postProcessFunc ) ) {} }; +template > +struct class_ : public serviceimpl_base< detail::ServiceImpl, WithArgsT > +{ + typedef serviceimpl_base< detail::ServiceImpl, WithArgsT > baseT; + /** Default ctor. Implementation class without args, expecting + component context as single argument. + */ + class_() : baseT() {} + template + /** 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 + */ + explicit class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {} +}; // // component_... helpers with arbitrary service declarations: -- cgit v1.2.3