/src/libreoffice/include/unoidl/unoidl.hxx
Line | Count | Source |
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 | | |
10 | | #ifndef INCLUDED_UNOIDL_UNOIDL_HXX |
11 | | #define INCLUDED_UNOIDL_UNOIDL_HXX |
12 | | |
13 | | #include <sal/config.h> |
14 | | |
15 | | #include <cassert> |
16 | | #include <utility> |
17 | | #include <vector> |
18 | | |
19 | | #include <osl/mutex.hxx> |
20 | | #include <rtl/ref.hxx> |
21 | | #include <rtl/ustring.hxx> |
22 | | #include <sal/types.h> |
23 | | #include <salhelper/simplereferenceobject.hxx> |
24 | | #include <unoidl/detail/dllapi.hxx> |
25 | | |
26 | | namespace unoidl { |
27 | | |
28 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL NoSuchFileException final { |
29 | | public: |
30 | 0 | SAL_DLLPRIVATE NoSuchFileException(OUString uri): uri_(std::move(uri)) {} |
31 | | |
32 | | SAL_DLLPRIVATE NoSuchFileException(NoSuchFileException const & other): |
33 | 0 | uri_(other.uri_) {} |
34 | | |
35 | | SAL_DLLPRIVATE ~NoSuchFileException() noexcept; |
36 | | |
37 | 0 | const OUString& getUri() const { return uri_; } |
38 | | |
39 | | private: |
40 | | NoSuchFileException& operator =(NoSuchFileException const &) = delete; |
41 | | |
42 | | OUString uri_; |
43 | | }; |
44 | | |
45 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL FileFormatException final { |
46 | | public: |
47 | | SAL_DLLPRIVATE FileFormatException( |
48 | | OUString uri, OUString detail): |
49 | 0 | uri_(std::move(uri)), detail_(std::move(detail)) |
50 | 0 | {} |
51 | | |
52 | | SAL_DLLPRIVATE FileFormatException(FileFormatException const & other): |
53 | | uri_(other.uri_), detail_(other.detail_) |
54 | 0 | {} |
55 | | |
56 | | SAL_DLLPRIVATE ~FileFormatException() noexcept; |
57 | | |
58 | 0 | const OUString& getUri() const { return uri_; } |
59 | | |
60 | 0 | const OUString& getDetail() const { return detail_; } |
61 | | |
62 | | private: |
63 | | FileFormatException& operator =(FileFormatException const &) = delete; |
64 | | |
65 | | OUString uri_; |
66 | | OUString detail_; |
67 | | }; |
68 | | |
69 | | struct AnnotatedReference { |
70 | | AnnotatedReference( |
71 | | OUString theName, |
72 | | std::vector< OUString > && theAnnotations): |
73 | 5.90k | name(std::move(theName)), annotations(std::move(theAnnotations)) |
74 | 5.90k | {} |
75 | | |
76 | | OUString name; |
77 | | |
78 | | std::vector< OUString > annotations; |
79 | | }; |
80 | | |
81 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL Entity: public salhelper::SimpleReferenceObject { |
82 | | public: |
83 | | enum Sort { |
84 | | SORT_MODULE, SORT_ENUM_TYPE, SORT_PLAIN_STRUCT_TYPE, |
85 | | SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE, SORT_EXCEPTION_TYPE, |
86 | | SORT_INTERFACE_TYPE, SORT_TYPEDEF, SORT_CONSTANT_GROUP, |
87 | | SORT_SINGLE_INTERFACE_BASED_SERVICE, SORT_ACCUMULATION_BASED_SERVICE, |
88 | | SORT_INTERFACE_BASED_SINGLETON, SORT_SERVICE_BASED_SINGLETON |
89 | | }; |
90 | | |
91 | 14.8k | Sort getSort() const { return sort_; } |
92 | | |
93 | | protected: |
94 | 14.8k | explicit SAL_DLLPRIVATE Entity(Sort sort): sort_(sort) {} |
95 | | |
96 | | virtual SAL_DLLPRIVATE ~Entity() noexcept override; |
97 | | |
98 | | private: |
99 | | Sort sort_; |
100 | | }; |
101 | | |
102 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL MapCursor: public salhelper::SimpleReferenceObject { |
103 | | public: |
104 | | // throws FileFormatException: |
105 | | virtual rtl::Reference< Entity > getNext(OUString * name) = 0; |
106 | | |
107 | | protected: |
108 | 0 | SAL_DLLPRIVATE MapCursor() {} |
109 | | |
110 | | virtual SAL_DLLPRIVATE ~MapCursor() noexcept override; |
111 | | }; |
112 | | |
113 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ModuleEntity: public Entity { |
114 | | public: |
115 | | // throws FileFormatException: |
116 | | virtual std::vector< OUString > getMemberNames() const = 0; |
117 | | |
118 | | // throws FileFormatException: |
119 | | virtual rtl::Reference< MapCursor > createCursor() const = 0; |
120 | | |
121 | | protected: |
122 | 0 | SAL_DLLPRIVATE ModuleEntity(): Entity(SORT_MODULE) {} |
123 | | |
124 | | virtual SAL_DLLPRIVATE ~ModuleEntity() noexcept override; |
125 | | }; |
126 | | |
127 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL PublishableEntity: public Entity { |
128 | | public: |
129 | 14.8k | bool isPublished() const { return published_; } |
130 | | |
131 | | std::vector< OUString > const & getAnnotations() const |
132 | 0 | { return annotations_; } |
133 | | |
134 | | protected: |
135 | | SAL_DLLPRIVATE PublishableEntity( |
136 | | Sort sort, bool published, |
137 | | std::vector< OUString >&& annotations): |
138 | 14.8k | Entity(sort), published_(published), annotations_(std::move(annotations)) |
139 | 14.8k | {} |
140 | | |
141 | | virtual SAL_DLLPRIVATE ~PublishableEntity() noexcept override; |
142 | | |
143 | | private: |
144 | | bool published_; |
145 | | |
146 | | std::vector< OUString > annotations_; |
147 | | }; |
148 | | |
149 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL EnumTypeEntity final : public PublishableEntity { |
150 | | public: |
151 | | struct Member { |
152 | | Member( |
153 | | OUString theName, sal_Int32 theValue, |
154 | | std::vector< OUString >&& theAnnotations): |
155 | 1.74k | name(std::move(theName)), value(theValue), annotations(std::move(theAnnotations)) |
156 | 1.74k | {} |
157 | | |
158 | | OUString name; |
159 | | |
160 | | sal_Int32 value; |
161 | | |
162 | | std::vector< OUString > annotations; |
163 | | }; |
164 | | |
165 | | SAL_DLLPRIVATE EnumTypeEntity( |
166 | | bool published, std::vector< Member >&& members, |
167 | | std::vector< OUString >&& annotations): |
168 | 205 | PublishableEntity(SORT_ENUM_TYPE, published, std::move(annotations)), |
169 | 205 | members_(std::move(members)) |
170 | 205 | { assert(!members_.empty()); } |
171 | | |
172 | 1.92k | std::vector< Member > const & getMembers() const { return members_; } |
173 | | |
174 | | private: |
175 | | virtual SAL_DLLPRIVATE ~EnumTypeEntity() noexcept override; |
176 | | |
177 | | std::vector< Member > members_; |
178 | | }; |
179 | | |
180 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL PlainStructTypeEntity final : public PublishableEntity { |
181 | | public: |
182 | | struct Member { |
183 | | Member(OUString theName, OUString theType, |
184 | | std::vector< OUString >&& theAnnotations): |
185 | 3.13k | name(std::move(theName)), type(std::move(theType)), annotations(std::move(theAnnotations)) |
186 | 3.13k | {} |
187 | | |
188 | | OUString name; |
189 | | |
190 | | OUString type; |
191 | | |
192 | | std::vector< OUString > annotations; |
193 | | }; |
194 | | |
195 | | SAL_DLLPRIVATE PlainStructTypeEntity( |
196 | | bool published, OUString directBase, |
197 | | std::vector< Member >&& directMembers, |
198 | | std::vector< OUString > && annotations): |
199 | 795 | PublishableEntity(SORT_PLAIN_STRUCT_TYPE, published, std::move(annotations)), |
200 | 795 | directBase_(std::move(directBase)), directMembers_(std::move(directMembers)) |
201 | 795 | {} |
202 | | |
203 | 632 | const OUString& getDirectBase() const { return directBase_; } |
204 | | |
205 | | std::vector< Member > const & getDirectMembers() const |
206 | 5.63k | { return directMembers_; } |
207 | | |
208 | | private: |
209 | | virtual SAL_DLLPRIVATE ~PlainStructTypeEntity() noexcept override; |
210 | | |
211 | | OUString directBase_; |
212 | | std::vector< Member > directMembers_; |
213 | | }; |
214 | | |
215 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL PolymorphicStructTypeTemplateEntity final : |
216 | | public PublishableEntity |
217 | | { |
218 | | public: |
219 | | struct Member { |
220 | | Member( |
221 | | OUString theName, OUString theType, |
222 | | bool theParameterized, |
223 | | std::vector< OUString >&& theAnnotations): |
224 | 0 | name(std::move(theName)), type(std::move(theType)), parameterized(theParameterized), |
225 | 0 | annotations(std::move(theAnnotations)) |
226 | 0 | {} |
227 | | |
228 | | OUString name; |
229 | | |
230 | | OUString type; |
231 | | |
232 | | bool parameterized; |
233 | | |
234 | | std::vector< OUString > annotations; |
235 | | }; |
236 | | |
237 | | SAL_DLLPRIVATE PolymorphicStructTypeTemplateEntity( |
238 | | bool published, std::vector< OUString >&& typeParameters, |
239 | | std::vector< Member >&& members, |
240 | | std::vector< OUString >&& annotations): |
241 | 0 | PublishableEntity( |
242 | 0 | SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE, published, std::move(annotations)), |
243 | 0 | typeParameters_(std::move(typeParameters)), members_(std::move(members)) |
244 | 0 | {} |
245 | | |
246 | | std::vector< OUString > const & getTypeParameters() const |
247 | 0 | { return typeParameters_; } |
248 | | |
249 | 0 | std::vector< Member > const & getMembers() const { return members_; } |
250 | | |
251 | | private: |
252 | | virtual SAL_DLLPRIVATE ~PolymorphicStructTypeTemplateEntity() noexcept override; |
253 | | |
254 | | std::vector< OUString > typeParameters_; |
255 | | std::vector< Member > members_; |
256 | | }; |
257 | | |
258 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ExceptionTypeEntity final : public PublishableEntity { |
259 | | public: |
260 | | struct Member { |
261 | | Member( |
262 | | OUString theName, OUString theType, |
263 | | std::vector< OUString >&& theAnnotations): |
264 | 444 | name(std::move(theName)), type(std::move(theType)), annotations(std::move(theAnnotations)) |
265 | 444 | {} |
266 | | |
267 | | OUString name; |
268 | | |
269 | | OUString type; |
270 | | |
271 | | std::vector< OUString > annotations; |
272 | | }; |
273 | | |
274 | | SAL_DLLPRIVATE ExceptionTypeEntity( |
275 | | bool published, OUString directBase, |
276 | | std::vector< Member >&& directMembers, |
277 | | std::vector< OUString >&& annotations): |
278 | 222 | PublishableEntity(SORT_EXCEPTION_TYPE, published, std::move(annotations)), |
279 | 222 | directBase_(std::move(directBase)), directMembers_(std::move(directMembers)) |
280 | 222 | {} |
281 | | |
282 | 363 | const OUString& getDirectBase() const { return directBase_; } |
283 | | |
284 | | std::vector< Member > const & getDirectMembers() const |
285 | 1.33k | { return directMembers_; } |
286 | | |
287 | | private: |
288 | | virtual SAL_DLLPRIVATE ~ExceptionTypeEntity() noexcept override; |
289 | | |
290 | | OUString directBase_; |
291 | | std::vector< Member > directMembers_; |
292 | | }; |
293 | | |
294 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL InterfaceTypeEntity final : public PublishableEntity { |
295 | | public: |
296 | | struct Attribute { |
297 | | Attribute( |
298 | | OUString theName, OUString theType, |
299 | | bool theBound, bool theReadOnly, |
300 | | std::vector< OUString >&& theGetExceptions, |
301 | | std::vector< OUString >&& theSetExceptions, |
302 | | std::vector< OUString >&& theAnnotations): |
303 | 2.13k | name(std::move(theName)), type(std::move(theType)), bound(theBound), |
304 | 2.13k | readOnly(theReadOnly), getExceptions(std::move(theGetExceptions)), |
305 | 2.13k | setExceptions(std::move(theSetExceptions)), annotations(std::move(theAnnotations)) |
306 | 2.13k | { assert(!theReadOnly || setExceptions.empty()); } |
307 | | |
308 | | OUString name; |
309 | | |
310 | | OUString type; |
311 | | |
312 | | bool bound; |
313 | | |
314 | | bool readOnly; |
315 | | |
316 | | std::vector< OUString > getExceptions; |
317 | | |
318 | | std::vector< OUString > setExceptions; |
319 | | |
320 | | std::vector< OUString > annotations; |
321 | | }; |
322 | | |
323 | | struct Method { |
324 | | struct Parameter { |
325 | | enum Direction { DIRECTION_IN, DIRECTION_OUT, DIRECTION_IN_OUT }; |
326 | | |
327 | | Parameter( |
328 | | OUString theName, OUString theType, |
329 | | Direction theDirection): |
330 | 24.2k | name(std::move(theName)), type(std::move(theType)), direction(theDirection) |
331 | 24.2k | {} |
332 | | |
333 | | OUString name; |
334 | | |
335 | | OUString type; |
336 | | |
337 | | Direction direction; |
338 | | }; |
339 | | |
340 | | Method( |
341 | | OUString theName, OUString theReturnType, |
342 | | std::vector< Parameter >&& theParameters, |
343 | | std::vector< OUString >&& theExceptions, |
344 | | std::vector< OUString >&& theAnnotations): |
345 | 44.5k | name(std::move(theName)), returnType(std::move(theReturnType)), parameters(std::move(theParameters)), |
346 | 44.5k | exceptions(std::move(theExceptions)), annotations(std::move(theAnnotations)) |
347 | 44.5k | {} |
348 | | |
349 | | OUString name; |
350 | | |
351 | | OUString returnType; |
352 | | |
353 | | std::vector< Parameter > parameters; |
354 | | |
355 | | std::vector< OUString > exceptions; |
356 | | |
357 | | std::vector< OUString > annotations; |
358 | | }; |
359 | | |
360 | | SAL_DLLPRIVATE InterfaceTypeEntity( |
361 | | bool published, |
362 | | std::vector< AnnotatedReference >&& directMandatoryBases, |
363 | | std::vector< AnnotatedReference >&& directOptionalBases, |
364 | | std::vector< Attribute >&& directAttributes, |
365 | | std::vector< Method >&& directMethods, |
366 | | std::vector< OUString >&& annotations): |
367 | 13.4k | PublishableEntity(SORT_INTERFACE_TYPE, published, std::move(annotations)), |
368 | 13.4k | directMandatoryBases_(std::move(directMandatoryBases)), |
369 | 13.4k | directOptionalBases_(std::move(directOptionalBases)), |
370 | 13.4k | directAttributes_(std::move(directAttributes)), |
371 | 13.4k | directMethods_(std::move(directMethods)) |
372 | 13.4k | {} |
373 | | |
374 | | std::vector< AnnotatedReference > const & getDirectMandatoryBases() const |
375 | 36.8k | { return directMandatoryBases_; } |
376 | | |
377 | | std::vector< AnnotatedReference > const & getDirectOptionalBases() const |
378 | 0 | { return directOptionalBases_; } |
379 | | |
380 | | std::vector< Attribute > const & getDirectAttributes() const |
381 | 16.4k | { return directAttributes_; } |
382 | | |
383 | | std::vector< Method > const & getDirectMethods() const |
384 | 97.0k | { return directMethods_; } |
385 | | |
386 | | private: |
387 | | virtual SAL_DLLPRIVATE ~InterfaceTypeEntity() noexcept override; |
388 | | |
389 | | std::vector< AnnotatedReference > directMandatoryBases_; |
390 | | std::vector< AnnotatedReference > directOptionalBases_; |
391 | | std::vector< Attribute > directAttributes_; |
392 | | std::vector< Method > directMethods_; |
393 | | }; |
394 | | |
395 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL TypedefEntity final : public PublishableEntity { |
396 | | public: |
397 | | SAL_DLLPRIVATE TypedefEntity( |
398 | | bool published, OUString type, |
399 | | std::vector< OUString >&& annotations): |
400 | 194 | PublishableEntity(SORT_TYPEDEF, published, std::move(annotations)), type_(std::move(type)) |
401 | 194 | {} |
402 | | |
403 | 106 | const OUString& getType() const { return type_; } |
404 | | |
405 | | private: |
406 | | virtual SAL_DLLPRIVATE ~TypedefEntity() noexcept override; |
407 | | |
408 | | OUString type_; |
409 | | }; |
410 | | |
411 | | struct SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ConstantValue { |
412 | | enum Type { |
413 | | TYPE_BOOLEAN, TYPE_BYTE, TYPE_SHORT, TYPE_UNSIGNED_SHORT, TYPE_LONG, |
414 | | TYPE_UNSIGNED_LONG, TYPE_HYPER, TYPE_UNSIGNED_HYPER, TYPE_FLOAT, |
415 | | TYPE_DOUBLE }; |
416 | | |
417 | 0 | ConstantValue(bool value): type(TYPE_BOOLEAN), booleanValue(value) {} |
418 | | |
419 | 0 | ConstantValue(sal_Int8 value): type(TYPE_BYTE), byteValue(value) {} |
420 | | |
421 | 0 | ConstantValue(sal_Int16 value): type(TYPE_SHORT), shortValue(value) {} |
422 | | |
423 | | ConstantValue(sal_uInt16 value): |
424 | 0 | type(TYPE_UNSIGNED_SHORT), unsignedShortValue(value) |
425 | 0 | {} |
426 | | |
427 | 0 | ConstantValue(sal_Int32 value): type(TYPE_LONG), longValue(value) {} |
428 | | |
429 | | ConstantValue(sal_uInt32 value): |
430 | 0 | type(TYPE_UNSIGNED_LONG), unsignedLongValue(value) |
431 | 0 | {} |
432 | | |
433 | 0 | ConstantValue(sal_Int64 value): type(TYPE_HYPER), hyperValue(value) {} |
434 | | |
435 | | ConstantValue(sal_uInt64 value): |
436 | 0 | type(TYPE_UNSIGNED_HYPER), unsignedHyperValue(value) |
437 | 0 | {} |
438 | | |
439 | 0 | ConstantValue(float value): type(TYPE_FLOAT), floatValue(value) {} |
440 | | |
441 | 0 | ConstantValue(double value): type(TYPE_DOUBLE), doubleValue(value) {} |
442 | | |
443 | | Type type; |
444 | | |
445 | | union { |
446 | | bool booleanValue; |
447 | | sal_Int8 byteValue; |
448 | | sal_Int16 shortValue; |
449 | | sal_uInt16 unsignedShortValue; |
450 | | sal_Int32 longValue; |
451 | | sal_uInt32 unsignedLongValue; |
452 | | sal_Int64 hyperValue; |
453 | | sal_uInt64 unsignedHyperValue; |
454 | | float floatValue; |
455 | | double doubleValue; |
456 | | }; |
457 | | }; |
458 | | |
459 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ConstantGroupEntity final : public PublishableEntity { |
460 | | public: |
461 | | struct Member { |
462 | | Member( |
463 | | OUString theName, ConstantValue const & theValue, |
464 | | std::vector< OUString >&& theAnnotations): |
465 | 0 | name(std::move(theName)), value(theValue), annotations(std::move(theAnnotations)) |
466 | 0 | {} |
467 | | |
468 | | OUString name; |
469 | | |
470 | | ConstantValue value; |
471 | | |
472 | | std::vector< OUString > annotations; |
473 | | }; |
474 | | |
475 | | SAL_DLLPRIVATE ConstantGroupEntity( |
476 | | bool published, std::vector< Member >&& members, |
477 | | std::vector< OUString >&& annotations): |
478 | 0 | PublishableEntity(SORT_CONSTANT_GROUP, published, std::move(annotations)), |
479 | 0 | members_(std::move(members)) |
480 | 0 | {} |
481 | | |
482 | 0 | std::vector< Member > const & getMembers() const { return members_; } |
483 | | |
484 | | private: |
485 | | virtual SAL_DLLPRIVATE ~ConstantGroupEntity() noexcept override; |
486 | | |
487 | | std::vector< Member > members_; |
488 | | }; |
489 | | |
490 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL SingleInterfaceBasedServiceEntity final : |
491 | | public PublishableEntity |
492 | | { |
493 | | public: |
494 | | struct Constructor { |
495 | | struct Parameter { |
496 | | Parameter( |
497 | | OUString theName, OUString theType, |
498 | | bool theRest): |
499 | 0 | name(std::move(theName)), type(std::move(theType)), rest(theRest) |
500 | 0 | {} |
501 | | |
502 | | OUString name; |
503 | | |
504 | | OUString type; |
505 | | |
506 | | bool rest; |
507 | | }; |
508 | | |
509 | | Constructor(): |
510 | 0 | defaultConstructor(true) {} |
511 | | |
512 | | Constructor( |
513 | | OUString theName, |
514 | | std::vector< Parameter >&& theParameters, |
515 | | std::vector< OUString >&& theExceptions, |
516 | | std::vector< OUString >&& theAnnotations): |
517 | 0 | name(std::move(theName)), parameters(std::move(theParameters)), |
518 | 0 | exceptions(std::move(theExceptions)), |
519 | 0 | annotations(std::move(theAnnotations)), |
520 | 0 | defaultConstructor(false) |
521 | 0 | {} |
522 | | |
523 | | OUString name; |
524 | | |
525 | | std::vector< Parameter > parameters; |
526 | | |
527 | | std::vector< OUString > exceptions; |
528 | | |
529 | | std::vector< OUString > annotations; |
530 | | |
531 | | bool defaultConstructor; |
532 | | }; |
533 | | |
534 | | SAL_DLLPRIVATE SingleInterfaceBasedServiceEntity( |
535 | | bool published, OUString base, |
536 | | std::vector< Constructor >&& constructors, |
537 | | std::vector< OUString >&& annotations): |
538 | 0 | PublishableEntity( |
539 | 0 | SORT_SINGLE_INTERFACE_BASED_SERVICE, published, std::move(annotations)), |
540 | 0 | base_(std::move(base)), constructors_(std::move(constructors)) |
541 | 0 | {} |
542 | | |
543 | 0 | const OUString& getBase() const { return base_; } |
544 | | |
545 | | std::vector< Constructor > const & getConstructors() const |
546 | 0 | { return constructors_; } |
547 | | |
548 | | private: |
549 | | virtual SAL_DLLPRIVATE ~SingleInterfaceBasedServiceEntity() noexcept override; |
550 | | |
551 | | OUString base_; |
552 | | std::vector< Constructor > constructors_; |
553 | | }; |
554 | | |
555 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL AccumulationBasedServiceEntity final : |
556 | | public PublishableEntity |
557 | | { |
558 | | public: |
559 | | struct Property { |
560 | | enum Attributes { |
561 | | ATTRIBUTE_MAYBE_VOID = 0x001, |
562 | | ATTRIBUTE_BOUND = 0x002, |
563 | | ATTRIBUTE_CONSTRAINED = 0x004, |
564 | | ATTRIBUTE_TRANSIENT = 0x008, |
565 | | ATTRIBUTE_READ_ONLY = 0x010, |
566 | | ATTRIBUTE_MAYBE_AMBIGUOUS = 0x020, |
567 | | ATTRIBUTE_MAYBE_DEFAULT = 0x040, |
568 | | ATTRIBUTE_REMOVABLE = 0x080, |
569 | | ATTRIBUTE_OPTIONAL = 0x100 |
570 | | }; |
571 | | |
572 | | Property( |
573 | | OUString theName, OUString theType, |
574 | | Attributes theAttributes, |
575 | | std::vector< OUString >&& theAnnotations): |
576 | 0 | name(std::move(theName)), type(std::move(theType)), attributes(theAttributes), |
577 | 0 | annotations(std::move(theAnnotations)) |
578 | 0 | {} |
579 | | |
580 | | OUString name; |
581 | | |
582 | | OUString type; |
583 | | |
584 | | Attributes attributes; |
585 | | |
586 | | std::vector< OUString > annotations; |
587 | | }; |
588 | | |
589 | | SAL_DLLPRIVATE AccumulationBasedServiceEntity( |
590 | | bool published, |
591 | | std::vector< AnnotatedReference >&& directMandatoryBaseServices, |
592 | | std::vector< AnnotatedReference >&& directOptionalBaseServices, |
593 | | std::vector< AnnotatedReference >&& directMandatoryBaseInterfaces, |
594 | | std::vector< AnnotatedReference >&& directOptionalBaseInterfaces, |
595 | | std::vector< Property >&& directProperties, |
596 | | std::vector< OUString >&& annotations): |
597 | 0 | PublishableEntity( |
598 | 0 | SORT_ACCUMULATION_BASED_SERVICE, published, std::move(annotations)), |
599 | 0 | directMandatoryBaseServices_(std::move(directMandatoryBaseServices)), |
600 | 0 | directOptionalBaseServices_(std::move(directOptionalBaseServices)), |
601 | 0 | directMandatoryBaseInterfaces_(std::move(directMandatoryBaseInterfaces)), |
602 | 0 | directOptionalBaseInterfaces_(std::move(directOptionalBaseInterfaces)), |
603 | 0 | directProperties_(std::move(directProperties)) |
604 | 0 | {} |
605 | | |
606 | | std::vector< AnnotatedReference > const & getDirectMandatoryBaseServices() |
607 | | const |
608 | 0 | { return directMandatoryBaseServices_; } |
609 | | |
610 | | std::vector< AnnotatedReference > const & getDirectOptionalBaseServices() |
611 | | const |
612 | 0 | { return directOptionalBaseServices_; } |
613 | | |
614 | | std::vector< AnnotatedReference > const & getDirectMandatoryBaseInterfaces() |
615 | | const |
616 | 0 | { return directMandatoryBaseInterfaces_; } |
617 | | |
618 | | std::vector< AnnotatedReference > const & getDirectOptionalBaseInterfaces() |
619 | | const |
620 | 0 | { return directOptionalBaseInterfaces_; } |
621 | | |
622 | | std::vector< Property > const & getDirectProperties() const |
623 | 0 | { return directProperties_; } |
624 | | |
625 | | private: |
626 | | virtual SAL_DLLPRIVATE ~AccumulationBasedServiceEntity() noexcept override; |
627 | | |
628 | | std::vector< AnnotatedReference > directMandatoryBaseServices_; |
629 | | std::vector< AnnotatedReference > directOptionalBaseServices_; |
630 | | std::vector< AnnotatedReference > directMandatoryBaseInterfaces_; |
631 | | std::vector< AnnotatedReference > directOptionalBaseInterfaces_; |
632 | | std::vector< Property > directProperties_; |
633 | | }; |
634 | | |
635 | | class LO_DLLPUBLIC_UNOIDL InterfaceBasedSingletonEntity final : |
636 | | public PublishableEntity |
637 | | { |
638 | | public: |
639 | | SAL_DLLPRIVATE InterfaceBasedSingletonEntity( |
640 | | bool published, OUString base, |
641 | | std::vector< OUString >&& annotations): |
642 | 0 | PublishableEntity( |
643 | 0 | SORT_INTERFACE_BASED_SINGLETON, published, std::move(annotations)), |
644 | 0 | base_(std::move(base)) |
645 | 0 | {} |
646 | | |
647 | 0 | const OUString& getBase() const { return base_; } |
648 | | |
649 | | private: |
650 | | virtual SAL_DLLPRIVATE ~InterfaceBasedSingletonEntity() noexcept override; |
651 | | |
652 | | OUString base_; |
653 | | }; |
654 | | |
655 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ServiceBasedSingletonEntity final : public PublishableEntity |
656 | | { |
657 | | public: |
658 | | SAL_DLLPRIVATE ServiceBasedSingletonEntity( |
659 | | bool published, OUString base, |
660 | | std::vector< OUString >&& annotations): |
661 | 0 | PublishableEntity(SORT_SERVICE_BASED_SINGLETON, published, std::move(annotations)), |
662 | 0 | base_(std::move(base)) |
663 | 0 | {} |
664 | | |
665 | 0 | const OUString& getBase() const { return base_; } |
666 | | |
667 | | private: |
668 | | virtual SAL_DLLPRIVATE ~ServiceBasedSingletonEntity() noexcept override; |
669 | | |
670 | | OUString base_; |
671 | | }; |
672 | | |
673 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL Provider: public salhelper::SimpleReferenceObject { |
674 | | public: |
675 | | // throws FileFormatException: |
676 | | virtual rtl::Reference< MapCursor > createRootCursor() const = 0; |
677 | | |
678 | | // throws FileFormatException: |
679 | | virtual rtl::Reference< Entity > findEntity(OUString const & name) |
680 | | const = 0; |
681 | | |
682 | | protected: |
683 | 212 | SAL_DLLPRIVATE Provider() {} |
684 | | |
685 | | virtual SAL_DLLPRIVATE ~Provider() noexcept override; |
686 | | }; |
687 | | |
688 | | class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL Manager final : public salhelper::SimpleReferenceObject { |
689 | | public: |
690 | 106 | Manager() {} |
691 | | |
692 | | // throws FileFormatException, NoSuchFileException: |
693 | | rtl::Reference< Provider > addProvider(OUString const & uri); |
694 | | |
695 | | // throws FileFormatException: |
696 | | rtl::Reference< Entity > findEntity(OUString const & name) const; |
697 | | |
698 | | // throws FileFormatException: |
699 | | rtl::Reference< MapCursor > createCursor(OUString const & name) const; |
700 | | |
701 | | private: |
702 | | virtual SAL_DLLPRIVATE ~Manager() noexcept override; |
703 | | |
704 | | SAL_DLLPRIVATE rtl::Reference< Provider > loadProvider( |
705 | | OUString const & uri); |
706 | | |
707 | | mutable osl::Mutex mutex_; |
708 | | std::vector< rtl::Reference< Provider > > providers_; |
709 | | }; |
710 | | |
711 | | } |
712 | | |
713 | | #endif |
714 | | |
715 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |