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