LibreOffice
LibreOffice 5.3 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
compbase2.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 #ifndef INCLUDED_CPPUHELPER_COMPBASE2_HXX
20 #define INCLUDED_CPPUHELPER_COMPBASE2_HXX
21 
22 #include <cppuhelper/implbase2.hxx>
24 
25 namespace cppu
26 {
27 
42  template< class Ifc1, class Ifc2 >
43  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper2
44  : public WeakComponentImplHelperBase
45  , public css::lang::XTypeProvider
46  , public Ifc1, public Ifc2
47  {
48  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakComponentImplHelper2<Ifc1, Ifc2> > > {};
49  public:
50  inline WeakComponentImplHelper2( ::osl::Mutex & rMutex ) throw ()
51  : WeakComponentImplHelperBase( rMutex )
52  {}
53  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
54  { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
55  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
56  { WeakComponentImplHelperBase::acquire(); }
57  virtual void SAL_CALL release() throw () SAL_OVERRIDE
58  { WeakComponentImplHelperBase::release(); }
59  virtual void SAL_CALL dispose()throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
60  { WeakComponentImplHelperBase::dispose(); }
61  virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener)throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
62  { WeakComponentImplHelperBase::addEventListener(xListener); }
63  virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener)throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
64  { WeakComponentImplHelperBase::removeEventListener(xListener); }
65  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
66  { return WeakComponentImplHelper_getTypes( cd::get() ); }
67  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
68  { return ImplHelper_getImplementationId( cd::get() ); }
69  };
70 
80  template< class Ifc1, class Ifc2 >
81  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper2
82  : public WeakComponentImplHelperBase
83  , public css::lang::XTypeProvider
84  , public Ifc1, public Ifc2
85  {
86  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, PartialWeakComponentImplHelper2<Ifc1, Ifc2> > > {};
87  public:
88  inline PartialWeakComponentImplHelper2( ::osl::Mutex & rMutex ) throw ()
89  : WeakComponentImplHelperBase( rMutex )
90  {}
91  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
92  { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast<WeakComponentImplHelperBase *>(this) ); }
93  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
94  { WeakComponentImplHelperBase::acquire(); }
95  virtual void SAL_CALL release() throw () SAL_OVERRIDE
96  { WeakComponentImplHelperBase::release(); }
97  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
98  { return WeakComponentImplHelper_getTypes( cd::get() ); }
99  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
100  { return ImplHelper_getImplementationId( cd::get() ); }
101  };
102 
103 
121  template< class Ifc1, class Ifc2 >
122  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper2
123  : public WeakAggComponentImplHelperBase
124  , public css::lang::XTypeProvider
125  , public Ifc1, public Ifc2
126  {
127  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggComponentImplHelper2<Ifc1, Ifc2> > > {};
128  public:
129  inline WeakAggComponentImplHelper2( ::osl::Mutex & rMutex ) throw ()
130  : WeakAggComponentImplHelperBase( rMutex )
131  {}
132  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
134  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
135  { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast<WeakAggComponentImplHelperBase *>(this) ); }
136  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
137  { WeakAggComponentImplHelperBase::acquire(); }
138  virtual void SAL_CALL release() throw () SAL_OVERRIDE
139  { WeakAggComponentImplHelperBase::release(); }
140  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
141  { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
142  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
143  { return ImplHelper_getImplementationId( cd::get() ); }
144  };
145 }
146 
147 #endif
148 
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Implementation helper supporting css::lang::XTypeProvider and css::lang::XComponent.
Definition: compbase2.hxx:43
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: compbase2.hxx:91
A mutual exclusion synchronization object.
Definition: mutex.hxx:30
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:546
virtual void removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) SAL_OVERRIDE
Definition: compbase2.hxx:63
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
#define SAL_OVERRIDE
C++11 &quot;override&quot; feature.
Definition: types.h:423
virtual void addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) SAL_OVERRIDE
Definition: compbase2.hxx:61
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: compbase2.hxx:67
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: compbase2.hxx:142
WeakAggComponentImplHelper2(::osl::Mutex &rMutex)
Definition: compbase2.hxx:129
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: compbase2.hxx:97
Same as WeakComponentImplHelper2, except doesn&#39;t implement addEventListener, removeEventListener and ...
Definition: compbase2.hxx:81
Implementation helper supporting css::lang::XTypeProvider and css::lang::XComponent.
Definition: compbase2.hxx:122
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: compbase2.hxx:134
virtual void release() SAL_OVERRIDE
Definition: compbase2.hxx:57
virtual void acquire() SAL_OVERRIDE
Definition: compbase2.hxx:93
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:335
virtual void release() SAL_OVERRIDE
Definition: compbase2.hxx:138
virtual void dispose() SAL_OVERRIDE
Definition: compbase2.hxx:59
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: compbase2.hxx:65
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: compbase2.hxx:132
PartialWeakComponentImplHelper2(::osl::Mutex &rMutex)
Definition: compbase2.hxx:88
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: compbase2.hxx:140
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: compbase2.hxx:53
WeakComponentImplHelper2(::osl::Mutex &rMutex)
Definition: compbase2.hxx:50
virtual void acquire() SAL_OVERRIDE
Definition: compbase2.hxx:136
virtual void release() SAL_OVERRIDE
Definition: compbase2.hxx:95
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: compbase2.hxx:99
virtual void acquire() SAL_OVERRIDE
Definition: compbase2.hxx:55