diff options
Diffstat (limited to 'tools/qdoc3/codeparser.cpp')
-rw-r--r-- | tools/qdoc3/codeparser.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index ed8b54e..3652758 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -105,7 +105,7 @@ void CodeParser::terminateParser() // nothing. } -QString CodeParser::headerFileNameFilter() +QStringList CodeParser::headerFileNameFilter() { return sourceFileNameFilter(); } @@ -158,6 +158,42 @@ CodeParser *CodeParser::parserForLanguage(const QString& language) return 0; } +CodeParser *CodeParser::parserForHeaderFile(const QString &filePath) +{ + QString fileName = QFileInfo(filePath).fileName(); + + QList<CodeParser *>::ConstIterator p = parsers.begin(); + while (p != parsers.end()) { + + QStringList headerPatterns = (*p)->headerFileNameFilter(); + foreach (QString pattern, headerPatterns) { + QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard); + if (re.exactMatch(fileName)) + return *p; + } + ++p; + } + return 0; +} + +CodeParser *CodeParser::parserForSourceFile(const QString &filePath) +{ + QString fileName = QFileInfo(filePath).fileName(); + + QList<CodeParser *>::ConstIterator p = parsers.begin(); + while (p != parsers.end()) { + + QStringList sourcePatterns = (*p)->sourceFileNameFilter(); + foreach (QString pattern, sourcePatterns) { + QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard); + if (re.exactMatch(fileName)) + return *p; + } + ++p; + } + return 0; +} + /*! Returns the set of strings representing the common metacommands. */ |