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