update dev300-m58
[ooovba.git] / cppuhelper / source / typeprovider.cxx
blobb3c5df0ba7f7d7d6bea10dd374ebdf5ae3a7a412
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: typeprovider.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_cppuhelper.hxx"
34 #include <cppuhelper/typeprovider.hxx>
35 #include <osl/mutex.hxx>
37 using namespace osl;
38 using namespace com::sun::star::uno;
40 namespace cppu
43 //__________________________________________________________________________________________________
44 OImplementationId::~OImplementationId() SAL_THROW( () )
46 delete _pSeq;
48 //__________________________________________________________________________________________________
49 Sequence< sal_Int8 > OImplementationId::getImplementationId() const SAL_THROW( () )
51 if (! _pSeq)
53 MutexGuard aGuard( Mutex::getGlobalMutex() );
54 if (! _pSeq)
56 Sequence< sal_Int8 > * pSeq = new Sequence< sal_Int8 >( 16 );
57 ::rtl_createUuid( (sal_uInt8 *)pSeq->getArray(), 0, _bUseEthernetAddress );
58 _pSeq = pSeq;
61 return *_pSeq;
64 //--------------------------------------------------------------------------------------------------
65 static inline void copy( Sequence< Type > & rDest, const Sequence< Type > & rSource, sal_Int32 nOffset )
66 SAL_THROW( () )
68 Type * pDest = rDest.getArray();
69 const Type * pSource = rSource.getConstArray();
71 for ( sal_Int32 nPos = rSource.getLength(); nPos--; )
72 pDest[nOffset+ nPos] = pSource[nPos];
75 //__________________________________________________________________________________________________
76 OTypeCollection::OTypeCollection(
77 const Type & rType1,
78 const Sequence< Type > & rAddTypes )
79 SAL_THROW( () )
80 : _aTypes( 1 + rAddTypes.getLength() )
82 _aTypes[0] = rType1;
83 copy( _aTypes, rAddTypes, 1 );
85 //__________________________________________________________________________________________________
86 OTypeCollection::OTypeCollection(
87 const Type & rType1,
88 const Type & rType2,
89 const Sequence< Type > & rAddTypes )
90 SAL_THROW( () )
91 : _aTypes( 2 + rAddTypes.getLength() )
93 _aTypes[0] = rType1;
94 _aTypes[1] = rType2;
95 copy( _aTypes, rAddTypes, 2 );
97 //__________________________________________________________________________________________________
98 OTypeCollection::OTypeCollection(
99 const Type & rType1,
100 const Type & rType2,
101 const Type & rType3,
102 const Sequence< Type > & rAddTypes )
103 SAL_THROW( () )
104 : _aTypes( 3 + rAddTypes.getLength() )
106 _aTypes[0] = rType1;
107 _aTypes[1] = rType2;
108 _aTypes[2] = rType3;
109 copy( _aTypes, rAddTypes, 3 );
111 //__________________________________________________________________________________________________
112 OTypeCollection::OTypeCollection(
113 const Type & rType1,
114 const Type & rType2,
115 const Type & rType3,
116 const Type & rType4,
117 const Sequence< Type > & rAddTypes )
118 SAL_THROW( () )
119 : _aTypes( 4 + rAddTypes.getLength() )
121 _aTypes[0] = rType1;
122 _aTypes[1] = rType2;
123 _aTypes[2] = rType3;
124 _aTypes[3] = rType4;
125 copy( _aTypes, rAddTypes, 4 );
127 //__________________________________________________________________________________________________
128 OTypeCollection::OTypeCollection(
129 const Type & rType1,
130 const Type & rType2,
131 const Type & rType3,
132 const Type & rType4,
133 const Type & rType5,
134 const Sequence< Type > & rAddTypes )
135 SAL_THROW( () )
136 : _aTypes( 5 + rAddTypes.getLength() )
138 _aTypes[0] = rType1;
139 _aTypes[1] = rType2;
140 _aTypes[2] = rType3;
141 _aTypes[3] = rType4;
142 _aTypes[4] = rType5;
143 copy( _aTypes, rAddTypes, 5 );
145 //__________________________________________________________________________________________________
146 OTypeCollection::OTypeCollection(
147 const Type & rType1,
148 const Type & rType2,
149 const Type & rType3,
150 const Type & rType4,
151 const Type & rType5,
152 const Type & rType6,
153 const Sequence< Type > & rAddTypes )
154 SAL_THROW( () )
155 : _aTypes( 6 + rAddTypes.getLength() )
157 _aTypes[0] = rType1;
158 _aTypes[1] = rType2;
159 _aTypes[2] = rType3;
160 _aTypes[3] = rType4;
161 _aTypes[4] = rType5;
162 _aTypes[5] = rType6;
163 copy( _aTypes, rAddTypes, 6 );
165 //__________________________________________________________________________________________________
166 OTypeCollection::OTypeCollection(
167 const Type & rType1,
168 const Type & rType2,
169 const Type & rType3,
170 const Type & rType4,
171 const Type & rType5,
172 const Type & rType6,
173 const Type & rType7,
174 const Sequence< Type > & rAddTypes )
175 SAL_THROW( () )
176 : _aTypes( 7 + rAddTypes.getLength() )
178 _aTypes[0] = rType1;
179 _aTypes[1] = rType2;
180 _aTypes[2] = rType3;
181 _aTypes[3] = rType4;
182 _aTypes[4] = rType5;
183 _aTypes[5] = rType6;
184 _aTypes[6] = rType7;
185 copy( _aTypes, rAddTypes, 7 );
187 //__________________________________________________________________________________________________
188 OTypeCollection::OTypeCollection(
189 const Type & rType1,
190 const Type & rType2,
191 const Type & rType3,
192 const Type & rType4,
193 const Type & rType5,
194 const Type & rType6,
195 const Type & rType7,
196 const Type & rType8,
197 const Sequence< Type > & rAddTypes )
198 SAL_THROW( () )
199 : _aTypes( 8 + rAddTypes.getLength() )
201 _aTypes[0] = rType1;
202 _aTypes[1] = rType2;
203 _aTypes[2] = rType3;
204 _aTypes[3] = rType4;
205 _aTypes[4] = rType5;
206 _aTypes[5] = rType6;
207 _aTypes[6] = rType7;
208 _aTypes[7] = rType8;
209 copy( _aTypes, rAddTypes, 8 );
211 //__________________________________________________________________________________________________
212 OTypeCollection::OTypeCollection(
213 const Type & rType1,
214 const Type & rType2,
215 const Type & rType3,
216 const Type & rType4,
217 const Type & rType5,
218 const Type & rType6,
219 const Type & rType7,
220 const Type & rType8,
221 const Type & rType9,
222 const Sequence< Type > & rAddTypes )
223 SAL_THROW( () )
224 : _aTypes( 9 + rAddTypes.getLength() )
226 _aTypes[0] = rType1;
227 _aTypes[1] = rType2;
228 _aTypes[2] = rType3;
229 _aTypes[3] = rType4;
230 _aTypes[4] = rType5;
231 _aTypes[5] = rType6;
232 _aTypes[6] = rType7;
233 _aTypes[7] = rType8;
234 _aTypes[8] = rType9;
235 copy( _aTypes, rAddTypes, 9 );
237 //__________________________________________________________________________________________________
238 OTypeCollection::OTypeCollection(
239 const Type & rType1,
240 const Type & rType2,
241 const Type & rType3,
242 const Type & rType4,
243 const Type & rType5,
244 const Type & rType6,
245 const Type & rType7,
246 const Type & rType8,
247 const Type & rType9,
248 const Type & rType10,
249 const Sequence< Type > & rAddTypes )
250 SAL_THROW( () )
251 : _aTypes( 10 + rAddTypes.getLength() )
253 _aTypes[0] = rType1;
254 _aTypes[1] = rType2;
255 _aTypes[2] = rType3;
256 _aTypes[3] = rType4;
257 _aTypes[4] = rType5;
258 _aTypes[5] = rType6;
259 _aTypes[6] = rType7;
260 _aTypes[7] = rType8;
261 _aTypes[8] = rType9;
262 _aTypes[9] = rType10;
263 copy( _aTypes, rAddTypes, 10 );
265 //__________________________________________________________________________________________________
266 OTypeCollection::OTypeCollection(
267 const Type & rType1,
268 const Type & rType2,
269 const Type & rType3,
270 const Type & rType4,
271 const Type & rType5,
272 const Type & rType6,
273 const Type & rType7,
274 const Type & rType8,
275 const Type & rType9,
276 const Type & rType10,
277 const Type & rType11,
278 const Sequence< Type > & rAddTypes )
279 SAL_THROW( () )
280 : _aTypes( 11 + rAddTypes.getLength() )
282 _aTypes[0] = rType1;
283 _aTypes[1] = rType2;
284 _aTypes[2] = rType3;
285 _aTypes[3] = rType4;
286 _aTypes[4] = rType5;
287 _aTypes[5] = rType6;
288 _aTypes[6] = rType7;
289 _aTypes[7] = rType8;
290 _aTypes[8] = rType9;
291 _aTypes[9] = rType10;
292 _aTypes[10] = rType11;
293 copy( _aTypes, rAddTypes, 11 );
295 //__________________________________________________________________________________________________
296 OTypeCollection::OTypeCollection(
297 const Type & rType1,
298 const Type & rType2,
299 const Type & rType3,
300 const Type & rType4,
301 const Type & rType5,
302 const Type & rType6,
303 const Type & rType7,
304 const Type & rType8,
305 const Type & rType9,
306 const Type & rType10,
307 const Type & rType11,
308 const Type & rType12,
309 const Sequence< Type > & rAddTypes )
310 SAL_THROW( () )
311 : _aTypes( 12 + rAddTypes.getLength() )
313 _aTypes[0] = rType1;
314 _aTypes[1] = rType2;
315 _aTypes[2] = rType3;
316 _aTypes[3] = rType4;
317 _aTypes[4] = rType5;
318 _aTypes[5] = rType6;
319 _aTypes[6] = rType7;
320 _aTypes[7] = rType8;
321 _aTypes[8] = rType9;
322 _aTypes[9] = rType10;
323 _aTypes[10] = rType11;
324 _aTypes[11] = rType12;
325 copy( _aTypes, rAddTypes, 12 );