LibreOffice Module cppuhelper (master)  1
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 
20 /*
21  * This file is part of LibreOffice published API.
22  */
23 #ifndef INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
24 #define INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
25 
27 #include "com/sun/star/lang/XComponent.hpp"
29 #include "cppuhelper/weak.hxx"
30 #include "cppuhelper/weakagg.hxx"
31 
33 
34 namespace osl { class Mutex; }
35 namespace cppu { struct class_data; }
36 
37 namespace cppu
38 {
39 
43 class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakComponentImplHelperBase
44  : public ::cppu::OWeakObject
45  , public css::lang::XComponent
46 {
47 protected:
50  ::cppu::OBroadcastHelper rBHelper;
51 
54  virtual void SAL_CALL disposing();
55 
60  WeakComponentImplHelperBase( ::osl::Mutex & rMutex );
61 public:
64  virtual ~WeakComponentImplHelperBase() SAL_OVERRIDE;
65 
66  // these are here to force memory de/allocation to sal lib.
67  static void * SAL_CALL operator new( size_t nSize )
68  { return ::rtl_allocateMemory( nSize ); }
69  static void SAL_CALL operator delete( void * pMem )
70  { ::rtl_freeMemory( pMem ); }
71  static void * SAL_CALL operator new( size_t, void * pMem )
72  { return pMem; }
73  static void SAL_CALL operator delete( void *, void * )
74  {}
75 
76  virtual css::uno::Any SAL_CALL queryInterface(
77  css::uno::Type const & rType ) SAL_OVERRIDE;
78  virtual void SAL_CALL acquire()
79  SAL_NOEXCEPT SAL_OVERRIDE;
80  virtual void SAL_CALL release()
81  SAL_NOEXCEPT SAL_OVERRIDE;
82  virtual void SAL_CALL dispose() SAL_OVERRIDE;
83  virtual void SAL_CALL addEventListener(
84  css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
85  virtual void SAL_CALL removeEventListener(
86  css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
87 };
88 
92 class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakAggComponentImplHelperBase
93  : public ::cppu::OWeakAggObject
94  , public css::lang::XComponent
95 {
96 protected:
97  ::cppu::OBroadcastHelper rBHelper;
98 
101  virtual void SAL_CALL disposing();
102 
103  WeakAggComponentImplHelperBase( ::osl::Mutex & rMutex );
104 public:
105  virtual ~WeakAggComponentImplHelperBase() SAL_OVERRIDE;
106 
107  // these are here to force memory de/allocation to sal lib.
108  static void * SAL_CALL operator new( size_t nSize )
109  { return ::rtl_allocateMemory( nSize ); }
110  static void SAL_CALL operator delete( void * pMem )
111  { ::rtl_freeMemory( pMem ); }
112  static void * SAL_CALL operator new( size_t, void * pMem )
113  { return pMem; }
114  static void SAL_CALL operator delete( void *, void * )
115  {}
116 
117  virtual css::uno::Any SAL_CALL queryInterface(
118  css::uno::Type const & rType ) SAL_OVERRIDE;
119  virtual css::uno::Any SAL_CALL queryAggregation(
120  css::uno::Type const & rType ) SAL_OVERRIDE;
121  virtual void SAL_CALL acquire()
122  SAL_NOEXCEPT SAL_OVERRIDE;
123  virtual void SAL_CALL release()
124  SAL_NOEXCEPT SAL_OVERRIDE;
125  virtual void SAL_CALL dispose() SAL_OVERRIDE;
126  virtual void SAL_CALL addEventListener(
127  css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
128  virtual void SAL_CALL removeEventListener(
129  css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
130 };
131 
135  css::uno::Type const & rType,
136  class_data * cd,
137  void * that,
138  ::cppu::WeakComponentImplHelperBase * pBase );
141 CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakComponentImplHelper_getTypes(
142  class_data * cd );
143 
147  css::uno::Type const & rType,
148  class_data * cd,
149  void * that,
150  ::cppu::WeakAggComponentImplHelperBase * pBase );
153 CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakAggComponentImplHelper_getTypes(
154  class_data * cd );
155 
156 }
157 
159 
160 #endif
161 
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Type
Any SAL_CALL WeakComponentImplHelper_query(Type const &rType, class_data *cd, void *that, WeakComponentImplHelperBase *pBase)
Any SAL_CALL WeakAggComponentImplHelper_queryAgg(Type const &rType, class_data *cd, void *that, WeakAggComponentImplHelperBase *pBase)
Sequence< Type > SAL_CALL WeakAggComponentImplHelper_getTypes(class_data *cd)
Sequence< Type > SAL_CALL WeakComponentImplHelper_getTypes(class_data *cd)
This struct contains the standard variables of a broadcaster.
Base class to implement a UNO object supporting weak references, i.e.
Definition: weak.hxx:47
#define SAL_NO_VTABLE
#define CPPUHELPER_DLLPUBLIC
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.