summaryrefslogtreecommitdiff
path: root/src/qdoc/qmlcodemarker.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/qmlcodemarker.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/qmlcodemarker.cpp')
-rw-r--r--src/qdoc/qmlcodemarker.cpp45
1 files changed, 18 insertions, 27 deletions
diff --git a/src/qdoc/qmlcodemarker.cpp b/src/qdoc/qmlcodemarker.cpp
index 719fc710b..4ecfb6475 100644
--- a/src/qdoc/qmlcodemarker.cpp
+++ b/src/qdoc/qmlcodemarker.cpp
@@ -40,22 +40,18 @@
#include "generator.h"
#ifndef QT_NO_DECLARATIVE
-#include <private/qqmljsast_p.h>
-#include <private/qqmljsastfwd_p.h>
-#include <private/qqmljsengine_p.h>
-#include <private/qqmljslexer_p.h>
-#include <private/qqmljsparser_p.h>
+# include <private/qqmljsast_p.h>
+# include <private/qqmljsastfwd_p.h>
+# include <private/qqmljsengine_p.h>
+# include <private/qqmljslexer_p.h>
+# include <private/qqmljsparser_p.h>
#endif
QT_BEGIN_NAMESPACE
-QmlCodeMarker::QmlCodeMarker()
-{
-}
+QmlCodeMarker::QmlCodeMarker() {}
-QmlCodeMarker::~QmlCodeMarker()
-{
-}
+QmlCodeMarker::~QmlCodeMarker() {}
/*!
Returns \c true if the \a code is recognized by the parser.
@@ -103,8 +99,7 @@ Atom::AtomType QmlCodeMarker::atomType() const
return Atom::Qml;
}
-QString QmlCodeMarker::markedUpCode(const QString &code,
- const Node *relative,
+QString QmlCodeMarker::markedUpCode(const QString &code, const Node *relative,
const Location &location)
{
return addMarkUp(code, relative, location);
@@ -127,8 +122,7 @@ QString QmlCodeMarker::markedUpFullName(const Node *node, const Node *relative)
{
if (node->name().isEmpty()) {
return "global";
- }
- else {
+ } else {
QString fullName;
for (;;) {
fullName.prepend(markedUpName(node));
@@ -155,16 +149,14 @@ QString QmlCodeMarker::markedUpIncludes(const QStringList &includes)
QString QmlCodeMarker::functionBeginRegExp(const QString &funcName)
{
return QLatin1Char('^') + QRegExp::escape("function " + funcName) + QLatin1Char('$');
-
}
-QString QmlCodeMarker::functionEndRegExp(const QString &/* funcName */)
+QString QmlCodeMarker::functionEndRegExp(const QString & /* funcName */)
{
return "^\\}$";
}
-QString QmlCodeMarker::addMarkUp(const QString &code,
- const Node * /* relative */,
+QString QmlCodeMarker::addMarkUp(const QString &code, const Node * /* relative */,
const Location &location)
{
#ifndef QT_NO_DECLARATIVE
@@ -185,14 +177,15 @@ QString QmlCodeMarker::addMarkUp(const QString &code,
QmlMarkupVisitor visitor(code, pragmas, &engine);
QQmlJS::AST::Node::accept(ast, &visitor);
if (visitor.hasError()) {
- location.warning(location.fileName() +
- tr("Unable to analyze QML snippet. The output is incomplete."));
+ location.warning(location.fileName()
+ + tr("Unable to analyze QML snippet. The output is incomplete."));
}
output = visitor.markedUpCode();
} else {
- location.warning(tr("Unable to parse QML snippet: \"%1\" at line %2, column %3").arg(
- parser.errorMessage()).arg(parser.errorLineNumber()).arg(
- parser.errorColumnNumber()));
+ location.warning(tr("Unable to parse QML snippet: \"%1\" at line %2, column %3")
+ .arg(parser.errorMessage())
+ .arg(parser.errorLineNumber())
+ .arg(parser.errorColumnNumber()));
output = protect(code);
}
@@ -253,9 +246,7 @@ QVector<QQmlJS::AST::SourceLocation> QmlCodeMarker::extractPragmas(QString &scri
token = l.lex();
}
replaceWithSpace(script, startOffset, endOffset - startOffset);
- removed.append(QQmlJS::AST::SourceLocation(startOffset,
- endOffset - startOffset,
- startLine,
+ removed.append(QQmlJS::AST::SourceLocation(startOffset, endOffset - startOffset, startLine,
startColumn));
}
return removed;