summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@nokia.com>2012-07-31 13:57:20 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-01 18:12:34 +0200
commite178b49522465becf1b0c56bff1974e6037ba9ec (patch)
treec74c0ec221b6e66018e14474d6c5cdb979e4edd7 /src/tools
parent864a843f98f58ce09528dca1ae7465f8149e404f (diff)
qdoc: Added support for modularized example doc
qdoc now searches for .qdoc files in the directories listed in the exampledirs variable. These files are added to the list of sources to be parsed. Task nr: QTBUG-26708 Change-Id: I6dfd7cd7b41e0bdf847f88b6d61ac0272902d4e1 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/qdoc/config.cpp18
-rw-r--r--src/tools/qdoc/config.h2
-rw-r--r--src/tools/qdoc/main.cpp10
3 files changed, 28 insertions, 2 deletions
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp
index e1a028315f..f2e66311a8 100644
--- a/src/tools/qdoc/config.cpp
+++ b/src/tools/qdoc/config.cpp
@@ -315,7 +315,7 @@ QSet<QString> Config::getStringSet(const QString& var) const
/*!
First, this function looks up the configuration variable \a var
in the location map and, if found, sets the internal variable
- \c{lastLoc} the Location that \a var maps to.
+ \c{lastLoc} to the Location that \a var maps to.
Then it looks up the configuration variable \a var in the string
list map, and returns the string list that \a var maps to.
@@ -477,6 +477,22 @@ QStringList Config::getAllFiles(const QString &filesVar,
return result;
}
+QStringList Config::getExampleQdocFiles()
+{
+ QStringList result;
+ QSet<QString> excludedDirs;
+ QSet<QString> excludedFiles;
+ QStringList dirs = getStringList("exampledirs");
+ QString nameFilter = " *.qdoc";
+
+ QStringList::ConstIterator d = dirs.constBegin();
+ while (d != dirs.constEnd()) {
+ result += getFilesHere(*d, nameFilter, excludedDirs, excludedFiles);
+ ++d;
+ }
+ return result;
+}
+
/*!
\a fileName is the path of the file to find.
diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h
index baab42e59d..408bffe77b 100644
--- a/src/tools/qdoc/config.h
+++ b/src/tools/qdoc/config.h
@@ -85,7 +85,7 @@ public:
const QString& dirsVar,
const QSet<QString> &excludedDirs = QSet<QString>(),
const QSet<QString> &excludedFiles = QSet<QString>());
-
+ QStringList getExampleQdocFiles();
static QStringList getFilesHere(const QString& dir,
const QString& nameFilter,
const QSet<QString> &excludedDirs = QSet<QString>(),
diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp
index effeadf908..32a2282a92 100644
--- a/src/tools/qdoc/main.cpp
+++ b/src/tools/qdoc/main.cpp
@@ -363,6 +363,16 @@ static void processQdocconfFile(const QString &fileName)
QString t = sourceList[i].mid(sourceList[i].lastIndexOf('/')+1);
sourceFileNames.insert(t,t);
}
+ /*
+ Find all the qdoc files in the example dirs, and add
+ them to the source files to be parsed.
+ */
+ QStringList exampleQdocList = config.getExampleQdocFiles();
+ for (int i=0; i<exampleQdocList.size(); ++i) {
+ sources.insert(exampleQdocList[i],exampleQdocList[i]);
+ QString t = exampleQdocList[i].mid(exampleQdocList[i].lastIndexOf('/')+1);
+ sourceFileNames.insert(t,t);
+ }
/*
Parse each header file in the set using the appropriate parser and add it