LibreOffice Module cppuhelper (master) 1
typeprovider.cxx
Go to the documentation of this file.
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
21
22#include <rtl/uuid.h>
23#include <osl/mutex.hxx>
24
25#include <algorithm>
26
27using namespace osl;
28using namespace com::sun::star::uno;
29
30namespace cppu
31{
32
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
38
39OImplementationId::~OImplementationId()
40{
41 delete _pSeq;
42}
43
44#if defined _MSC_VER && !defined __clang__
45#pragma warning(pop)
46#endif
47
48Sequence< sal_Int8 > OImplementationId::getImplementationId() const
49{
50 if (! _pSeq)
51 {
52 MutexGuard aGuard( Mutex::getGlobalMutex() );
53 if (! _pSeq)
54 {
56 ::rtl_createUuid( reinterpret_cast<sal_uInt8 *>(pSeq->getArray()), nullptr, _bUseEthernetAddress );
57 _pSeq = pSeq;
58 }
59 }
60 return *_pSeq;
61}
62
63namespace
64{
65sal_Int32 TypeSeqLen(const Sequence<Type>& s) { return s.getLength(); }
66template <class... Args> sal_Int32 TypeSeqLen(const Type&, Args... args)
67{
68 return 1 + TypeSeqLen(args...);
69}
70
71void PutToTypeSeq(Type* p, const Sequence<Type>& s) { std::copy(s.begin(), s.end(), p); }
72template <class... Args> void PutToTypeSeq(Type* p, const Type& t, Args... args)
73{
74 *p = t;
75 PutToTypeSeq(p + 1, args...);
76}
77
78template <class... Args> Sequence<Type> InitTypeSeq(Args... args)
79{
80 Sequence<Type> s(TypeSeqLen(args...));
81 PutToTypeSeq(s.getArray(), args...);
82 return s;
83}
84}
85
87 const Type & rT1,
88 const Sequence< Type > & rMore )
89 : _aTypes(InitTypeSeq(rT1, rMore))
90{
91}
92
93OTypeCollection::OTypeCollection(
94 const Type & rT1,
95 const Type & rT2,
96 const Sequence< Type > & rMore )
97 : _aTypes(InitTypeSeq(rT1, rT2, rMore))
98{
99}
100
101OTypeCollection::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))
107{
108}
109
110OTypeCollection::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))
117{
118}
119
120OTypeCollection::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))
128{
129}
130
131OTypeCollection::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))
140{
141}
142
143OTypeCollection::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))
153{
154}
155
156OTypeCollection::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))
167{
168}
169
170OTypeCollection::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))
182{
183}
184
185OTypeCollection::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))
198{
199}
200
201OTypeCollection::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))
215{
216}
217
218OTypeCollection::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))
233{
234}
235
236}
237
238/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XPropertyListType t
OTypeCollection(const css::uno::Type &rType1, const css::uno::Sequence< css::uno::Type > &rAddTypes=css::uno::Sequence< css::uno::Type >())
void * p
Type
args
unsigned char sal_uInt8