merged tag LIBREOFFICE_3_2_99_3
[LibreOffice.git] / cppuhelper / source / typeprovider.cxx
blobfd403f9d2bebddc2e8c42c3c896568d71b99e599
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_cppuhelper.hxx"
32 #include <cppuhelper/typeprovider.hxx>
33 #include <osl/mutex.hxx>
35 using namespace osl;
36 using namespace com::sun::star::uno;
38 namespace cppu
41 //__________________________________________________________________________________________________
42 OImplementationId::~OImplementationId() SAL_THROW( () )
44 delete _pSeq;
46 //__________________________________________________________________________________________________
47 Sequence< sal_Int8 > OImplementationId::getImplementationId() const SAL_THROW( () )
49 if (! _pSeq)
51 MutexGuard aGuard( Mutex::getGlobalMutex() );
52 if (! _pSeq)
54 Sequence< sal_Int8 > * pSeq = new Sequence< sal_Int8 >( 16 );
55 ::rtl_createUuid( (sal_uInt8 *)pSeq->getArray(), 0, _bUseEthernetAddress );
56 _pSeq = pSeq;
59 return *_pSeq;
62 //--------------------------------------------------------------------------------------------------
63 static inline void copy( Sequence< Type > & rDest, const Sequence< Type > & rSource, sal_Int32 nOffset )
64 SAL_THROW( () )
66 Type * pDest = rDest.getArray();
67 const Type * pSource = rSource.getConstArray();
69 for ( sal_Int32 nPos = rSource.getLength(); nPos--; )
70 pDest[nOffset+ nPos] = pSource[nPos];
73 //__________________________________________________________________________________________________
74 OTypeCollection::OTypeCollection(
75 const Type & rType1,
76 const Sequence< Type > & rAddTypes )
77 SAL_THROW( () )
78 : _aTypes( 1 + rAddTypes.getLength() )
80 _aTypes[0] = rType1;
81 copy( _aTypes, rAddTypes, 1 );
83 //__________________________________________________________________________________________________
84 OTypeCollection::OTypeCollection(
85 const Type & rType1,
86 const Type & rType2,
87 const Sequence< Type > & rAddTypes )
88 SAL_THROW( () )
89 : _aTypes( 2 + rAddTypes.getLength() )
91 _aTypes[0] = rType1;
92 _aTypes[1] = rType2;
93 copy( _aTypes, rAddTypes, 2 );
95 //__________________________________________________________________________________________________
96 OTypeCollection::OTypeCollection(
97 const Type & rType1,
98 const Type & rType2,
99 const Type & rType3,
100 const Sequence< Type > & rAddTypes )
101 SAL_THROW( () )
102 : _aTypes( 3 + rAddTypes.getLength() )
104 _aTypes[0] = rType1;
105 _aTypes[1] = rType2;
106 _aTypes[2] = rType3;
107 copy( _aTypes, rAddTypes, 3 );
109 //__________________________________________________________________________________________________
110 OTypeCollection::OTypeCollection(
111 const Type & rType1,
112 const Type & rType2,
113 const Type & rType3,
114 const Type & rType4,
115 const Sequence< Type > & rAddTypes )
116 SAL_THROW( () )
117 : _aTypes( 4 + rAddTypes.getLength() )
119 _aTypes[0] = rType1;
120 _aTypes[1] = rType2;
121 _aTypes[2] = rType3;
122 _aTypes[3] = rType4;
123 copy( _aTypes, rAddTypes, 4 );
125 //__________________________________________________________________________________________________
126 OTypeCollection::OTypeCollection(
127 const Type & rType1,
128 const Type & rType2,
129 const Type & rType3,
130 const Type & rType4,
131 const Type & rType5,
132 const Sequence< Type > & rAddTypes )
133 SAL_THROW( () )
134 : _aTypes( 5 + rAddTypes.getLength() )
136 _aTypes[0] = rType1;
137 _aTypes[1] = rType2;
138 _aTypes[2] = rType3;
139 _aTypes[3] = rType4;
140 _aTypes[4] = rType5;
141 copy( _aTypes, rAddTypes, 5 );
143 //__________________________________________________________________________________________________
144 OTypeCollection::OTypeCollection(
145 const Type & rType1,
146 const Type & rType2,
147 const Type & rType3,
148 const Type & rType4,
149 const Type & rType5,
150 const Type & rType6,
151 const Sequence< Type > & rAddTypes )
152 SAL_THROW( () )
153 : _aTypes( 6 + rAddTypes.getLength() )
155 _aTypes[0] = rType1;
156 _aTypes[1] = rType2;
157 _aTypes[2] = rType3;
158 _aTypes[3] = rType4;
159 _aTypes[4] = rType5;
160 _aTypes[5] = rType6;
161 copy( _aTypes, rAddTypes, 6 );
163 //__________________________________________________________________________________________________
164 OTypeCollection::OTypeCollection(
165 const Type & rType1,
166 const Type & rType2,
167 const Type & rType3,
168 const Type & rType4,
169 const Type & rType5,
170 const Type & rType6,
171 const Type & rType7,
172 const Sequence< Type > & rAddTypes )
173 SAL_THROW( () )
174 : _aTypes( 7 + rAddTypes.getLength() )
176 _aTypes[0] = rType1;
177 _aTypes[1] = rType2;
178 _aTypes[2] = rType3;
179 _aTypes[3] = rType4;
180 _aTypes[4] = rType5;
181 _aTypes[5] = rType6;
182 _aTypes[6] = rType7;
183 copy( _aTypes, rAddTypes, 7 );
185 //__________________________________________________________________________________________________
186 OTypeCollection::OTypeCollection(
187 const Type & rType1,
188 const Type & rType2,
189 const Type & rType3,
190 const Type & rType4,
191 const Type & rType5,
192 const Type & rType6,
193 const Type & rType7,
194 const Type & rType8,
195 const Sequence< Type > & rAddTypes )
196 SAL_THROW( () )
197 : _aTypes( 8 + rAddTypes.getLength() )
199 _aTypes[0] = rType1;
200 _aTypes[1] = rType2;
201 _aTypes[2] = rType3;
202 _aTypes[3] = rType4;
203 _aTypes[4] = rType5;
204 _aTypes[5] = rType6;
205 _aTypes[6] = rType7;
206 _aTypes[7] = rType8;
207 copy( _aTypes, rAddTypes, 8 );
209 //__________________________________________________________________________________________________
210 OTypeCollection::OTypeCollection(
211 const Type & rType1,
212 const Type & rType2,
213 const Type & rType3,
214 const Type & rType4,
215 const Type & rType5,
216 const Type & rType6,
217 const Type & rType7,
218 const Type & rType8,
219 const Type & rType9,
220 const Sequence< Type > & rAddTypes )
221 SAL_THROW( () )
222 : _aTypes( 9 + rAddTypes.getLength() )
224 _aTypes[0] = rType1;
225 _aTypes[1] = rType2;
226 _aTypes[2] = rType3;
227 _aTypes[3] = rType4;
228 _aTypes[4] = rType5;
229 _aTypes[5] = rType6;
230 _aTypes[6] = rType7;
231 _aTypes[7] = rType8;
232 _aTypes[8] = rType9;
233 copy( _aTypes, rAddTypes, 9 );
235 //__________________________________________________________________________________________________
236 OTypeCollection::OTypeCollection(
237 const Type & rType1,
238 const Type & rType2,
239 const Type & rType3,
240 const Type & rType4,
241 const Type & rType5,
242 const Type & rType6,
243 const Type & rType7,
244 const Type & rType8,
245 const Type & rType9,
246 const Type & rType10,
247 const Sequence< Type > & rAddTypes )
248 SAL_THROW( () )
249 : _aTypes( 10 + rAddTypes.getLength() )
251 _aTypes[0] = rType1;
252 _aTypes[1] = rType2;
253 _aTypes[2] = rType3;
254 _aTypes[3] = rType4;
255 _aTypes[4] = rType5;
256 _aTypes[5] = rType6;
257 _aTypes[6] = rType7;
258 _aTypes[7] = rType8;
259 _aTypes[8] = rType9;
260 _aTypes[9] = rType10;
261 copy( _aTypes, rAddTypes, 10 );
263 //__________________________________________________________________________________________________
264 OTypeCollection::OTypeCollection(
265 const Type & rType1,
266 const Type & rType2,
267 const Type & rType3,
268 const Type & rType4,
269 const Type & rType5,
270 const Type & rType6,
271 const Type & rType7,
272 const Type & rType8,
273 const Type & rType9,
274 const Type & rType10,
275 const Type & rType11,
276 const Sequence< Type > & rAddTypes )
277 SAL_THROW( () )
278 : _aTypes( 11 + rAddTypes.getLength() )
280 _aTypes[0] = rType1;
281 _aTypes[1] = rType2;
282 _aTypes[2] = rType3;
283 _aTypes[3] = rType4;
284 _aTypes[4] = rType5;
285 _aTypes[5] = rType6;
286 _aTypes[6] = rType7;
287 _aTypes[7] = rType8;
288 _aTypes[8] = rType9;
289 _aTypes[9] = rType10;
290 _aTypes[10] = rType11;
291 copy( _aTypes, rAddTypes, 11 );
293 //__________________________________________________________________________________________________
294 OTypeCollection::OTypeCollection(
295 const Type & rType1,
296 const Type & rType2,
297 const Type & rType3,
298 const Type & rType4,
299 const Type & rType5,
300 const Type & rType6,
301 const Type & rType7,
302 const Type & rType8,
303 const Type & rType9,
304 const Type & rType10,
305 const Type & rType11,
306 const Type & rType12,
307 const Sequence< Type > & rAddTypes )
308 SAL_THROW( () )
309 : _aTypes( 12 + rAddTypes.getLength() )
311 _aTypes[0] = rType1;
312 _aTypes[1] = rType2;
313 _aTypes[2] = rType3;
314 _aTypes[3] = rType4;
315 _aTypes[4] = rType5;
316 _aTypes[5] = rType6;
317 _aTypes[6] = rType7;
318 _aTypes[7] = rType8;
319 _aTypes[8] = rType9;
320 _aTypes[9] = rType10;
321 _aTypes[10] = rType11;
322 _aTypes[11] = rType12;
323 copy( _aTypes, rAddTypes, 12 );
328 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */