/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef INCLUDED_UNOIDL_UNOIDL_HXX #define INCLUDED_UNOIDL_UNOIDL_HXX #include #include #include #include #include #include #include #include #include namespace unoidl { class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL NoSuchFileException final { public: SAL_DLLPRIVATE NoSuchFileException(OUString const & uri): uri_(uri) {} SAL_DLLPRIVATE NoSuchFileException(NoSuchFileException const & other): uri_(other.uri_) {} SAL_DLLPRIVATE ~NoSuchFileException() throw (); const OUString& getUri() const { return uri_; } private: NoSuchFileException& operator =(NoSuchFileException const &) = delete; OUString const uri_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL FileFormatException final { public: SAL_DLLPRIVATE FileFormatException( OUString const & uri, OUString const & detail): uri_(uri), detail_(detail) {} SAL_DLLPRIVATE FileFormatException(FileFormatException const & other): uri_(other.uri_), detail_(other.detail_) {} SAL_DLLPRIVATE ~FileFormatException() throw (); const OUString& getUri() const { return uri_; } const OUString& getDetail() const { return detail_; } private: FileFormatException& operator =(FileFormatException const &) = delete; OUString const uri_; OUString const detail_; }; struct AnnotatedReference { AnnotatedReference( OUString const & theName, std::vector< OUString > const & theAnnotations): name(theName), annotations(theAnnotations) {} OUString name; std::vector< OUString > const annotations; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL Entity: public salhelper::SimpleReferenceObject { public: enum Sort { SORT_MODULE, SORT_ENUM_TYPE, SORT_PLAIN_STRUCT_TYPE, SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE, SORT_EXCEPTION_TYPE, SORT_INTERFACE_TYPE, SORT_TYPEDEF, SORT_CONSTANT_GROUP, SORT_SINGLE_INTERFACE_BASED_SERVICE, SORT_ACCUMULATION_BASED_SERVICE, SORT_INTERFACE_BASED_SINGLETON, SORT_SERVICE_BASED_SINGLETON }; Sort getSort() const { return sort_; } protected: explicit SAL_DLLPRIVATE Entity(Sort sort): sort_(sort) {} virtual SAL_DLLPRIVATE ~Entity() throw () override; private: Sort const sort_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL MapCursor: public salhelper::SimpleReferenceObject { public: // throws FileFormatException: virtual rtl::Reference< Entity > getNext(OUString * name) = 0; protected: SAL_DLLPRIVATE MapCursor() {} virtual SAL_DLLPRIVATE ~MapCursor() throw() override; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ModuleEntity: public Entity { public: // throws FileFormatException: virtual std::vector< OUString > getMemberNames() const = 0; // throws FileFormatException: virtual rtl::Reference< MapCursor > createCursor() const = 0; protected: SAL_DLLPRIVATE ModuleEntity(): Entity(SORT_MODULE) {} virtual SAL_DLLPRIVATE ~ModuleEntity() throw () override; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL PublishableEntity: public Entity { public: bool isPublished() const { return published_; } std::vector< OUString > const & getAnnotations() const { return annotations_; } protected: SAL_DLLPRIVATE PublishableEntity( Sort sort, bool published, std::vector< OUString > const & annotations): Entity(sort), published_(published), annotations_(annotations) {} virtual SAL_DLLPRIVATE ~PublishableEntity() throw () override; private: bool const published_; std::vector< OUString > const annotations_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL EnumTypeEntity: public PublishableEntity { public: struct Member { Member( OUString const & theName, sal_Int32 theValue, std::vector< OUString > const & theAnnotations): name(theName), value(theValue), annotations(theAnnotations) {} OUString name; sal_Int32 value; std::vector< OUString > const annotations; }; SAL_DLLPRIVATE EnumTypeEntity( bool published, std::vector< Member > const & members, std::vector< OUString > const & annotations): PublishableEntity(SORT_ENUM_TYPE, published, annotations), members_(members) { assert(!members.empty()); } std::vector< Member > const & getMembers() const { return members_; } private: virtual SAL_DLLPRIVATE ~EnumTypeEntity() throw () override; std::vector< Member > const members_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL PlainStructTypeEntity: public PublishableEntity { public: struct Member { Member(OUString const & theName, OUString const & theType, std::vector< OUString > const & theAnnotations): name(theName), type(theType), annotations(theAnnotations) {} OUString name; OUString type; std::vector< OUString > const annotations; }; SAL_DLLPRIVATE PlainStructTypeEntity( bool published, OUString const & directBase, std::vector< Member > const & directMembers, std::vector< OUString > const & annotations): PublishableEntity(SORT_PLAIN_STRUCT_TYPE, published, annotations), directBase_(directBase), directMembers_(directMembers) {} const OUString& getDirectBase() const { return directBase_; } std::vector< Member > const & getDirectMembers() const { return directMembers_; } private: virtual SAL_DLLPRIVATE ~PlainStructTypeEntity() throw () override; OUString const directBase_; std::vector< Member > const directMembers_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL PolymorphicStructTypeTemplateEntity: public PublishableEntity { public: struct Member { Member( OUString const & theName, OUString const & theType, bool theParameterized, std::vector< OUString > const & theAnnotations): name(theName), type(theType), parameterized(theParameterized), annotations(theAnnotations) {} OUString name; OUString type; bool parameterized; std::vector< OUString > const annotations; }; SAL_DLLPRIVATE PolymorphicStructTypeTemplateEntity( bool published, std::vector< OUString > const & typeParameters, std::vector< Member > const & members, std::vector< OUString > const & annotations): PublishableEntity( SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE, published, annotations), typeParameters_(typeParameters), members_(members) {} std::vector< OUString > const & getTypeParameters() const { return typeParameters_; } std::vector< Member > const & getMembers() const { return members_; } private: virtual SAL_DLLPRIVATE ~PolymorphicStructTypeTemplateEntity() throw () override; std::vector< OUString > const typeParameters_; std::vector< Member > const members_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ExceptionTypeEntity: public PublishableEntity { public: struct Member { Member( OUString const & theName, OUString const & theType, std::vector< OUString > const & theAnnotations): name(theName), type(theType), annotations(theAnnotations) {} OUString name; OUString type; std::vector< OUString > const annotations; }; SAL_DLLPRIVATE ExceptionTypeEntity( bool published, OUString const & directBase, std::vector< Member > const & directMembers, std::vector< OUString > const & annotations): PublishableEntity(SORT_EXCEPTION_TYPE, published, annotations), directBase_(directBase), directMembers_(directMembers) {} const OUString& getDirectBase() const { return directBase_; } std::vector< Member > const & getDirectMembers() const { return directMembers_; } private: virtual SAL_DLLPRIVATE ~ExceptionTypeEntity() throw () override; OUString const directBase_; std::vector< Member > const directMembers_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL InterfaceTypeEntity: public PublishableEntity { public: struct Attribute { Attribute( OUString const & theName, OUString const & theType, bool theBound, bool theReadOnly, std::vector< OUString > const & theGetExceptions, std::vector< OUString > const & theSetExceptions, std::vector< OUString > const & theAnnotations): name(theName), type(theType), bound(theBound), readOnly(theReadOnly), getExceptions(theGetExceptions), setExceptions(theSetExceptions), annotations(theAnnotations) { assert(!theReadOnly || theSetExceptions.empty()); } OUString name; OUString type; bool bound; bool readOnly; std::vector< OUString > getExceptions; std::vector< OUString > setExceptions; std::vector< OUString > const annotations; }; struct Method { struct Parameter { enum Direction { DIRECTION_IN, DIRECTION_OUT, DIRECTION_IN_OUT }; Parameter( OUString const & theName, OUString const & theType, Direction theDirection): name(theName), type(theType), direction(theDirection) {} OUString name; OUString type; Direction direction; }; Method( OUString const & theName, OUString const & theReturnType, std::vector< Parameter > const & theParameters, std::vector< OUString > const & theExceptions, std::vector< OUString > const & theAnnotations): name(theName), returnType(theReturnType), parameters(theParameters), exceptions(theExceptions), annotations(theAnnotations) {} OUString name; OUString returnType; std::vector< Parameter > parameters; std::vector< OUString > exceptions; std::vector< OUString > const annotations; }; SAL_DLLPRIVATE 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): PublishableEntity(SORT_INTERFACE_TYPE, published, annotations), directMandatoryBases_(directMandatoryBases), directOptionalBases_(directOptionalBases), directAttributes_(directAttributes), directMethods_(directMethods) {} std::vector< AnnotatedReference > const & getDirectMandatoryBases() const { return directMandatoryBases_; } std::vector< AnnotatedReference > const & getDirectOptionalBases() const { return directOptionalBases_; } std::vector< Attribute > const & getDirectAttributes() const { return directAttributes_; } std::vector< Method > const & getDirectMethods() const { return directMethods_; } private: virtual SAL_DLLPRIVATE ~InterfaceTypeEntity() throw () override; std::vector< AnnotatedReference > const directMandatoryBases_; std::vector< AnnotatedReference > const directOptionalBases_; std::vector< Attribute > const directAttributes_; std::vector< Method > const directMethods_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL TypedefEntity: public PublishableEntity { public: SAL_DLLPRIVATE TypedefEntity( bool published, OUString const & type, std::vector< OUString > const & annotations): PublishableEntity(SORT_TYPEDEF, published, annotations), type_(type) {} const OUString& getType() const { return type_; } private: virtual SAL_DLLPRIVATE ~TypedefEntity() throw () override; OUString const type_; }; struct SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ConstantValue { enum Type { TYPE_BOOLEAN, TYPE_BYTE, TYPE_SHORT, TYPE_UNSIGNED_SHORT, TYPE_LONG, TYPE_UNSIGNED_LONG, TYPE_HYPER, TYPE_UNSIGNED_HYPER, TYPE_FLOAT, TYPE_DOUBLE }; ConstantValue(bool value): type(TYPE_BOOLEAN), booleanValue(value) {} ConstantValue(sal_Int8 value): type(TYPE_BYTE), byteValue(value) {} ConstantValue(sal_Int16 value): type(TYPE_SHORT), shortValue(value) {} ConstantValue(sal_uInt16 value): type(TYPE_UNSIGNED_SHORT), unsignedShortValue(value) {} ConstantValue(sal_Int32 value): type(TYPE_LONG), longValue(value) {} ConstantValue(sal_uInt32 value): type(TYPE_UNSIGNED_LONG), unsignedLongValue(value) {} ConstantValue(sal_Int64 value): type(TYPE_HYPER), hyperValue(value) {} ConstantValue(sal_uInt64 value): type(TYPE_UNSIGNED_HYPER), unsignedHyperValue(value) {} ConstantValue(float value): type(TYPE_FLOAT), floatValue(value) {} ConstantValue(double value): type(TYPE_DOUBLE), doubleValue(value) {} Type type; union { bool booleanValue; sal_Int8 byteValue; sal_Int16 shortValue; sal_uInt16 unsignedShortValue; sal_Int32 longValue; sal_uInt32 unsignedLongValue; sal_Int64 hyperValue; sal_uInt64 unsignedHyperValue; float floatValue; double doubleValue; }; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ConstantGroupEntity: public PublishableEntity { public: struct Member { Member( OUString const & theName, ConstantValue const & theValue, std::vector< OUString > const & theAnnotations): name(theName), value(theValue), annotations(theAnnotations) {} OUString name; ConstantValue value; std::vector< OUString > const annotations; }; SAL_DLLPRIVATE ConstantGroupEntity( bool published, std::vector< Member > const & members, std::vector< OUString > const & annotations): PublishableEntity(SORT_CONSTANT_GROUP, published, annotations), members_(members) {} std::vector< Member > const & getMembers() const { return members_; } private: virtual SAL_DLLPRIVATE ~ConstantGroupEntity() throw () override; std::vector< Member > const members_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL SingleInterfaceBasedServiceEntity: public PublishableEntity { public: struct Constructor { struct Parameter { Parameter( OUString const & theName, OUString const & theType, bool theRest): name(theName), type(theType), rest(theRest) {} OUString name; OUString const type; bool const rest; }; Constructor(): defaultConstructor(true) {} Constructor( OUString const & theName, std::vector< Parameter > const & theParameters, std::vector< OUString > const & theExceptions, std::vector< OUString > const & theAnnotations): name(theName), parameters(theParameters), exceptions(theExceptions), annotations(theAnnotations), defaultConstructor(false) {} OUString name; std::vector< Parameter > parameters; std::vector< OUString > exceptions; std::vector< OUString > const annotations; bool defaultConstructor; }; SAL_DLLPRIVATE SingleInterfaceBasedServiceEntity( bool published, OUString const & base, std::vector< Constructor > const & constructors, std::vector< OUString > const & annotations): PublishableEntity( SORT_SINGLE_INTERFACE_BASED_SERVICE, published, annotations), base_(base), constructors_(constructors) {} const OUString& getBase() const { return base_; } std::vector< Constructor > const & getConstructors() const { return constructors_; } private: virtual SAL_DLLPRIVATE ~SingleInterfaceBasedServiceEntity() throw () override; OUString const base_; std::vector< Constructor > const constructors_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL AccumulationBasedServiceEntity: public PublishableEntity { public: struct Property { enum Attributes { ATTRIBUTE_MAYBE_VOID = 0x001, ATTRIBUTE_BOUND = 0x002, ATTRIBUTE_CONSTRAINED = 0x004, ATTRIBUTE_TRANSIENT = 0x008, ATTRIBUTE_READ_ONLY = 0x010, ATTRIBUTE_MAYBE_AMBIGUOUS = 0x020, ATTRIBUTE_MAYBE_DEFAULT = 0x040, ATTRIBUTE_REMOVABLE = 0x080, ATTRIBUTE_OPTIONAL = 0x100 }; Property( OUString const & theName, OUString const & theType, Attributes theAttributes, std::vector< OUString > const & theAnnotations): name(theName), type(theType), attributes(theAttributes), annotations(theAnnotations) {} OUString name; OUString type; Attributes const attributes; std::vector< OUString > const annotations; }; SAL_DLLPRIVATE 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): PublishableEntity( SORT_ACCUMULATION_BASED_SERVICE, published, annotations), directMandatoryBaseServices_(directMandatoryBaseServices), directOptionalBaseServices_(directOptionalBaseServices), directMandatoryBaseInterfaces_(directMandatoryBaseInterfaces), directOptionalBaseInterfaces_(directOptionalBaseInterfaces), directProperties_(directProperties) {} std::vector< AnnotatedReference > const & getDirectMandatoryBaseServices() const { return directMandatoryBaseServices_; } std::vector< AnnotatedReference > const & getDirectOptionalBaseServices() const { return directOptionalBaseServices_; } std::vector< AnnotatedReference > const & getDirectMandatoryBaseInterfaces() const { return directMandatoryBaseInterfaces_; } std::vector< AnnotatedReference > const & getDirectOptionalBaseInterfaces() const { return directOptionalBaseInterfaces_; } std::vector< Property > const & getDirectProperties() const { return directProperties_; } private: virtual SAL_DLLPRIVATE ~AccumulationBasedServiceEntity() throw () override; 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_; }; class LO_DLLPUBLIC_UNOIDL InterfaceBasedSingletonEntity: public PublishableEntity { public: SAL_DLLPRIVATE InterfaceBasedSingletonEntity( bool published, OUString const & base, std::vector< OUString > const & annotations): PublishableEntity( SORT_INTERFACE_BASED_SINGLETON, published, annotations), base_(base) {} const OUString& getBase() const { return base_; } private: virtual SAL_DLLPRIVATE ~InterfaceBasedSingletonEntity() throw () override; OUString const base_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL ServiceBasedSingletonEntity: public PublishableEntity { public: SAL_DLLPRIVATE ServiceBasedSingletonEntity( bool published, OUString const & base, std::vector< OUString > const & annotations): PublishableEntity(SORT_SERVICE_BASED_SINGLETON, published, annotations), base_(base) {} const OUString& getBase() const { return base_; } private: virtual SAL_DLLPRIVATE ~ServiceBasedSingletonEntity() throw () override; OUString const base_; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL Provider: public salhelper::SimpleReferenceObject { public: // throws FileFormatException: virtual rtl::Reference< MapCursor > createRootCursor() const = 0; // throws FileFormatException: virtual rtl::Reference< Entity > findEntity(OUString const & name) const = 0; protected: SAL_DLLPRIVATE Provider() {} virtual SAL_DLLPRIVATE ~Provider() throw () override; }; class SAL_WARN_UNUSED LO_DLLPUBLIC_UNOIDL Manager: public salhelper::SimpleReferenceObject { public: Manager() {} // throws FileFormatException, NoSuchFileException: rtl::Reference< Provider > addProvider(OUString const & uri); // throws FileFormatException: rtl::Reference< Entity > findEntity(OUString const & name) const; // throws FileFormatException: rtl::Reference< MapCursor > createCursor(OUString const & name) const; private: virtual SAL_DLLPRIVATE ~Manager() throw () override; SAL_DLLPRIVATE rtl::Reference< Provider > loadProvider( OUString const & uri); mutable osl::Mutex mutex_; std::vector< rtl::Reference< Provider > > providers_; }; } #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ion> LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-04-28prefer makefile-gmake-modeTakeshi Abe
Change-Id: I9cc9bfbddd3a90e00eee3e674994e5d6207f9034
2013-04-30Move to MPLv2 license headers, with ESC decision and author's permission.Michael Meeks
2013-04-05new module i18nlangtagEike Rathke
Moved portions from module i18npool, all of former i18nisolang1 library that now is i18nlangtag. Included are languagetag, isolang and mslangid. This i18nlangtag code is now even used by module comphelper, so disentangling i18npool and making this an own module was needed to not create circular module dependencies. Change-Id: Ib887c3d6dde667403fd22d382310ba5f1a9b0015
2013-03-29ResMgr with LanguageTagEike Rathke
Change-Id: Ie5ce9157a7ea59db7b0509fbaec61d07f8f9edf0
2013-03-04make lto workPeter Foley
Change-Id: Iab6892368c6ba6bb5b83132cdcd6aa959c3b0e1f
2013-01-26gbuild: fix silly "expandtabs" in makefile VIM modelinesMichael Stahl
Change-Id: I54d8923ad315e8041fd3904da3a29f1a7a8c8b16
2013-01-26gbuild: do not copy boost headers aroundMichael Stahl
- do not use gb_UnpackedTarball_copy_header_files for boost - adapt the optimization in concat-deps.c for new path - use boost_headers in all LinkTargets that require it - add explicit include paths to mysqlc, mysqlcppconn, libvisio, liborcus Change-Id: I0c43e73ed43cc9d2e6bce8faf55e992d655a0bb9
2012-09-28gbuild: invert handling of standard system libraries:Michael Stahl
Always link in gb_STDLIBS, except when the library explicitly opts out with gb_LinkTarget_disable_standard_system_libs. Change-Id: I489a99114fbfa46d0421a27cf6c7b899dc268a4a
2012-09-28gbuild: replace direct gb_STDLIBS use with ...Michael Stahl
... new gb_LinkTarget_add_standard_system_libs Change-Id: Ib2bc843098db3d8c6822b45a3d21724e67f57d69
2012-09-28gbuild: split uwinapi out of gb_STDLIBSMichael Stahl
Change-Id: I53316e0b9369d806197bccb42cf22d3497af43e7