summaryrefslogtreecommitdiff
path: root/src/qdoc/quoter.cpp
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2019-12-17 06:44:19 +0100
committerPaul Wicking <paul.wicking@qt.io>2019-12-17 09:08:20 +0100
commited6658c2c82e2d91f34d57e88b61648fb301baf4 (patch)
treebf1c298dd4b59acb55f3f3921c6b9edac407192c /src/qdoc/quoter.cpp
parent9f13c865439c024364f999680ceceb296d9daeb2 (diff)
downloadqttools-ed6658c2c82e2d91f34d57e88b61648fb301baf4.tar.gz
clang-format QDoc
This patch is the result of formatting all of QDoc's source with clang-format. The clang-format style is from the qt5 super repo's _clang-format definition. The purpose is unify the style across the code, to avoid spending too much time on style related issues in reviews and cleanup patches. Future changes to QDoc can benefit from using git-clang-format in combination with the git commit hook provided in qtrepotools.git as mentioned in this email to the dev list: https://lists.qt-project.org/pipermail/development/2019-October/037682.html Change-Id: I8af6a051c8334b5f35862a4dcd3becce8ac500c2 Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'src/qdoc/quoter.cpp')
-rw-r--r--src/qdoc/quoter.cpp34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/qdoc/quoter.cpp b/src/qdoc/quoter.cpp
index 7dd13233e..a313ab5c5 100644
--- a/src/qdoc/quoter.cpp
+++ b/src/qdoc/quoter.cpp
@@ -34,7 +34,7 @@
QT_BEGIN_NAMESPACE
-QHash<QString,QString> Quoter::commentHash;
+QHash<QString, QString> Quoter::commentHash;
static void replaceMultipleNewlines(QString &s)
{
@@ -106,8 +106,7 @@ static void trimWhiteSpace(QString &str)
str.resize(++j);
}
-Quoter::Quoter()
- : silent(false)
+Quoter::Quoter() : silent(false)
{
/* We're going to hard code these delimiters:
* C++, Qt, Qt Script, Java:
@@ -138,9 +137,8 @@ void Quoter::reset()
codeLocation = Location::null;
}
-void Quoter::quoteFromFile(const QString &userFriendlyFilePath,
- const QString &plainCode,
- const QString &markedCode)
+void Quoter::quoteFromFile(const QString &userFriendlyFilePath, const QString &plainCode,
+ const QString &markedCode)
{
silent = false;
@@ -186,7 +184,7 @@ QString Quoter::quoteLine(const Location &docLocation, const QString &command,
const QString &pattern)
{
if (plainLines.isEmpty()) {
- failedAtEnd( docLocation, command );
+ failedAtEnd(docLocation, command);
return QString();
}
@@ -200,8 +198,7 @@ QString Quoter::quoteLine(const Location &docLocation, const QString &command,
if (!silent) {
docLocation.warning(tr("Command '\\%1' failed").arg(command));
- codeLocation.warning(tr("Pattern '%1' didn't match here")
- .arg(pattern));
+ codeLocation.warning(tr("Pattern '%1' didn't match here").arg(pattern));
silent = true;
}
return QString();
@@ -249,8 +246,7 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif
return t;
}
-QString Quoter::quoteTo(const Location &docLocation, const QString &command,
- const QString &pattern)
+QString Quoter::quoteTo(const Location &docLocation, const QString &command, const QString &pattern)
{
QString t;
QString comment = commentForCode();
@@ -298,21 +294,18 @@ QString Quoter::getLine(int unindent)
return t;
}
-bool Quoter::match(const Location &docLocation, const QString &pattern0,
- const QString &line)
+bool Quoter::match(const Location &docLocation, const QString &pattern0, const QString &line)
{
QString str = line;
while (str.endsWith(QLatin1Char('\n')))
str.truncate(str.length() - 1);
QString pattern = pattern0;
- if (pattern.startsWith(QLatin1Char('/'))
- && pattern.endsWith(QLatin1Char('/'))
- && pattern.length() > 2) {
+ if (pattern.startsWith(QLatin1Char('/')) && pattern.endsWith(QLatin1Char('/'))
+ && pattern.length() > 2) {
QRegExp rx(pattern.mid(1, pattern.length() - 2));
if (!silent && !rx.isValid()) {
- docLocation.warning(tr("Invalid regular expression '%1'")
- .arg(rx.pattern()));
+ docLocation.warning(tr("Invalid regular expression '%1'").arg(rx.pattern()));
silent = true;
}
return str.indexOf(rx) != -1;
@@ -325,11 +318,12 @@ bool Quoter::match(const Location &docLocation, const QString &pattern0,
void Quoter::failedAtEnd(const Location &docLocation, const QString &command)
{
if (!silent && !command.isEmpty()) {
- if (codeLocation.filePath().isEmpty() ) {
+ if (codeLocation.filePath().isEmpty()) {
docLocation.warning(tr("Unexpected '\\%1'").arg(command));
} else {
docLocation.warning(tr("Command '\\%1' failed at end of file '%2'")
- .arg(command).arg(codeLocation.filePath()));
+ .arg(command)
+ .arg(codeLocation.filePath()));
}
silent = true;
}