/* -*- 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/. */ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include "sourceprovider-parser-requires.hxx" #include namespace unoidl::detail { struct SourceProviderScannerData; class SourceProviderEntityPad: public salhelper::SimpleReferenceObject { public: bool isPublished() const { return published_; } protected: explicit SourceProviderEntityPad(bool published): published_(published) {} virtual ~SourceProviderEntityPad() override {} private: bool const published_; }; class SourceProviderEnumTypeEntityPad: public SourceProviderEntityPad { public: explicit SourceProviderEnumTypeEntityPad(bool published): SourceProviderEntityPad(published) {} std::vector members; private: virtual ~SourceProviderEnumTypeEntityPad() noexcept override {} }; class SourceProviderPlainStructTypeEntityPad: public SourceProviderEntityPad { public: SourceProviderPlainStructTypeEntityPad( bool published, const OUString & theBaseName, rtl::Reference const & theBaseEntity): SourceProviderEntityPad(published), baseName(theBaseName), baseEntity(theBaseEntity) { assert(theBaseName.isEmpty() != theBaseEntity.is()); } OUString const baseName; rtl::Reference const baseEntity; std::vector members; private: virtual ~SourceProviderPlainStructTypeEntityPad() noexcept override {} }; class SourceProviderPolymorphicStructTypeTemplateEntityPad: public SourceProviderEntityPad { public: explicit SourceProviderPolymorphicStructTypeTemplateEntityPad(bool published) : SourceProviderEntityPad(published) {} std::vector typeParameters; std::vector members; private: virtual ~SourceProviderPolymorphicStructTypeTemplateEntityPad() noexcept override {} }; class SourceProviderExceptionTypeEntityPad: public SourceProviderEntityPad { public: SourceProviderExceptionTypeEntityPad( bool published, const OUString & theBaseName, rtl::Reference const & theBaseEntity): SourceProviderEntityPad(published), baseName(theBaseName), baseEntity(theBaseEntity) { assert(theBaseName.isEmpty() != theBaseEntity.is()); } OUString const baseName; rtl::Reference const baseEntity; std::vector members; private: virtual ~SourceProviderExceptionTypeEntityPad() noexcept override {} }; class SourceProviderInterfaceTypeEntityPad: public SourceProviderEntityPad { public: struct DirectBase { DirectBase( OUString theName, rtl::Reference const & theEntity, std::vector&& theAnnotations): name(std::move(theName)), entity(theEntity), annotations(std::move(theAnnotations)) { assert(theEntity.is()); } OUString name; rtl::Reference entity; std::vector annotations; }; enum BaseKind { BASE_INDIRECT_OPTIONAL, BASE_DIRECT_OPTIONAL, BASE_INDIRECT_MANDATORY, BASE_DIRECT_MANDATORY }; struct Member { OUString mandatory; std::set optional; explicit Member(OUString theMandatory): mandatory(std::move(theMandatory)) {} }; SourceProviderInterfaceTypeEntityPad(bool published, bool theSingleBase): SourceProviderEntityPad(published), singleBase(theSingleBase) {} bool addDirectBase( YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data, DirectBase const & base, bool optional); bool addDirectMember( YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data, OUString const & name); bool singleBase; std::vector directMandatoryBases; std::vector directOptionalBases; std::vector directAttributes; std::vector directMethods; std::map allBases; std::map allMembers; private: virtual ~SourceProviderInterfaceTypeEntityPad() noexcept override {} bool checkBaseClashes( YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data, OUString const & name, rtl::Reference const & entity, bool direct, bool optional, bool outerOptional, std::set * seen) const; bool checkMemberClashes( YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data, std::u16string_view interfaceName, OUString const & memberName, bool checkOptional) const; bool addBase( YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data, OUString const & directBaseName, OUString const & name, rtl::Reference const & entity, bool direct, bool optional); bool addOptionalBaseMembers( YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data, OUString const & name, rtl::Reference const & entity); }; class SourceProviderConstantGroupEntityPad: public SourceProviderEntityPad { public: explicit SourceProviderConstantGroupEntityPad(bool published): SourceProviderEntityPad(published) {} std::vector members; private: virtual ~SourceProviderConstantGroupEntityPad() noexcept override {} }; class SourceProviderSingleInterfaceBasedServiceEntityPad: public SourceProviderEntityPad { public: struct Constructor { struct Parameter { Parameter( OUString theName, SourceProviderType theType, bool theRest): name(std::move(theName)), type(std::move(theType)), rest(theRest) {} OUString name; SourceProviderType type; bool rest; }; Constructor( OUString theName, std::vector< OUString >&& theAnnotations): name(std::move(theName)), annotations(std::move(theAnnotations)) {} OUString name; std::vector< Parameter > parameters; std::vector< OUString > exceptions; std::vector< OUString > annotations; }; explicit SourceProviderSingleInterfaceBasedServiceEntityPad( bool published, OUString theBase): SourceProviderEntityPad(published), base(std::move(theBase)) {} OUString const base; std::vector constructors; private: virtual ~SourceProviderSingleInterfaceBasedServiceEntityPad() noexcept override {} }; class SourceProviderAccumulationBasedServiceEntityPad: public SourceProviderEntityPad { public: explicit SourceProviderAccumulationBasedServiceEntityPad(bool published): SourceProviderEntityPad(published) {} std::vector directMandatoryBaseServices; std::vector directOptionalBaseServices; std::vector directMandatoryBaseInterfaces; std::vector directOptionalBaseInterfaces; std::vector directProperties; private: virtual ~SourceProviderAccumulationBasedServiceEntityPad() noexcept override {} }; struct SourceProviderEntity { enum Kind { KIND_EXTERNAL, KIND_LOCAL, KIND_INTERFACE_DECL, KIND_PUBLISHED_INTERFACE_DECL, KIND_MODULE }; explicit SourceProviderEntity( Kind theKind, rtl::Reference const & externalEntity): kind(theKind), entity(externalEntity) { assert(theKind <= KIND_LOCAL); assert(externalEntity.is()); } explicit SourceProviderEntity( rtl::Reference const & localPad): kind(KIND_LOCAL), pad(localPad) { assert(localPad.is()); } explicit SourceProviderEntity(Kind theKind): kind(theKind) { assert(theKind >= KIND_INTERFACE_DECL); } SourceProviderEntity(): // needed for std::map::operator [] kind() // avoid false warnings about uninitialized members {} Kind kind; rtl::Reference entity; rtl::Reference pad; }; struct SourceProviderScannerData { explicit SourceProviderScannerData( rtl::Reference theManager): manager(std::move(theManager)), sourcePosition(), sourceEnd(), // avoid false warnings about uninitialized members errorLine(0), publishedContext(false) { assert(manager.is()); } void setSource(void const * address, sal_uInt64 size) { sourcePosition = static_cast(address); sourceEnd = sourcePosition + size; } rtl::Reference manager; char const * sourcePosition; char const * sourceEnd; YYLTYPE errorLine; OString parserError; OUString errorMessage; std::map entities; std::vector modules; OUString currentName; bool publishedContext; }; bool parse(OUString const & uri, SourceProviderScannerData * data); } int yylex_init_extra( unoidl::detail::SourceProviderScannerData * user_defined, yyscan_t * yyscanner); int yylex_destroy(yyscan_t yyscanner); int yylex(YYSTYPE * yylval_param, YYLTYPE * yylloc_param, yyscan_t yyscanner); unoidl::detail::SourceProviderScannerData * yyget_extra(yyscan_t yyscanner); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ tract34185'>feature/allo_contract34185 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2023-10-19Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: cppuhelperStephan Bergmann
2023-10-07loplugin:ostr: automatic rewriteStephan Bergmann
2023-09-29cid#1537991 Unchecked return valueCaolán McNamara
2023-06-12tdf#153109 Use any_of instead of loop to check a rangeParis Oplopoios
2023-05-10use WeakComponentImplHelper2 in Bootstrap_MacroExpanderNoel Grandin
2023-05-10use WeakComponentImplHelper2 in ServiceManagerNoel Grandin
2023-05-09use WeakComponentImplHelper2 in TypeManagerNoel Grandin
2023-05-09copy some comphelper code down into cppuhelperNoel Grandin
2023-04-12fix o3tl::equalsAsciiLNoel Grandin
2023-04-11fix for o3tl::equalsAsciiNoel Grandin
2023-03-24loplugin:stringadd in c*Noel Grandin
2023-03-22OUString::match -> OUString::startsWithStephan Bergmann
2023-03-22rhbz#2171265 Filter out all non *.rdb filesStephan Bergmann
2023-03-20cppuhelper : use BaseMutex instead of OFactoryComponentHelper_MutexArnaud VERSINI
2023-03-20cppuhelper : use constexpr OUStringLiteral instead of a functionArnaud VERSINI
2023-01-13OFactoryComponentHelper's XAggregation is apparently unusedStephan Bergmann
2023-01-13Merge OSingleFactoryHelper into OFactoryComponentHelperStephan Bergmann
2023-01-12Don't let OSingleFactoryHelper delegate to derived classes' virtual overridesStephan Bergmann
2023-01-12Fix aggregating OFactoryComponentHelper::queryInterfaceStephan Bergmann
2023-01-09use std::this_thread::sleep_for instead of osl equivalentArnaud VERSINI
2022-12-06tdf#152380: add checks for names and values sequences length equalityMike Kaganski
2022-12-02Replace some uses of static_type with UnoTypeStephan Bergmann
2022-06-13Drop obsolete preprocessor directives from UNOIDL filesStephan Bergmann
2022-06-02Fix type of cppuhelper::TypeManager::getInterfaceMember separator paramStephan Bergmann
2022-06-02clang-tidy modernize-pass-by-value in cppuhelperNoel Grandin
2022-05-09tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macroPragat Pandya
2022-05-09osl::Mutex->std::mutex in cppuhelper::ServiceManagerNoel Grandin
2022-05-06Remove duplicated includesAndrea Gelmini
2022-05-05use more o3tl::getTokenNoel Grandin
2022-05-05use more string_viewNoel Grandin
2022-05-04Just use Any ctor instead of makeAny in cppuhelperStephan Bergmann
2022-04-26Use o3tl::make_unsigned in some placesStephan Bergmann
2022-04-26revert unnecessary changeNoel Grandin
2022-04-26Drop obsolete workaround for LanguageTool 1.7Gabor Kelemen
2022-04-22fix master after string_view patches..Noel Grandin
2022-04-22use more string_view in cppuhelperNoel Grandin
2022-04-22address review comments on "use more string in unoidl.."Noel Grandin
2022-04-21android: Use fake exceptions on all architecturesMichael Weghorn
2022-04-21use more string_view in unoidl,codemakerNoel Grandin
2022-04-13use more string_view in cppuNoel Grandin
2022-04-13loplugin:stringviewparam whitelist some more functionsNoel Grandin
2022-04-11-Werror,-Wstrict-prototypes (clang-cl)Stephan Bergmann
2022-04-10-Werror,-Wstrict-prototypesStephan Bergmann
2022-03-18Simplify a static array iterationMike Kaganski
2022-02-28address review comments for "Add XWeak constructor..."Noel Grandin
2022-02-22Add XWeak constructor and operator= to uno::WeakReferenceNoel Grandin