/* -*- 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/. */ #include #include #include #include #include "sourcefileprovider.hxx" #include "sourceprovider-scanner.hxx" namespace unoidl { namespace detail { namespace { class Cursor: public MapCursor { public: explicit Cursor(std::map< OUString, rtl::Reference > const & map): map_(map), iterator_(map_.begin()) {} private: virtual ~Cursor() throw () override {} virtual rtl::Reference< Entity > getNext(OUString * name) override; std::map< OUString, rtl::Reference > const & map_; //TODO: extent std::map< OUString, rtl::Reference >::const_iterator iterator_; }; rtl::Reference< Entity > Cursor::getNext(OUString * name) { assert(name != nullptr); rtl::Reference< Entity > ent; if (iterator_ != map_.end()) { *name = iterator_->first; ent = iterator_->second; ++iterator_; } return ent; } class Module: public ModuleEntity { public: Module() {} std::map< OUString, rtl::Reference > map; private: virtual ~Module() throw () override {} virtual std::vector getMemberNames() const override; virtual rtl::Reference createCursor() const override { return new Cursor(map); } }; std::vector Module::getMemberNames() const { std::vector names; for (auto & i: map) { names.push_back(i.first); } return names; } } SourceFileProvider::SourceFileProvider( rtl::Reference const & manager, OUString const & uri) { SourceProviderScannerData data(manager); if (!parse(uri, &data)) { throw NoSuchFileException(uri); } for (auto & i: data.entities) { if (i.second.kind == SourceProviderEntity::KIND_LOCAL) { assert(i.second.entity.is()); assert(i.second.entity->getSort() != Entity::SORT_MODULE); std::map< OUString, rtl::Reference > * map = &rootMap_; for (sal_Int32 j = 0;;) { OUString id(i.first.getToken(0, '.', j)); if (j == -1) { map->insert(std::make_pair(id, i.second.entity)); break; } std::map< OUString, rtl::Reference >::const_iterator k( map->find(id)); if (k == map->end()) { k = map->insert(std::make_pair(id, new Module)).first; } Module& mod = dynamic_cast(*k->second.get()); map = &mod.map; } } } } rtl::Reference SourceFileProvider::createRootCursor() const { return new Cursor(rootMap_); } rtl::Reference SourceFileProvider::findEntity(OUString const & name) const { std::map< OUString, rtl::Reference > const * map = &rootMap_; for (sal_Int32 i = 0;;) { OUString id(name.getToken(0, '.', i)); std::map< OUString, rtl::Reference >::const_iterator j( map->find(id)); if (j == map->end()) { return rtl::Reference(); } if (i == -1) { return j->second; } if (j->second->getSort() != Entity::SORT_MODULE) { return rtl::Reference(); } Module * mod = dynamic_cast< Module * >(j->second.get()); assert(mod != nullptr); map = &mod->map; } } SourceFileProvider::~SourceFileProvider() throw () {} } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2024-10-19sw: use frozen in SwXText::convertToTable()Miklos Vajna
2024-09-13sw: add Comments Panel in sidebarMohit Marathe
2024-04-04tdf#95405 Sidebar: Quick Find for writerkhushishikhu
2024-04-04improve usability of variable fieldsOliver Specht
2024-02-10tdf#159372 svx: Add goto dialogAkshayWarrier
2024-01-30tdf#158695 convert-to bogusly needs libcui (--disable-gui build)Noel Grandin
2023-11-23sw floattable: add per-frame wrap-on-all-pages modeMiklos Vajna
2023-05-09sw: support Undo/Redo for theme colorsTomaž Vajngerl
2023-04-20tdf#142978 Add quick fix action for missing alt textSamuel Mehrbrodt
2023-04-12Use more *string_viewMike Kaganski
2023-03-20tdf#142978 Add a11y check sidebarSamuel Mehrbrodt
2023-01-24sw: add document model for multi-page fly framesMiklos Vajna
2023-01-14sw: add ThemeColorChanger that sweeps the model and changes colorsTomaž Vajngerl
2023-01-12introduce docmodel comp., model::ThemeColor, use it in SvxColorItemTomaž Vajngerl
2022-12-07sw: split out some of the LOK parts of SwXTextDocument into a separate fileMiklos Vajna
2022-11-30WASM: need sw/../translatehelper.cxx backThorsten Behrens
2022-11-28WASM linguistic,sw: disable curl-using deepl codeMichael Stahl
2022-11-15sw: add accessibility check statusbar controlTomaž Vajngerl
2022-11-15sw: add online accessibility check implementationTomaž Vajngerl
2022-10-24sw: rename IGrammarContact*, SwGrammarContact* to GrammarContact*Tomaž Vajngerl
2022-10-17sw content controls: add rendering for the aliasMiklos Vajna
2022-10-12new uno command uno:Translate with deepl apiMert Tumer
2022-05-25sw content controls, date: show a date picker on clickMiklos Vajna
2022-05-18tdf#149017 fix space distribution in SwFntObj::DrawText()Mark Hung
2022-05-05sw content controls, drop-down: show list items on clickMiklos Vajna
2022-03-31sw content controls: add UNO API to insert thisMiklos Vajna
2022-03-30sw content controls: add document modelMiklos Vajna
2022-03-01sw clearing breaks: add UNO API to insert thisMiklos Vajna
2022-02-28sw clearing breaks: add document modelMiklos Vajna
2022-01-20WASM --enable-wasm-strip now skips lots of LO codeArmin Le Grand (Allotropia)
2021-12-22Separate core drawinglayer func. into drawinglayercore libraryTomaž Vajngerl
2021-12-21Filter optional component implementations by nameJan-Marek Glogowski
2021-12-20Add graphic size checker for the preferred document DPITomaž Vajngerl
2021-12-14Allow for conditional parts of component filesStephan Bergmann
2021-12-10Generally determine Rdb content from gb_*_set_componentfile callsStephan Bergmann
2021-12-06gbuild: create services.rdb from built componentsJan-Marek Glogowski
2021-12-01Fix --disable-avmedia for DESKTOP buildJan-Marek Glogowski
2021-10-09Rename bookmrk* -> bookmark*Julien Nabet
2021-07-26indexing: search result locator to return the rect of the resultTomaž Vajngerl
2021-06-30indexing: add indexing export as an export filter for WriterTomaž Vajngerl
2021-06-19indexing: indexing paragraph text with the ModelTraverserTomaž Vajngerl
2021-02-06weld annotation windowCaolán McNamara
2021-01-29remove SwCache bookkeeping from SwModifyBjoern Michaelsen