From 8ad48d881b5d36af4d2e744cf8031b5f4b2f43e1 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 7 Jan 2015 17:42:07 +0100 Subject: Variadic cppu::ImplInheritanceHelper Change-Id: I7d958fdf328e44a0d299b29a3a165425731ccf7c --- include/cppuhelper/implbase.hxx | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'include') diff --git a/include/cppuhelper/implbase.hxx b/include/cppuhelper/implbase.hxx index 813ea3d0cf42..e97196d8532e 100644 --- a/include/cppuhelper/implbase.hxx +++ b/include/cppuhelper/implbase.hxx @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -89,6 +90,11 @@ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper: class_data, detail::ImplClassData> {}; +protected: + WeakImplHelper() {} + + virtual ~WeakImplHelper() {} + public: css::uno::Any SAL_CALL queryInterface(css::uno::Type const & aType) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE @@ -107,6 +113,43 @@ public: { return css::uno::Sequence(); } }; +template +class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper: + public BaseClass, public Ifc... +{ + struct cd: + rtl::StaticAggregate< + class_data, detail::ImplClassData> + {}; + +protected: + template ImplInheritanceHelper(Arg &&... arg): + BaseClass(std::forward(arg)...) + {} + + virtual ~ImplInheritanceHelper() {} + +public: + css::uno::Any SAL_CALL queryInterface(css::uno::Type const & aType) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE + { + css::uno::Any ret(ImplHelper_queryNoXInterface(aType, cd::get(), this)); + return ret.hasValue() ? ret : BaseClass::queryInterface(aType); + } + + void SAL_CALL acquire() throw () SAL_OVERRIDE { BaseClass::acquire(); } + + void SAL_CALL release() throw () SAL_OVERRIDE { BaseClass::release(); } + + css::uno::Sequence SAL_CALL getTypes() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE + { return ImplInhHelper_getTypes(cd::get(), BaseClass::getTypes()); } + + css::uno::Sequence SAL_CALL getImplementationId() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE + { return css::uno::Sequence(); } +}; + } #endif -- cgit