Bump version to 24.04.3.4
[LibreOffice.git] / cppuhelper / source / typeprovider.cxx
blob649e0ed5503d39c7e73f1fcb3dbf995c17c8b521
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <cppuhelper/typeprovider.hxx>
22 #include <rtl/uuid.h>
23 #include <osl/mutex.hxx>
25 #include <algorithm>
27 using namespace osl;
28 using namespace com::sun::star::uno;
30 namespace cppu
33 // suppress spurious warning triggered by SAL_DEPRECATED in class declaration
34 #if defined _MSC_VER && !defined __clang__
35 #pragma warning(push)
36 #pragma warning(disable: 4996)
37 #endif
39 OImplementationId::~OImplementationId()
41 delete _pSeq;
44 #if defined _MSC_VER && !defined __clang__
45 #pragma warning(pop)
46 #endif
48 Sequence< sal_Int8 > OImplementationId::getImplementationId() const
50 if (! _pSeq)
52 MutexGuard aGuard( Mutex::getGlobalMutex() );
53 if (! _pSeq)
55 Sequence< sal_Int8 > * pSeq = new Sequence< sal_Int8 >( 16 );
56 ::rtl_createUuid( reinterpret_cast<sal_uInt8 *>(pSeq->getArray()), nullptr, _bUseEthernetAddress );
57 _pSeq = pSeq;
60 return *_pSeq;
63 namespace
65 sal_Int32 TypeSeqLen(const Sequence<Type>& s) { return s.getLength(); }
66 template <class... Args> sal_Int32 TypeSeqLen(const Type&, Args... args)
68 return 1 + TypeSeqLen(args...);
71 void PutToTypeSeq(Type* p, const Sequence<Type>& s) { std::copy(s.begin(), s.end(), p); }
72 template <class... Args> void PutToTypeSeq(Type* p, const Type& t, Args... args)
74 *p = t;
75 PutToTypeSeq(p + 1, args...);
78 template <class... Args> Sequence<Type> InitTypeSeq(Args... args)
80 Sequence<Type> s(TypeSeqLen(args...));
81 PutToTypeSeq(s.getArray(), args...);
82 return s;
86 OTypeCollection::OTypeCollection(
87 const Type & rT1,
88 const Sequence< Type > & rMore )
89 : _aTypes(InitTypeSeq(rT1, rMore))
93 OTypeCollection::OTypeCollection(
94 const Type & rT1,
95 const Type & rT2,
96 const Sequence< Type > & rMore )
97 : _aTypes(InitTypeSeq(rT1, rT2, rMore))
101 OTypeCollection::OTypeCollection(
102 const Type & rT1,
103 const Type & rT2,
104 const Type & rT3,
105 const Sequence< Type > & rMore )
106 : _aTypes(InitTypeSeq(rT1, rT2, rT3, rMore))
110 OTypeCollection::OTypeCollection(
111 const Type & rT1,
112 const Type & rT2,
113 const Type & rT3,
114 const Type & rT4,
115 const Sequence< Type > & rMore )
116 : _aTypes(InitTypeSeq(rT1, rT2, rT3, rT4, rMore))
120 OTypeCollection::OTypeCollection(
121 const Type & rT1,
122 const Type & rT2,
123 const Type & rT3,
124 const Type & rT4,
125 const Type & rT5,
126 const Sequence< Type > & rMore )
127 : _aTypes(InitTypeSeq(rT1, rT2, rT3, rT4, rT5, rMore))
131 OTypeCollection::OTypeCollection(
132 const Type & rT1,
133 const Type & rT2,
134 const Type & rT3,
135 const Type & rT4,
136 const Type & rT5,
137 const Type & rT6,
138 const Sequence< Type > & rMore )
139 : _aTypes(InitTypeSeq(rT1, rT2, rT3, rT4, rT5, rT6, rMore))
143 OTypeCollection::OTypeCollection(
144 const Type & rT1,
145 const Type & rT2,
146 const Type & rT3,
147 const Type & rT4,
148 const Type & rT5,
149 const Type & rT6,
150 const Type & rT7,
151 const Sequence< Type > & rMore )
152 : _aTypes(InitTypeSeq(rT1, rT2, rT3, rT4, rT5, rT6, rT7, rMore))
156 OTypeCollection::OTypeCollection(
157 const Type & rT1,
158 const Type & rT2,
159 const Type & rT3,
160 const Type & rT4,
161 const Type & rT5,
162 const Type & rT6,
163 const Type & rT7,
164 const Type & rT8,
165 const Sequence< Type > & rMore )
166 : _aTypes(InitTypeSeq(rT1, rT2, rT3, rT4, rT5, rT6, rT7, rT8, rMore))
170 OTypeCollection::OTypeCollection(
171 const Type & rT1,
172 const Type & rT2,
173 const Type & rT3,
174 const Type & rT4,
175 const Type & rT5,
176 const Type & rT6,
177 const Type & rT7,
178 const Type & rT8,
179 const Type & rT9,
180 const Sequence< Type > & rMore )
181 : _aTypes(InitTypeSeq(rT1, rT2, rT3, rT4, rT5, rT6, rT7, rT8, rT9, rMore))
185 OTypeCollection::OTypeCollection(
186 const Type & rT1,
187 const Type & rT2,
188 const Type & rT3,
189 const Type & rT4,
190 const Type & rT5,
191 const Type & rT6,
192 const Type & rT7,
193 const Type & rT8,
194 const Type & rT9,
195 const Type & rT10,
196 const Sequence< Type > & rMore )
197 : _aTypes(InitTypeSeq(rT1, rT2, rT3, rT4, rT5, rT6, rT7, rT8, rT9, rT10, rMore))
201 OTypeCollection::OTypeCollection(
202 const Type & rT1,
203 const Type & rT2,
204 const Type & rT3,
205 const Type & rT4,
206 const Type & rT5,
207 const Type & rT6,
208 const Type & rT7,
209 const Type & rT8,
210 const Type & rT9,
211 const Type & rT10,
212 const Type & rT11,
213 const Sequence< Type > & rMore )
214 : _aTypes(InitTypeSeq(rT1, rT2, rT3, rT4, rT5, rT6, rT7, rT8, rT9, rT10, rT11, rMore))
218 OTypeCollection::OTypeCollection(
219 const Type & rT1,
220 const Type & rT2,
221 const Type & rT3,
222 const Type & rT4,
223 const Type & rT5,
224 const Type & rT6,
225 const Type & rT7,
226 const Type & rT8,
227 const Type & rT9,
228 const Type & rT10,
229 const Type & rT11,
230 const Type & rT12,
231 const Sequence< Type > & rMore )
232 : _aTypes(InitTypeSeq(rT1, rT2, rT3, rT4, rT5, rT6, rT7, rT8, rT9, rT10, rT11, rT12, rMore))
238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */