1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cppuhelper.hxx"
26 
27 #include <cppuhelper/typeprovider.hxx>
28 #include <osl/mutex.hxx>
29 
30 using namespace osl;
31 using namespace com::sun::star::uno;
32 
33 namespace cppu
34 {
35 
36 //__________________________________________________________________________________________________
~OImplementationId()37 OImplementationId::~OImplementationId() SAL_THROW( () )
38 {
39 	delete _pSeq;
40 }
41 //__________________________________________________________________________________________________
getImplementationId() const42 Sequence< sal_Int8 > OImplementationId::getImplementationId() const SAL_THROW( () )
43 {
44 	if (! _pSeq)
45 	{
46 		MutexGuard aGuard( Mutex::getGlobalMutex() );
47 		if (! _pSeq)
48 		{
49 			Sequence< sal_Int8 > * pSeq = new Sequence< sal_Int8 >( 16 );
50 			::rtl_createUuid( (sal_uInt8 *)pSeq->getArray(), 0, _bUseEthernetAddress );
51 			_pSeq = pSeq;
52 		}
53 	}
54 	return *_pSeq;
55 }
56 
57 //--------------------------------------------------------------------------------------------------
copy(Sequence<Type> & rDest,const Sequence<Type> & rSource,sal_Int32 nOffset)58 static inline void copy( Sequence< Type > & rDest, const Sequence< Type > & rSource, sal_Int32 nOffset )
59 	SAL_THROW( () )
60 {
61 	Type * pDest = rDest.getArray();
62 	const Type * pSource = rSource.getConstArray();
63 
64 	for ( sal_Int32 nPos = rSource.getLength(); nPos--; )
65 		pDest[nOffset+ nPos] = pSource[nPos];
66 }
67 
68 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Sequence<Type> & rAddTypes)69 OTypeCollection::OTypeCollection(
70 	const Type & rType1,
71 	const Sequence< Type > & rAddTypes )
72 	SAL_THROW( () )
73 	: _aTypes( 1 + rAddTypes.getLength() )
74 {
75 	_aTypes[0] = rType1;
76 	copy( _aTypes, rAddTypes, 1 );
77 }
78 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Sequence<Type> & rAddTypes)79 OTypeCollection::OTypeCollection(
80 	const Type & rType1,
81 	const Type & rType2,
82 	const Sequence< Type > & rAddTypes )
83 	SAL_THROW( () )
84 	: _aTypes( 2 + rAddTypes.getLength() )
85 {
86 	_aTypes[0] = rType1;
87 	_aTypes[1] = rType2;
88 	copy( _aTypes, rAddTypes, 2 );
89 }
90 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Type & rType3,const Sequence<Type> & rAddTypes)91 OTypeCollection::OTypeCollection(
92 	const Type & rType1,
93 	const Type & rType2,
94 	const Type & rType3,
95 	const Sequence< Type > & rAddTypes )
96 	SAL_THROW( () )
97 	: _aTypes( 3 + rAddTypes.getLength() )
98 {
99 	_aTypes[0] = rType1;
100 	_aTypes[1] = rType2;
101 	_aTypes[2] = rType3;
102 	copy( _aTypes, rAddTypes, 3 );
103 }
104 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Type & rType3,const Type & rType4,const Sequence<Type> & rAddTypes)105 OTypeCollection::OTypeCollection(
106 	const Type & rType1,
107 	const Type & rType2,
108 	const Type & rType3,
109 	const Type & rType4,
110 	const Sequence< Type > & rAddTypes )
111 	SAL_THROW( () )
112 	: _aTypes( 4 + rAddTypes.getLength() )
113 {
114 	_aTypes[0] = rType1;
115 	_aTypes[1] = rType2;
116 	_aTypes[2] = rType3;
117 	_aTypes[3] = rType4;
118 	copy( _aTypes, rAddTypes, 4 );
119 }
120 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Type & rType3,const Type & rType4,const Type & rType5,const Sequence<Type> & rAddTypes)121 OTypeCollection::OTypeCollection(
122 	const Type & rType1,
123 	const Type & rType2,
124 	const Type & rType3,
125 	const Type & rType4,
126 	const Type & rType5,
127 	const Sequence< Type > & rAddTypes )
128 	SAL_THROW( () )
129 	: _aTypes( 5 + rAddTypes.getLength() )
130 {
131 	_aTypes[0] = rType1;
132 	_aTypes[1] = rType2;
133 	_aTypes[2] = rType3;
134 	_aTypes[3] = rType4;
135 	_aTypes[4] = rType5;
136 	copy( _aTypes, rAddTypes, 5 );
137 }
138 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Type & rType3,const Type & rType4,const Type & rType5,const Type & rType6,const Sequence<Type> & rAddTypes)139 OTypeCollection::OTypeCollection(
140 	const Type & rType1,
141 	const Type & rType2,
142 	const Type & rType3,
143 	const Type & rType4,
144 	const Type & rType5,
145 	const Type & rType6,
146 	const Sequence< Type > & rAddTypes )
147 	SAL_THROW( () )
148 	: _aTypes( 6 + rAddTypes.getLength() )
149 {
150 	_aTypes[0] = rType1;
151 	_aTypes[1] = rType2;
152 	_aTypes[2] = rType3;
153 	_aTypes[3] = rType4;
154 	_aTypes[4] = rType5;
155 	_aTypes[5] = rType6;
156 	copy( _aTypes, rAddTypes, 6 );
157 }
158 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Type & rType3,const Type & rType4,const Type & rType5,const Type & rType6,const Type & rType7,const Sequence<Type> & rAddTypes)159 OTypeCollection::OTypeCollection(
160 	const Type & rType1,
161 	const Type & rType2,
162 	const Type & rType3,
163 	const Type & rType4,
164 	const Type & rType5,
165 	const Type & rType6,
166 	const Type & rType7,
167 	const Sequence< Type > & rAddTypes )
168 	SAL_THROW( () )
169 	: _aTypes( 7 + rAddTypes.getLength() )
170 {
171 	_aTypes[0] = rType1;
172 	_aTypes[1] = rType2;
173 	_aTypes[2] = rType3;
174 	_aTypes[3] = rType4;
175 	_aTypes[4] = rType5;
176 	_aTypes[5] = rType6;
177 	_aTypes[6] = rType7;
178 	copy( _aTypes, rAddTypes, 7 );
179 }
180 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Type & rType3,const Type & rType4,const Type & rType5,const Type & rType6,const Type & rType7,const Type & rType8,const Sequence<Type> & rAddTypes)181 OTypeCollection::OTypeCollection(
182 	const Type & rType1,
183 	const Type & rType2,
184 	const Type & rType3,
185 	const Type & rType4,
186 	const Type & rType5,
187 	const Type & rType6,
188 	const Type & rType7,
189 	const Type & rType8,
190 	const Sequence< Type > & rAddTypes )
191 	SAL_THROW( () )
192 	: _aTypes( 8 + rAddTypes.getLength() )
193 {
194 	_aTypes[0] = rType1;
195 	_aTypes[1] = rType2;
196 	_aTypes[2] = rType3;
197 	_aTypes[3] = rType4;
198 	_aTypes[4] = rType5;
199 	_aTypes[5] = rType6;
200 	_aTypes[6] = rType7;
201 	_aTypes[7] = rType8;
202 	copy( _aTypes, rAddTypes, 8 );
203 }
204 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Type & rType3,const Type & rType4,const Type & rType5,const Type & rType6,const Type & rType7,const Type & rType8,const Type & rType9,const Sequence<Type> & rAddTypes)205 OTypeCollection::OTypeCollection(
206 	const Type & rType1,
207 	const Type & rType2,
208 	const Type & rType3,
209 	const Type & rType4,
210 	const Type & rType5,
211 	const Type & rType6,
212 	const Type & rType7,
213 	const Type & rType8,
214 	const Type & rType9,
215 	const Sequence< Type > & rAddTypes )
216 	SAL_THROW( () )
217 	: _aTypes( 9 + rAddTypes.getLength() )
218 {
219 	_aTypes[0] = rType1;
220 	_aTypes[1] = rType2;
221 	_aTypes[2] = rType3;
222 	_aTypes[3] = rType4;
223 	_aTypes[4] = rType5;
224 	_aTypes[5] = rType6;
225 	_aTypes[6] = rType7;
226 	_aTypes[7] = rType8;
227 	_aTypes[8] = rType9;
228 	copy( _aTypes, rAddTypes, 9 );
229 }
230 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Type & rType3,const Type & rType4,const Type & rType5,const Type & rType6,const Type & rType7,const Type & rType8,const Type & rType9,const Type & rType10,const Sequence<Type> & rAddTypes)231 OTypeCollection::OTypeCollection(
232 	const Type & rType1,
233 	const Type & rType2,
234 	const Type & rType3,
235 	const Type & rType4,
236 	const Type & rType5,
237 	const Type & rType6,
238 	const Type & rType7,
239 	const Type & rType8,
240 	const Type & rType9,
241 	const Type & rType10,
242 	const Sequence< Type > & rAddTypes )
243 	SAL_THROW( () )
244 	: _aTypes( 10 + rAddTypes.getLength() )
245 {
246 	_aTypes[0] = rType1;
247 	_aTypes[1] = rType2;
248 	_aTypes[2] = rType3;
249 	_aTypes[3] = rType4;
250 	_aTypes[4] = rType5;
251 	_aTypes[5] = rType6;
252 	_aTypes[6] = rType7;
253 	_aTypes[7] = rType8;
254 	_aTypes[8] = rType9;
255 	_aTypes[9] = rType10;
256 	copy( _aTypes, rAddTypes, 10 );
257 }
258 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Type & rType3,const Type & rType4,const Type & rType5,const Type & rType6,const Type & rType7,const Type & rType8,const Type & rType9,const Type & rType10,const Type & rType11,const Sequence<Type> & rAddTypes)259 OTypeCollection::OTypeCollection(
260 	const Type & rType1,
261 	const Type & rType2,
262 	const Type & rType3,
263 	const Type & rType4,
264 	const Type & rType5,
265 	const Type & rType6,
266 	const Type & rType7,
267 	const Type & rType8,
268 	const Type & rType9,
269 	const Type & rType10,
270 	const Type & rType11,
271 	const Sequence< Type > & rAddTypes )
272 	SAL_THROW( () )
273 	: _aTypes( 11 + rAddTypes.getLength() )
274 {
275 	_aTypes[0] = rType1;
276 	_aTypes[1] = rType2;
277 	_aTypes[2] = rType3;
278 	_aTypes[3] = rType4;
279 	_aTypes[4] = rType5;
280 	_aTypes[5] = rType6;
281 	_aTypes[6] = rType7;
282 	_aTypes[7] = rType8;
283 	_aTypes[8] = rType9;
284 	_aTypes[9] = rType10;
285 	_aTypes[10] = rType11;
286 	copy( _aTypes, rAddTypes, 11 );
287 }
288 //__________________________________________________________________________________________________
OTypeCollection(const Type & rType1,const Type & rType2,const Type & rType3,const Type & rType4,const Type & rType5,const Type & rType6,const Type & rType7,const Type & rType8,const Type & rType9,const Type & rType10,const Type & rType11,const Type & rType12,const Sequence<Type> & rAddTypes)289 OTypeCollection::OTypeCollection(
290 	const Type & rType1,
291 	const Type & rType2,
292 	const Type & rType3,
293 	const Type & rType4,
294 	const Type & rType5,
295 	const Type & rType6,
296 	const Type & rType7,
297 	const Type & rType8,
298 	const Type & rType9,
299 	const Type & rType10,
300 	const Type & rType11,
301 	const Type & rType12,
302 	const Sequence< Type > & rAddTypes )
303 	SAL_THROW( () )
304 	: _aTypes( 12 + rAddTypes.getLength() )
305 {
306 	_aTypes[0] = rType1;
307 	_aTypes[1] = rType2;
308 	_aTypes[2] = rType3;
309 	_aTypes[3] = rType4;
310 	_aTypes[4] = rType5;
311 	_aTypes[5] = rType6;
312 	_aTypes[6] = rType7;
313 	_aTypes[7] = rType8;
314 	_aTypes[8] = rType9;
315 	_aTypes[9] = rType10;
316 	_aTypes[10] = rType11;
317 	_aTypes[11] = rType12;
318 	copy( _aTypes, rAddTypes, 12 );
319 }
320 
321 }
322 
323