Line data Source code
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 : #include <cppuhelper/typeprovider.hxx>
22 : #include <osl/mutex.hxx>
23 :
24 : using namespace osl;
25 : using namespace com::sun::star::uno;
26 :
27 : namespace cppu
28 : {
29 :
30 :
31 0 : OImplementationId::~OImplementationId() SAL_THROW(())
32 : {
33 0 : delete _pSeq;
34 0 : }
35 :
36 0 : Sequence< sal_Int8 > OImplementationId::getImplementationId() const SAL_THROW(())
37 : {
38 0 : if (! _pSeq)
39 : {
40 0 : MutexGuard aGuard( Mutex::getGlobalMutex() );
41 0 : if (! _pSeq)
42 : {
43 0 : Sequence< sal_Int8 > * pSeq = new Sequence< sal_Int8 >( 16 );
44 0 : ::rtl_createUuid( (sal_uInt8 *)pSeq->getArray(), 0, _bUseEthernetAddress );
45 0 : _pSeq = pSeq;
46 0 : }
47 : }
48 0 : return *_pSeq;
49 : }
50 :
51 :
52 0 : static inline void copy( Sequence< Type > & rDest, const Sequence< Type > & rSource, sal_Int32 nOffset )
53 : SAL_THROW(())
54 : {
55 0 : Type * pDest = rDest.getArray();
56 0 : const Type * pSource = rSource.getConstArray();
57 :
58 0 : for ( sal_Int32 nPos = rSource.getLength(); nPos--; )
59 0 : pDest[nOffset+ nPos] = pSource[nPos];
60 0 : }
61 :
62 :
63 0 : OTypeCollection::OTypeCollection(
64 : const Type & rType1,
65 : const Sequence< Type > & rAddTypes )
66 : SAL_THROW(())
67 0 : : _aTypes( 1 + rAddTypes.getLength() )
68 : {
69 0 : _aTypes[0] = rType1;
70 0 : copy( _aTypes, rAddTypes, 1 );
71 0 : }
72 :
73 0 : OTypeCollection::OTypeCollection(
74 : const Type & rType1,
75 : const Type & rType2,
76 : const Sequence< Type > & rAddTypes )
77 : SAL_THROW(())
78 0 : : _aTypes( 2 + rAddTypes.getLength() )
79 : {
80 0 : _aTypes[0] = rType1;
81 0 : _aTypes[1] = rType2;
82 0 : copy( _aTypes, rAddTypes, 2 );
83 0 : }
84 :
85 0 : OTypeCollection::OTypeCollection(
86 : const Type & rType1,
87 : const Type & rType2,
88 : const Type & rType3,
89 : const Sequence< Type > & rAddTypes )
90 : SAL_THROW(())
91 0 : : _aTypes( 3 + rAddTypes.getLength() )
92 : {
93 0 : _aTypes[0] = rType1;
94 0 : _aTypes[1] = rType2;
95 0 : _aTypes[2] = rType3;
96 0 : copy( _aTypes, rAddTypes, 3 );
97 0 : }
98 :
99 0 : OTypeCollection::OTypeCollection(
100 : const Type & rType1,
101 : const Type & rType2,
102 : const Type & rType3,
103 : const Type & rType4,
104 : const Sequence< Type > & rAddTypes )
105 : SAL_THROW(())
106 0 : : _aTypes( 4 + rAddTypes.getLength() )
107 : {
108 0 : _aTypes[0] = rType1;
109 0 : _aTypes[1] = rType2;
110 0 : _aTypes[2] = rType3;
111 0 : _aTypes[3] = rType4;
112 0 : copy( _aTypes, rAddTypes, 4 );
113 0 : }
114 :
115 0 : OTypeCollection::OTypeCollection(
116 : const Type & rType1,
117 : const Type & rType2,
118 : const Type & rType3,
119 : const Type & rType4,
120 : const Type & rType5,
121 : const Sequence< Type > & rAddTypes )
122 : SAL_THROW(())
123 0 : : _aTypes( 5 + rAddTypes.getLength() )
124 : {
125 0 : _aTypes[0] = rType1;
126 0 : _aTypes[1] = rType2;
127 0 : _aTypes[2] = rType3;
128 0 : _aTypes[3] = rType4;
129 0 : _aTypes[4] = rType5;
130 0 : copy( _aTypes, rAddTypes, 5 );
131 0 : }
132 :
133 0 : OTypeCollection::OTypeCollection(
134 : const Type & rType1,
135 : const Type & rType2,
136 : const Type & rType3,
137 : const Type & rType4,
138 : const Type & rType5,
139 : const Type & rType6,
140 : const Sequence< Type > & rAddTypes )
141 : SAL_THROW(())
142 0 : : _aTypes( 6 + rAddTypes.getLength() )
143 : {
144 0 : _aTypes[0] = rType1;
145 0 : _aTypes[1] = rType2;
146 0 : _aTypes[2] = rType3;
147 0 : _aTypes[3] = rType4;
148 0 : _aTypes[4] = rType5;
149 0 : _aTypes[5] = rType6;
150 0 : copy( _aTypes, rAddTypes, 6 );
151 0 : }
152 :
153 0 : OTypeCollection::OTypeCollection(
154 : const Type & rType1,
155 : const Type & rType2,
156 : const Type & rType3,
157 : const Type & rType4,
158 : const Type & rType5,
159 : const Type & rType6,
160 : const Type & rType7,
161 : const Sequence< Type > & rAddTypes )
162 : SAL_THROW(())
163 0 : : _aTypes( 7 + rAddTypes.getLength() )
164 : {
165 0 : _aTypes[0] = rType1;
166 0 : _aTypes[1] = rType2;
167 0 : _aTypes[2] = rType3;
168 0 : _aTypes[3] = rType4;
169 0 : _aTypes[4] = rType5;
170 0 : _aTypes[5] = rType6;
171 0 : _aTypes[6] = rType7;
172 0 : copy( _aTypes, rAddTypes, 7 );
173 0 : }
174 :
175 0 : OTypeCollection::OTypeCollection(
176 : const Type & rType1,
177 : const Type & rType2,
178 : const Type & rType3,
179 : const Type & rType4,
180 : const Type & rType5,
181 : const Type & rType6,
182 : const Type & rType7,
183 : const Type & rType8,
184 : const Sequence< Type > & rAddTypes )
185 : SAL_THROW(())
186 0 : : _aTypes( 8 + rAddTypes.getLength() )
187 : {
188 0 : _aTypes[0] = rType1;
189 0 : _aTypes[1] = rType2;
190 0 : _aTypes[2] = rType3;
191 0 : _aTypes[3] = rType4;
192 0 : _aTypes[4] = rType5;
193 0 : _aTypes[5] = rType6;
194 0 : _aTypes[6] = rType7;
195 0 : _aTypes[7] = rType8;
196 0 : copy( _aTypes, rAddTypes, 8 );
197 0 : }
198 :
199 0 : OTypeCollection::OTypeCollection(
200 : const Type & rType1,
201 : const Type & rType2,
202 : const Type & rType3,
203 : const Type & rType4,
204 : const Type & rType5,
205 : const Type & rType6,
206 : const Type & rType7,
207 : const Type & rType8,
208 : const Type & rType9,
209 : const Sequence< Type > & rAddTypes )
210 : SAL_THROW(())
211 0 : : _aTypes( 9 + rAddTypes.getLength() )
212 : {
213 0 : _aTypes[0] = rType1;
214 0 : _aTypes[1] = rType2;
215 0 : _aTypes[2] = rType3;
216 0 : _aTypes[3] = rType4;
217 0 : _aTypes[4] = rType5;
218 0 : _aTypes[5] = rType6;
219 0 : _aTypes[6] = rType7;
220 0 : _aTypes[7] = rType8;
221 0 : _aTypes[8] = rType9;
222 0 : copy( _aTypes, rAddTypes, 9 );
223 0 : }
224 :
225 0 : OTypeCollection::OTypeCollection(
226 : const Type & rType1,
227 : const Type & rType2,
228 : const Type & rType3,
229 : const Type & rType4,
230 : const Type & rType5,
231 : const Type & rType6,
232 : const Type & rType7,
233 : const Type & rType8,
234 : const Type & rType9,
235 : const Type & rType10,
236 : const Sequence< Type > & rAddTypes )
237 : SAL_THROW(())
238 0 : : _aTypes( 10 + rAddTypes.getLength() )
239 : {
240 0 : _aTypes[0] = rType1;
241 0 : _aTypes[1] = rType2;
242 0 : _aTypes[2] = rType3;
243 0 : _aTypes[3] = rType4;
244 0 : _aTypes[4] = rType5;
245 0 : _aTypes[5] = rType6;
246 0 : _aTypes[6] = rType7;
247 0 : _aTypes[7] = rType8;
248 0 : _aTypes[8] = rType9;
249 0 : _aTypes[9] = rType10;
250 0 : copy( _aTypes, rAddTypes, 10 );
251 0 : }
252 :
253 0 : OTypeCollection::OTypeCollection(
254 : const Type & rType1,
255 : const Type & rType2,
256 : const Type & rType3,
257 : const Type & rType4,
258 : const Type & rType5,
259 : const Type & rType6,
260 : const Type & rType7,
261 : const Type & rType8,
262 : const Type & rType9,
263 : const Type & rType10,
264 : const Type & rType11,
265 : const Sequence< Type > & rAddTypes )
266 : SAL_THROW(())
267 0 : : _aTypes( 11 + rAddTypes.getLength() )
268 : {
269 0 : _aTypes[0] = rType1;
270 0 : _aTypes[1] = rType2;
271 0 : _aTypes[2] = rType3;
272 0 : _aTypes[3] = rType4;
273 0 : _aTypes[4] = rType5;
274 0 : _aTypes[5] = rType6;
275 0 : _aTypes[6] = rType7;
276 0 : _aTypes[7] = rType8;
277 0 : _aTypes[8] = rType9;
278 0 : _aTypes[9] = rType10;
279 0 : _aTypes[10] = rType11;
280 0 : copy( _aTypes, rAddTypes, 11 );
281 0 : }
282 :
283 0 : OTypeCollection::OTypeCollection(
284 : const Type & rType1,
285 : const Type & rType2,
286 : const Type & rType3,
287 : const Type & rType4,
288 : const Type & rType5,
289 : const Type & rType6,
290 : const Type & rType7,
291 : const Type & rType8,
292 : const Type & rType9,
293 : const Type & rType10,
294 : const Type & rType11,
295 : const Type & rType12,
296 : const Sequence< Type > & rAddTypes )
297 : SAL_THROW(())
298 0 : : _aTypes( 12 + rAddTypes.getLength() )
299 : {
300 0 : _aTypes[0] = rType1;
301 0 : _aTypes[1] = rType2;
302 0 : _aTypes[2] = rType3;
303 0 : _aTypes[3] = rType4;
304 0 : _aTypes[4] = rType5;
305 0 : _aTypes[5] = rType6;
306 0 : _aTypes[6] = rType7;
307 0 : _aTypes[7] = rType8;
308 0 : _aTypes[8] = rType9;
309 0 : _aTypes[9] = rType10;
310 0 : _aTypes[10] = rType11;
311 0 : _aTypes[11] = rType12;
312 0 : copy( _aTypes, rAddTypes, 12 );
313 0 : }
314 :
315 : }
316 :
317 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|