/* -*- 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/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_SVTOOLS_TEMPLATEFOLDERCACHE_HXX #define INCLUDED_SVTOOLS_TEMPLATEFOLDERCACHE_HXX #include #include #include namespace svt { //= TemplateFolderCache class TemplateFolderCacheImpl; /** allows to cache the state of the template directories of OOo

Usually, this class is used together with an instance of the DocumentTemplates service. It allows to scan the template folders of the Office, and updates the configuration so that it reflects the most recent state of the folders.
As this is an expensive, the TemplateFolderCache has been introduced. It caches the state of the template folders, and allows to determine if the DocumentTemplates service needs to be invoked to do the (much more expensive) update.

@example C++ TemplateFolderCache aTemplateFolders; if ( aTemplateFolders.needsUpdate() ) { // store the current state aCache.storeState(); // create the DocumentTemplates instance Reference< XDocumentTemplates > xTemplates = ...; // update the templates configuration xTemplates->update(); } // do anything which relies on a up-to-date template configuration */ class SVT_DLLPUBLIC TemplateFolderCache { private: std::unique_ptr> m_pImpl; public: /** ctor. @param _bAutoStoreState Set this to if you want the instance to automatically store the state of the template folders upon destruction.
If set to , you would explicitly need to call storeState to do this.
If the current state is not known (e.g. because you did not call needsUpdate, which retrieves it), it is not retrieved in the dtor, regardless of the _bAutoStoreState flag. */ TemplateFolderCache( bool _bAutoStoreState = false ); ~TemplateFolderCache( ); /** determines whether or not the template configuration needs to be updated @return if the template configuration needs to be updated */ bool needsUpdate(); /** stores the current state of the template folders in the cache */ void storeState(); }; } // namespace svt #endif // INCLUDED_SVTOOLS_TEMPLATEFOLDERCACHE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ra/cp-4.1'>distro/collabora/cp-4.1 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2021-12-02Fix clang-cl -Zc:dllexportInlines- buildStephan Bergmann
2021-05-14Revert "improve perf of xmlreader::Pad"Noel Grandin
2021-05-11improve perf of xmlreader::PadNoel Grandin
2021-04-10speed up XmlReader::handleSkippedTextNoel Grandin
2021-04-07Updated README.md files to represent current code / use Markdown formatHossein
2021-03-24Using .md extension/Markdown syntax for modules READMEHossein
2019-10-10Revert "Optimize getNamespaceId (xmlreader)"Julien Nabet
2019-10-08cleanups in xmlreaderNoel Grandin
2019-10-06we can use Span for the cache key hereNoel Grandin
2019-10-06convert equals() to operator== in xmlreader::SpanNoel Grandin
2019-10-06Optimize getNamespaceId (xmlreader)Julien Nabet
2019-02-04tdf#42949 Fix IWYU warnings in xmlreader/Gabor Kelemen
2018-09-15Simplify containers iterations in xmlhelp, xmlreader, xmlscript, xmlsecurityArkadiy Illarionov
2018-07-24loplugin:unusedfields,can-be-const in xmlreaderNoel Grandin
2018-01-23Silence -Werror=implicit-fallthrough= (upcoming GCC 8)Stephan Bergmann
2017-09-14clang-tidy modernize-use-emplace in variousNoel Grandin
2017-07-25loplugin:unusedmethodsNoel Grandin
2017-04-21gbuild: Remove MSVC 2013 legacy codeDavid Ostrovsky
2016-08-31convert XmlReader::State to scoped enumNoel Grandin
2016-05-25Convert XmlReader::Result to scoped enumNoel Grandin
2016-05-24Convert XmlReader::Text to scoped enumNoel Grandin
2016-05-13clang-tidy modernize-loop-convert in writerfilter to xmlsecurityNoel Grandin
2016-04-02cleanup: remove unused Reference.h(xx) includesJochen Nitschke
2016-03-31use SAL_N_ELEMENTS in for loopsNoel Grandin
2016-02-15Rename rtl::isValidCodePoint -> rtl::isUnicodeCodePointStephan Bergmann
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann