diff options
author | Topi Reinio <topi.reinio@qt.io> | 2023-03-02 20:08:26 +0000 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2023-03-14 10:07:20 +0000 |
commit | 71a826b126b74795f2f0fd2f3bdca3c4abddc835 (patch) | |
tree | 322f70986da382bd319a65efed64a1e2cdfe9b58 | |
parent | ea641ace22e8c2eca957470206cd20b54f7bd9a0 (diff) | |
download | qttools-71a826b126b74795f2f0fd2f3bdca3c4abddc835.tar.gz |
qdoc: Remove unnecessary Config access functions
Config class now provides Config::get(), returning a
ConfigVar reference which can be further converted
to string, list, set, int, or bool. Use get()
throughout the codebase and remove the old access
functions.
In addition, make Config::get() return a const
reference, and prevent an unnecessary contains()
check by using an iterator.
Do some drive-by cleaning of related code.
Change-Id: I2ff2203824cd4ae80c4615080948565219ad20b2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 6 | ||||
-rw-r--r-- | src/qdoc/codemarker.cpp | 2 | ||||
-rw-r--r-- | src/qdoc/config.h | 26 | ||||
-rw-r--r-- | src/qdoc/cppcodeparser.cpp | 12 | ||||
-rw-r--r-- | src/qdoc/docbookgenerator.cpp | 16 | ||||
-rw-r--r-- | src/qdoc/docparser.cpp | 8 | ||||
-rw-r--r-- | src/qdoc/generator.cpp | 27 | ||||
-rw-r--r-- | src/qdoc/helpprojectwriter.cpp | 51 | ||||
-rw-r--r-- | src/qdoc/htmlgenerator.cpp | 88 | ||||
-rw-r--r-- | src/qdoc/location.cpp | 8 | ||||
-rw-r--r-- | src/qdoc/main.cpp | 38 | ||||
-rw-r--r-- | src/qdoc/manifestwriter.cpp | 20 | ||||
-rw-r--r-- | src/qdoc/node.cpp | 2 | ||||
-rw-r--r-- | src/qdoc/qdocdatabase.cpp | 10 | ||||
-rw-r--r-- | src/qdoc/qdocindexfiles.cpp | 6 | ||||
-rw-r--r-- | src/qdoc/tokenizer.cpp | 19 | ||||
-rw-r--r-- | src/qdoc/webxmlgenerator.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qdoc/config/tst_config.cpp | 30 |
18 files changed, 177 insertions, 196 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index e3984e502..4e918c2e7 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -1182,7 +1182,7 @@ Node *ClangVisitor::nodeForCommentAtLocation(CXSourceLocation loc, CXSourceLocat void ClangCodeParser::initializeParser() { Config &config = Config::instance(); - m_version = config.getString(CONFIG_VERSION); + m_version = config.get(CONFIG_VERSION).asString(); auto args = config.getCanonicalPathList(CONFIG_INCLUDEPATHS, Config::IncludePaths); #ifdef Q_OS_MACOS @@ -1204,7 +1204,7 @@ void ClangCodeParser::initializeParser() m_defines.clear(); QSet<QString> accepted; { - const QStringList tmpDefines = config.getStringList(CONFIG_CLANGDEFINES); + const QStringList tmpDefines{config.get(CONFIG_CLANGDEFINES).asStringList()}; for (const QString &def : tmpDefines) { if (!accepted.contains(def)) { QByteArray tmp("-D"); @@ -1215,7 +1215,7 @@ void ClangCodeParser::initializeParser() } } { - const QStringList tmpDefines = config.getStringList(CONFIG_DEFINES); + const QStringList tmpDefines{config.get(CONFIG_DEFINES).asStringList()}; for (const QString &def : tmpDefines) { if (!accepted.contains(def) && !def.contains(QChar('*'))) { QByteArray tmp("-D"); diff --git a/src/qdoc/codemarker.cpp b/src/qdoc/codemarker.cpp index c3949e375..f897f07a7 100644 --- a/src/qdoc/codemarker.cpp +++ b/src/qdoc/codemarker.cpp @@ -57,7 +57,7 @@ void CodeMarker::terminateMarker() */ void CodeMarker::initialize() { - s_defaultLang = Config::instance().getString(CONFIG_LANGUAGE); + s_defaultLang = Config::instance().get(CONFIG_LANGUAGE).asString(); for (const auto &marker : std::as_const(s_markers)) marker->initializeMarker(); } diff --git a/src/qdoc/config.h b/src/qdoc/config.h index b5ff26305..e3cfcff06 100644 --- a/src/qdoc/config.h +++ b/src/qdoc/config.h @@ -118,35 +118,15 @@ public: [[nodiscard]] QStringList qdocFiles() const { return m_parser.positionalArguments(); } [[nodiscard]] const QString &programName() const { return m_prog; } [[nodiscard]] const Location &location() const { return m_location; } - [[nodiscard]] ConfigVar &get(const QString &var) + [[nodiscard]] const ConfigVar &get(const QString &var) const { // Avoid injecting default-constructed values to map if var doesn't exist static ConfigVar empty; - return (m_configVars.contains(var)) ? m_configVars[var] : empty; - } - [[nodiscard]] bool getBool(const QString &var) const - { - return m_configVars.value(var).asBool(); - } - [[nodiscard]] int getInt(const QString &var) const - { - return m_configVars.value(var).asInt(); + auto it = m_configVars.constFind(var); + return (it != m_configVars.constEnd()) ? *it : empty; } [[nodiscard]] QString getOutputDir(const QString &format = QString("HTML")) const; [[nodiscard]] QSet<QString> getOutputFormats() const; - [[nodiscard]] QString getString(const QString &var, - const QString &defaultString = QString()) const - { - return m_configVars.value(var).asString(defaultString); - } - [[nodiscard]] QSet<QString> getStringSet(const QString &var) const - { - return m_configVars.value(var).asStringSet(); - } - [[nodiscard]] QStringList getStringList(const QString &var) const - { - return m_configVars.value(var).asStringList(); - } [[nodiscard]] QStringList getCanonicalPathList(const QString &var, PathFlags flags = None) const; [[nodiscard]] QRegularExpression getRegExp(const QString &var) const; diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index db339537f..f8d829187 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -92,8 +92,9 @@ CppCodeParser::CppCodeParser() void CppCodeParser::initializeParser() { Config &config = Config::instance(); - QStringList exampleFilePatterns = - config.getStringList(CONFIG_EXAMPLES + Config::dot + CONFIG_FILEEXTENSIONS); + QStringList exampleFilePatterns{config.get(CONFIG_EXAMPLES + + Config::dot + + CONFIG_FILEEXTENSIONS).asStringList()}; // Used for excluding dirs and files from the list of example files const auto &excludeDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS); @@ -106,15 +107,16 @@ void CppCodeParser::initializeParser() else m_exampleNameFilter = "*.cpp *.h *.js *.xq *.svg *.xml *.ui"; - QStringList exampleImagePatterns = - config.getStringList(CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS); + QStringList exampleImagePatterns{config.get(CONFIG_EXAMPLES + + Config::dot + + CONFIG_IMAGEEXTENSIONS).asStringList()}; if (!exampleImagePatterns.isEmpty()) m_exampleImageFilter = exampleImagePatterns.join(' '); else m_exampleImageFilter = "*.png"; - m_showLinkErrors = !config.getBool(CONFIG_NOLINKERRORS); + m_showLinkErrors = !config.get(CONFIG_NOLINKERRORS).asBool(); } /*! diff --git a/src/qdoc/docbookgenerator.cpp b/src/qdoc/docbookgenerator.cpp index 2a2b9e1bb..721bbd945 100644 --- a/src/qdoc/docbookgenerator.cpp +++ b/src/qdoc/docbookgenerator.cpp @@ -145,17 +145,17 @@ void DocBookGenerator::initializeGenerator() Generator::initializeGenerator(); m_config = &Config::instance(); - m_project = m_config->getString(CONFIG_PROJECT); + m_project = m_config->get(CONFIG_PROJECT).asString(); - m_projectDescription = m_config->getString(CONFIG_DESCRIPTION); + m_projectDescription = m_config->get(CONFIG_DESCRIPTION).asString(); if (m_projectDescription.isEmpty() && !m_project.isEmpty()) m_projectDescription = m_project + QLatin1String(" Reference Documentation"); - m_naturalLanguage = m_config->getString(CONFIG_NATURALLANGUAGE); + m_naturalLanguage = m_config->get(CONFIG_NATURALLANGUAGE).asString(); if (m_naturalLanguage.isEmpty()) m_naturalLanguage = QLatin1String("en"); - m_buildVersion = m_config->getString(CONFIG_BUILDVERSION); + m_buildVersion = m_config->get(CONFIG_BUILDVERSION).asString(); } QString DocBookGenerator::format() @@ -1221,7 +1221,7 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative) m_writer->writeEndElement(); // bridgehead newLine(); - if (m_config->getBool(CONFIG_DOCBOOKEXTENSIONS)) { + if (m_config->get(CONFIG_DOCBOOKEXTENSIONS).asBool()) { if (isStyleProperty) { m_writer->writeStartElement(dbNamespace, "fieldsynopsis"); @@ -3239,7 +3239,7 @@ void DocBookGenerator::generateRequiredLinks(const Node *node) return; const auto en = static_cast<const ExampleNode *>(node); - QString exampleUrl = Config::instance().getString(CONFIG_URL + Config::dot + CONFIG_EXAMPLES); + QString exampleUrl{Config::instance().get(CONFIG_URL + Config::dot + CONFIG_EXAMPLES).asString()}; if (exampleUrl.isEmpty()) { if (!en->noAutoList()) { @@ -3279,7 +3279,7 @@ void DocBookGenerator::generateLinkToExample(const ExampleNode *en, const QStrin // Construct a path to the example; <install path>/<example name> QStringList path = QStringList() - << Config::instance().getString(CONFIG_EXAMPLESINSTALLPATH) << en->name(); + << Config::instance().get(CONFIG_EXAMPLESINSTALLPATH).asString() << en->name(); path.removeAll(QString()); // Write the link to the example. Typically, this link comes after sections, hence @@ -3656,7 +3656,7 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node) // Generator::generateThreadSafeness, QDocIndexFiles::generateIndexSection. // This function is the only place where DocBook extensions are used. - if (m_config->getBool(CONFIG_DOCBOOKEXTENSIONS)) + if (m_config->get(CONFIG_DOCBOOKEXTENSIONS).asBool()) return; // Nothing to export in some cases. Note that isSharedCommentNode() returns diff --git a/src/qdoc/docparser.cpp b/src/qdoc/docparser.cpp index d6344fcc4..74e9584e8 100644 --- a/src/qdoc/docparser.cpp +++ b/src/qdoc/docparser.cpp @@ -239,8 +239,8 @@ static QString cleanLink(const QString &link) void DocParser::initialize(const Config &config, FileResolver &file_resolver) { - s_tabSize = config.getInt(CONFIG_TABSIZE); - s_ignoreWords = config.getStringList(CONFIG_IGNOREWORDS); + s_tabSize = config.get(CONFIG_TABSIZE).asInt(); + s_ignoreWords = config.get(CONFIG_IGNOREWORDS).asStringList(); int i = 0; while (cmds[i].name) { @@ -252,11 +252,11 @@ void DocParser::initialize(const Config &config, FileResolver &file_resolver) } // If any of the formats define quotinginformation, activate quoting - DocParser::s_quoting = config.getBool(CONFIG_QUOTINGINFORMATION); + DocParser::s_quoting = config.get(CONFIG_QUOTINGINFORMATION).asBool(); const auto &outputFormats = config.getOutputFormats(); for (const auto &format : outputFormats) DocParser::s_quoting = DocParser::s_quoting - || config.getBool(format + Config::dot + CONFIG_QUOTINGINFORMATION); + || config.get(format + Config::dot + CONFIG_QUOTINGINFORMATION).asBool(); // KLUDGE: file_resolver is temporarily a pointer. See the // comment for file_resolver in the header file for more context. diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp index 84e283491..3e9b26bac 100644 --- a/src/qdoc/generator.cpp +++ b/src/qdoc/generator.cpp @@ -845,7 +845,7 @@ void Generator::generateRequiredLinks(const Node *node, CodeMarker *marker) return; const auto *en = static_cast<const ExampleNode *>(node); - QString exampleUrl = Config::instance().getString(CONFIG_URL + Config::dot + CONFIG_EXAMPLES); + QString exampleUrl{Config::instance().get(CONFIG_URL + Config::dot + CONFIG_EXAMPLES).asString()}; if (exampleUrl.isEmpty()) { if (!en->noAutoList()) { @@ -890,7 +890,7 @@ void Generator::generateLinkToExample(const ExampleNode *en, CodeMarker *marker, if (metaTagMap) pathRoot = metaTagMap->value(QLatin1String("installpath")); if (pathRoot.isEmpty()) - pathRoot = Config::instance().getString(CONFIG_EXAMPLESINSTALLPATH); + pathRoot = Config::instance().get(CONFIG_EXAMPLESINSTALLPATH).asString(); QStringList path = QStringList() << pathRoot << en->name(); path.removeAll(QString()); @@ -1602,7 +1602,7 @@ void Generator::initialize() { Config &config = Config::instance(); s_outputFormats = config.getOutputFormats(); - s_redirectDocumentationToDevNull = config.getBool(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL); + s_redirectDocumentationToDevNull = config.get(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL).asBool(); for (auto &g : s_generators) { if (s_outputFormats.contains(g->format())) { @@ -1641,26 +1641,27 @@ void Generator::initialize() } } - s_project = config.getString(CONFIG_PROJECT); + s_project = config.get(CONFIG_PROJECT).asString(); s_outDir = config.getOutputDir(); s_outSubdir = s_outDir.mid(s_outDir.lastIndexOf('/') + 1); s_outputPrefixes.clear(); - QStringList items = config.getStringList(CONFIG_OUTPUTPREFIXES); + QStringList items{config.get(CONFIG_OUTPUTPREFIXES).asStringList()}; if (!items.isEmpty()) { for (const auto &prefix : items) s_outputPrefixes[prefix] = - config.getString(CONFIG_OUTPUTPREFIXES + Config::dot + prefix); + config.get(CONFIG_OUTPUTPREFIXES + Config::dot + prefix).asString(); } else { s_outputPrefixes[QLatin1String("QML")] = QLatin1String("qml-"); } s_outputSuffixes.clear(); - for (const auto &suffix : config.getStringList(CONFIG_OUTPUTSUFFIXES)) - s_outputSuffixes[suffix] = config.getString(CONFIG_OUTPUTSUFFIXES + Config::dot + suffix); + for (const auto &suffix : config.get(CONFIG_OUTPUTSUFFIXES).asStringList()) + s_outputSuffixes[suffix] = config.get(CONFIG_OUTPUTSUFFIXES + + Config::dot + suffix).asString(); - s_noLinkErrors = config.getBool(CONFIG_NOLINKERRORS); - s_autolinkErrors = config.getBool(CONFIG_AUTOLINKERRORS); + s_noLinkErrors = config.get(CONFIG_NOLINKERRORS).asBool(); + s_autolinkErrors = config.get(CONFIG_AUTOLINKERRORS).asBool(); } /*! @@ -1723,7 +1724,7 @@ void Generator::initializeFormat() Config &config = Config::instance(); s_outFileNames.clear(); s_useOutputSubdirs = true; - if (config.getBool(format() + Config::dot + "nosubdirs")) + if (config.get(format() + Config::dot + "nosubdirs").asBool()) resetUseOutputSubdirs(); if (s_outputFormats.isEmpty()) @@ -1762,9 +1763,9 @@ void Generator::initializeFormat() // Use a format-specific .quotinginformation if defined, otherwise a global value if (config.subVars(format()).contains(CONFIG_QUOTINGINFORMATION)) - m_quoting = config.getBool(format() + Config::dot + CONFIG_QUOTINGINFORMATION); + m_quoting = config.get(format() + Config::dot + CONFIG_QUOTINGINFORMATION).asBool(); else - m_quoting = config.getBool(CONFIG_QUOTINGINFORMATION); + m_quoting = config.get(CONFIG_QUOTINGINFORMATION).asBool(); } /*! diff --git a/src/qdoc/helpprojectwriter.cpp b/src/qdoc/helpprojectwriter.cpp index d2ea24c71..8c0e56b26 100644 --- a/src/qdoc/helpprojectwriter.cpp +++ b/src/qdoc/helpprojectwriter.cpp @@ -43,58 +43,55 @@ void HelpProjectWriter::reset(const QString &defaultFileName, Generator *g) Config &config = Config::instance(); m_outputDir = config.getOutputDir(); - const QStringList names = config.getStringList(CONFIG_QHP + Config::dot + "projects"); + const QStringList names{config.get(CONFIG_QHP + Config::dot + "projects").asStringList()}; for (const auto &projectName : names) { HelpProject project; project.m_name = projectName; QString prefix = CONFIG_QHP + Config::dot + projectName + Config::dot; - project.m_helpNamespace = config.getString(prefix + "namespace"); - project.m_virtualFolder = config.getString(prefix + "virtualFolder"); - project.m_version = config.getString(CONFIG_VERSION); - project.m_fileName = config.getString(prefix + "file"); + project.m_helpNamespace = config.get(prefix + "namespace").asString(); + project.m_virtualFolder = config.get(prefix + "virtualFolder").asString(); + project.m_version = config.get(CONFIG_VERSION).asString(); + project.m_fileName = config.get(prefix + "file").asString(); if (project.m_fileName.isEmpty()) project.m_fileName = defaultFileName; - project.m_extraFiles = config.getStringSet(prefix + "extraFiles"); - project.m_extraFiles += config.getStringSet(CONFIG_QHP + Config::dot + "extraFiles"); - project.m_indexTitle = config.getString(prefix + "indexTitle"); - project.m_indexRoot = config.getString(prefix + "indexRoot"); - const auto &filterAttributes = config.getStringList(prefix + "filterAttributes"); - project.m_filterAttributes = - QSet<QString>(filterAttributes.cbegin(), filterAttributes.cend()); - project.m_includeIndexNodes = config.getBool(prefix + "includeIndexNodes"); + project.m_extraFiles = config.get(prefix + "extraFiles").asStringSet(); + project.m_extraFiles += config.get(CONFIG_QHP + Config::dot + "extraFiles").asStringSet(); + project.m_indexTitle = config.get(prefix + "indexTitle").asString(); + project.m_indexRoot = config.get(prefix + "indexRoot").asString(); + project.m_filterAttributes = config.get(prefix + "filterAttributes").asStringSet(); + project.m_includeIndexNodes = config.get(prefix + "includeIndexNodes").asBool(); const QSet<QString> customFilterNames = config.subVars(prefix + "customFilters"); for (const auto &filterName : customFilterNames) { - QString name = config.getString(prefix + "customFilters" + Config::dot + filterName - + Config::dot + "name"); - const auto &filters = - config.getStringList(prefix + "customFilters" + Config::dot + filterName - + Config::dot + "filterAttributes"); - project.m_customFilters[name] = QSet<QString>(filters.cbegin(), filters.cend()); + QString name{config.get(prefix + "customFilters" + Config::dot + filterName + + Config::dot + "name").asString()}; + project.m_customFilters[name] = + config.get(prefix + "customFilters" + Config::dot + filterName + + Config::dot + "filterAttributes").asStringSet(); } - const auto excludedPrefixes = config.getStringSet(prefix + "excluded"); + const auto excludedPrefixes = config.get(prefix + "excluded").asStringSet(); for (auto name : excludedPrefixes) project.m_excluded.insert(name.replace(QLatin1Char('\\'), QLatin1Char('/'))); - const auto subprojectPrefixes = config.getStringList(prefix + "subprojects"); + const auto subprojectPrefixes{config.get(prefix + "subprojects").asStringList()}; for (const auto &name : subprojectPrefixes) { SubProject subproject; QString subprefix = prefix + "subprojects" + Config::dot + name + Config::dot; - subproject.m_title = config.getString(subprefix + "title"); + subproject.m_title = config.get(subprefix + "title").asString(); if (subproject.m_title.isEmpty()) continue; - subproject.m_indexTitle = config.getString(subprefix + "indexTitle"); - subproject.m_sortPages = config.getBool(subprefix + "sortPages"); - subproject.m_type = config.getString(subprefix + "type"); - readSelectors(subproject, config.getStringList(subprefix + "selectors")); + subproject.m_indexTitle = config.get(subprefix + "indexTitle").asString(); + subproject.m_sortPages = config.get(subprefix + "sortPages").asBool(); + subproject.m_type = config.get(subprefix + "type").asString(); + readSelectors(subproject, config.get(subprefix + "selectors").asStringList()); project.m_subprojects.append(subproject); } if (project.m_subprojects.isEmpty()) { SubProject subproject; - readSelectors(subproject, config.getStringList(prefix + "selectors")); + readSelectors(subproject, config.get(prefix + "selectors").asStringList()); project.m_subprojects.insert(0, subproject); } diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index a4fb7fd13..2266c69e4 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -124,45 +124,35 @@ void HtmlGenerator::initializeGenerator() The formatting maps are owned by Generator. They are cleared in Generator::terminate(). */ - int i = 0; - while (defaults[i].key) { + for (int i = 0; defaults[i].key; ++i) { formattingLeftMap().insert(QLatin1String(defaults[i].key), QLatin1String(defaults[i].left)); formattingRightMap().insert(QLatin1String(defaults[i].key), QLatin1String(defaults[i].right)); - i++; } - m_endHeader = config->getString(HtmlGenerator::format() + Config::dot + CONFIG_ENDHEADER); - m_postHeader = - config->getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTHEADER); - m_postPostHeader = - config->getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTPOSTHEADER); - m_prologue = config->getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_PROLOGUE); + QString formatDot{HtmlGenerator::format() + Config::dot}; + m_endHeader = config->get(formatDot + CONFIG_ENDHEADER).asString(); + m_postHeader = config->get(formatDot + HTMLGENERATOR_POSTHEADER).asString(); + m_postPostHeader = config->get(formatDot + HTMLGENERATOR_POSTPOSTHEADER).asString(); + m_prologue = config->get(formatDot + HTMLGENERATOR_PROLOGUE).asString(); - m_footer = config->getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_FOOTER); - m_address = config->getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_ADDRESS); - m_noNavigationBar = - config->getBool(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_NONAVIGATIONBAR); - m_navigationSeparator = config->getString(HtmlGenerator::format() + Config::dot - + HTMLGENERATOR_NAVIGATIONSEPARATOR); - tocDepth = config->getInt(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_TOCDEPTH); + m_footer = config->get(formatDot + HTMLGENERATOR_FOOTER).asString(); + m_address = config->get(formatDot + HTMLGENERATOR_ADDRESS).asString(); + m_noNavigationBar = config->get(formatDot + HTMLGENERATOR_NONAVIGATIONBAR).asBool(); + m_navigationSeparator = config->get(formatDot + HTMLGENERATOR_NAVIGATIONSEPARATOR).asString(); + tocDepth = config->get(formatDot + HTMLGENERATOR_TOCDEPTH).asInt(); - m_project = config->getString(CONFIG_PROJECT); + m_project = config->get(CONFIG_PROJECT).asString(); + m_projectDescription = config->get(CONFIG_DESCRIPTION) + .asString(m_project + QLatin1String(" Reference Documentation")); - m_projectDescription = config->getString(CONFIG_DESCRIPTION); - if (m_projectDescription.isEmpty() && !m_project.isEmpty()) - m_projectDescription = m_project + QLatin1String(" Reference Documentation"); + m_projectUrl = config->get(CONFIG_URL).asString(); + tagFile_ = config->get(CONFIG_TAGFILE).asString(); + naturalLanguage = config->get(CONFIG_NATURALLANGUAGE).asString(QLatin1String("en")); - m_projectUrl = config->getString(CONFIG_URL); - tagFile_ = config->getString(CONFIG_TAGFILE); - - naturalLanguage = config->getString(CONFIG_NATURALLANGUAGE); - if (naturalLanguage.isEmpty()) - naturalLanguage = QLatin1String("en"); - - m_codeIndent = config->getInt(CONFIG_CODEINDENT); // QTBUG-27798 - m_codePrefix = config->getString(CONFIG_CODEPREFIX); - m_codeSuffix = config->getString(CONFIG_CODESUFFIX); + m_codeIndent = config->get(CONFIG_CODEINDENT).asInt(); + m_codePrefix = config->get(CONFIG_CODEPREFIX).asString(); + m_codeSuffix = config->get(CONFIG_CODESUFFIX).asString(); /* The help file write should be allocated once and only once @@ -177,31 +167,39 @@ void HtmlGenerator::initializeGenerator() m_manifestWriter = new ManifestWriter(); // Documentation template handling - m_headerScripts = - config->getString(HtmlGenerator::format() + Config::dot + CONFIG_HEADERSCRIPTS); - m_headerStyles = config->getString(HtmlGenerator::format() + Config::dot + CONFIG_HEADERSTYLES); + m_headerScripts = config->get(formatDot + CONFIG_HEADERSCRIPTS).asString(); + m_headerStyles = config->get(formatDot + CONFIG_HEADERSTYLES).asString(); // Retrieve the config for the navigation bar - m_homepage = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_HOMEPAGE); + m_homepage = config->get(CONFIG_NAVIGATION + + Config::dot + CONFIG_HOMEPAGE).asString(); - m_hometitle = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_HOMETITLE, m_homepage); + m_hometitle = config->get(CONFIG_NAVIGATION + + Config::dot + CONFIG_HOMETITLE) + .asString(m_homepage); - m_landingpage = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGPAGE); + m_landingpage = config->get(CONFIG_NAVIGATION + + Config::dot + CONFIG_LANDINGPAGE).asString(); - m_landingtitle = - config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGTITLE, m_landingpage); + m_landingtitle = config->get(CONFIG_NAVIGATION + + Config::dot + CONFIG_LANDINGTITLE) + .asString(m_landingpage); - m_cppclassespage = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_CPPCLASSESPAGE); + m_cppclassespage = config->get(CONFIG_NAVIGATION + + Config::dot + CONFIG_CPPCLASSESPAGE).asString(); - m_cppclassestitle = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_CPPCLASSESTITLE, - QLatin1String("C++ Classes")); + m_cppclassestitle = config->get(CONFIG_NAVIGATION + + Config::dot + CONFIG_CPPCLASSESTITLE) + .asString(QLatin1String("C++ Classes")); - m_qmltypespage = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_QMLTYPESPAGE); + m_qmltypespage = config->get(CONFIG_NAVIGATION + + Config::dot + CONFIG_QMLTYPESPAGE).asString(); - m_qmltypestitle = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_QMLTYPESTITLE, - QLatin1String("QML Types")); + m_qmltypestitle = config->get(CONFIG_NAVIGATION + + Config::dot + CONFIG_QMLTYPESTITLE) + .asString(QLatin1String("QML Types")); - m_buildversion = config->getString(CONFIG_BUILDVERSION); + m_buildversion = config->get(CONFIG_BUILDVERSION).asString(); } /*! diff --git a/src/qdoc/location.cpp b/src/qdoc/location.cpp index c61e5eedb..3501c8706 100644 --- a/src/qdoc/location.cpp +++ b/src/qdoc/location.cpp @@ -283,14 +283,14 @@ void Location::report(const QString &message, const QString &details) const void Location::initialize() { Config &config = Config::instance(); - s_tabSize = config.getInt(CONFIG_TABSIZE); + s_tabSize = config.get(CONFIG_TABSIZE).asInt(); s_programName = config.programName(); - s_project = config.getString(CONFIG_PROJECT); + s_project = config.get(CONFIG_PROJECT).asString(); if (!config.singleExec()) s_warningCount = 0; if (qEnvironmentVariableIsSet("QDOC_ENABLE_WARNINGLIMIT") - || config.getBool(CONFIG_WARNINGLIMIT + Config::dot + "enabled")) - s_warningLimit = config.getInt(CONFIG_WARNINGLIMIT); + || config.get(CONFIG_WARNINGLIMIT + Config::dot + "enabled").asBool()) + s_warningLimit = config.get(CONFIG_WARNINGLIMIT).asInt(); QRegularExpression regExp = config.getRegExp(CONFIG_SPURIOUS); if (regExp.isValid()) { diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp index 69a6bcc96..fd145a8f4 100644 --- a/src/qdoc/main.cpp +++ b/src/qdoc/main.cpp @@ -63,8 +63,8 @@ static void loadIndexFiles(const QSet<QString> &formats) Config &config = Config::instance(); QDocDatabase *qdb = QDocDatabase::qdocDB(); QStringList indexFiles; - const QStringList configIndexes = config.getStringList(CONFIG_INDEXES); - bool warn = !config.getBool(CONFIG_NOLINKERRORS); + const QStringList configIndexes{config.get(CONFIG_INDEXES).asStringList()}; + bool warn = !config.get(CONFIG_NOLINKERRORS).asBool(); for (const auto &index : configIndexes) { QFileInfo fi(index); @@ -74,15 +74,15 @@ static void loadIndexFiles(const QSet<QString> &formats) Location().warning(QString("Index file not found: %1").arg(index)); } - config.dependModules() += config.getStringList(CONFIG_DEPENDS); + config.dependModules() += config.get(CONFIG_DEPENDS).asStringList(); config.dependModules().removeDuplicates(); bool useNoSubDirs = false; QSet<QString> subDirs; for (const auto &format : formats) { - if (config.getBool(format + Config::dot + "nosubdirs")) { + if (config.get(format + Config::dot + "nosubdirs").asBool()) { useNoSubDirs = true; - QString singleOutputSubdir = config.getString(format + Config::dot + "outputsubdir"); + QString singleOutputSubdir{config.get(format + Config::dot + "outputsubdir").asString()}; if (singleOutputSubdir.isEmpty()) singleOutputSubdir = "html"; subDirs << singleOutputSubdir; @@ -130,7 +130,7 @@ static void loadIndexFiles(const QSet<QString> &formats) } } // Remove self-dependencies and possible duplicates - QString project{config.getString(CONFIG_PROJECT)}; + QString project{config.get(CONFIG_PROJECT).asString()}; config.dependModules().removeAll(project.toLower()); config.dependModules().removeDuplicates(); qCCritical(lcQdoc) << "Configuration file for" @@ -189,7 +189,7 @@ static void loadIndexFiles(const QSet<QString> &formats) } else if (!asteriskUsed && warn) { Location().warning( QString(R"("%1" Cannot locate index file for dependency "%2")") - .arg(config.getString(CONFIG_PROJECT), module)); + .arg(config.get(CONFIG_PROJECT).asString(), module)); } } } else if (warn) { @@ -209,13 +209,13 @@ static void loadIndexFiles(const QSet<QString> &formats) If QDoc is not running in debug mode or --log-progress command line option is not set, do nothing. */ -void logStartEndMessage(const QLatin1String &startStop, const Config &config) +void logStartEndMessage(const QLatin1String &startStop, Config &config) { - if (!config.getBool(CONFIG_LOGPROGRESS)) + if (!config.get(CONFIG_LOGPROGRESS).asBool()) return; const QString runName = " qdoc for " - + config.getString(CONFIG_PROJECT) + + config.get(CONFIG_PROJECT).asString() + QLatin1String(" in ") + QLatin1String(config.singleExec() ? "single" : "dual") + QLatin1String(" process mode: ") @@ -248,7 +248,7 @@ static void processQdocconfFile(const QString &fileName) */ Location::initialize(); config.load(fileName); - QString project = config.getString(CONFIG_PROJECT); + QString project{config.get(CONFIG_PROJECT).asString()}; if (project.isEmpty()) { qCCritical(lcQdoc) << QLatin1String("qdoc can't run; no project set in qdocconf file"); exit(1); @@ -392,7 +392,7 @@ static void processQdocconfFile(const QString &fileName) but only if they haven't already been loaded. This works in both -prepare/-generate mode and -singleexec mode. */ - const QStringList fileNames = config.getStringList(CONFIG_TRANSLATORS); + const QStringList fileNames{config.get(CONFIG_TRANSLATORS).asStringList()}; for (const auto &file : fileNames) { bool found = false; if (!translators.isEmpty()) { @@ -427,7 +427,7 @@ static void processQdocconfFile(const QString &fileName) So it is safe to call qdocDB() any time. */ QDocDatabase *qdb = QDocDatabase::qdocDB(); - qdb->setVersion(config.getString(CONFIG_VERSION)); + qdb->setVersion(config.get(CONFIG_VERSION).asString()); /* By default, the only output format is HTML. */ @@ -446,7 +446,7 @@ static void processQdocconfFile(const QString &fileName) else qdb->setPrimaryTree(project); - const QString moduleHeader = config.getString(CONFIG_MODULEHEADER); + const QString moduleHeader{config.get(CONFIG_MODULEHEADER).asString()}; if (!moduleHeader.isNull()) clangParser.setModuleHeader(moduleHeader); else @@ -454,7 +454,7 @@ static void processQdocconfFile(const QString &fileName) // Retrieve the dependencies if loadIndexFiles() was not called if (config.dependModules().isEmpty()) { - config.dependModules() = config.getStringList(CONFIG_DEPENDS); + config.dependModules() = config.get(CONFIG_DEPENDS).asStringList(); config.dependModules().removeDuplicates(); } qdb->setSearchOrder(config.dependModules()); @@ -462,9 +462,9 @@ static void processQdocconfFile(const QString &fileName) // Store the title of the index (landing) page NamespaceNode *root = qdb->primaryTreeRoot(); if (root) { - QString title = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGPAGE); + QString title{config.get(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGPAGE).asString()}; root->tree()->setIndexTitle( - config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGTITLE, title)); + config.get(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGTITLE).asString(title)); } if (config.dualExec() || config.preparing()) { @@ -535,7 +535,7 @@ static void processQdocconfFile(const QString &fileName) Parse each source text file in the set using the appropriate parser and add it to the big tree. */ - if (config.getBool(CONFIG_LOGPROGRESS)) + if (config.get(CONFIG_LOGPROGRESS).asBool()) qCInfo(lcQdoc) << "Parse source files for" << project; for (auto it = sources.cbegin(), end = sources.cend(); it != end; ++it) { const auto &key = it.key(); @@ -545,7 +545,7 @@ static void processQdocconfFile(const QString &fileName) codeParser->parseSourceFile(config.location(), key); } } - if (config.getBool(CONFIG_LOGPROGRESS)) + if (config.get(CONFIG_LOGPROGRESS).asBool()) qCInfo(lcQdoc) << "Source files parsed for" << project; } /* diff --git a/src/qdoc/manifestwriter.cpp b/src/qdoc/manifestwriter.cpp index 3c61037e9..2f2ced1b3 100644 --- a/src/qdoc/manifestwriter.cpp +++ b/src/qdoc/manifestwriter.cpp @@ -145,17 +145,18 @@ static void writeMetaInformation(QXmlStreamWriter &writer, const QStringMultiMap ManifestWriter::ManifestWriter() { Config &config = Config::instance(); - m_project = config.getString(CONFIG_PROJECT); + m_project = config.get(CONFIG_PROJECT).asString(); m_outputDirectory = config.getOutputDir(); m_qdb = QDocDatabase::qdocDB(); const QString prefix = CONFIG_QHP + Config::dot + m_project + Config::dot; m_manifestDir = - QLatin1String("qthelp://") + config.getString(prefix + QLatin1String("namespace")); - m_manifestDir += QLatin1Char('/') + config.getString(prefix + QLatin1String("virtualFolder")) + QLatin1String("qthelp://") + config.get(prefix + QLatin1String("namespace")).asString(); + m_manifestDir += + QLatin1Char('/') + config.get(prefix + QLatin1String("virtualFolder")).asString() + QLatin1Char('/'); readManifestMetaContent(); - m_examplesPath = config.getString(CONFIG_EXAMPLESINSTALLPATH); + m_examplesPath = config.get(CONFIG_EXAMPLESINSTALLPATH).asString(); if (!m_examplesPath.isEmpty()) m_examplesPath += QLatin1Char('/'); } @@ -352,15 +353,16 @@ void ManifestWriter::generateExampleManifestFile() void ManifestWriter::readManifestMetaContent() { Config &config = Config::instance(); - const QStringList names = - config.getStringList(CONFIG_MANIFESTMETA + Config::dot + QStringLiteral("filters")); + const QStringList names{config.get(CONFIG_MANIFESTMETA + + Config::dot + + QStringLiteral("filters")).asStringList()}; for (const auto &manifest : names) { ManifestMetaFilter filter; QString prefix = CONFIG_MANIFESTMETA + Config::dot + manifest + Config::dot; - filter.m_names = config.getStringSet(prefix + QStringLiteral("names")); - filter.m_attributes = config.getStringSet(prefix + QStringLiteral("attributes")); - filter.m_tags = config.getStringSet(prefix + QStringLiteral("tags")); + filter.m_names = config.get(prefix + QStringLiteral("names")).asStringSet(); + filter.m_attributes = config.get(prefix + QStringLiteral("attributes")).asStringSet(); + filter.m_tags = config.get(prefix + QStringLiteral("tags")).asStringSet(); m_manifestMetaContent.append(filter); } } diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp index 4b6189b0a..40bf03cbc 100644 --- a/src/qdoc/node.cpp +++ b/src/qdoc/node.cpp @@ -744,7 +744,7 @@ void Node::setSince(const QString &since) project = Config::dot + parts.first(); QVersionNumber cutoff = - QVersionNumber::fromString(Config::instance().getString(CONFIG_IGNORESINCE + project)) + QVersionNumber::fromString(Config::instance().get(CONFIG_IGNORESINCE + project).asString()) .normalized(); if (!cutoff.isNull() && QVersionNumber::fromString(parts.last()).normalized() < cutoff) diff --git a/src/qdoc/qdocdatabase.cpp b/src/qdoc/qdocdatabase.cpp index a372d0379..de099b881 100644 --- a/src/qdoc/qdocdatabase.cpp +++ b/src/qdoc/qdocdatabase.cpp @@ -961,7 +961,7 @@ void QDocDatabase::resolveNamespaces() if (!m_namespaceIndex.isEmpty()) return; - bool linkErrors = !Config::instance().getBool(CONFIG_NOLINKERRORS); + bool linkErrors = !Config::instance().get(CONFIG_NOLINKERRORS).asBool(); NodeMultiMap namespaceMultimap; Tree *t = m_forest.firstTree(); while (t) { @@ -1552,13 +1552,11 @@ void QDocDatabase::updateNavigation() // for Config to be a POD type that generally is scoped to // main and whose data is destructured into dependencies when // the dependencies are constructed. - bool inclusive = - Config::instance().getBool(configVar + - Config::dot + - CONFIG_INCLUSIVE); + bool inclusive{Config::instance().get( + configVar + Config::dot + CONFIG_INCLUSIVE).asBool()}; // TODO: [direct-configuration-access] - const auto tocTitles = Config::instance().getStringList(configVar); + const auto tocTitles{Config::instance().get(configVar).asStringList()}; for (const auto &tocTitle : tocTitles) { if (const auto candidateTarget = findNodeForTarget(tocTitle, nullptr); candidateTarget && candidateTarget->isPageNode()) { diff --git a/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdocindexfiles.cpp index 1c4ca824a..3f79c8fbf 100644 --- a/src/qdoc/qdocindexfiles.cpp +++ b/src/qdoc/qdocindexfiles.cpp @@ -55,7 +55,7 @@ QDocIndexFiles *QDocIndexFiles::s_qdocIndexFiles = nullptr; QDocIndexFiles::QDocIndexFiles() : m_gen(nullptr) { m_qdb = QDocDatabase::qdocDB(); - m_storeLocationInfo = Config::instance().getBool(CONFIG_LOCATIONINFO); + m_storeLocationInfo = Config::instance().get(CONFIG_LOCATIONINFO).asBool(); } /*! @@ -129,7 +129,7 @@ void QDocIndexFiles::readIndexFile(const QString &path) // the dependency is identical to ours, assume that also // the dependent html files are available under the same // directory tree. Otherwise, link using the full index URL. - if (!Config::installDir.isEmpty() && indexUrl == Config::instance().getString(CONFIG_URL)) { + if (!Config::installDir.isEmpty() && indexUrl == Config::instance().get(CONFIG_URL).asString()) { // Generate a relative URL between the install dir and the index file // when the -installdir command line option is set. QDir installDir(path.section('/', 0, -3) + '/' + Generator::outputSubdir()); @@ -1406,7 +1406,7 @@ void QDocIndexFiles::generateIndex(const QString &fileName, const QString &url, writer.writeAttribute("url", url); writer.writeAttribute("title", title); writer.writeAttribute("version", m_qdb->version()); - writer.writeAttribute("project", Config::instance().getString(CONFIG_PROJECT)); + writer.writeAttribute("project", Config::instance().get(CONFIG_PROJECT).asString()); root_ = m_qdb->primaryTreeRoot(); if (!root_->tree()->indexTitle().isEmpty()) diff --git a/src/qdoc/tokenizer.cpp b/src/qdoc/tokenizer.cpp index ea9060f97..bfbfc53c5 100644 --- a/src/qdoc/tokenizer.cpp +++ b/src/qdoc/tokenizer.cpp @@ -482,10 +482,10 @@ int Tokenizer::getToken() void Tokenizer::initialize() { Config &config = Config::instance(); - QString versionSym = config.getString(CONFIG_VERSIONSYM); + QString versionSym = config.get(CONFIG_VERSIONSYM).asString(); const QLatin1String defaultEncoding("UTF-8"); - QString sourceEncoding = config.getString(CONFIG_SOURCEENCODING, defaultEncoding); + QString sourceEncoding = config.get(CONFIG_SOURCEENCODING).asString(defaultEncoding); if (!QStringConverter::encodingForName(sourceEncoding.toUtf8().constData())) { Location().warning(QStringLiteral("Source encoding '%1' not supported, using '%2' as default.") .arg(sourceEncoding, defaultEncoding)); @@ -501,10 +501,11 @@ void Tokenizer::initialize() + ")[ \t]+\"([^\"]*)\"[ \t]*$"); definedX = new QRegularExpression("^defined ?\\(?([A-Z_0-9a-z]+) ?\\)?$"); - QStringList d = config.getStringList(CONFIG_DEFINES); + QStringList d{config.get(CONFIG_DEFINES).asStringList()}; d += "qdoc"; defines = new QRegularExpression(QRegularExpression::anchoredPattern(d.join('|'))); - falsehoods = new QRegularExpression(QRegularExpression::anchoredPattern(config.getStringList(CONFIG_FALSEHOODS).join('|'))); + falsehoods = new QRegularExpression(QRegularExpression::anchoredPattern( + config.get(CONFIG_FALSEHOODS).asStringList().join('|'))); /* The keyword hash table is always cleared before any words are inserted. @@ -515,16 +516,18 @@ void Tokenizer::initialize() ignoredTokensAndDirectives = new QHash<QByteArray, bool>; - const QStringList tokens = - config.getStringList(LANGUAGE_CPP + Config::dot + CONFIG_IGNORETOKENS); + const QStringList tokens{config.get(LANGUAGE_CPP + + Config::dot + + CONFIG_IGNORETOKENS).asStringList()}; for (const auto &token : tokens) { const QByteArray tb = token.toLatin1(); ignoredTokensAndDirectives->insert(tb, false); insertKwordIntoHash(tb.data(), -1); } - const QStringList directives = - config.getStringList(LANGUAGE_CPP + Config::dot + CONFIG_IGNOREDIRECTIVES); + const QStringList directives{config.get(LANGUAGE_CPP + + Config::dot + + CONFIG_IGNOREDIRECTIVES).asStringList()}; for (const auto &directive : directives) { const QByteArray db = directive.toLatin1(); ignoredTokensAndDirectives->insert(db, true); diff --git a/src/qdoc/webxmlgenerator.cpp b/src/qdoc/webxmlgenerator.cpp index 79a58df4b..4b44f1254 100644 --- a/src/qdoc/webxmlgenerator.cpp +++ b/src/qdoc/webxmlgenerator.cpp @@ -118,7 +118,7 @@ void WebXMLGenerator::generateExampleFilePage(const Node *en, ResolvedFile resol writer.writeAttribute("subtitle", resolved_file.get_path()); writer.writeStartElement("description"); - if (Config::instance().getBool(CONFIG_LOCATIONINFO)) { + if (Config::instance().get(CONFIG_LOCATIONINFO).asBool()) { writer.writeAttribute("path", resolved_file.get_path()); writer.writeAttribute("line", "0"); writer.writeAttribute("column", "0"); @@ -157,7 +157,7 @@ void WebXMLGenerator::append(QXmlStreamWriter &writer, Node *node) Q_ASSERT(marker_); writer.writeStartElement("description"); - if (Config::instance().getBool(CONFIG_LOCATIONINFO)) { + if (Config::instance().get(CONFIG_LOCATIONINFO).asBool()) { writer.writeAttribute("path", node->doc().location().filePath()); writer.writeAttribute("line", QString::number(node->doc().location().lineNo())); writer.writeAttribute("column", QString::number(node->doc().location().columnNo())); diff --git a/tests/auto/qdoc/config/tst_config.cpp b/tests/auto/qdoc/config/tst_config.cpp index 522e02526..ac69f3b51 100644 --- a/tests/auto/qdoc/config/tst_config.cpp +++ b/tests/auto/qdoc/config/tst_config.cpp @@ -84,16 +84,16 @@ void tst_Config::variables() auto &config = initConfig("/testdata/configs/vars.qdocconf"); const QStringList list = { "testing", "line", "by\n", "line" }; - QCOMPARE(config.getStringList("list"), list); - QCOMPARE(config.getString("list"), "testing line by\nline"); - QCOMPARE(config.getBool("true"), true); - QCOMPARE(config.getBool("untrue"), false); - QCOMPARE(config.getInt("int"), 2); - QCOMPARE(config.getString("void"), QString()); - QVERIFY(!config.getString("void").isNull()); - QCOMPARE(config.getString("void", "undefined"), QString()); - QCOMPARE(config.getString("undefined", "undefined"), "undefined"); - QVERIFY(config.getString("undefined").isNull()); + QCOMPARE(config.get("list").asStringList(), list); + QCOMPARE(config.get("list").asString(), "testing line by\nline"); + QCOMPARE(config.get("true").asBool(), true); + QCOMPARE(config.get("untrue").asBool(), false); + QCOMPARE(config.get("int").asInt(), 2); + QCOMPARE(config.get("void").asString(), QString()); + QVERIFY(!config.get("void").asString().isNull()); + QCOMPARE(config.get("void").asString("undefined"), QString()); + QCOMPARE(config.get("undefined").asString("undefined"), "undefined"); + QVERIFY(config.get("undefined").asString().isNull()); QSet<QString> subVars = { "thing", "where", "time" }; QCOMPARE(config.subVars("some"), subVars); @@ -168,11 +168,11 @@ void::tst_Config::expandVars() qputenv("QDOC_TSTCONFIG_LIST", QByteArray("a b c")); auto &config = initConfig("/testdata/configs/expandvars.qdocconf"); - QCOMPARE(config.getString("expanded1"), "foo"); - QCOMPARE(config.getString("expanded2"), "foo,bar"); - QCOMPARE(config.getString("expanded3"), "foobar foobar baz"); - QCOMPARE(config.getString("literally"), "$data ${data}"); - QCOMPARE(config.getString("csvlist"), "a,b,c"); + QCOMPARE(config.get("expanded1").asString(), "foo"); + QCOMPARE(config.get("expanded2").asString(), "foo,bar"); + QCOMPARE(config.get("expanded3").asString(), "foobar foobar baz"); + QCOMPARE(config.get("literally").asString(), "$data ${data}"); + QCOMPARE(config.get("csvlist").asString(), "a,b,c"); } QTEST_APPLESS_MAIN(tst_Config) |