Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
29 : : #define _CPPUHELPER_TYPEPROVIDER_HXX_
30 : :
31 : : #include <rtl/alloc.h>
32 : : #include <rtl/uuid.h>
33 : : #include <com/sun/star/uno/Sequence.hxx>
34 : : #include "cppuhelperdllapi.h"
35 : :
36 : :
37 : : namespace cppu
38 : : {
39 : :
40 : : /** Helper class to implement com::sun::star::lang::XTypeProvider. Construct a static object
41 : : of this class with your UNO object's supported types.
42 : : */
43 : 36 : class CPPUHELPER_DLLPUBLIC OTypeCollection
44 : : {
45 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > _aTypes;
46 : :
47 : : public:
48 : : /// @cond INTERNAL
49 : : // these are here to force memory de/allocation to sal lib.
50 : 0 : inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
51 : 0 : { return ::rtl_allocateMemory( nSize ); }
52 : 0 : inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
53 : 0 : { ::rtl_freeMemory( pMem ); }
54 : : inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
55 : : { return pMem; }
56 : : inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
57 : : {}
58 : : /// @endcond
59 : :
60 : 0 : inline OTypeCollection( const OTypeCollection & rCollection )
61 : : SAL_THROW(())
62 : 0 : : _aTypes( rCollection._aTypes )
63 : 0 : {}
64 : : OTypeCollection(
65 : : const ::com::sun::star::uno::Type & rType1,
66 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
67 : : SAL_THROW(());
68 : : OTypeCollection(
69 : : const ::com::sun::star::uno::Type & rType1,
70 : : const ::com::sun::star::uno::Type & rType2,
71 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
72 : : SAL_THROW(());
73 : : OTypeCollection(
74 : : const ::com::sun::star::uno::Type & rType1,
75 : : const ::com::sun::star::uno::Type & rType2,
76 : : const ::com::sun::star::uno::Type & rType3,
77 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
78 : : SAL_THROW(());
79 : : OTypeCollection(
80 : : const ::com::sun::star::uno::Type & rType1,
81 : : const ::com::sun::star::uno::Type & rType2,
82 : : const ::com::sun::star::uno::Type & rType3,
83 : : const ::com::sun::star::uno::Type & rType4,
84 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
85 : : SAL_THROW(());
86 : : OTypeCollection(
87 : : const ::com::sun::star::uno::Type & rType1,
88 : : const ::com::sun::star::uno::Type & rType2,
89 : : const ::com::sun::star::uno::Type & rType3,
90 : : const ::com::sun::star::uno::Type & rType4,
91 : : const ::com::sun::star::uno::Type & rType5,
92 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
93 : : SAL_THROW(());
94 : : OTypeCollection(
95 : : const ::com::sun::star::uno::Type & rType1,
96 : : const ::com::sun::star::uno::Type & rType2,
97 : : const ::com::sun::star::uno::Type & rType3,
98 : : const ::com::sun::star::uno::Type & rType4,
99 : : const ::com::sun::star::uno::Type & rType5,
100 : : const ::com::sun::star::uno::Type & rType6,
101 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
102 : : SAL_THROW(());
103 : : OTypeCollection(
104 : : const ::com::sun::star::uno::Type & rType1,
105 : : const ::com::sun::star::uno::Type & rType2,
106 : : const ::com::sun::star::uno::Type & rType3,
107 : : const ::com::sun::star::uno::Type & rType4,
108 : : const ::com::sun::star::uno::Type & rType5,
109 : : const ::com::sun::star::uno::Type & rType6,
110 : : const ::com::sun::star::uno::Type & rType7,
111 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
112 : : SAL_THROW(());
113 : : OTypeCollection(
114 : : const ::com::sun::star::uno::Type & rType1,
115 : : const ::com::sun::star::uno::Type & rType2,
116 : : const ::com::sun::star::uno::Type & rType3,
117 : : const ::com::sun::star::uno::Type & rType4,
118 : : const ::com::sun::star::uno::Type & rType5,
119 : : const ::com::sun::star::uno::Type & rType6,
120 : : const ::com::sun::star::uno::Type & rType7,
121 : : const ::com::sun::star::uno::Type & rType8,
122 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
123 : : SAL_THROW(());
124 : : OTypeCollection(
125 : : const ::com::sun::star::uno::Type & rType1,
126 : : const ::com::sun::star::uno::Type & rType2,
127 : : const ::com::sun::star::uno::Type & rType3,
128 : : const ::com::sun::star::uno::Type & rType4,
129 : : const ::com::sun::star::uno::Type & rType5,
130 : : const ::com::sun::star::uno::Type & rType6,
131 : : const ::com::sun::star::uno::Type & rType7,
132 : : const ::com::sun::star::uno::Type & rType8,
133 : : const ::com::sun::star::uno::Type & rType9,
134 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
135 : : SAL_THROW(());
136 : : OTypeCollection(
137 : : const ::com::sun::star::uno::Type & rType1,
138 : : const ::com::sun::star::uno::Type & rType2,
139 : : const ::com::sun::star::uno::Type & rType3,
140 : : const ::com::sun::star::uno::Type & rType4,
141 : : const ::com::sun::star::uno::Type & rType5,
142 : : const ::com::sun::star::uno::Type & rType6,
143 : : const ::com::sun::star::uno::Type & rType7,
144 : : const ::com::sun::star::uno::Type & rType8,
145 : : const ::com::sun::star::uno::Type & rType9,
146 : : const ::com::sun::star::uno::Type & rType10,
147 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
148 : : SAL_THROW(());
149 : : OTypeCollection(
150 : : const ::com::sun::star::uno::Type & rType1,
151 : : const ::com::sun::star::uno::Type & rType2,
152 : : const ::com::sun::star::uno::Type & rType3,
153 : : const ::com::sun::star::uno::Type & rType4,
154 : : const ::com::sun::star::uno::Type & rType5,
155 : : const ::com::sun::star::uno::Type & rType6,
156 : : const ::com::sun::star::uno::Type & rType7,
157 : : const ::com::sun::star::uno::Type & rType8,
158 : : const ::com::sun::star::uno::Type & rType9,
159 : : const ::com::sun::star::uno::Type & rType10,
160 : : const ::com::sun::star::uno::Type & rType11,
161 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
162 : : SAL_THROW(());
163 : : OTypeCollection(
164 : : const ::com::sun::star::uno::Type & rType1,
165 : : const ::com::sun::star::uno::Type & rType2,
166 : : const ::com::sun::star::uno::Type & rType3,
167 : : const ::com::sun::star::uno::Type & rType4,
168 : : const ::com::sun::star::uno::Type & rType5,
169 : : const ::com::sun::star::uno::Type & rType6,
170 : : const ::com::sun::star::uno::Type & rType7,
171 : : const ::com::sun::star::uno::Type & rType8,
172 : : const ::com::sun::star::uno::Type & rType9,
173 : : const ::com::sun::star::uno::Type & rType10,
174 : : const ::com::sun::star::uno::Type & rType11,
175 : : const ::com::sun::star::uno::Type & rType12,
176 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() )
177 : : SAL_THROW(());
178 : :
179 : : /** Called upon XTypeProvider::getTypes().
180 : :
181 : : @return type collection
182 : : */
183 : 142 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() SAL_THROW(())
184 : 142 : { return _aTypes; }
185 : : };
186 : :
187 : : /** Helper class to implement com::sun::star::lang::XTypeProvider. Construct a static object
188 : : of this class for your UNO object's implementation id.
189 : : */
190 : : class CPPUHELPER_DLLPUBLIC OImplementationId
191 : : {
192 : : mutable ::com::sun::star::uno::Sequence< sal_Int8 > * _pSeq;
193 : : sal_Bool _bUseEthernetAddress;
194 : :
195 : : public:
196 : : /// @cond INTERNAL
197 : :
198 : : // these are here to force memory de/allocation to sal lib.
199 : : inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
200 : : { return ::rtl_allocateMemory( nSize ); }
201 : : inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
202 : : { ::rtl_freeMemory( pMem ); }
203 : : inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
204 : : { return pMem; }
205 : : inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
206 : : {}
207 : :
208 : : ~OImplementationId() SAL_THROW(());
209 : :
210 : : /// @endcond
211 : :
212 : : /** Constructor.
213 : :
214 : : @param bUseEthernetAddress whether an ethernet mac address should be taken into account
215 : : */
216 : 269 : inline OImplementationId( sal_Bool bUseEthernetAddress = sal_True ) SAL_THROW(())
217 : : : _pSeq( 0 )
218 : 269 : , _bUseEthernetAddress( bUseEthernetAddress )
219 : 269 : {}
220 : : /** Constructor giving implementation id.
221 : :
222 : : @param rSeq implementation id
223 : : */
224 : : inline OImplementationId( const ::com::sun::star::uno::Sequence< sal_Int8 > & rSeq ) SAL_THROW(())
225 : : : _pSeq( new ::com::sun::star::uno::Sequence< sal_Int8 >( rSeq ) )
226 : : {}
227 : 64 : inline OImplementationId( const OImplementationId & rId ) SAL_THROW(())
228 [ + - ]: 64 : : _pSeq( new ::com::sun::star::uno::Sequence< sal_Int8 >( rId.getImplementationId() ) )
229 : 64 : {}
230 : :
231 : : /** Called upon XTypeProvider::getImplementationId().
232 : :
233 : : @return implementation id
234 : : */
235 : : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() const SAL_THROW(());
236 : : };
237 : :
238 : : }
239 : :
240 : : #endif
241 : :
242 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|