CWS-TOOLING: integrate CWS npower12
This commit is contained in:
commit
df19494dfb
1 changed files with 46 additions and 14 deletions
|
@ -169,21 +169,20 @@ template <bool> struct with_args;
|
||||||
|
|
||||||
/// @internal
|
/// @internal
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template <typename ImplT>
|
template <typename ImplT>
|
||||||
class ServiceImpl
|
class OwnServiceImpl
|
||||||
: public ::cppu::ImplInheritanceHelper1<ImplT, css::lang::XServiceInfo>,
|
: public ImplT,
|
||||||
private ::boost::noncopyable
|
private ::boost::noncopyable
|
||||||
{
|
{
|
||||||
typedef ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> BaseT;
|
typedef ImplT BaseT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ServiceImpl(
|
OwnServiceImpl(
|
||||||
ServiceDecl const& rServiceDecl,
|
ServiceDecl const& rServiceDecl,
|
||||||
css::uno::Sequence<css::uno::Any> const& args,
|
css::uno::Sequence<css::uno::Any> const& args,
|
||||||
css::uno::Reference<css::uno::XComponentContext> const& xContext )
|
css::uno::Reference<css::uno::XComponentContext> const& xContext )
|
||||||
: BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {}
|
:BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {}
|
||||||
ServiceImpl(
|
OwnServiceImpl(
|
||||||
ServiceDecl const& rServiceDecl,
|
ServiceDecl const& rServiceDecl,
|
||||||
css::uno::Reference<css::uno::XComponentContext> const& xContext )
|
css::uno::Reference<css::uno::XComponentContext> const& xContext )
|
||||||
: BaseT(xContext), m_rServiceDecl(rServiceDecl) {}
|
: BaseT(xContext), m_rServiceDecl(rServiceDecl) {}
|
||||||
|
@ -206,6 +205,22 @@ private:
|
||||||
ServiceDecl const& m_rServiceDecl;
|
ServiceDecl const& m_rServiceDecl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename ImplT>
|
||||||
|
class ServiceImpl : public OwnServiceImpl< ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> >
|
||||||
|
{
|
||||||
|
typedef OwnServiceImpl< ::cppu::ImplInheritanceHelper1<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 ServiceImplT>
|
template <typename ServiceImplT>
|
||||||
struct PostProcessDefault {
|
struct PostProcessDefault {
|
||||||
css::uno::Reference<css::uno::XInterface>
|
css::uno::Reference<css::uno::XInterface>
|
||||||
|
@ -230,7 +245,7 @@ struct CreateFunc<ImplT, PostProcessFuncT, with_args<false> > {
|
||||||
const& xContext ) const
|
const& xContext ) const
|
||||||
{
|
{
|
||||||
return m_postProcessFunc(
|
return m_postProcessFunc(
|
||||||
new ServiceImpl<ImplT>( rServiceDecl, xContext ) );
|
new ImplT( rServiceDecl, xContext ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -247,7 +262,7 @@ struct CreateFunc<ImplT, PostProcessFuncT, with_args<true> > {
|
||||||
const& xContext ) const
|
const& xContext ) const
|
||||||
{
|
{
|
||||||
return m_postProcessFunc(
|
return m_postProcessFunc(
|
||||||
new ServiceImpl<ImplT>( rServiceDecl, args, xContext ) );
|
new ImplT( rServiceDecl, args, xContext ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -261,18 +276,17 @@ struct CreateFunc<ImplT, PostProcessFuncT, with_args<true> > {
|
||||||
or just (uno::Reference<uno::XComponentContext>)
|
or just (uno::Reference<uno::XComponentContext>)
|
||||||
*/
|
*/
|
||||||
template <typename ImplT_, typename WithArgsT = with_args<false> >
|
template <typename ImplT_, typename WithArgsT = with_args<false> >
|
||||||
struct class_ {
|
struct serviceimpl_base {
|
||||||
typedef ImplT_ ImplT;
|
typedef ImplT_ ImplT;
|
||||||
typedef detail::ServiceImpl<ImplT_> ServiceImplT;
|
|
||||||
|
|
||||||
detail::CreateFuncF const m_createFunc;
|
detail::CreateFuncF const m_createFunc;
|
||||||
|
|
||||||
typedef detail::PostProcessDefault<ServiceImplT> PostProcessDefaultT;
|
typedef detail::PostProcessDefault<ImplT> PostProcessDefaultT;
|
||||||
|
|
||||||
/** Default ctor. Implementation class without args, expecting
|
/** Default ctor. Implementation class without args, expecting
|
||||||
component context as single argument.
|
component context as single argument.
|
||||||
*/
|
*/
|
||||||
class_() : m_createFunc(
|
serviceimpl_base() : m_createFunc(
|
||||||
detail::CreateFunc<ImplT, PostProcessDefaultT, WithArgsT>(
|
detail::CreateFunc<ImplT, PostProcessDefaultT, WithArgsT>(
|
||||||
PostProcessDefaultT() ) ) {}
|
PostProcessDefaultT() ) ) {}
|
||||||
|
|
||||||
|
@ -284,11 +298,29 @@ struct class_ {
|
||||||
uno::Reference<uno::XInterface>
|
uno::Reference<uno::XInterface>
|
||||||
*/
|
*/
|
||||||
template <typename PostProcessFuncT>
|
template <typename PostProcessFuncT>
|
||||||
explicit class_( PostProcessFuncT const& postProcessFunc )
|
explicit serviceimpl_base( PostProcessFuncT const& postProcessFunc )
|
||||||
: m_createFunc( detail::CreateFunc<ImplT, PostProcessFuncT, WithArgsT>(
|
: m_createFunc( detail::CreateFunc<ImplT, PostProcessFuncT, WithArgsT>(
|
||||||
postProcessFunc ) ) {}
|
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 ) {}
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// component_... helpers with arbitrary service declarations:
|
// component_... helpers with arbitrary service declarations:
|
||||||
|
|
Loading…
Reference in a new issue