diff options
author | David Boddie <david.boddie@nokia.com> | 2010-12-20 15:09:56 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2010-12-20 15:09:56 (GMT) |
commit | 7317b84067387b6b0350a28d6c63e8d7f6945829 (patch) | |
tree | d40dc8c9c04055697ee10e925d9ce72cf6f0a027 /tools | |
parent | 33cd330645b3bb690437b5403ef2635608fc19e6 (diff) | |
parent | 382b359f2c014d8ce353845579508a8c54410c7f (diff) | |
download | Qt-7317b84067387b6b0350a28d6c63e8d7f6945829.zip Qt-7317b84067387b6b0350a28d6c63e8d7f6945829.tar.gz Qt-7317b84067387b6b0350a28d6c63e8d7f6945829.tar.bz2 |
Merge branch 'qdoc-simplified' into 4.7
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qdoc3/quoter.cpp | 56 | ||||
-rw-r--r-- | tools/qdoc3/quoter.h | 1 |
2 files changed, 27 insertions, 30 deletions
diff --git a/tools/qdoc3/quoter.cpp b/tools/qdoc3/quoter.cpp index 84c6fb1..8e08e9a 100644 --- a/tools/qdoc3/quoter.cpp +++ b/tools/qdoc3/quoter.cpp @@ -248,21 +248,8 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif } return t; } - // Remove special macros to support Qt namespacing. - if (line.startsWith("QT_BEGIN_NAMESPACE")) { - getLine(); - } else if (line.startsWith("QT_END_NAMESPACE")) { - getLine(); - t += QLatin1Char('\n'); - } else if (!line.startsWith(comment)) { - // Ordinary code - t += getLine(); - } else { - // Normal comments - if (line.contains(QLatin1Char('\n'))) - t += QLatin1Char('\n'); - getLine(); - } + + t += removeSpecialLines(line, comment); } failedAtEnd(docLocation, QString("snippet (%1)").arg(delimiter)); return t; @@ -277,21 +264,7 @@ QString Quoter::quoteTo( const Location& docLocation, const QString& command, if ( pattern.isEmpty() ) { while ( !plainLines.isEmpty() ) { QString line = plainLines.first(); - // Remove special macros to support Qt namespacing. - if (line.startsWith("QT_BEGIN_NAMESPACE")) { - getLine(); - } else if (line.startsWith("QT_END_NAMESPACE")) { - getLine(); - t += QLatin1Char('\n'); - } else if (!line.startsWith(comment)) - // Ordinary code - t += getLine(); - else { - // Normal comments - if (line.contains(QLatin1Char('\n'))) - t += QLatin1Char('\n'); - getLine(); - } + t += removeSpecialLines(line, comment); } } else { while ( !plainLines.isEmpty() ) { @@ -369,4 +342,27 @@ QString Quoter::commentForCode() const return commentHash.value(suffix, "//!"); } +QString Quoter::removeSpecialLines(const QString &line, const QString &comment) +{ + QString t; + + // Remove special macros to support Qt namespacing. + QString trimmed = line.trimmed(); + if (trimmed.startsWith("QT_BEGIN_NAMESPACE")) { + getLine(); + } else if (trimmed.startsWith("QT_END_NAMESPACE")) { + getLine(); + t += QLatin1Char('\n'); + } else if (!trimmed.startsWith(comment)) { + // Ordinary code + t += getLine(); + } else { + // Comments + if (line.contains(QLatin1Char('\n'))) + t += QLatin1Char('\n'); + getLine(); + } + return t; +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/quoter.h b/tools/qdoc3/quoter.h index d984194..e1728d1 100644 --- a/tools/qdoc3/quoter.h +++ b/tools/qdoc3/quoter.h @@ -75,6 +75,7 @@ private: bool match( const Location& docLocation, const QString& pattern, const QString& line ); QString commentForCode() const; + QString removeSpecialLines(const QString &line, const QString &comment); bool silent; bool validRegExp; |