Branch data 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 : 319 : OImplementationId::~OImplementationId() SAL_THROW(())
32 : : {
33 [ + + ]: 319 : delete _pSeq;
34 : 319 : }
35 : : //__________________________________________________________________________________________________
36 : 159470 : Sequence< sal_Int8 > OImplementationId::getImplementationId() const SAL_THROW(())
37 : : {
38 [ + + ]: 159470 : if (! _pSeq)
39 : : {
40 [ + - ][ + - ]: 213 : MutexGuard aGuard( Mutex::getGlobalMutex() );
41 [ + - ]: 213 : if (! _pSeq)
42 : : {
43 [ + - ]: 213 : Sequence< sal_Int8 > * pSeq = new Sequence< sal_Int8 >( 16 );
44 [ + - ][ + - ]: 213 : ::rtl_createUuid( (sal_uInt8 *)pSeq->getArray(), 0, _bUseEthernetAddress );
45 : 213 : _pSeq = pSeq;
46 [ + - ]: 213 : }
47 : : }
48 : 159470 : return *_pSeq;
49 : : }
50 : :
51 : : //--------------------------------------------------------------------------------------------------
52 : 36 : static inline void copy( Sequence< Type > & rDest, const Sequence< Type > & rSource, sal_Int32 nOffset )
53 : : SAL_THROW(())
54 : : {
55 : 36 : Type * pDest = rDest.getArray();
56 : 36 : const Type * pSource = rSource.getConstArray();
57 : :
58 [ + + ]: 100 : for ( sal_Int32 nPos = rSource.getLength(); nPos--; )
59 : 64 : pDest[nOffset+ nPos] = pSource[nPos];
60 : 36 : }
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 : 14 : OTypeCollection::OTypeCollection(
86 : : const Type & rType1,
87 : : const Type & rType2,
88 : : const Type & rType3,
89 : : const Sequence< Type > & rAddTypes )
90 : : SAL_THROW(())
91 : 14 : : _aTypes( 3 + rAddTypes.getLength() )
92 : : {
93 [ + - ]: 14 : _aTypes[0] = rType1;
94 [ + - ]: 14 : _aTypes[1] = rType2;
95 [ + - ]: 14 : _aTypes[2] = rType3;
96 [ + - ]: 14 : copy( _aTypes, rAddTypes, 3 );
97 : 14 : }
98 : : //__________________________________________________________________________________________________
99 : 10 : 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 : 10 : : _aTypes( 4 + rAddTypes.getLength() )
107 : : {
108 [ + - ]: 10 : _aTypes[0] = rType1;
109 [ + - ]: 10 : _aTypes[1] = rType2;
110 [ + - ]: 10 : _aTypes[2] = rType3;
111 [ + - ]: 10 : _aTypes[3] = rType4;
112 [ + - ]: 10 : copy( _aTypes, rAddTypes, 4 );
113 : 10 : }
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 : 2 : 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 : 2 : : _aTypes( 6 + rAddTypes.getLength() )
143 : : {
144 [ + - ]: 2 : _aTypes[0] = rType1;
145 [ + - ]: 2 : _aTypes[1] = rType2;
146 [ + - ]: 2 : _aTypes[2] = rType3;
147 [ + - ]: 2 : _aTypes[3] = rType4;
148 [ + - ]: 2 : _aTypes[4] = rType5;
149 [ + - ]: 2 : _aTypes[5] = rType6;
150 [ + - ]: 2 : copy( _aTypes, rAddTypes, 6 );
151 : 2 : }
152 : : //__________________________________________________________________________________________________
153 : 2 : 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 : 2 : : _aTypes( 7 + rAddTypes.getLength() )
164 : : {
165 [ + - ]: 2 : _aTypes[0] = rType1;
166 [ + - ]: 2 : _aTypes[1] = rType2;
167 [ + - ]: 2 : _aTypes[2] = rType3;
168 [ + - ]: 2 : _aTypes[3] = rType4;
169 [ + - ]: 2 : _aTypes[4] = rType5;
170 [ + - ]: 2 : _aTypes[5] = rType6;
171 [ + - ]: 2 : _aTypes[6] = rType7;
172 [ + - ]: 2 : copy( _aTypes, rAddTypes, 7 );
173 : 2 : }
174 : : //__________________________________________________________________________________________________
175 : 2 : 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 : 2 : : _aTypes( 8 + rAddTypes.getLength() )
187 : : {
188 [ + - ]: 2 : _aTypes[0] = rType1;
189 [ + - ]: 2 : _aTypes[1] = rType2;
190 [ + - ]: 2 : _aTypes[2] = rType3;
191 [ + - ]: 2 : _aTypes[3] = rType4;
192 [ + - ]: 2 : _aTypes[4] = rType5;
193 [ + - ]: 2 : _aTypes[5] = rType6;
194 [ + - ]: 2 : _aTypes[6] = rType7;
195 [ + - ]: 2 : _aTypes[7] = rType8;
196 [ + - ]: 2 : copy( _aTypes, rAddTypes, 8 );
197 : 2 : }
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 : 2 : 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 : 2 : : _aTypes( 10 + rAddTypes.getLength() )
239 : : {
240 [ + - ]: 2 : _aTypes[0] = rType1;
241 [ + - ]: 2 : _aTypes[1] = rType2;
242 [ + - ]: 2 : _aTypes[2] = rType3;
243 [ + - ]: 2 : _aTypes[3] = rType4;
244 [ + - ]: 2 : _aTypes[4] = rType5;
245 [ + - ]: 2 : _aTypes[5] = rType6;
246 [ + - ]: 2 : _aTypes[6] = rType7;
247 [ + - ]: 2 : _aTypes[7] = rType8;
248 [ + - ]: 2 : _aTypes[8] = rType9;
249 [ + - ]: 2 : _aTypes[9] = rType10;
250 [ + - ]: 2 : copy( _aTypes, rAddTypes, 10 );
251 : 2 : }
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 : 4 : 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 : 4 : : _aTypes( 12 + rAddTypes.getLength() )
299 : : {
300 [ + - ]: 4 : _aTypes[0] = rType1;
301 [ + - ]: 4 : _aTypes[1] = rType2;
302 [ + - ]: 4 : _aTypes[2] = rType3;
303 [ + - ]: 4 : _aTypes[3] = rType4;
304 [ + - ]: 4 : _aTypes[4] = rType5;
305 [ + - ]: 4 : _aTypes[5] = rType6;
306 [ + - ]: 4 : _aTypes[6] = rType7;
307 [ + - ]: 4 : _aTypes[7] = rType8;
308 [ + - ]: 4 : _aTypes[8] = rType9;
309 [ + - ]: 4 : _aTypes[9] = rType10;
310 [ + - ]: 4 : _aTypes[10] = rType11;
311 [ + - ]: 4 : _aTypes[11] = rType12;
312 [ + - ]: 4 : copy( _aTypes, rAddTypes, 12 );
313 : 4 : }
314 : :
315 : : }
316 : :
317 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|