From 9e44204bf84edcfe2befaaa9b7280257c9268548 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 3 Apr 2014 10:50:02 +0200 Subject: qdoc: Simplify config code for reading file paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change greatly simplifies the code used for reading paths from config files: near-identical functions Config::getCanonicalPathList() and Config::getPathList() are combined into one, and the use of Config::getCleanPathList() is replaced with the above. Effectively, all paths read from the config files are now converted into canonical ones. It also adds support for absolute paths in config files. Task-number: QTBUG-36193 Change-Id: I2dc1ee6a67a400e056404ec1c09c6e81f643aa77 Reviewed-by: Martin Smith Reviewed-by: Jędrzej Nowacki --- src/tools/qdoc/config.cpp | 106 +++++++++------------------------------------- 1 file changed, 20 insertions(+), 86 deletions(-) (limited to 'src/tools/qdoc/config.cpp') diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index 185c1c77f1..644eab8a56 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -454,87 +454,21 @@ QStringList Config::getStringList(const QString& var) const } /*! - \brief Returns the a path list where all paths are canonicalized, then - made relative to the config file. - \param var The variable containing the list of paths. - \see Location::canonicalRelativePath() - */ -QStringList Config::getCanonicalPathList(const QString& var) const -{ - QStringList t; - QList configVars = configVars_.values(var); - if (!configVars.empty()) { - int i = configVars.size() - 1; - while (i >= 0) { - const ConfigVar& cv = configVars[i]; - if (!cv.location_.isEmpty()) - (Location&) lastLocation_ = cv.location_; - if (!cv.plus_) - t.clear(); - const QString d = cv.currentPath_; - const QStringList& sl = cv.values_; - if (!sl.isEmpty()) { - t.reserve(t.size() + sl.size()); - for (int i=0; i configVars = configVars_.values(var); - if (!configVars.empty()) { - int i = configVars.size() - 1; - while (i >= 0) { - const ConfigVar& cv = configVars[i]; - if (!cv.plus_) - t.clear(); - if (!cv.location_.isEmpty()) - (Location&) lastLocation_ = cv.location_; - const QStringList& sl = cv.values_; - if (!sl.isEmpty()) { - t.reserve(t.size() + sl.size()); - for (int i=0; i configVars = configVars_.values(var); @@ -542,22 +476,23 @@ QStringList Config::getPathList(const QString& var) const int i = configVars.size() - 1; while (i >= 0) { const ConfigVar& cv = configVars[i]; - if (!cv.plus_) - t.clear(); if (!cv.location_.isEmpty()) (Location&) lastLocation_ = cv.location_; + if (!cv.plus_) + t.clear(); const QString d = cv.currentPath_; const QStringList& sl = cv.values_; if (!sl.isEmpty()) { t.reserve(t.size() + sl.size()); for (int i=0; i