LibreOffice
LibreOffice 5.3 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
compbase_ex.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_COMPBASE_EX_HXX
20 #define INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
21 
24 #include <com/sun/star/lang/XComponent.hpp>
26 
28 
29 namespace osl { class Mutex; }
30 
31 namespace cppu
32 {
33 
37 class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakComponentImplHelperBase
38  : public ::cppu::OWeakObject
39  , public css::lang::XComponent
40 {
41 protected:
44  ::cppu::OBroadcastHelper rBHelper;
45 
48  virtual void SAL_CALL disposing();
49 
54  WeakComponentImplHelperBase( ::osl::Mutex & rMutex );
55 public:
58  virtual ~WeakComponentImplHelperBase() SAL_OVERRIDE;
59 
60  // these are here to force memory de/allocation to sal lib.
61  inline static void * SAL_CALL operator new( size_t nSize )
62  { return ::rtl_allocateMemory( nSize ); }
63  inline static void SAL_CALL operator delete( void * pMem )
64  { ::rtl_freeMemory( pMem ); }
65  inline static void * SAL_CALL operator new( size_t, void * pMem )
66  { return pMem; }
67  inline static void SAL_CALL operator delete( void *, void * )
68  {}
69 
70  virtual css::uno::Any SAL_CALL queryInterface(
71  css::uno::Type const & rType )
72  throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73  virtual void SAL_CALL acquire()
74  throw () SAL_OVERRIDE;
75  virtual void SAL_CALL release()
76  throw () SAL_OVERRIDE;
77  virtual void SAL_CALL dispose()
78  throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79  virtual void SAL_CALL addEventListener(
80  css::uno::Reference< css::lang::XEventListener > const & xListener )
81  throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82  virtual void SAL_CALL removeEventListener(
83  css::uno::Reference< css::lang::XEventListener > const & xListener )
84  throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 };
86 
90 class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakAggComponentImplHelperBase
91  : public ::cppu::OWeakAggObject
92  , public css::lang::XComponent
93 {
94 protected:
95  ::cppu::OBroadcastHelper rBHelper;
96 
99  virtual void SAL_CALL disposing();
100 
101  WeakAggComponentImplHelperBase( ::osl::Mutex & rMutex );
102 public:
103  virtual ~WeakAggComponentImplHelperBase() SAL_OVERRIDE;
104 
105  // these are here to force memory de/allocation to sal lib.
106  inline static void * SAL_CALL operator new( size_t nSize )
107  { return ::rtl_allocateMemory( nSize ); }
108  inline static void SAL_CALL operator delete( void * pMem )
109  { ::rtl_freeMemory( pMem ); }
110  inline static void * SAL_CALL operator new( size_t, void * pMem )
111  { return pMem; }
112  inline static void SAL_CALL operator delete( void *, void * )
113  {}
114 
115  virtual css::uno::Any SAL_CALL queryInterface(
116  css::uno::Type const & rType )
117  throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118  virtual css::uno::Any SAL_CALL queryAggregation(
119  css::uno::Type const & rType )
120  throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121  virtual void SAL_CALL acquire()
122  throw () SAL_OVERRIDE;
123  virtual void SAL_CALL release()
124  throw () SAL_OVERRIDE;
125  virtual void SAL_CALL dispose()
126  throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127  virtual void SAL_CALL addEventListener(
128  css::uno::Reference< css::lang::XEventListener > const & xListener )
129  throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130  virtual void SAL_CALL removeEventListener(
131  css::uno::Reference< css::lang::XEventListener > const & xListener )
132  throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 };
134 
137 CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakComponentImplHelper_query(
138  css::uno::Type const & rType,
139  class_data * cd,
140  void * that,
141  ::cppu::WeakComponentImplHelperBase * pBase );
144 CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakComponentImplHelper_getTypes(
145  class_data * cd );
146 
149 CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakAggComponentImplHelper_queryAgg(
150  css::uno::Type const & rType,
151  class_data * cd,
152  void * that,
153  ::cppu::WeakAggComponentImplHelperBase * pBase );
156 CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakAggComponentImplHelper_getTypes(
157  class_data * cd );
158 
159 }
160 
162 
163 #endif
164 
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
A mutual exclusion synchronization object.
Definition: mutex.hxx:30
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
#define SAL_OVERRIDE
C++11 &quot;override&quot; feature.
Definition: types.h:423
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:335
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
This struct contains the standard variables of a broadcaster.
Definition: interfacecontainer.h:435
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.