summaryrefslogtreecommitdiff
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
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>
-rw-r--r--src/qdoc/atom.cpp193
-rw-r--r--src/qdoc/atom.h80
-rw-r--r--src/qdoc/clangcodeparser.cpp280
-rw-r--r--src/qdoc/codechunk.cpp70
-rw-r--r--src/qdoc/codechunk.h24
-rw-r--r--src/qdoc/codemarker.cpp102
-rw-r--r--src/qdoc/codemarker.h30
-rw-r--r--src/qdoc/codeparser.cpp51
-rw-r--r--src/qdoc/codeparser.h186
-rw-r--r--src/qdoc/config.cpp161
-rw-r--r--src/qdoc/config.h47
-rw-r--r--src/qdoc/cppcodemarker.cpp112
-rw-r--r--src/qdoc/cppcodemarker.h3
-rw-r--r--src/qdoc/cppcodeparser.cpp314
-rw-r--r--src/qdoc/cppcodeparser.h30
-rw-r--r--src/qdoc/doc.cpp827
-rw-r--r--src/qdoc/doc.h32
-rw-r--r--src/qdoc/editdistance.cpp20
-rw-r--r--src/qdoc/generator.cpp530
-rw-r--r--src/qdoc/generator.h57
-rw-r--r--src/qdoc/helpprojectwriter.cpp221
-rw-r--r--src/qdoc/helpprojectwriter.h20
-rw-r--r--src/qdoc/htmlgenerator.cpp1403
-rw-r--r--src/qdoc/htmlgenerator.h110
-rw-r--r--src/qdoc/jscodemarker.cpp35
-rw-r--r--src/qdoc/jscodemarker.h6
-rw-r--r--src/qdoc/location.cpp52
-rw-r--r--src/qdoc/location.h22
-rw-r--r--src/qdoc/main.cpp103
-rw-r--r--src/qdoc/node.cpp463
-rw-r--r--src/qdoc/node.h292
-rw-r--r--src/qdoc/openedlist.cpp8
-rw-r--r--src/qdoc/openedlist.h6
-rw-r--r--src/qdoc/parameters.cpp61
-rw-r--r--src/qdoc/parameters.h28
-rw-r--r--src/qdoc/puredocparser.cpp11
-rw-r--r--src/qdoc/qdoccommandlineparser.cpp63
-rw-r--r--src/qdoc/qdocdatabase.cpp72
-rw-r--r--src/qdoc/qdocdatabase.h133
-rw-r--r--src/qdoc/qdocindexfiles.cpp558
-rw-r--r--src/qdoc/qdocindexfiles.h18
-rw-r--r--src/qdoc/qdoctagfiles.cpp149
-rw-r--r--src/qdoc/qmlcodemarker.cpp45
-rw-r--r--src/qdoc/qmlcodemarker.h8
-rw-r--r--src/qdoc/qmlcodeparser.cpp58
-rw-r--r--src/qdoc/qmlcodeparser.h6
-rw-r--r--src/qdoc/qmlmarkupvisitor.cpp57
-rw-r--r--src/qdoc/qmlmarkupvisitor.h15
-rw-r--r--src/qdoc/qmlvisitor.cpp170
-rw-r--r--src/qdoc/qmlvisitor.h18
-rw-r--r--src/qdoc/quoter.cpp34
-rw-r--r--src/qdoc/quoter.h21
-rw-r--r--src/qdoc/sections.cpp162
-rw-r--r--src/qdoc/sections.h55
-rw-r--r--src/qdoc/text.cpp41
-rw-r--r--src/qdoc/text.h30
-rw-r--r--src/qdoc/tokenizer.cpp145
-rw-r--r--src/qdoc/tokenizer.h118
-rw-r--r--src/qdoc/tree.cpp148
-rw-r--r--src/qdoc/tree.h80
-rw-r--r--src/qdoc/utilities.cpp36
-rw-r--r--src/qdoc/utilities.h9
-rw-r--r--src/qdoc/webxmlgenerator.cpp131
-rw-r--r--src/qdoc/webxmlgenerator.h9
-rw-r--r--src/qdoc/xmlgenerator.cpp45
-rw-r--r--src/qdoc/xmlgenerator.h4
-rw-r--r--src/qdoc/yyindent.cpp112
67 files changed, 3911 insertions, 4629 deletions
diff --git a/src/qdoc/atom.cpp b/src/qdoc/atom.cpp
index ecbea2013..298d2bbd4 100644
--- a/src/qdoc/atom.cpp
+++ b/src/qdoc/atom.cpp
@@ -145,98 +145,97 @@ QT_BEGIN_NAMESPACE
QString Atom::noError_ = QString();
-static const struct {
+static const struct
+{
const char *english;
int no;
-} atms[] = {
- { "AnnotatedList", Atom::AnnotatedList },
- { "AutoLink", Atom::AutoLink },
- { "BaseName", Atom::BaseName },
- { "br", Atom::BR},
- { "BriefLeft", Atom::BriefLeft },
- { "BriefRight", Atom::BriefRight },
- { "C", Atom::C },
- { "CaptionLeft", Atom::CaptionLeft },
- { "CaptionRight", Atom::CaptionRight },
- { "Code", Atom::Code },
- { "CodeBad", Atom::CodeBad },
- { "CodeNew", Atom::CodeNew },
- { "CodeOld", Atom::CodeOld },
- { "CodeQuoteArgument", Atom::CodeQuoteArgument },
- { "CodeQuoteCommand", Atom::CodeQuoteCommand },
- { "DivLeft", Atom::DivLeft },
- { "DivRight", Atom::DivRight },
- { "EndQmlText", Atom::EndQmlText },
- { "ExampleFileLink", Atom::ExampleFileLink},
- { "ExampleImageLink", Atom::ExampleImageLink},
- { "FootnoteLeft", Atom::FootnoteLeft },
- { "FootnoteRight", Atom::FootnoteRight },
- { "FormatElse", Atom::FormatElse },
- { "FormatEndif", Atom::FormatEndif },
- { "FormatIf", Atom::FormatIf },
- { "FormattingLeft", Atom::FormattingLeft },
- { "FormattingRight", Atom::FormattingRight },
- { "GeneratedList", Atom::GeneratedList },
- { "hr", Atom::HR},
- { "Image", Atom::Image },
- { "ImageText", Atom::ImageText },
- { "ImportantLeft", Atom::ImportantLeft },
- { "ImportantRight", Atom::ImportantRight },
- { "InlineImage", Atom::InlineImage },
- { "JavaScript", Atom::JavaScript },
- { "EndJavaScript", Atom::EndJavaScript },
- { "Keyword", Atom::Keyword },
- { "LegaleseLeft", Atom::LegaleseLeft },
- { "LegaleseRight", Atom::LegaleseRight },
- { "LineBreak", Atom::LineBreak },
- { "Link", Atom::Link },
- { "LinkNode", Atom::LinkNode },
- { "ListLeft", Atom::ListLeft },
- { "ListItemNumber", Atom::ListItemNumber },
- { "ListTagLeft", Atom::ListTagLeft },
- { "ListTagRight", Atom::ListTagRight },
- { "ListItemLeft", Atom::ListItemLeft },
- { "ListItemRight", Atom::ListItemRight },
- { "ListRight", Atom::ListRight },
- { "NavAutoLink", Atom::NavAutoLink },
- { "NavLink", Atom::NavLink },
- { "Nop", Atom::Nop },
- { "NoteLeft", Atom::NoteLeft },
- { "NoteRight", Atom::NoteRight },
- { "ParaLeft", Atom::ParaLeft },
- { "ParaRight", Atom::ParaRight },
- { "Qml", Atom::Qml},
- { "QmlText", Atom::QmlText },
- { "QuotationLeft", Atom::QuotationLeft },
- { "QuotationRight", Atom::QuotationRight },
- { "RawString", Atom::RawString },
- { "SectionLeft", Atom::SectionLeft },
- { "SectionRight", Atom::SectionRight },
- { "SectionHeadingLeft", Atom::SectionHeadingLeft },
- { "SectionHeadingRight", Atom::SectionHeadingRight },
- { "SidebarLeft", Atom::SidebarLeft },
- { "SidebarRight", Atom::SidebarRight },
- { "SinceList", Atom::SinceList },
- { "SinceTagLeft", Atom::SinceTagLeft },
- { "SinceTagRight", Atom::SinceTagRight },
- { "SnippetCommand", Atom::SnippetCommand },
- { "SnippetIdentifier", Atom::SnippetIdentifier },
- { "SnippetLocation", Atom::SnippetLocation },
- { "String", Atom::String },
- { "TableLeft", Atom::TableLeft },
- { "TableRight", Atom::TableRight },
- { "TableHeaderLeft", Atom::TableHeaderLeft },
- { "TableHeaderRight", Atom::TableHeaderRight },
- { "TableRowLeft", Atom::TableRowLeft },
- { "TableRowRight", Atom::TableRowRight },
- { "TableItemLeft", Atom::TableItemLeft },
- { "TableItemRight", Atom::TableItemRight },
- { "TableOfContents", Atom::TableOfContents },
- { "Target", Atom::Target },
- { "UnhandledFormat", Atom::UnhandledFormat },
- { "UnknownCommand", Atom::UnknownCommand },
- { nullptr, 0 }
-};
+} atms[] = { { "AnnotatedList", Atom::AnnotatedList },
+ { "AutoLink", Atom::AutoLink },
+ { "BaseName", Atom::BaseName },
+ { "br", Atom::BR },
+ { "BriefLeft", Atom::BriefLeft },
+ { "BriefRight", Atom::BriefRight },
+ { "C", Atom::C },
+ { "CaptionLeft", Atom::CaptionLeft },
+ { "CaptionRight", Atom::CaptionRight },
+ { "Code", Atom::Code },
+ { "CodeBad", Atom::CodeBad },
+ { "CodeNew", Atom::CodeNew },
+ { "CodeOld", Atom::CodeOld },
+ { "CodeQuoteArgument", Atom::CodeQuoteArgument },
+ { "CodeQuoteCommand", Atom::CodeQuoteCommand },
+ { "DivLeft", Atom::DivLeft },
+ { "DivRight", Atom::DivRight },
+ { "EndQmlText", Atom::EndQmlText },
+ { "ExampleFileLink", Atom::ExampleFileLink },
+ { "ExampleImageLink", Atom::ExampleImageLink },
+ { "FootnoteLeft", Atom::FootnoteLeft },
+ { "FootnoteRight", Atom::FootnoteRight },
+ { "FormatElse", Atom::FormatElse },
+ { "FormatEndif", Atom::FormatEndif },
+ { "FormatIf", Atom::FormatIf },
+ { "FormattingLeft", Atom::FormattingLeft },
+ { "FormattingRight", Atom::FormattingRight },
+ { "GeneratedList", Atom::GeneratedList },
+ { "hr", Atom::HR },
+ { "Image", Atom::Image },
+ { "ImageText", Atom::ImageText },
+ { "ImportantLeft", Atom::ImportantLeft },
+ { "ImportantRight", Atom::ImportantRight },
+ { "InlineImage", Atom::InlineImage },
+ { "JavaScript", Atom::JavaScript },
+ { "EndJavaScript", Atom::EndJavaScript },
+ { "Keyword", Atom::Keyword },
+ { "LegaleseLeft", Atom::LegaleseLeft },
+ { "LegaleseRight", Atom::LegaleseRight },
+ { "LineBreak", Atom::LineBreak },
+ { "Link", Atom::Link },
+ { "LinkNode", Atom::LinkNode },
+ { "ListLeft", Atom::ListLeft },
+ { "ListItemNumber", Atom::ListItemNumber },
+ { "ListTagLeft", Atom::ListTagLeft },
+ { "ListTagRight", Atom::ListTagRight },
+ { "ListItemLeft", Atom::ListItemLeft },
+ { "ListItemRight", Atom::ListItemRight },
+ { "ListRight", Atom::ListRight },
+ { "NavAutoLink", Atom::NavAutoLink },
+ { "NavLink", Atom::NavLink },
+ { "Nop", Atom::Nop },
+ { "NoteLeft", Atom::NoteLeft },
+ { "NoteRight", Atom::NoteRight },
+ { "ParaLeft", Atom::ParaLeft },
+ { "ParaRight", Atom::ParaRight },
+ { "Qml", Atom::Qml },
+ { "QmlText", Atom::QmlText },
+ { "QuotationLeft", Atom::QuotationLeft },
+ { "QuotationRight", Atom::QuotationRight },
+ { "RawString", Atom::RawString },
+ { "SectionLeft", Atom::SectionLeft },
+ { "SectionRight", Atom::SectionRight },
+ { "SectionHeadingLeft", Atom::SectionHeadingLeft },
+ { "SectionHeadingRight", Atom::SectionHeadingRight },
+ { "SidebarLeft", Atom::SidebarLeft },
+ { "SidebarRight", Atom::SidebarRight },
+ { "SinceList", Atom::SinceList },
+ { "SinceTagLeft", Atom::SinceTagLeft },
+ { "SinceTagRight", Atom::SinceTagRight },
+ { "SnippetCommand", Atom::SnippetCommand },
+ { "SnippetIdentifier", Atom::SnippetIdentifier },
+ { "SnippetLocation", Atom::SnippetLocation },
+ { "String", Atom::String },
+ { "TableLeft", Atom::TableLeft },
+ { "TableRight", Atom::TableRight },
+ { "TableHeaderLeft", Atom::TableHeaderLeft },
+ { "TableHeaderRight", Atom::TableHeaderRight },
+ { "TableRowLeft", Atom::TableRowLeft },
+ { "TableRowRight", Atom::TableRowRight },
+ { "TableItemLeft", Atom::TableItemLeft },
+ { "TableItemRight", Atom::TableItemRight },
+ { "TableOfContents", Atom::TableOfContents },
+ { "Target", Atom::Target },
+ { "UnhandledFormat", Atom::UnhandledFormat },
+ { "UnknownCommand", Atom::UnknownCommand },
+ { nullptr, 0 } };
/*! \fn Atom::Atom(AtomType type, const QString &string)
@@ -333,7 +332,8 @@ QString Atom::typeString() const
int i = 0;
while (atms[i].english != nullptr) {
if (atms[i].no != i)
- Location::internalError(QCoreApplication::translate("QDoc::Atom", "atom %1 missing").arg(i));
+ Location::internalError(
+ QCoreApplication::translate("QDoc::Atom", "atom %1 missing").arg(i));
++i;
}
deja = true;
@@ -365,10 +365,7 @@ void Atom::dump() const
str.replace(QRegExp(QLatin1String("[^\x20-\x7e]")), QLatin1String("?"));
if (!str.isEmpty())
str = QLatin1String(" \"") + str + QLatin1Char('"');
- fprintf(stderr,
- " %-15s%s\n",
- typeString().toLatin1().data(),
- str.toLatin1().data());
+ fprintf(stderr, " %-15s%s\n", typeString().toLatin1().data(), str.toLatin1().data());
}
/*!
@@ -400,13 +397,13 @@ void LinkAtom::resolveSquareBracketParams()
if (resolved_)
return;
const QStringList params = squareBracketParams_.toLower().split(QLatin1Char(' '));
- for (const auto &param : params) {
+ for (const auto &param : params) {
if (!domain_) {
domain_ = QDocDatabase::qdocDB()->findTree(param);
if (domain_) {
- continue;
+ continue;
}
- }
+ }
if (goal_ == Node::NoType) {
goal_ = Node::goal(param);
if (goal_ != Node::NoType)
diff --git a/src/qdoc/atom.h b/src/qdoc/atom.h
index 9ad1d2b7a..f7cb0b654 100644
--- a/src/qdoc/atom.h
+++ b/src/qdoc/atom.h
@@ -134,20 +134,14 @@ public:
friend class LinkAtom;
- Atom(const QString &string)
- : next_(nullptr), type_(Link)
- {
- strs << string;
- }
+ Atom(const QString &string) : next_(nullptr), type_(Link) { strs << string; }
- Atom(AtomType type, const QString &string = "")
- : next_(nullptr), type_(type)
+ Atom(AtomType type, const QString &string = "") : next_(nullptr), type_(type)
{
strs << string;
}
- Atom(AtomType type, const QString &p1, const QString &p2)
- : next_(nullptr), type_(type)
+ Atom(AtomType type, const QString &p1, const QString &p2) : next_(nullptr), type_(type)
{
strs << p1;
if (!p2.isEmpty())
@@ -170,7 +164,7 @@ public:
previous->next_ = this;
}
- virtual ~Atom() { }
+ virtual ~Atom() {}
void appendChar(QChar ch) { strs[0] += ch; }
void appendString(const QString &string) { strs[0] += string; }
@@ -196,7 +190,7 @@ public:
virtual Tree *domain() { return nullptr; }
virtual Node::NodeType goal() { return Node::NoType; }
virtual const QString &error() { return noError_; }
- virtual void resolveSquareBracketParams() { }
+ virtual void resolveSquareBracketParams() {}
protected:
static QString noError_;
@@ -211,13 +205,29 @@ public:
LinkAtom(const QString &p1, const QString &p2);
LinkAtom(const LinkAtom &t);
LinkAtom(Atom *previous, const LinkAtom &t);
- ~LinkAtom() override { }
+ ~LinkAtom() override {}
bool isLinkAtom() const override { return true; }
- Node::Genus genus() override { resolveSquareBracketParams(); return genus_; }
- bool specifiesDomain() override { resolveSquareBracketParams(); return (domain_ != nullptr); }
- Tree *domain() override { resolveSquareBracketParams(); return domain_; }
- Node::NodeType goal() override { resolveSquareBracketParams(); return goal_; }
+ Node::Genus genus() override
+ {
+ resolveSquareBracketParams();
+ return genus_;
+ }
+ bool specifiesDomain() override
+ {
+ resolveSquareBracketParams();
+ return (domain_ != nullptr);
+ }
+ Tree *domain() override
+ {
+ resolveSquareBracketParams();
+ return domain_;
+ }
+ Node::NodeType goal() override
+ {
+ resolveSquareBracketParams();
+ return goal_;
+ }
const QString &error() override { return error_; }
void resolveSquareBracketParams() override;
@@ -230,26 +240,26 @@ protected:
QString squareBracketParams_;
};
-#define ATOM_FORMATTING_BOLD "bold"
-#define ATOM_FORMATTING_INDEX "index"
-#define ATOM_FORMATTING_ITALIC "italic"
-#define ATOM_FORMATTING_LINK "link"
-#define ATOM_FORMATTING_PARAMETER "parameter"
-#define ATOM_FORMATTING_SPAN "span "
-#define ATOM_FORMATTING_SUBSCRIPT "subscript"
-#define ATOM_FORMATTING_SUPERSCRIPT "superscript"
-#define ATOM_FORMATTING_TELETYPE "teletype"
-#define ATOM_FORMATTING_UICONTROL "uicontrol"
-#define ATOM_FORMATTING_UNDERLINE "underline"
+#define ATOM_FORMATTING_BOLD "bold"
+#define ATOM_FORMATTING_INDEX "index"
+#define ATOM_FORMATTING_ITALIC "italic"
+#define ATOM_FORMATTING_LINK "link"
+#define ATOM_FORMATTING_PARAMETER "parameter"
+#define ATOM_FORMATTING_SPAN "span "
+#define ATOM_FORMATTING_SUBSCRIPT "subscript"
+#define ATOM_FORMATTING_SUPERSCRIPT "superscript"
+#define ATOM_FORMATTING_TELETYPE "teletype"
+#define ATOM_FORMATTING_UICONTROL "uicontrol"
+#define ATOM_FORMATTING_UNDERLINE "underline"
-#define ATOM_LIST_BULLET "bullet"
-#define ATOM_LIST_TAG "tag"
-#define ATOM_LIST_VALUE "value"
-#define ATOM_LIST_LOWERALPHA "loweralpha"
-#define ATOM_LIST_LOWERROMAN "lowerroman"
-#define ATOM_LIST_NUMERIC "numeric"
-#define ATOM_LIST_UPPERALPHA "upperalpha"
-#define ATOM_LIST_UPPERROMAN "upperroman"
+#define ATOM_LIST_BULLET "bullet"
+#define ATOM_LIST_TAG "tag"
+#define ATOM_LIST_VALUE "value"
+#define ATOM_LIST_LOWERALPHA "loweralpha"
+#define ATOM_LIST_LOWERROMAN "lowerroman"
+#define ATOM_LIST_NUMERIC "numeric"
+#define ATOM_LIST_UPPERALPHA "upperalpha"
+#define ATOM_LIST_UPPERROMAN "upperroman"
QT_END_NAMESPACE
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index 2e96a092d..5e04c344e 100644
--- a/src/qdoc/clangcodeparser.cpp
+++ b/src/qdoc/clangcodeparser.cpp
@@ -67,7 +67,7 @@ static CXTranslationUnit_Flags flags_ = static_cast<CXTranslationUnit_Flags>(0);
static CXIndex index_ = nullptr;
#ifndef QT_NO_DEBUG_STREAM
-template <class T>
+template<class T>
static QDebug operator<<(QDebug debug, const std::vector<T> &v)
{
QDebugStateSaver saver(debug);
@@ -90,10 +90,13 @@ static QDebug operator<<(QDebug debug, const std::vector<T> &v)
T can be any functor that is callable with a CXCursor parameter and returns a CXChildVisitResult
(in other word compatible with function<CXChildVisitResult(CXCursor)>
*/
-template <typename T> bool visitChildrenLambda(CXCursor cursor, T &&lambda)
+template<typename T>
+bool visitChildrenLambda(CXCursor cursor, T &&lambda)
{
- CXCursorVisitor visitor = [](CXCursor c, CXCursor , CXClientData client_data) -> CXChildVisitResult
- { return (*static_cast<T *>(client_data))(c); };
+ CXCursorVisitor visitor = [](CXCursor c, CXCursor,
+ CXClientData client_data) -> CXChildVisitResult {
+ return (*static_cast<T *>(client_data))(c);
+ };
return clang_visitChildren(cursor, visitor, &lambda);
}
@@ -107,7 +110,6 @@ static QString fromCXString(CXString &&string)
return ret;
}
-
/*!
convert a CXSourceLocation to a qdoc Location
*/
@@ -125,12 +127,17 @@ static Location fromCXSourceLocation(CXSourceLocation location)
/*!
convert a CX_CXXAccessSpecifier to Node::Access
*/
-static Node::Access fromCX_CXXAccessSpecifier(CX_CXXAccessSpecifier spec) {
+static Node::Access fromCX_CXXAccessSpecifier(CX_CXXAccessSpecifier spec)
+{
switch (spec) {
- case CX_CXXPrivate: return Node::Private;
- case CX_CXXProtected: return Node::Protected;
- case CX_CXXPublic: return Node::Public;
- default: return Node::Public;
+ case CX_CXXPrivate:
+ return Node::Private;
+ case CX_CXXProtected:
+ return Node::Protected;
+ case CX_CXXPublic:
+ return Node::Public;
+ default:
+ return Node::Public;
}
}
@@ -154,7 +161,6 @@ static QString getSpelling(CXSourceRange range)
return QString::fromUtf8(file.read(offset2 - offset1));
}
-
/*!
Returns the function name from a given cursor representing a
function declaration. This is usually clang_getCursorSpelling, but
@@ -163,9 +169,9 @@ static QString getSpelling(CXSourceRange range)
QString functionName(CXCursor cursor)
{
if (clang_getCursorKind(cursor) == CXCursor_ConversionFunction) {
- // For a CXCursor_ConversionFunction we don't want the spelling which would be something like
- // "operator type-parameter-0-0" or "operator unsigned int".
- // we want the actual name as spelled;
+ // For a CXCursor_ConversionFunction we don't want the spelling which would be something
+ // like "operator type-parameter-0-0" or "operator unsigned int". we want the actual name as
+ // spelled;
QString type = fromCXString(clang_getTypeSpelling(clang_getCursorResultType(cursor)));
if (type.isEmpty())
return fromCXString(clang_getCursorSpelling(cursor));
@@ -185,7 +191,8 @@ QString functionName(CXCursor cursor)
Reconstruct the qualified path name of a function that is
being overridden.
*/
-static QString reconstructQualifiedPathForCursor(CXCursor cur) {
+static QString reconstructQualifiedPathForCursor(CXCursor cur)
+{
QString path;
auto kind = clang_getCursorKind(cur);
while (!clang_isInvalid(kind) && kind != CXCursor_TranslationUnit) {
@@ -219,7 +226,8 @@ static QString reconstructQualifiedPathForCursor(CXCursor cur) {
Find the node from the QDocDatabase \a qdb that corrseponds to the declaration
represented by the cursor \a cur, if it exists.
*/
-static Node *findNodeForCursor(QDocDatabase *qdb, CXCursor cur) {
+static Node *findNodeForCursor(QDocDatabase *qdb, CXCursor cur)
+{
auto kind = clang_getCursorKind(cur);
if (clang_isInvalid(kind))
return nullptr;
@@ -308,7 +316,8 @@ static Node *findNodeForCursor(QDocDatabase *qdb, CXCursor cur) {
corrseponds to the declaration represented by the cursor
\a cur, if it exists.
*/
-static Node *findFunctionNodeForCursor(QDocDatabase *qdb, CXCursor cur) {
+static Node *findFunctionNodeForCursor(QDocDatabase *qdb, CXCursor cur)
+{
auto kind = clang_getCursorKind(cur);
if (clang_isInvalid(kind))
return nullptr;
@@ -375,10 +384,13 @@ static Node *findFunctionNodeForCursor(QDocDatabase *qdb, CXCursor cur) {
return nullptr;
}
-class ClangVisitor {
+class ClangVisitor
+{
public:
ClangVisitor(QDocDatabase *qdb, const QHash<QString, QString> &allHeaders)
- : qdb_(qdb), parent_(qdb->primaryTreeRoot()), allHeaders_(allHeaders) { }
+ : qdb_(qdb), parent_(qdb->primaryTreeRoot()), allHeaders_(allHeaders)
+ {
+ }
QDocDatabase *qdocDB() { return qdb_; }
@@ -425,6 +437,7 @@ public:
}
Node *nodeForCommentAtLocation(CXSourceLocation loc, CXSourceLocation nextCommentLoc);
+
private:
/*!
SimpleLoc represents a simple location in the main source file,
@@ -433,7 +446,8 @@ private:
struct SimpleLoc
{
unsigned int line, column;
- friend bool operator<(const SimpleLoc &a, const SimpleLoc &b) {
+ friend bool operator<(const SimpleLoc &a, const SimpleLoc &b)
+ {
return a.line != b.line ? a.line < b.line : a.column < b.column;
}
};
@@ -452,7 +466,8 @@ private:
/*!
Returns true if the symbol should be ignored for the documentation.
*/
- bool ignoredSymbol(const QString &symbolName) {
+ bool ignoredSymbol(const QString &symbolName)
+ {
if (symbolName == QLatin1String("QPrivateSignal"))
return true;
return false;
@@ -464,7 +479,8 @@ private:
example: 'QLinkedList::iterator' -> 'iterator'
*/
- QString adjustTypeName(const QString &typeName) {
+ QString adjustTypeName(const QString &typeName)
+ {
auto parent = parent_->parent();
if (parent && parent->isClassNode()) {
QStringRef typeNameConstRemoved(&typeName);
@@ -473,7 +489,7 @@ private:
auto parentName = parent->fullName();
if (typeNameConstRemoved.startsWith(parentName)
- && typeNameConstRemoved.mid(parentName.size(), 2) == QLatin1String("::")) {
+ && typeNameConstRemoved.mid(parentName.size(), 2) == QLatin1String("::")) {
QString result = typeName;
result.remove(typeNameConstRemoved.position(), parentName.size() + 2);
return result;
@@ -484,7 +500,8 @@ private:
CXChildVisitResult visitSource(CXCursor cursor, CXSourceLocation loc);
CXChildVisitResult visitHeader(CXCursor cursor, CXSourceLocation loc);
- CXChildVisitResult visitFnSignature(CXCursor cursor, CXSourceLocation loc, Node **fnNode, bool &ignoreSignature);
+ CXChildVisitResult visitFnSignature(CXCursor cursor, CXSourceLocation loc, Node **fnNode,
+ bool &ignoreSignature);
void parseProperty(const QString &spelling, const Location &loc);
void readParameterNamesAndAttributes(FunctionNode *fn, CXCursor cursor);
Aggregate *getSemanticParent(CXCursor cursor);
@@ -524,7 +541,8 @@ Aggregate *ClangVisitor::getSemanticParent(CXCursor cursor)
return parent_;
}
-CXChildVisitResult ClangVisitor::visitFnSignature(CXCursor cursor, CXSourceLocation , Node **fnNode, bool &ignoreSignature)
+CXChildVisitResult ClangVisitor::visitFnSignature(CXCursor cursor, CXSourceLocation, Node **fnNode,
+ bool &ignoreSignature)
{
switch (clang_getCursorKind(cursor)) {
case CXCursor_FunctionDecl:
@@ -582,7 +600,8 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
if (!clang_isCursorDefinition(cursor))
return CXChildVisit_Continue;
- if (findNodeForCursor(qdb_, cursor)) // Was already parsed, propably in another translation unit
+ if (findNodeForCursor(qdb_,
+ cursor)) // Was already parsed, propably in another translation unit
return CXChildVisit_Continue;
QString className = fromCXString(clang_getCursorSpelling(cursor));
@@ -610,7 +629,6 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
QScopedValueRollback<Aggregate *> setParent(parent_, classe);
return visitChildren(cursor);
-
}
case CXCursor_CXXBaseSpecifier: {
if (!parent_->isClassNode())
@@ -633,7 +651,8 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
QString namespaceName = fromCXString(clang_getCursorDisplayName(cursor));
NamespaceNode *ns = nullptr;
if (parent_)
- ns = static_cast<NamespaceNode *>(parent_->findNonfunctionChild(namespaceName, &Node::isNamespace));
+ ns = static_cast<NamespaceNode *>(
+ parent_->findNonfunctionChild(namespaceName, &Node::isNamespace));
if (!ns) {
ns = new NamespaceNode(parent_, namespaceName);
ns->setAccess(Node::Public);
@@ -648,7 +667,8 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
case CXCursor_Constructor:
case CXCursor_Destructor:
case CXCursor_ConversionFunction: {
- if (findNodeForCursor(qdb_, cursor)) // Was already parsed, propably in another translation unit
+ if (findNodeForCursor(qdb_,
+ cursor)) // Was already parsed, propably in another translation unit
return CXChildVisit_Continue;
QString name = functionName(cursor);
if (ignoredSymbol(name))
@@ -679,14 +699,16 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
else if (kind == CXCursor_Destructor)
fn->setMetaness(FunctionNode::Dtor);
else
- fn->setReturnType(adjustTypeName(fromCXString(
- clang_getTypeSpelling(clang_getResultType(funcType)))));
+ fn->setReturnType(adjustTypeName(
+ fromCXString(clang_getTypeSpelling(clang_getResultType(funcType)))));
fn->setStatic(clang_CXXMethod_isStatic(cursor));
fn->setConst(clang_CXXMethod_isConst(cursor));
- fn->setVirtualness(!clang_CXXMethod_isVirtual(cursor) ? FunctionNode::NonVirtual
- : clang_CXXMethod_isPureVirtual(cursor) ? FunctionNode::PureVirtual
- : FunctionNode::NormalVirtual);
+ fn->setVirtualness(!clang_CXXMethod_isVirtual(cursor)
+ ? FunctionNode::NonVirtual
+ : clang_CXXMethod_isPureVirtual(cursor)
+ ? FunctionNode::PureVirtual
+ : FunctionNode::NormalVirtual);
CXRefQualifierKind refQualKind = clang_Type_getCXXRefQualifier(funcType);
if (refQualKind == CXRefQualifier_LValue)
fn->setRef(true);
@@ -746,7 +768,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
Aggregate *ns = parent_;
while (ns && ns->isClassNode())
ns = ns->parent();
- QScopedValueRollback<Aggregate *>setParent(parent_, ns);
+ QScopedValueRollback<Aggregate *> setParent(parent_, ns);
// Visit the friend functions
return visitChildren(cursor);
}
@@ -774,7 +796,6 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
if (clang_getCursorKind(cur) != CXCursor_EnumConstantDecl)
return CXChildVisit_Continue;
-
QString value;
visitChildrenLambda(cur, [&](CXCursor cur) {
if (clang_isExpression(clang_getCursorKind(cur))) {
@@ -799,7 +820,8 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
}
case CXCursor_FieldDecl:
case CXCursor_VarDecl: {
- if (findNodeForCursor(qdb_, cursor)) // Was already parsed, propably in another translation unit
+ if (findNodeForCursor(qdb_,
+ cursor)) // Was already parsed, propably in another translation unit
return CXChildVisit_Continue;
auto access = fromCX_CXXAccessSpecifier(clang_getCXXAccessSpecifier(cursor));
auto var = new VariableNode(parent_, fromCXString(clang_getCursorSpelling(cursor)));
@@ -810,7 +832,8 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
return CXChildVisit_Continue;
}
case CXCursor_TypedefDecl: {
- if (findNodeForCursor(qdb_, cursor)) // Was already parsed, propably in another translation unit
+ if (findNodeForCursor(qdb_,
+ cursor)) // Was already parsed, propably in another translation unit
return CXChildVisit_Continue;
TypedefNode *td = new TypedefNode(parent_, fromCXString(clang_getCursorSpelling(cursor)));
td->setAccess(fromCX_CXXAccessSpecifier(clang_getCXXAccessSpecifier(cursor)));
@@ -818,13 +841,14 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
// Search to see if this is a Q_DECLARE_FLAGS (if the type is QFlags<ENUM>)
visitChildrenLambda(cursor, [&](CXCursor cur) {
if (clang_getCursorKind(cur) != CXCursor_TemplateRef
- || fromCXString(clang_getCursorSpelling(cur)) != QLatin1String("QFlags"))
+ || fromCXString(clang_getCursorSpelling(cur)) != QLatin1String("QFlags"))
return CXChildVisit_Continue;
// Found QFlags<XXX>
visitChildrenLambda(cursor, [&](CXCursor cur) {
if (clang_getCursorKind(cur) != CXCursor_TypeRef)
return CXChildVisit_Continue;
- auto *en = findNodeForCursor(qdb_, clang_getTypeDeclaration(clang_getCursorType(cur)));
+ auto *en =
+ findNodeForCursor(qdb_, clang_getTypeDeclaration(clang_getCursorType(cur)));
if (en && en->isEnumType())
static_cast<EnumNode *>(en)->setFlagsType(td);
return CXChildVisit_Break;
@@ -836,10 +860,10 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
default:
if (clang_isDeclaration(kind) && parent_->isClassNode()) {
// maybe a static_assert (which is not exposed from the clang API)
- QString spelling = getSpelling(clang_getCursorExtent(cursor));
+ QString spelling = getSpelling(clang_getCursorExtent(cursor));
if (spelling.startsWith(QLatin1String("Q_PROPERTY"))
- || spelling.startsWith(QLatin1String("QDOC_PROPERTY"))
- || spelling.startsWith(QLatin1String("Q_OVERRIDE"))) {
+ || spelling.startsWith(QLatin1String("QDOC_PROPERTY"))
+ || spelling.startsWith(QLatin1String("Q_OVERRIDE"))) {
parseProperty(spelling, fromCXSourceLocation(loc));
}
}
@@ -907,7 +931,7 @@ void ClangVisitor::parseProperty(const QString &spelling, const Location &loc)
QString name = part.at(1);
if (name.at(0) == QChar('*')) {
type.append(QChar('*'));
- name.remove(0,1);
+ name.remove(0, 1);
}
auto *property = new PropertyNode(parent_, name);
property->setAccess(Node::Public);
@@ -923,7 +947,7 @@ void ClangVisitor::parseProperty(const QString &spelling, const Location &loc)
property->setFinal();
}
if (i < part.size()) {
- QString value = part.at(i++);
+ QString value = part.at(i++);
if (key == "READ") {
qdb_->addPropertyFunction(property, value, PropertyNode::Getter);
} else if (key == "WRITE") {
@@ -990,14 +1014,14 @@ Node *ClangVisitor::nodeForCommentAtLocation(CXSourceLocation loc, CXSourceLocat
// make sure the previous decl was finished.
if (decl_it != declMap_.begin()) {
- CXSourceLocation prevDeclEnd = clang_getRangeEnd(clang_getCursorExtent(*(decl_it-1)));
+ CXSourceLocation prevDeclEnd = clang_getRangeEnd(clang_getCursorExtent(*(decl_it - 1)));
unsigned int prevDeclLine;
clang_getPresumedLocation(prevDeclEnd, nullptr, &prevDeclLine, nullptr);
if (prevDeclLine >= docloc.line) {
// The previous declaration was still going. This is only valid if the previous
// declaration is a parent of the next declaration.
auto parent = clang_getCursorLexicalParent(*decl_it);
- if (!clang_equalCursors(parent, *(decl_it-1)))
+ if (!clang_equalCursors(parent, *(decl_it - 1)))
return nullptr;
}
}
@@ -1039,12 +1063,12 @@ void ClangCodeParser::initializeParser(const Config &config)
includePaths_.resize(squeezedArgs.size());
std::transform(squeezedArgs.begin(), squeezedArgs.end(), includePaths_.begin(),
[](const QString &s) {
- QByteArray path(s.toUtf8());
- QFileInfo fi(QDir::current(), s);
- if (fi.exists())
- path = fi.canonicalFilePath().toUtf8();
- return path.prepend("-I");
- });
+ QByteArray path(s.toUtf8());
+ QFileInfo fi(QDir::current(), s);
+ if (fi.exists())
+ path = fi.canonicalFilePath().toUtf8();
+ return path.prepend("-I");
+ });
CppCodeParser::initializeParser(config);
pchFileDir_.reset(nullptr);
allHeaders_.clear();
@@ -1073,8 +1097,8 @@ void ClangCodeParser::initializeParser(const Config &config)
}
}
}
- qCDebug(lcQdoc).nospace() << __FUNCTION__ << " Clang v" << CINDEX_VERSION_MAJOR
- << '.' << CINDEX_VERSION_MINOR;
+ qCDebug(lcQdoc).nospace() << __FUNCTION__ << " Clang v" << CINDEX_VERSION_MAJOR << '.'
+ << CINDEX_VERSION_MINOR;
}
/*!
@@ -1096,7 +1120,12 @@ QString ClangCodeParser::language()
*/
QStringList ClangCodeParser::headerFileNameFilter()
{
- return QStringList() << "*.ch" << "*.h" << "*.h++" << "*.hh" << "*.hpp" << "*.hxx";
+ return QStringList() << "*.ch"
+ << "*.h"
+ << "*.h++"
+ << "*.hh"
+ << "*.hpp"
+ << "*.hxx";
}
/*!
@@ -1105,7 +1134,11 @@ QStringList ClangCodeParser::headerFileNameFilter()
*/
QStringList ClangCodeParser::sourceFileNameFilter()
{
- return QStringList() << "*.c++" << "*.cc" << "*.cpp" << "*.cxx" << "*.mm";
+ return QStringList() << "*.c++"
+ << "*.cc"
+ << "*.cpp"
+ << "*.cxx"
+ << "*.mm";
}
/*!
@@ -1158,8 +1191,8 @@ static QVector<QByteArray> includePathsFromHeaders(const QHash<QString, QString>
QVector<QByteArray> result;
for (auto it = allHeaders.cbegin(); it != allHeaders.cend(); ++it) {
const QByteArray path = "-I" + it.value().toLatin1();
- const QByteArray parent = "-I"
- + QDir::cleanPath(it.value() + QLatin1String("/../")).toLatin1();
+ const QByteArray parent =
+ "-I" + QDir::cleanPath(it.value() + QLatin1String("/../")).toLatin1();
if (!result.contains(path))
result.append(path);
if (!result.contains(parent))
@@ -1191,7 +1224,8 @@ bool ClangCodeParser::getMoreArgs()
of reasonable places to look for include files and use
that list instead.
*/
- Location::logToStdErrAlways("No include paths passed to qdoc; guessing reasonable include paths");
+ Location::logToStdErrAlways(
+ "No include paths passed to qdoc; guessing reasonable include paths");
guessedIncludePaths = true;
auto forest = qdb_->searchOrder();
@@ -1199,8 +1233,7 @@ bool ClangCodeParser::getMoreArgs()
QString basicIncludeDir = QDir::cleanPath(QString(Config::installDir + "/../include"));
moreArgs_ += "-I" + basicIncludeDir.toLatin1();
moreArgs_ += includePathsFromHeaders(allHeaders_);
- }
- else {
+ } else {
moreArgs_ = includePaths_;
}
@@ -1217,22 +1250,28 @@ void ClangCodeParser::buildPCH()
if (!pchFileDir_ && !moduleHeader().isEmpty()) {
pchFileDir_.reset(new QTemporaryDir(QDir::tempPath() + QLatin1String("/qdoc_pch")));
if (pchFileDir_->isValid()) {
- //const QByteArray module = qdb_->primaryTreeRoot()->tree()->camelCaseModuleName().toUtf8();
+ // const QByteArray module =
+ // qdb_->primaryTreeRoot()->tree()->camelCaseModuleName().toUtf8();
const QByteArray module = moduleHeader().toUtf8();
QByteArray header;
QByteArray privateHeaderDir;
Location::logToStdErrAlways("Build & visit PCH for " + moduleHeader());
// A predicate for std::find_if() to locate a path to the module's header
// (e.g. QtGui/QtGui) to be used as pre-compiled header
- struct FindPredicate {
+ struct FindPredicate
+ {
enum SearchType { Any, Module, Private };
QByteArray &candidate_;
const QByteArray &module_;
SearchType type_;
- FindPredicate(QByteArray &candidate, const QByteArray &module, SearchType type = Any)
- : candidate_(candidate), module_(module), type_(type) {}
+ FindPredicate(QByteArray &candidate, const QByteArray &module,
+ SearchType type = Any)
+ : candidate_(candidate), module_(module), type_(type)
+ {
+ }
- bool operator()(const QByteArray &p) const {
+ bool operator()(const QByteArray &p) const
+ {
if (type_ != Any && !p.endsWith(module_))
return false;
candidate_ = p + "/";
@@ -1255,27 +1294,25 @@ void ClangCodeParser::buildPCH()
// First, search for an include path that contains the module name, then any path
QByteArray candidate;
- auto it = std::find_if(includePaths_.begin(),
- includePaths_.end(),
+ auto it = std::find_if(includePaths_.begin(), includePaths_.end(),
FindPredicate(candidate, module, FindPredicate::Module));
if (it == includePaths_.end())
- it = std::find_if(includePaths_.begin(),
- includePaths_.end(),
+ it = std::find_if(includePaths_.begin(), includePaths_.end(),
FindPredicate(candidate, module, FindPredicate::Any));
if (it != includePaths_.end())
header = candidate;
// Find the path to module's private headers - currently unused
- it = std::find_if(includePaths_.begin(),
- includePaths_.end(),
+ it = std::find_if(includePaths_.begin(), includePaths_.end(),
FindPredicate(candidate, module, FindPredicate::Private));
if (it != includePaths_.end())
privateHeaderDir = candidate;
if (header.isEmpty()) {
qWarning() << "(qdoc) Could not find the module header in include paths for module"
- << module << " (include paths: "<< includePaths_ << ")";
- qWarning() << " Artificial module header built from header dirs in qdocconf file";
+ << module << " (include paths: " << includePaths_ << ")";
+ qWarning() << " Artificial module header built from header dirs in qdocconf "
+ "file";
}
args_.push_back("-xc++");
CXTranslationUnit tu;
@@ -1285,11 +1322,11 @@ void ClangCodeParser::buildPCH()
QTextStream out(&tmpHeaderFile);
if (header.isEmpty()) {
for (auto it = allHeaders_.constKeyValueBegin();
- it != allHeaders_.constKeyValueEnd(); ++it) {
- if (!(*it).first.endsWith(QLatin1String("_p.h")) &&
- !(*it).first.startsWith(QLatin1String("moc_"))) {
- QString line = QLatin1String("#include \"") + (*it).second +
- QLatin1String("/") + (*it).first + QLatin1String("\"");
+ it != allHeaders_.constKeyValueEnd(); ++it) {
+ if (!(*it).first.endsWith(QLatin1String("_p.h"))
+ && !(*it).first.startsWith(QLatin1String("moc_"))) {
+ QString line = QLatin1String("#include \"") + (*it).second
+ + QLatin1String("/") + (*it).first + QLatin1String("\"");
out << line << "\n";
}
}
@@ -1306,25 +1343,27 @@ void ClangCodeParser::buildPCH()
out << line << "\n";
}
}
- tmpHeaderFile.close();
+ tmpHeaderFile.close();
}
if (printParsingErrors_ == 0)
- Location::logToStdErrAlways("clang not printing errors; include paths were guessed");
- CXErrorCode err = clang_parseTranslationUnit2(index_,
- tmpHeader.toLatin1().data(),
- args_.data(), static_cast<int>(args_.size()), nullptr, 0,
- flags_ | CXTranslationUnit_ForSerialization, &tu);
- qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2("
- << tmpHeader << args_ << ") returns" << err;
+ Location::logToStdErrAlways(
+ "clang not printing errors; include paths were guessed");
+ CXErrorCode err =
+ clang_parseTranslationUnit2(index_, tmpHeader.toLatin1().data(), args_.data(),
+ static_cast<int>(args_.size()), nullptr, 0,
+ flags_ | CXTranslationUnit_ForSerialization, &tu);
+ qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2(" << tmpHeader << args_
+ << ") returns" << err;
if (!err && tu) {
pchName_ = pchFileDir_->path().toUtf8() + "/" + module + ".pch";
- auto error = clang_saveTranslationUnit(tu, pchName_.constData(), clang_defaultSaveOptions(tu));
+ auto error = clang_saveTranslationUnit(tu, pchName_.constData(),
+ clang_defaultSaveOptions(tu));
if (error) {
Location::logToStdErrAlways("Could not save PCH file for " + moduleHeader());
pchName_.clear();
- }
- else {
- // Visit the header now, as token from pre-compiled header won't be visited later
+ } else {
+ // Visit the header now, as token from pre-compiled header won't be visited
+ // later
CXCursor cur = clang_getTranslationUnitCursor(tu);
ClangVisitor visitor(qdb_, allHeaders_);
visitor.visitChildren(cur);
@@ -1351,7 +1390,9 @@ void ClangCodeParser::precompileHeaders()
for (const auto &p : qAsConst(moreArgs_))
args_.push_back(p.constData());
- flags_ = static_cast<CXTranslationUnit_Flags>(CXTranslationUnit_Incomplete | CXTranslationUnit_SkipFunctionBodies | CXTranslationUnit_KeepGoing);
+ flags_ = static_cast<CXTranslationUnit_Flags>(CXTranslationUnit_Incomplete
+ | CXTranslationUnit_SkipFunctionBodies
+ | CXTranslationUnit_KeepGoing);
// 1 as 2nd parameter tells clang to report parser errors.
index_ = clang_createIndex(1, printParsingErrors_);
buildPCH();
@@ -1372,7 +1413,7 @@ static float getUnpatchedVersion(QString t)
Call matchDocsAndStuff() to do all the parsing and tree building.
*/
-void ClangCodeParser::parseSourceFile(const Location &/*location*/, const QString &filePath)
+void ClangCodeParser::parseSourceFile(const Location & /*location*/, const QString &filePath)
{
/*
The set of open namespaces is cleared before parsing
@@ -1380,7 +1421,9 @@ void ClangCodeParser::parseSourceFile(const Location &/*location*/, const QStrin
*/
qdb_->clearOpenNamespaces();
currentFile_ = filePath;
- flags_ = static_cast<CXTranslationUnit_Flags>(CXTranslationUnit_Incomplete | CXTranslationUnit_SkipFunctionBodies | CXTranslationUnit_KeepGoing);
+ flags_ = static_cast<CXTranslationUnit_Flags>(CXTranslationUnit_Incomplete
+ | CXTranslationUnit_SkipFunctionBodies
+ | CXTranslationUnit_KeepGoing);
index_ = clang_createIndex(1, 0);
getDefaultArgs();
@@ -1394,10 +1437,11 @@ void ClangCodeParser::parseSourceFile(const Location &/*location*/, const QStrin
args_.push_back(p.constData());
CXTranslationUnit tu;
- CXErrorCode err = clang_parseTranslationUnit2(index_, filePath.toLocal8Bit(), args_.data(),
- static_cast<int>(args_.size()), nullptr, 0, flags_, &tu);
- qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2("
- << filePath << args_ << ") returns" << err;
+ CXErrorCode err =
+ clang_parseTranslationUnit2(index_, filePath.toLocal8Bit(), args_.data(),
+ static_cast<int>(args_.size()), nullptr, 0, flags_, &tu);
+ qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2(" << filePath << args_
+ << ") returns" << err;
if (err || !tu) {
qWarning() << "(qdoc) Could not parse source file" << filePath << " error code:" << err;
clang_disposeIndex(index_);
@@ -1422,7 +1466,7 @@ void ClangCodeParser::parseSourceFile(const Location &/*location*/, const QStrin
auto loc = fromCXSourceLocation(clang_getTokenLocation(tu, tokens[i]));
auto end_loc = fromCXSourceLocation(clang_getRangeEnd(clang_getTokenExtent(tu, tokens[i])));
- Doc::trimCStyleComment(loc,comment);
+ Doc::trimCStyleComment(loc, comment);
// Doc constructor parses the comment.
Doc doc(loc, end_loc, comment, commands, topicCommands());
@@ -1442,9 +1486,9 @@ void ClangCodeParser::parseSourceFile(const Location &/*location*/, const QStrin
if (i + 1 < numTokens) {
// Try to find the next declaration.
CXSourceLocation nextCommentLoc = commentLoc;
- while (i + 2 < numTokens && clang_getTokenKind(tokens[i+1]) != CXToken_Comment)
+ while (i + 2 < numTokens && clang_getTokenKind(tokens[i + 1]) != CXToken_Comment)
++i; // already skip all the tokens that are not comments
- nextCommentLoc = clang_getTokenLocation(tu, tokens[i+1]);
+ nextCommentLoc = clang_getTokenLocation(tu, tokens[i + 1]);
n = visitor.nodeForCommentAtLocation(commentLoc, nextCommentLoc);
}
@@ -1464,7 +1508,8 @@ void ClangCodeParser::parseSourceFile(const Location &/*location*/, const QStrin
"topic command (e.g., '\\%1', '\\%2') in the "
"comment and no function definition following "
"the comment.")
- .arg(COMMAND_FN).arg(COMMAND_PAGE));
+ .arg(COMMAND_FN)
+ .arg(COMMAND_PAGE));
}
}
} else {
@@ -1498,7 +1543,9 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnArg
QString tag = fnArg.left(end + 1);
fnNode = qdb_->findFunctionNodeForTag(tag);
if (!fnNode) {
- location.error(ClangCodeParser::tr("tag \\fn %1 not used in any include file in current module").arg(tag));
+ location.error(ClangCodeParser::tr(
+ "tag \\fn %1 not used in any include file in current module")
+ .arg(tag));
} else {
/*
The function node was found. Use the formal
@@ -1536,9 +1583,9 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnArg
}
return fnNode;
}
- CXTranslationUnit_Flags flags = static_cast<CXTranslationUnit_Flags>(CXTranslationUnit_Incomplete |
- CXTranslationUnit_SkipFunctionBodies |
- CXTranslationUnit_KeepGoing);
+ CXTranslationUnit_Flags flags = static_cast<CXTranslationUnit_Flags>(
+ CXTranslationUnit_Incomplete | CXTranslationUnit_SkipFunctionBodies
+ | CXTranslationUnit_KeepGoing);
// Change 2nd parameter to 1 to make clang report errors.
CXIndex index = clang_createIndex(1, Utilities::debugging() ? 1 : 0);
@@ -1558,15 +1605,10 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnArg
const char *dummyFileName = "/fn_dummyfile.cpp";
CXUnsavedFile unsavedFile { dummyFileName, fn.constData(),
static_cast<unsigned long>(fn.size()) };
- CXErrorCode err = clang_parseTranslationUnit2(index, dummyFileName,
- args.data(),
- args.size(),
- &unsavedFile,
- 1,
- flags,
- &tu);
- qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2("
- << dummyFileName << args << ") returns" << err;
+ CXErrorCode err = clang_parseTranslationUnit2(index, dummyFileName, args.data(), args.size(),
+ &unsavedFile, 1, flags, &tu);
+ qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2(" << dummyFileName << args
+ << ") returns" << err;
if (err || !tu) {
location.error(ClangCodeParser::tr("clang could not parse \\fn %1").arg(fnArg));
clang_disposeTranslationUnit(tu);
@@ -1609,10 +1651,12 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnArg
}
}
if (report) {
- location.warning(ClangCodeParser::tr("clang found diagnostics parsing \\fn %1").arg(fnArg));
+ location.warning(ClangCodeParser::tr("clang found diagnostics parsing \\fn %1")
+ .arg(fnArg));
for (unsigned i = 0; i < diagnosticCount; ++i) {
CXDiagnostic diagnostic = clang_getDiagnostic(tu, i);
- location.report(tr(" %1").arg(fromCXString(clang_formatDiagnostic(diagnostic, 0))));
+ location.report(tr(" %1").arg(
+ fromCXString(clang_formatDiagnostic(diagnostic, 0))));
}
}
}
diff --git a/src/qdoc/codechunk.cpp b/src/qdoc/codechunk.cpp
index 27f26fdd6..d6293432e 100644
--- a/src/qdoc/codechunk.cpp
+++ b/src/qdoc/codechunk.cpp
@@ -40,47 +40,45 @@ QT_BEGIN_NAMESPACE
enum { Other, Alnum, Gizmo, Comma, LBrace, RBrace, RAngle, Colon, Paren };
// entries 128 and above are Other
-static const int charCategory[256] = {
- Other, Other, Other, Other, Other, Other, Other, Other,
- Other, Other, Other, Other, Other, Other, Other, Other,
- Other, Other, Other, Other, Other, Other, Other, Other,
- Other, Other, Other, Other, Other, Other, Other, Other,
- // ! " # $ % & '
- Other, Other, Other, Other, Other, Gizmo, Gizmo, Other,
- // ( ) * + , - . /
- Paren, Paren, Gizmo, Gizmo, Comma, Other, Other, Gizmo,
- // 0 1 2 3 4 5 6 7
- Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // 8 9 : ; < = > ?
- Alnum, Alnum, Colon, Other, Other, Gizmo, RAngle, Gizmo,
- // @ A B C D E F G
- Other, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // H I J K L M N O
- Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // P Q R S T U V W
- Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // X Y Z [ \ ] ^ _
- Alnum, Alnum, Alnum, Other, Other, Other, Gizmo, Alnum,
- // ` a b c d e f g
- Other, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // h i j k l m n o
- Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // p q r s t u v w
- Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // x y z { | } ~
- Alnum, Alnum, Alnum, LBrace, Gizmo, RBrace, Other, Other
-};
+static const int charCategory[256] = { Other, Other, Other, Other, Other, Other, Other, Other,
+ Other, Other, Other, Other, Other, Other, Other, Other,
+ Other, Other, Other, Other, Other, Other, Other, Other,
+ Other, Other, Other, Other, Other, Other, Other, Other,
+ // ! " # $ % & '
+ Other, Other, Other, Other, Other, Gizmo, Gizmo, Other,
+ // ( ) * + , - . /
+ Paren, Paren, Gizmo, Gizmo, Comma, Other, Other, Gizmo,
+ // 0 1 2 3 4 5 6 7
+ Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
+ // 8 9 : ; < = > ?
+ Alnum, Alnum, Colon, Other, Other, Gizmo, RAngle, Gizmo,
+ // @ A B C D E F G
+ Other, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
+ // H I J K L M N O
+ Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
+ // P Q R S T U V W
+ Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
+ // X Y Z [ \ ] ^ _
+ Alnum, Alnum, Alnum, Other, Other, Other, Gizmo, Alnum,
+ // ` a b c d e f g
+ Other, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
+ // h i j k l m n o
+ Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
+ // p q r s t u v w
+ Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
+ // x y z { | } ~
+ Alnum, Alnum, Alnum, LBrace, Gizmo, RBrace, Other, Other };
static const bool needSpace[9][9] = {
/* [ a + , { } > : ) */
- /* [ */ { false, false, false, false, false, true, false, false, false },
- /* a */ { false, true, true, false, false, true, false, false, false },
- /* + */ { false, true, false, false, false, true, false, true, false },
- /* , */ { true, true, true, true, true, true, true, true, false },
+ /* [ */ { false, false, false, false, false, true, false, false, false },
+ /* a */ { false, true, true, false, false, true, false, false, false },
+ /* + */ { false, true, false, false, false, true, false, true, false },
+ /* , */ { true, true, true, true, true, true, true, true, false },
/* { */ { false, false, false, false, false, false, false, false, false },
/* } */ { false, false, false, false, false, false, false, false, false },
- /* > */ { true, true, true, false, true, true, true, false, false },
- /* : */ { false, false, true, true, true, true, true, false, false },
+ /* > */ { true, true, true, false, true, true, true, false, false },
+ /* : */ { false, false, true, true, true, true, true, false, false },
/* ( */ { false, false, false, false, false, false, false, false, false },
};
diff --git a/src/qdoc/codechunk.h b/src/qdoc/codechunk.h
index b7cda1324..0ccc26304 100644
--- a/src/qdoc/codechunk.h
+++ b/src/qdoc/codechunk.h
@@ -46,7 +46,11 @@ public:
CodeChunk(const QString &str) : s(str), hotspot(-1) {}
void append(const QString &lexeme);
- void appendHotspot() { if (hotspot == -1) hotspot = s.length(); }
+ void appendHotspot()
+ {
+ if (hotspot == -1)
+ hotspot = s.length();
+ }
bool isEmpty() const { return s.isEmpty(); }
void clear() { s.clear(); }
@@ -60,27 +64,33 @@ private:
int hotspot;
};
-inline bool operator==(const CodeChunk& c, const CodeChunk& d) {
+inline bool operator==(const CodeChunk &c, const CodeChunk &d)
+{
return c.toString() == d.toString();
}
-inline bool operator!=(const CodeChunk& c, const CodeChunk& d) {
+inline bool operator!=(const CodeChunk &c, const CodeChunk &d)
+{
return !(c == d);
}
-inline bool operator<(const CodeChunk& c, const CodeChunk& d) {
+inline bool operator<(const CodeChunk &c, const CodeChunk &d)
+{
return c.toString() < d.toString();
}
-inline bool operator>(const CodeChunk& c, const CodeChunk& d) {
+inline bool operator>(const CodeChunk &c, const CodeChunk &d)
+{
return d < c;
}
-inline bool operator<=(const CodeChunk& c, const CodeChunk& d) {
+inline bool operator<=(const CodeChunk &c, const CodeChunk &d)
+{
return !(c > d);
}
-inline bool operator>=(const CodeChunk& c, const CodeChunk& d) {
+inline bool operator>=(const CodeChunk &c, const CodeChunk &d)
+{
return !(c < d);
}
diff --git a/src/qdoc/codemarker.cpp b/src/qdoc/codemarker.cpp
index f9b1a163e..000bf97f0 100644
--- a/src/qdoc/codemarker.cpp
+++ b/src/qdoc/codemarker.cpp
@@ -152,15 +152,14 @@ QString CodeMarker::stringForNode(const Node *node)
{
if (sizeof(const Node *) == sizeof(ulong)) {
return QString::number(reinterpret_cast<quintptr>(node));
- }
- else {
+ } else {
return QString::number(reinterpret_cast<qulonglong>(node));
}
}
-static const QString samp = QLatin1String("&amp;");
-static const QString slt = QLatin1String("&lt;");
-static const QString sgt = QLatin1String("&gt;");
+static const QString samp = QLatin1String("&amp;");
+static const QString slt = QLatin1String("&lt;");
+static const QString sgt = QLatin1String("&gt;");
static const QString squot = QLatin1String("&quot;");
QString CodeMarker::protect(const QString &str)
@@ -171,11 +170,20 @@ QString CodeMarker::protect(const QString &str)
const QChar *data = str.constData();
for (int i = 0; i != n; ++i) {
switch (data[i].unicode()) {
- case '&': marked += samp; break;
- case '<': marked += slt; break;
- case '>': marked += sgt; break;
- case '"': marked += squot; break;
- default : marked += data[i];
+ case '&':
+ marked += samp;
+ break;
+ case '<':
+ marked += slt;
+ break;
+ case '>':
+ marked += sgt;
+ break;
+ case '"':
+ marked += squot;
+ break;
+ default:
+ marked += data[i];
}
}
return marked;
@@ -188,11 +196,20 @@ void CodeMarker::appendProtectedString(QString *output, const QStringRef &str)
const QChar *data = str.constData();
for (int i = 0; i != n; ++i) {
switch (data[i].unicode()) {
- case '&': *output += samp; break;
- case '<': *output += slt; break;
- case '>': *output += sgt; break;
- case '"': *output += squot; break;
- default : *output += data[i];
+ case '&':
+ *output += samp;
+ break;
+ case '<':
+ *output += slt;
+ break;
+ case '>':
+ *output += sgt;
+ break;
+ case '"':
+ *output += squot;
+ break;
+ default:
+ *output += data[i];
}
}
}
@@ -208,12 +225,10 @@ QString CodeMarker::typified(const QString &string, bool trailingSpace)
ch = string.at(i);
QChar lower = ch.toLower();
- if ((lower >= QLatin1Char('a') && lower <= QLatin1Char('z'))
- || ch.digitValue() >= 0 || ch == QLatin1Char('_')
- || ch == QLatin1Char(':')) {
+ if ((lower >= QLatin1Char('a') && lower <= QLatin1Char('z')) || ch.digitValue() >= 0
+ || ch == QLatin1Char('_') || ch == QLatin1Char(':')) {
pendingWord += ch;
- }
- else {
+ } else {
if (!pendingWord.isEmpty()) {
bool isProbablyType = (pendingWord != QLatin1String("const"));
if (isProbablyType)
@@ -242,9 +257,8 @@ QString CodeMarker::typified(const QString &string, bool trailingSpace)
}
}
if (trailingSpace && string.size()) {
- if (!string.endsWith(QLatin1Char('*'))
- && !string.endsWith(QLatin1Char('&')))
- result += QLatin1Char(' ');
+ if (!string.endsWith(QLatin1Char('*')) && !string.endsWith(QLatin1Char('&')))
+ result += QLatin1Char(' ');
}
return result;
}
@@ -295,8 +309,8 @@ QString CodeMarker::taggedNode(const Node *node)
tag = QLatin1String("@unknown");
break;
}
- return (QLatin1Char('<') + tag + QLatin1Char('>') + protect(name)
- + QLatin1String("</") + tag + QLatin1Char('>'));
+ return (QLatin1Char('<') + tag + QLatin1Char('>') + protect(name) + QLatin1String("</") + tag
+ + QLatin1Char('>'));
}
QString CodeMarker::taggedQmlNode(const Node *node)
@@ -326,14 +340,14 @@ QString CodeMarker::taggedQmlNode(const Node *node)
} else {
tag = QLatin1String("@unknown");
}
- return QLatin1Char('<') + tag + QLatin1Char('>') + protect(node->name())
- + QLatin1String("</") + tag + QLatin1Char('>');
+ return QLatin1Char('<') + tag + QLatin1Char('>') + protect(node->name()) + QLatin1String("</")
+ + tag + QLatin1Char('>');
}
QString CodeMarker::linkTag(const Node *node, const QString &body)
{
- return QLatin1String("<@link node=\"") + stringForNode(node)
- + QLatin1String("\">") + body + QLatin1String("</@link>");
+ return QLatin1String("<@link node=\"") + stringForNode(node) + QLatin1String("\">") + body
+ + QLatin1String("</@link>");
}
static QString encode(const QString &string)
@@ -345,32 +359,27 @@ QStringList CodeMarker::macRefsForNode(Node *node)
{
QString result = QLatin1String("cpp/");
switch (node->nodeType()) {
- case Node::Class:
- {
+ case Node::Class: {
const ClassNode *classe = static_cast<const ClassNode *>(node);
{
result += QLatin1String("cl/");
}
result += macName(classe); // ### Maybe plainName?
- }
- break;
- case Node::Enum:
- {
+ } break;
+ case Node::Enum: {
QStringList stringList;
stringList << encode(result + QLatin1String("tag/") + macName(node));
const auto enumItemNames = node->doc().enumItemNames();
for (const auto &name : enumItemNames) {
// ### Write a plainEnumValue() and use it here
- stringList << encode(result + QLatin1String("econst/") +
- macName(node->parent(), name));
+ stringList << encode(result + QLatin1String("econst/") + macName(node->parent(), name));
}
return stringList;
}
case Node::Typedef:
result += QLatin1String("tdef/") + macName(node);
break;
- case Node::Function:
- {
+ case Node::Function: {
bool isMacro = false;
Q_UNUSED(isMacro);
const FunctionNode *func = static_cast<const FunctionNode *>(node);
@@ -381,27 +390,22 @@ QStringList CodeMarker::macRefsForNode(Node *node)
if (func->isMacro()) {
result += QLatin1String("macro/");
- }
- else if (func->isStatic()) {
+ } else if (func->isStatic()) {
result += QLatin1String("clm/");
- }
- else if (!func->parent()->name().isEmpty()) {
+ } else if (!func->parent()->name().isEmpty()) {
result += QLatin1String("instm/");
- }
- else {
+ } else {
result += QLatin1String("func/");
}
result += macName(func);
if (result.endsWith(QLatin1String("()")))
result.chop(2);
- }
- break;
+ } break;
case Node::Variable:
result += QLatin1String("data/") + macName(node);
break;
- case Node::Property:
- {
+ case Node::Property: {
const NodeList list = static_cast<const PropertyNode *>(node)->functions();
QStringList stringList;
for (auto *node : list) {
diff --git a/src/qdoc/codemarker.h b/src/qdoc/codemarker.h
index 4a6264ea6..e17b82903 100644
--- a/src/qdoc/codemarker.h
+++ b/src/qdoc/codemarker.h
@@ -44,22 +44,30 @@ public:
virtual void initializeMarker(const Config &config);
virtual void terminateMarker();
- virtual bool recognizeCode(const QString & /*code*/) { return true; }
+ virtual bool recognizeCode(const QString & /*code*/) { return true; }
virtual bool recognizeExtension(const QString & /*extension*/) { return true; }
virtual bool recognizeLanguage(const QString & /*language*/) { return false; }
virtual Atom::AtomType atomType() const { return Atom::Code; }
- virtual QString markedUpCode(const QString &code,
- const Node * /*relative*/,
- const Location & /*location*/) { return protect(code); }
- virtual QString markedUpSynopsis(const Node * /*node*/,
- const Node * /*relative*/,
- Section::Style /*style*/) { return QString(); }
+ virtual QString markedUpCode(const QString &code, const Node * /*relative*/,
+ const Location & /*location*/)
+ {
+ return protect(code);
+ }
+ virtual QString markedUpSynopsis(const Node * /*node*/, const Node * /*relative*/,
+ Section::Style /*style*/)
+ {
+ return QString();
+ }
virtual QString markedUpQmlItem(const Node *, bool) { return QString(); }
virtual QString markedUpName(const Node * /*node*/) { return QString(); }
- virtual QString markedUpFullName(const Node * /*node*/,
- const Node * /*relative*/) { return QString(); }
- virtual QString markedUpEnumValue(const QString & /*enumValue*/,
- const Node * /*relative*/) { return QString(); }
+ virtual QString markedUpFullName(const Node * /*node*/, const Node * /*relative*/)
+ {
+ return QString();
+ }
+ virtual QString markedUpEnumValue(const QString & /*enumValue*/, const Node * /*relative*/)
+ {
+ return QString();
+ }
virtual QString markedUpIncludes(const QStringList & /*includes*/) { return QString(); }
virtual QString functionBeginRegExp(const QString & /*funcName*/) { return QString(); }
virtual QString functionEndRegExp(const QString & /*funcName*/) { return QString(); }
diff --git a/src/qdoc/codeparser.cpp b/src/qdoc/codeparser.cpp
index b8d884a13..4f4589823 100644
--- a/src/qdoc/codeparser.cpp
+++ b/src/qdoc/codeparser.cpp
@@ -157,42 +157,23 @@ static QSet<QString> commonMetaCommands_;
const QSet<QString> &CodeParser::commonMetaCommands()
{
if (commonMetaCommands_.isEmpty()) {
- commonMetaCommands_ << COMMAND_ABSTRACT
- << COMMAND_DEPRECATED
- << COMMAND_INGROUP
- << COMMAND_INJSMODULE
- << COMMAND_INMODULE
- << COMMAND_INPUBLICGROUP
- << COMMAND_INQMLMODULE
- << COMMAND_INTERNAL
- << COMMAND_MAINCLASS
- << COMMAND_NOAUTOLIST
- << COMMAND_NONREENTRANT
- << COMMAND_OBSOLETE
- << COMMAND_PAGEKEYWORDS
- << COMMAND_PRELIMINARY
- << COMMAND_QMLABSTRACT
- << COMMAND_QMLDEFAULT
- << COMMAND_QMLINHERITS
- << COMMAND_QMLREADONLY
- << COMMAND_QTVARIABLE
- << COMMAND_REENTRANT
- << COMMAND_SINCE
- << COMMAND_STARTPAGE
- << COMMAND_SUBTITLE
- << COMMAND_THREADSAFE
- << COMMAND_TITLE
- << COMMAND_WRAPPER;
- }
+ commonMetaCommands_ << COMMAND_ABSTRACT << COMMAND_DEPRECATED << COMMAND_INGROUP
+ << COMMAND_INJSMODULE << COMMAND_INMODULE << COMMAND_INPUBLICGROUP
+ << COMMAND_INQMLMODULE << COMMAND_INTERNAL << COMMAND_MAINCLASS
+ << COMMAND_NOAUTOLIST << COMMAND_NONREENTRANT << COMMAND_OBSOLETE
+ << COMMAND_PAGEKEYWORDS << COMMAND_PRELIMINARY << COMMAND_QMLABSTRACT
+ << COMMAND_QMLDEFAULT << COMMAND_QMLINHERITS << COMMAND_QMLREADONLY
+ << COMMAND_QTVARIABLE << COMMAND_REENTRANT << COMMAND_SINCE
+ << COMMAND_STARTPAGE << COMMAND_SUBTITLE << COMMAND_THREADSAFE
+ << COMMAND_TITLE << COMMAND_WRAPPER;
+ }
return commonMetaCommands_;
}
/*!
\internal
*/
-void CodeParser::extractPageLinkAndDesc(const QString &arg,
- QString *link,
- QString *desc)
+void CodeParser::extractPageLinkAndDesc(const QString &arg, QString *link, QString *desc)
{
QRegExp bracedRegExp(QLatin1String("\\{([^{}]*)\\}(?:\\{([^{}]*)\\})?"));
@@ -201,14 +182,12 @@ void CodeParser::extractPageLinkAndDesc(const QString &arg,
*desc = bracedRegExp.cap(2);
if (desc->isEmpty())
*desc = *link;
- }
- else {
+ } else {
int spaceAt = arg.indexOf(QLatin1Char(' '));
if (arg.contains(QLatin1String(".html")) && spaceAt != -1) {
*link = arg.leftRef(spaceAt).trimmed().toString();
*desc = arg.midRef(spaceAt).trimmed().toString();
- }
- else {
+ } else {
*link = arg;
*desc = arg;
}
@@ -311,7 +290,9 @@ void CodeParser::checkModuleInclusion(Node *n)
if (n->isInAPI() && !n->name().isEmpty()) {
n->doc().location().warning(tr("%1 %2 has no \\inmodule command; "
"using project name by default: %3")
- .arg(word).arg(n->name()).arg(Generator::defaultModuleName()));
+ .arg(word)
+ .arg(n->name())
+ .arg(Generator::defaultModuleName()));
}
}
}
diff --git a/src/qdoc/codeparser.h b/src/qdoc/codeparser.h
index b9a85fb75..7e1e551e4 100644
--- a/src/qdoc/codeparser.h
+++ b/src/qdoc/codeparser.h
@@ -55,7 +55,7 @@ public:
virtual QStringList sourceFileNameFilter() = 0;
virtual void parseHeaderFile(const Location &location, const QString &filePath);
virtual void parseSourceFile(const Location &location, const QString &filePath) = 0;
- virtual void precompileHeaders() { }
+ virtual void precompileHeaders() {}
virtual Node *parseFnArg(const Location &, const QString &) { return nullptr; }
bool isParsingH() const;
@@ -76,9 +76,7 @@ public:
protected:
const QSet<QString> &commonMetaCommands();
- static void extractPageLinkAndDesc(const QString &arg,
- QString *link,
- QString *desc);
+ static void extractPageLinkAndDesc(const QString &arg, QString *link, QString *desc);
static bool showInternal() { return showInternal_; }
QString moduleHeader_;
QString currentFile_;
@@ -90,96 +88,96 @@ private:
static bool singleExec_;
};
-#define COMMAND_ABSTRACT Doc::alias(QLatin1String("abstract"))
-#define COMMAND_AUDIENCE Doc::alias(QLatin1String("audience"))
-#define COMMAND_AUTHOR Doc::alias(QLatin1String("author"))
-#define COMMAND_CATEGORY Doc::alias(QLatin1String("category"))
-#define COMMAND_CLASS Doc::alias(QLatin1String("class"))
-#define COMMAND_COMPONENT Doc::alias(QLatin1String("component"))
-#define COMMAND_CONTENTSPAGE Doc::alias(QLatin1String("contentspage"))
-#define COMMAND_COPYRHOLDER Doc::alias(QLatin1String("copyrholder"))
-#define COMMAND_COPYRYEAR Doc::alias(QLatin1String("copyryear"))
-#define COMMAND_DEPRECATED Doc::alias(QLatin1String("deprecated")) // ### don't document
-#define COMMAND_DONTDOCUMENT Doc::alias(QLatin1String("dontdocument"))
-#define COMMAND_DITAMAP Doc::alias(QLatin1String("ditamap"))
-#define COMMAND_ENUM Doc::alias(QLatin1String("enum"))
-#define COMMAND_EXAMPLE Doc::alias(QLatin1String("example"))
-#define COMMAND_EXTERNALPAGE Doc::alias(QLatin1String("externalpage"))
-#define COMMAND_FN Doc::alias(QLatin1String("fn"))
-#define COMMAND_GROUP Doc::alias(QLatin1String("group"))
-#define COMMAND_HEADERFILE Doc::alias(QLatin1String("headerfile"))
-#define COMMAND_INGROUP Doc::alias(QLatin1String("ingroup"))
-#define COMMAND_INHEADERFILE Doc::alias(QLatin1String("inheaderfile"))
-#define COMMAND_INJSMODULE Doc::alias(QLatin1String("injsmodule"))
-#define COMMAND_INMODULE Doc::alias(QLatin1String("inmodule")) // ### don't document
-#define COMMAND_INPUBLICGROUP Doc::alias(QLatin1String("inpublicgroup"))
-#define COMMAND_INQMLMODULE Doc::alias(QLatin1String("inqmlmodule"))
-#define COMMAND_INTERNAL Doc::alias(QLatin1String("internal"))
-#define COMMAND_JSATTACHEDMETHOD Doc::alias(QLatin1String("jsattachedmethod"))
-#define COMMAND_JSATTACHEDPROPERTY Doc::alias(QLatin1String("jsattachedproperty"))
-#define COMMAND_JSATTACHEDSIGNAL Doc::alias(QLatin1String("jsattachedsignal"))
-#define COMMAND_JSBASICTYPE Doc::alias(QLatin1String("jsbasictype"))
-#define COMMAND_JSMETHOD Doc::alias(QLatin1String("jsmethod"))
-#define COMMAND_JSMODULE Doc::alias(QLatin1String("jsmodule"))
-#define COMMAND_JSPROPERTY Doc::alias(QLatin1String("jsproperty"))
-#define COMMAND_JSPROPERTYGROUP Doc::alias(QLatin1String("jspropertygroup"))
-#define COMMAND_JSSIGNAL Doc::alias(QLatin1String("jssignal"))
-#define COMMAND_JSTYPE Doc::alias(QLatin1String("jstype"))
-#define COMMAND_LICENSEDESCRIPTION Doc::alias(QLatin1String("licensedescription"))
-#define COMMAND_LICENSENAME Doc::alias(QLatin1String("licensename"))
-#define COMMAND_LICENSEYEAR Doc::alias(QLatin1String("licenseyear"))
-#define COMMAND_LIFECYCLEVERSION Doc::alias(QLatin1String("lifecycleversion"))
-#define COMMAND_LIFECYCLEWSTATUS Doc::alias(QLatin1String("lifecyclestatus"))
-#define COMMAND_MACRO Doc::alias(QLatin1String("macro"))
-#define COMMAND_MAINCLASS Doc::alias(QLatin1String("mainclass"))
-#define COMMAND_MODULE Doc::alias(QLatin1String("module"))
-#define COMMAND_NAMESPACE Doc::alias(QLatin1String("namespace"))
-#define COMMAND_NEXTPAGE Doc::alias(QLatin1String("nextpage"))
-#define COMMAND_NOAUTOLIST Doc::alias(QLatin1String("noautolist"))
-#define COMMAND_NONREENTRANT Doc::alias(QLatin1String("nonreentrant"))
-#define COMMAND_OBSOLETE Doc::alias(QLatin1String("obsolete"))
-#define COMMAND_OVERLOAD Doc::alias(QLatin1String("overload"))
-#define COMMAND_PAGE Doc::alias(QLatin1String("page"))
-#define COMMAND_PAGEKEYWORDS Doc::alias(QLatin1String("pagekeywords"))
-#define COMMAND_PERMISSIONS Doc::alias(QLatin1String("permissions"))
-#define COMMAND_PRELIMINARY Doc::alias(QLatin1String("preliminary"))
-#define COMMAND_PREVIOUSPAGE Doc::alias(QLatin1String("previouspage"))
-#define COMMAND_PRODNAME Doc::alias(QLatin1String("prodname"))
-#define COMMAND_PROPERTY Doc::alias(QLatin1String("property"))
-#define COMMAND_PUBLISHER Doc::alias(QLatin1String("publisher"))
-#define COMMAND_QMLABSTRACT Doc::alias(QLatin1String("qmlabstract"))
-#define COMMAND_QMLATTACHEDMETHOD Doc::alias(QLatin1String("qmlattachedmethod"))
-#define COMMAND_QMLATTACHEDPROPERTY Doc::alias(QLatin1String("qmlattachedproperty"))
-#define COMMAND_QMLATTACHEDSIGNAL Doc::alias(QLatin1String("qmlattachedsignal"))
-#define COMMAND_QMLBASICTYPE Doc::alias(QLatin1String("qmlbasictype"))
-#define COMMAND_QMLCLASS Doc::alias(QLatin1String("qmlclass"))
-#define COMMAND_QMLDEFAULT Doc::alias(QLatin1String("default"))
-#define COMMAND_QMLINHERITS Doc::alias(QLatin1String("inherits"))
-#define COMMAND_QMLINSTANTIATES Doc::alias(QLatin1String("instantiates"))
-#define COMMAND_QMLMETHOD Doc::alias(QLatin1String("qmlmethod"))
-#define COMMAND_QMLMODULE Doc::alias(QLatin1String("qmlmodule"))
-#define COMMAND_QMLPROPERTY Doc::alias(QLatin1String("qmlproperty"))
-#define COMMAND_QMLPROPERTYGROUP Doc::alias(QLatin1String("qmlpropertygroup"))
-#define COMMAND_QMLREADONLY Doc::alias(QLatin1String("readonly"))
-#define COMMAND_QMLSIGNAL Doc::alias(QLatin1String("qmlsignal"))
-#define COMMAND_QMLTYPE Doc::alias(QLatin1String("qmltype"))
-#define COMMAND_QTVARIABLE Doc::alias(QLatin1String("qtvariable"))
-#define COMMAND_REENTRANT Doc::alias(QLatin1String("reentrant"))
-#define COMMAND_REIMP Doc::alias(QLatin1String("reimp"))
-#define COMMAND_RELATES Doc::alias(QLatin1String("relates"))
-#define COMMAND_RELEASEDATE Doc::alias(QLatin1String("releasedate"))
-#define COMMAND_SINCE Doc::alias(QLatin1String("since"))
-#define COMMAND_STRUCT Doc::alias(QLatin1String("struct"))
-#define COMMAND_SUBTITLE Doc::alias(QLatin1String("subtitle"))
-#define COMMAND_STARTPAGE Doc::alias(QLatin1String("startpage"))
-#define COMMAND_THREADSAFE Doc::alias(QLatin1String("threadsafe"))
-#define COMMAND_TITLE Doc::alias(QLatin1String("title"))
-#define COMMAND_TYPEALIAS Doc::alias(QLatin1String("typealias"))
-#define COMMAND_TYPEDEF Doc::alias(QLatin1String("typedef"))
-#define COMMAND_VARIABLE Doc::alias(QLatin1String("variable"))
-#define COMMAND_VERSION Doc::alias(QLatin1String("version"))
-#define COMMAND_UNION Doc::alias(QLatin1String("union"))
-#define COMMAND_WRAPPER Doc::alias(QLatin1String("wrapper"))
+#define COMMAND_ABSTRACT Doc::alias(QLatin1String("abstract"))
+#define COMMAND_AUDIENCE Doc::alias(QLatin1String("audience"))
+#define COMMAND_AUTHOR Doc::alias(QLatin1String("author"))
+#define COMMAND_CATEGORY Doc::alias(QLatin1String("category"))
+#define COMMAND_CLASS Doc::alias(QLatin1String("class"))
+#define COMMAND_COMPONENT Doc::alias(QLatin1String("component"))
+#define COMMAND_CONTENTSPAGE Doc::alias(QLatin1String("contentspage"))
+#define COMMAND_COPYRHOLDER Doc::alias(QLatin1String("copyrholder"))
+#define COMMAND_COPYRYEAR Doc::alias(QLatin1String("copyryear"))
+#define COMMAND_DEPRECATED Doc::alias(QLatin1String("deprecated")) // ### don't document
+#define COMMAND_DONTDOCUMENT Doc::alias(QLatin1String("dontdocument"))
+#define COMMAND_DITAMAP Doc::alias(QLatin1String("ditamap"))
+#define COMMAND_ENUM Doc::alias(QLatin1String("enum"))
+#define COMMAND_EXAMPLE Doc::alias(QLatin1String("example"))
+#define COMMAND_EXTERNALPAGE Doc::alias(QLatin1String("externalpage"))
+#define COMMAND_FN Doc::alias(QLatin1String("fn"))
+#define COMMAND_GROUP Doc::alias(QLatin1String("group"))
+#define COMMAND_HEADERFILE Doc::alias(QLatin1String("headerfile"))
+#define COMMAND_INGROUP Doc::alias(QLatin1String("ingroup"))
+#define COMMAND_INHEADERFILE Doc::alias(QLatin1String("inheaderfile"))
+#define COMMAND_INJSMODULE Doc::alias(QLatin1String("injsmodule"))
+#define COMMAND_INMODULE Doc::alias(QLatin1String("inmodule")) // ### don't document
+#define COMMAND_INPUBLICGROUP Doc::alias(QLatin1String("inpublicgroup"))
+#define COMMAND_INQMLMODULE Doc::alias(QLatin1String("inqmlmodule"))
+#define COMMAND_INTERNAL Doc::alias(QLatin1String("internal"))
+#define COMMAND_JSATTACHEDMETHOD Doc::alias(QLatin1String("jsattachedmethod"))
+#define COMMAND_JSATTACHEDPROPERTY Doc::alias(QLatin1String("jsattachedproperty"))
+#define COMMAND_JSATTACHEDSIGNAL Doc::alias(QLatin1String("jsattachedsignal"))
+#define COMMAND_JSBASICTYPE Doc::alias(QLatin1String("jsbasictype"))
+#define COMMAND_JSMETHOD Doc::alias(QLatin1String("jsmethod"))
+#define COMMAND_JSMODULE Doc::alias(QLatin1String("jsmodule"))
+#define COMMAND_JSPROPERTY Doc::alias(QLatin1String("jsproperty"))
+#define COMMAND_JSPROPERTYGROUP Doc::alias(QLatin1String("jspropertygroup"))
+#define COMMAND_JSSIGNAL Doc::alias(QLatin1String("jssignal"))
+#define COMMAND_JSTYPE Doc::alias(QLatin1String("jstype"))
+#define COMMAND_LICENSEDESCRIPTION Doc::alias(QLatin1String("licensedescription"))
+#define COMMAND_LICENSENAME Doc::alias(QLatin1String("licensename"))
+#define COMMAND_LICENSEYEAR Doc::alias(QLatin1String("licenseyear"))
+#define COMMAND_LIFECYCLEVERSION Doc::alias(QLatin1String("lifecycleversion"))
+#define COMMAND_LIFECYCLEWSTATUS Doc::alias(QLatin1String("lifecyclestatus"))
+#define COMMAND_MACRO Doc::alias(QLatin1String("macro"))
+#define COMMAND_MAINCLASS Doc::alias(QLatin1String("mainclass"))
+#define COMMAND_MODULE Doc::alias(QLatin1String("module"))
+#define COMMAND_NAMESPACE Doc::alias(QLatin1String("namespace"))
+#define COMMAND_NEXTPAGE Doc::alias(QLatin1String("nextpage"))
+#define COMMAND_NOAUTOLIST Doc::alias(QLatin1String("noautolist"))
+#define COMMAND_NONREENTRANT Doc::alias(QLatin1String("nonreentrant"))
+#define COMMAND_OBSOLETE Doc::alias(QLatin1String("obsolete"))
+#define COMMAND_OVERLOAD Doc::alias(QLatin1String("overload"))
+#define COMMAND_PAGE Doc::alias(QLatin1String("page"))
+#define COMMAND_PAGEKEYWORDS Doc::alias(QLatin1String("pagekeywords"))
+#define COMMAND_PERMISSIONS Doc::alias(QLatin1String("permissions"))
+#define COMMAND_PRELIMINARY Doc::alias(QLatin1String("preliminary"))
+#define COMMAND_PREVIOUSPAGE Doc::alias(QLatin1String("previouspage"))
+#define COMMAND_PRODNAME Doc::alias(QLatin1String("prodname"))
+#define COMMAND_PROPERTY Doc::alias(QLatin1String("property"))
+#define COMMAND_PUBLISHER Doc::alias(QLatin1String("publisher"))
+#define COMMAND_QMLABSTRACT Doc::alias(QLatin1String("qmlabstract"))
+#define COMMAND_QMLATTACHEDMETHOD Doc::alias(QLatin1String("qmlattachedmethod"))
+#define COMMAND_QMLATTACHEDPROPERTY Doc::alias(QLatin1String("qmlattachedproperty"))
+#define COMMAND_QMLATTACHEDSIGNAL Doc::alias(QLatin1String("qmlattachedsignal"))
+#define COMMAND_QMLBASICTYPE Doc::alias(QLatin1String("qmlbasictype"))
+#define COMMAND_QMLCLASS Doc::alias(QLatin1String("qmlclass"))
+#define COMMAND_QMLDEFAULT Doc::alias(QLatin1String("default"))
+#define COMMAND_QMLINHERITS Doc::alias(QLatin1String("inherits"))
+#define COMMAND_QMLINSTANTIATES Doc::alias(QLatin1String("instantiates"))
+#define COMMAND_QMLMETHOD Doc::alias(QLatin1String("qmlmethod"))
+#define COMMAND_QMLMODULE Doc::alias(QLatin1String("qmlmodule"))
+#define COMMAND_QMLPROPERTY Doc::alias(QLatin1String("qmlproperty"))
+#define COMMAND_QMLPROPERTYGROUP Doc::alias(QLatin1String("qmlpropertygroup"))
+#define COMMAND_QMLREADONLY Doc::alias(QLatin1String("readonly"))
+#define COMMAND_QMLSIGNAL Doc::alias(QLatin1String("qmlsignal"))
+#define COMMAND_QMLTYPE Doc::alias(QLatin1String("qmltype"))
+#define COMMAND_QTVARIABLE Doc::alias(QLatin1String("qtvariable"))
+#define COMMAND_REENTRANT Doc::alias(QLatin1String("reentrant"))
+#define COMMAND_REIMP Doc::alias(QLatin1String("reimp"))
+#define COMMAND_RELATES Doc::alias(QLatin1String("relates"))
+#define COMMAND_RELEASEDATE Doc::alias(QLatin1String("releasedate"))
+#define COMMAND_SINCE Doc::alias(QLatin1String("since"))
+#define COMMAND_STRUCT Doc::alias(QLatin1String("struct"))
+#define COMMAND_SUBTITLE Doc::alias(QLatin1String("subtitle"))
+#define COMMAND_STARTPAGE Doc::alias(QLatin1String("startpage"))
+#define COMMAND_THREADSAFE Doc::alias(QLatin1String("threadsafe"))
+#define COMMAND_TITLE Doc::alias(QLatin1String("title"))
+#define COMMAND_TYPEALIAS Doc::alias(QLatin1String("typealias"))
+#define COMMAND_TYPEDEF Doc::alias(QLatin1String("typedef"))
+#define COMMAND_VARIABLE Doc::alias(QLatin1String("variable"))
+#define COMMAND_VERSION Doc::alias(QLatin1String("version"))
+#define COMMAND_UNION Doc::alias(QLatin1String("union"))
+#define COMMAND_WRAPPER Doc::alias(QLatin1String("wrapper"))
QT_END_NAMESPACE
diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp
index 079ffd0e5..73f29d56a 100644
--- a/src/qdoc/config.cpp
+++ b/src/qdoc/config.cpp
@@ -94,7 +94,8 @@ QString ConfigStrings::OUTPUTFORMATS = QStringLiteral("outputformats");
QString ConfigStrings::OUTPUTPREFIXES = QStringLiteral("outputprefixes");
QString ConfigStrings::OUTPUTSUFFIXES = QStringLiteral("outputsuffixes");
QString ConfigStrings::PROJECT = QStringLiteral("project");
-QString ConfigStrings::REDIRECTDOCUMENTATIONTODEVNULL = QStringLiteral("redirectdocumentationtodevnull");
+QString ConfigStrings::REDIRECTDOCUMENTATIONTODEVNULL =
+ QStringLiteral("redirectdocumentationtodevnull");
QString ConfigStrings::QHP = QStringLiteral("qhp");
QString ConfigStrings::QUOTINGINFORMATION = QStringLiteral("quotinginformation");
QString ConfigStrings::SCRIPTDIRS = QStringLiteral("scriptdirs");
@@ -205,7 +206,7 @@ void MetaStack::process(QChar ch, const Location &location)
top().next.clear();
for (const auto &prefix : prefixes) {
- for (const auto &suffix: suffixes)
+ for (const auto &suffix : suffixes)
top().next << prefix + suffix;
}
} else if (ch == QLatin1Char(',') && count() > 1) {
@@ -256,8 +257,7 @@ QMap<QString, QStringList> Config::includeFilesMap_;
internal state variables to either default values or to ones
defined in command line arguments \a args.
*/
-Config::Config(const QString &programName, const QStringList &args)
- : prog(programName)
+Config::Config(const QString &programName, const QStringList &args) : prog(programName)
{
++numInstances;
processCommandLineOptions(args);
@@ -309,7 +309,7 @@ void Config::reset()
#undef SET
setListFlag(CONFIG_NOLINKERRORS,
m_parser.isSet(m_parser.noLinkErrorsOption)
- || qEnvironmentVariableIsSet("QDOC_NOLINKERRORS"));
+ || qEnvironmentVariableIsSet("QDOC_NOLINKERRORS"));
// CONFIG_DEFINES and CONFIG_INCLUDEPATHS are set in load()
}
@@ -418,12 +418,11 @@ void Config::setIndexDirs()
{
m_indexDirs = m_parser.values(m_parser.indexDirOption);
auto it = std::remove_if(m_indexDirs.begin(), m_indexDirs.end(),
- [](const QString &s) { return !QFile::exists(s); });
+ [](const QString &s) { return !QFile::exists(s); });
- std::for_each(it, m_indexDirs.end(),
- [](const QString &s) {
- Location::logToStdErrAlways(tr("Cannot find index directory: %1").arg(s));
- });
+ std::for_each(it, m_indexDirs.end(), [](const QString &s) {
+ Location::logToStdErrAlways(tr("Cannot find index directory: %1").arg(s));
+ });
m_indexDirs.erase(it, m_indexDirs.end());
}
@@ -517,13 +516,13 @@ QString Config::getString(const QString &var, const QString &defaultString) cons
QString value("");
int i = configVars.size() - 1;
while (i >= 0) {
- const ConfigVar& cv = configVars[i];
+ const ConfigVar &cv = configVars[i];
if (!cv.location_.isEmpty())
const_cast<Config *>(this)->lastLocation_ = cv.location_;
if (!cv.values_.isEmpty()) {
if (!cv.plus_)
value.clear();
- for (int j=0; j<cv.values_.size(); ++j) {
+ for (int j = 0; j < cv.values_.size(); ++j) {
if (!value.isEmpty() && !value.endsWith(QChar('\n')))
value.append(QChar(' '));
value.append(cv.values_[j]);
@@ -601,7 +600,7 @@ QStringList Config::getCanonicalPathList(const QString &var, bool validate) cons
if (!configVars.empty()) {
int i = configVars.size() - 1;
while (i >= 0) {
- const ConfigVar& cv = configVars[i];
+ const ConfigVar &cv = configVars[i];
if (!cv.location_.isEmpty())
const_cast<Config *>(this)->lastLocation_ = cv.location_;
if (!cv.plus_)
@@ -610,7 +609,7 @@ QStringList Config::getCanonicalPathList(const QString &var, bool validate) cons
const QStringList &sl = cv.values_;
if (!sl.isEmpty()) {
t.reserve(t.size() + sl.size());
- for (int i=0; i<sl.size(); ++i) {
+ for (int i = 0; i < sl.size(); ++i) {
QDir dir(sl[i].simplified());
QString path = dir.path();
if (dir.isRelative())
@@ -746,8 +745,7 @@ QString Config::getIncludeFilePath(const QString &fileName) const
The directories in \a excludedDirs are avoided. The files
in \a excludedFiles are not included in the return list.
*/
-QStringList Config::getAllFiles(const QString &filesVar,
- const QString &dirsVar,
+QStringList Config::getAllFiles(const QString &filesVar, const QString &dirsVar,
const QSet<QString> &excludedDirs,
const QSet<QString> &excludedFiles)
{
@@ -794,10 +792,8 @@ QStringList Config::getExampleImageFiles(const QSet<QString> &excludedDirs,
\a location is used for obtaining the file and line numbers
for report qdoc errors.
*/
-QString Config::findFile(const Location &location,
- const QStringList &files,
- const QStringList &dirs,
- const QString &fileName,
+QString Config::findFile(const Location &location, const QStringList &files,
+ const QStringList &dirs, const QString &fileName,
QString *userFriendlyFilePath)
{
if (fileName.isEmpty() || fileName.startsWith(QLatin1Char('/'))) {
@@ -811,8 +807,7 @@ QString Config::findFile(const Location &location,
QString firstComponent = components.first();
for (const auto &file : files) {
- if (file == firstComponent ||
- file.endsWith(QLatin1Char('/') + firstComponent)) {
+ if (file == firstComponent || file.endsWith(QLatin1Char('/') + firstComponent)) {
fileInfo.setFile(file);
if (!fileInfo.exists())
location.fatal(tr("File '%1' does not exist").arg(file));
@@ -854,18 +849,12 @@ QString Config::findFile(const Location &location,
/*!
*/
-QString Config::findFile(const Location &location,
- const QStringList &files,
- const QStringList &dirs,
- const QString &fileBase,
- const QStringList &fileExtensions,
- QString *userFriendlyFilePath)
+QString Config::findFile(const Location &location, const QStringList &files,
+ const QStringList &dirs, const QString &fileBase,
+ const QStringList &fileExtensions, QString *userFriendlyFilePath)
{
for (const auto &extension : fileExtensions) {
- QString filePath = findFile(location,
- files,
- dirs,
- fileBase + QLatin1Char('.') + extension,
+ QString filePath = findFile(location, files, dirs, fileBase + QLatin1Char('.') + extension,
userFriendlyFilePath);
if (!filePath.isEmpty())
return filePath;
@@ -880,15 +869,14 @@ QString Config::findFile(const Location &location,
the file and line number where a qdoc error occurred. The
constructed output file name is returned.
*/
-QString Config::copyFile(const Location &location,
- const QString &sourceFilePath,
- const QString &userFriendlySourceFilePath,
- const QString &targetDirPath)
+QString Config::copyFile(const Location &location, const QString &sourceFilePath,
+ const QString &userFriendlySourceFilePath, const QString &targetDirPath)
{
QFile inFile(sourceFilePath);
if (!inFile.open(QFile::ReadOnly)) {
location.warning(tr("Cannot open input file for copy: '%1': %2")
- .arg(sourceFilePath).arg(inFile.errorString()));
+ .arg(sourceFilePath)
+ .arg(inFile.errorString()));
return QString();
}
@@ -903,7 +891,8 @@ QString Config::copyFile(const Location &location,
QFile outFile(outFileName);
if (!outFile.open(QFile::WriteOnly)) {
location.warning(tr("Cannot open output file for copy: '%1': %2")
- .arg(outFileName).arg(outFile.errorString()));
+ .arg(outFileName)
+ .arg(outFile.errorString()));
return QString();
}
@@ -945,8 +934,7 @@ bool Config::removeDirContents(const QString &dir)
if (entry.isFile()) {
if (!dirInfo.remove(entry.fileName()))
ok = false;
- }
- else if (entry.isDir()) {
+ } else if (entry.isDir()) {
if (entry.fileName() != QLatin1String(".") && entry.fileName() != QLatin1String("..")) {
if (removeDirContents(entry.absoluteFilePath())) {
if (!dirInfo.rmdir(entry.fileName()))
@@ -966,12 +954,8 @@ bool Config::removeDirContents(const QString &dir)
*/
bool Config::isMetaKeyChar(QChar ch)
{
- return ch.isLetterOrNumber()
- || ch == QLatin1Char('_')
- || ch == QLatin1Char('.')
- || ch == QLatin1Char('{')
- || ch == QLatin1Char('}')
- || ch == QLatin1Char(',');
+ return ch.isLetterOrNumber() || ch == QLatin1Char('_') || ch == QLatin1Char('.')
+ || ch == QLatin1Char('{') || ch == QLatin1Char('}') || ch == QLatin1Char(',');
}
/*!
@@ -985,10 +969,13 @@ QStringList Config::loadMaster(const QString &fileName)
if (!fin.open(QFile::ReadOnly | QFile::Text)) {
if (!Config::installDir.isEmpty()) {
int prefix = location.filePath().length() - location.fileName().length();
- fin.setFileName(Config::installDir + QLatin1Char('/') + fileName.right(fileName.length() - prefix));
+ fin.setFileName(Config::installDir + QLatin1Char('/')
+ + fileName.right(fileName.length() - prefix));
}
if (!fin.open(QFile::ReadOnly | QFile::Text))
- location.fatal(tr("Cannot open master qdocconf file '%1': %2").arg(fileName).arg(fin.errorString()));
+ location.fatal(tr("Cannot open master qdocconf file '%1': %2")
+ .arg(fileName)
+ .arg(fin.errorString()));
}
QTextStream stream(&fin);
#ifndef QT_NO_TEXTCODEC
@@ -1018,20 +1005,20 @@ void Config::load(Location location, const QString &fileName)
QDir::setCurrent(path);
QRegExp keySyntax(QLatin1String("\\w+(?:\\.\\w+)*"));
-#define SKIP_CHAR() \
- do { \
- location.advance(c); \
- ++i; \
- c = text.at(i); \
- cc = c.unicode(); \
-} while (0)
+#define SKIP_CHAR() \
+ do { \
+ location.advance(c); \
+ ++i; \
+ c = text.at(i); \
+ cc = c.unicode(); \
+ } while (0)
-#define SKIP_SPACES() \
- while (c.isSpace() && cc != '\n') \
+#define SKIP_SPACES() \
+ while (c.isSpace() && cc != '\n') \
SKIP_CHAR()
-#define PUT_CHAR() \
- word += c; \
+#define PUT_CHAR() \
+ word += c; \
SKIP_CHAR();
if (location.depth() > 16)
@@ -1041,7 +1028,8 @@ void Config::load(Location location, const QString &fileName)
if (!fin.open(QFile::ReadOnly | QFile::Text)) {
if (!Config::installDir.isEmpty()) {
int prefix = location.filePath().length() - location.fileName().length();
- fin.setFileName(Config::installDir + QLatin1Char('/') + fileName.right(fileName.length() - prefix));
+ fin.setFileName(Config::installDir + QLatin1Char('/')
+ + fileName.right(fileName.length() - prefix));
}
if (!fin.open(QFile::ReadOnly | QFile::Text))
location.fatal(tr("Cannot open file '%1': %2").arg(fileName).arg(fin.errorString()));
@@ -1111,8 +1099,7 @@ void Config::load(Location location, const QString &fileName)
const QByteArray val = qgetenv(var.toLatin1().data());
if (val.isNull()) {
location.fatal(tr("Environment variable '%1' undefined").arg(var));
- }
- else {
+ } else {
includeFile += QString::fromLatin1(val);
}
}
@@ -1133,8 +1120,7 @@ void Config::load(Location location, const QString &fileName)
Here is the recursive call.
*/
load(location, QFileInfo(QDir(path), includeFile).filePath());
- }
- else {
+ } else {
/*
It wasn't an include statement, so it's something else.
We must see either '=' or '+=' next. If not, fatal error.
@@ -1155,26 +1141,22 @@ void Config::load(Location location, const QString &fileName)
SKIP_CHAR();
if (cc == '\n') {
SKIP_CHAR();
- }
- else if (cc > '0' && cc < '8') {
+ } else if (cc > '0' && cc < '8') {
word += QChar(c.digitValue());
SKIP_CHAR();
- }
- else if ((metaCharPos = QString::fromLatin1("abfnrtv").indexOf(c)) != -1) {
+ } else if ((metaCharPos = QString::fromLatin1("abfnrtv").indexOf(c))
+ != -1) {
word += QLatin1Char("\a\b\f\n\r\t\v"[metaCharPos]);
SKIP_CHAR();
- }
- else {
+ } else {
PUT_CHAR();
}
- }
- else if (c.isSpace() || cc == '#') {
+ } else if (c.isSpace() || cc == '#') {
if (inQuote) {
if (cc == '\n')
location.fatal(tr("Unterminated string"));
PUT_CHAR();
- }
- else {
+ } else {
if (!word.isEmpty()) {
if (metWord)
stringValue += QLatin1Char(' ');
@@ -1188,8 +1170,7 @@ void Config::load(Location location, const QString &fileName)
break;
SKIP_SPACES();
}
- }
- else if (cc == '"') {
+ } else if (cc == '"') {
if (inQuote) {
if (!prevWordQuoted)
stringValue += QLatin1Char(' ');
@@ -1202,8 +1183,7 @@ void Config::load(Location location, const QString &fileName)
}
inQuote = !inQuote;
SKIP_CHAR();
- }
- else if (cc == '$') {
+ } else if (cc == '$') {
QString var;
SKIP_CHAR();
while (c.isLetterOrNumber() || cc == '_') {
@@ -1214,13 +1194,11 @@ void Config::load(Location location, const QString &fileName)
const QByteArray val = qgetenv(var.toLatin1().constData());
if (val.isNull()) {
location.fatal(tr("Environment variable '%1' undefined").arg(var));
- }
- else {
+ } else {
word += QString::fromLatin1(val);
}
}
- }
- else {
+ } else {
if (!inQuote && cc == '=')
location.fatal(tr("Unexpected '='"));
PUT_CHAR();
@@ -1231,7 +1209,8 @@ void Config::load(Location location, const QString &fileName)
keyLoc.fatal(tr("Invalid key '%1'").arg(key));
ConfigVarMultimap::Iterator i;
- i = configVars_.insert(key, ConfigVar(key, rhsValues, QDir::currentPath(), keyLoc));
+ i = configVars_.insert(key,
+ ConfigVar(key, rhsValues, QDir::currentPath(), keyLoc));
i.value().plus_ = plus;
}
}
@@ -1256,13 +1235,12 @@ bool Config::isFileExcluded(const QString &fileName, const QSet<QString> &exclud
return excludedFiles.contains(fileName);
}
-QStringList Config::getFilesHere(const QString &uncleanDir,
- const QString &nameFilter,
- const Location &location,
- const QSet<QString> &excludedDirs,
+QStringList Config::getFilesHere(const QString &uncleanDir, const QString &nameFilter,
+ const Location &location, const QSet<QString> &excludedDirs,
const QSet<QString> &excludedFiles)
{
- QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : QDir(uncleanDir).canonicalPath();
+ QString dir =
+ location.isEmpty() ? QDir::cleanPath(uncleanDir) : QDir(uncleanDir).canonicalPath();
QStringList result;
if (excludedDirs.contains(dir))
return result;
@@ -1273,7 +1251,7 @@ QStringList Config::getFilesHere(const QString &uncleanDir,
dirInfo.setSorting(QDir::Name);
dirInfo.setFilter(QDir::Files);
QStringList fileNames = dirInfo.entryList();
- for (const auto &file: qAsConst(fileNames)) {
+ for (const auto &file : qAsConst(fileNames)) {
if (!file.startsWith(QLatin1Char('~'))) {
QString s = dirInfo.filePath(file);
QString c = QDir::cleanPath(s);
@@ -1283,10 +1261,11 @@ QStringList Config::getFilesHere(const QString &uncleanDir,
}
dirInfo.setNameFilters(QStringList(QLatin1String("*")));
- dirInfo.setFilter(QDir::Dirs|QDir::NoDotAndDotDot);
+ dirInfo.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
fileNames = dirInfo.entryList();
for (const auto &file : fileNames)
- result += getFilesHere(dirInfo.filePath(file), nameFilter, location, excludedDirs, excludedFiles);
+ result += getFilesHere(dirInfo.filePath(file), nameFilter, location, excludedDirs,
+ excludedFiles);
return result;
}
diff --git a/src/qdoc/config.h b/src/qdoc/config.h
index 7006f002a..85a12c0b3 100644
--- a/src/qdoc/config.h
+++ b/src/qdoc/config.h
@@ -48,20 +48,26 @@ QT_BEGIN_NAMESPACE
This struct contains all the information for
one config variable found in a qdocconf file.
*/
-struct ConfigVar {
+struct ConfigVar
+{
bool plus_;
QString name_;
QStringList values_;
QString currentPath_;
Location location_;
- ConfigVar() : plus_(false) { }
+ ConfigVar() : plus_(false) {}
- ConfigVar(const QString &name, const QStringList &values, const QString &dir)
- : plus_(true), name_(name), values_(values), currentPath_(dir) { }
+ ConfigVar(const QString &name, const QStringList &values, const QString &dir)
+ : plus_(true), name_(name), values_(values), currentPath_(dir)
+ {
+ }
- ConfigVar(const QString &name, const QStringList &values, const QString &dir, const Location &loc)
- : plus_(false), name_(name), values_(values), currentPath_(dir), location_(loc) { }
+ ConfigVar(const QString &name, const QStringList &values, const QString &dir,
+ const Location &loc)
+ : plus_(false), name_(name), values_(values), currentPath_(dir), location_(loc)
+ {
+ }
};
/*
@@ -103,34 +109,29 @@ public:
QVector<QRegExp> getRegExpList(const QString &var) const;
QSet<QString> subVars(const QString &var) const;
void subVarsAndValues(const QString &var, ConfigVarMultimap &t) const;
- QStringList getAllFiles(const QString &filesVar,
- const QString &dirsVar,
+ QStringList getAllFiles(const QString &filesVar, const QString &dirsVar,
const QSet<QString> &excludedDirs = QSet<QString>(),
const QSet<QString> &excludedFiles = QSet<QString>());
QString getIncludeFilePath(const QString &fileName) const;
- QStringList getExampleQdocFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles);
- QStringList getExampleImageFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles);
+ QStringList getExampleQdocFiles(const QSet<QString> &excludedDirs,
+ const QSet<QString> &excludedFiles);
+ QStringList getExampleImageFiles(const QSet<QString> &excludedDirs,
+ const QSet<QString> &excludedFiles);
static QStringList loadMaster(const QString &fileName);
static bool isFileExcluded(const QString &fileName, const QSet<QString> &excludedFiles);
- static QStringList getFilesHere(const QString &dir,
- const QString &nameFilter,
+ static QStringList getFilesHere(const QString &dir, const QString &nameFilter,
const Location &location = Location(),
const QSet<QString> &excludedDirs = QSet<QString>(),
const QSet<QString> &excludedFiles = QSet<QString>());
- static QString findFile(const Location &location,
- const QStringList &files,
- const QStringList &dirs,
- const QString &fileName,
+ static QString findFile(const Location &location, const QStringList &files,
+ const QStringList &dirs, const QString &fileName,
QString *userFriendlyFilePath = nullptr);
- static QString findFile(const Location &location,
- const QStringList &files,
- const QStringList &dirs,
- const QString &fileBase,
+ static QString findFile(const Location &location, const QStringList &files,
+ const QStringList &dirs, const QString &fileBase,
const QStringList &fileExtensions,
QString *userFriendlyFilePath = nullptr);
- static QString copyFile(const Location &location,
- const QString &sourceFilePath,
+ static QString copyFile(const Location &location, const QString &sourceFilePath,
const QString &userFriendlySourceFilePath,
const QString &targetDirPath);
static int numParams(const QString &value);
@@ -174,7 +175,7 @@ private:
QString prog;
Location loc;
Location lastLocation_;
- ConfigVarMultimap configVars_;
+ ConfigVarMultimap configVars_;
static QMap<QString, QString> uncompressedFiles;
static QMap<QString, QString> extractedDirs;
diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp
index 843e24db6..550e01328 100644
--- a/src/qdoc/cppcodemarker.cpp
+++ b/src/qdoc/cppcodemarker.cpp
@@ -62,7 +62,7 @@ CppCodeMarker::~CppCodeMarker()
/*!
Returns \c true.
*/
-bool CppCodeMarker::recognizeCode(const QString &/* code */)
+bool CppCodeMarker::recognizeCode(const QString & /* code */)
{
return true;
}
@@ -74,20 +74,9 @@ bool CppCodeMarker::recognizeCode(const QString &/* code */)
bool CppCodeMarker::recognizeExtension(const QString &extension)
{
QByteArray ext = extension.toLatin1();
- return ext == "c" ||
- ext == "c++" ||
- ext == "qdoc" ||
- ext == "qtt" ||
- ext == "qtx" ||
- ext == "cc" ||
- ext == "cpp" ||
- ext == "cxx" ||
- ext == "ch" ||
- ext == "h" ||
- ext == "h++" ||
- ext == "hh" ||
- ext == "hpp" ||
- ext == "hxx";
+ return ext == "c" || ext == "c++" || ext == "qdoc" || ext == "qtt" || ext == "qtx"
+ || ext == "cc" || ext == "cpp" || ext == "cxx" || ext == "ch" || ext == "h"
+ || ext == "h++" || ext == "hh" || ext == "hpp" || ext == "hxx";
}
/*!
@@ -106,15 +95,13 @@ Atom::AtomType CppCodeMarker::atomType() const
return Atom::Code;
}
-QString CppCodeMarker::markedUpCode(const QString &code,
- const Node *relative,
+QString CppCodeMarker::markedUpCode(const QString &code, const Node *relative,
const Location &location)
{
return addMarkUp(code, relative, location);
}
-QString CppCodeMarker::markedUpSynopsis(const Node *node,
- const Node * /* relative */,
+QString CppCodeMarker::markedUpSynopsis(const Node *node, const Node * /* relative */,
Section::Style style)
{
const int MaxEnumValues = 6;
@@ -133,13 +120,9 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
name = "<@name>" + name + "</@name>";
if (style == Section::Details) {
- if (!node->isRelatedNonmember() &&
- !node->isProxyNode() &&
- !node->parent()->name().isEmpty() &&
- !node->parent()->isHeader() &&
- !node->isProperty() &&
- !node->isQmlNode() &&
- !node->isJsNode()) {
+ if (!node->isRelatedNonmember() && !node->isProxyNode() && !node->parent()->name().isEmpty()
+ && !node->parent()->isHeader() && !node->isProperty() && !node->isQmlNode()
+ && !node->isJsNode()) {
name.prepend(taggedNode(node->parent()) + "::");
}
}
@@ -152,7 +135,7 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
synopsis = "class " + name;
break;
case Node::Function:
- func = (const FunctionNode *) node;
+ func = (const FunctionNode *)node;
if (style != Section::AllMembers && !func->returnType().isEmpty())
synopsis = typified(func->returnType(), true);
@@ -195,17 +178,17 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
if (func->isPureVirtual())
synopsis.append(" = 0");
if (func->isRef())
- synopsis.append(" &");
+ synopsis.append(" &");
else if (func->isRefRef())
- synopsis.append(" &&");
+ synopsis.append(" &&");
} else if (style == Section::AllMembers) {
if (!func->returnType().isEmpty() && func->returnType() != "void")
synopsis += " : " + typified(func->returnType());
} else {
if (func->isRef())
- synopsis.append(" &");
+ synopsis.append(" &");
else if (func->isRefRef())
- synopsis.append(" &&");
+ synopsis.append(" &&");
QStringList bracketed;
if (func->isStatic()) {
bracketed += "static";
@@ -256,7 +239,7 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
}
} else {
for (int i = 0; i < documentedItems.size(); ++i) {
- if (i < MaxEnumValues-2 || i == documentedItems.size()-1) {
+ if (i < MaxEnumValues - 2 || i == documentedItems.size() - 1) {
if (i != 0)
synopsis += ", ";
synopsis += documentedItems.at(i);
@@ -287,8 +270,7 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
if (style == Section::AllMembers) {
synopsis = name + " : " + typified(variable->dataType());
} else {
- synopsis = typified(variable->leftType(), true) +
- name + protect(variable->rightType());
+ synopsis = typified(variable->leftType(), true) + name + protect(variable->rightType());
}
break;
default:
@@ -423,8 +405,8 @@ QString CppCodeMarker::markedUpIncludes(const QStringList &includes)
QString code;
for (const auto &include : includes)
- code += "<@preprocessor>#include &lt;<@headerfile>"
- + include + "</@headerfile>&gt;</@preprocessor>\n";
+ code += "<@preprocessor>#include &lt;<@headerfile>" + include
+ + "</@headerfile>&gt;</@preprocessor>\n";
return code;
}
@@ -433,7 +415,7 @@ QString CppCodeMarker::functionBeginRegExp(const QString &funcName)
return QLatin1Char('^') + QRegExp::escape(funcName) + QLatin1Char('$');
}
-QString CppCodeMarker::functionEndRegExp(const QString &/* funcName */)
+QString CppCodeMarker::functionEndRegExp(const QString & /* funcName */)
{
return "^\\}$";
}
@@ -451,8 +433,7 @@ QString CppCodeMarker::functionEndRegExp(const QString &/* funcName */)
@type
*/
-QString CppCodeMarker::addMarkUp(const QString &in,
- const Node * /* relative */,
+QString CppCodeMarker::addMarkUp(const QString &in, const Node * /* relative */,
const Location & /* location */)
{
static QSet<QString> types;
@@ -462,26 +443,42 @@ QString CppCodeMarker::addMarkUp(const QString &in,
// initialize statics
Q_ASSERT(keywords.isEmpty());
static const QString typeTable[] = {
- QLatin1String("bool"), QLatin1String("char"), QLatin1String("double"), QLatin1String("float"), QLatin1String("int"), QLatin1String("long"), QLatin1String("short"),
- QLatin1String("signed"), QLatin1String("unsigned"), QLatin1String("uint"), QLatin1String("ulong"), QLatin1String("ushort"), QLatin1String("uchar"), QLatin1String("void"),
- QLatin1String("qlonglong"), QLatin1String("qulonglong"),
- QLatin1String("qint"), QLatin1String("qint8"), QLatin1String("qint16"), QLatin1String("qint32"), QLatin1String("qint64"),
- QLatin1String("quint"), QLatin1String("quint8"), QLatin1String("quint16"), QLatin1String("quint32"), QLatin1String("quint64"),
- QLatin1String("qreal"), QLatin1String("cond")
+ QLatin1String("bool"), QLatin1String("char"), QLatin1String("double"),
+ QLatin1String("float"), QLatin1String("int"), QLatin1String("long"),
+ QLatin1String("short"), QLatin1String("signed"), QLatin1String("unsigned"),
+ QLatin1String("uint"), QLatin1String("ulong"), QLatin1String("ushort"),
+ QLatin1String("uchar"), QLatin1String("void"), QLatin1String("qlonglong"),
+ QLatin1String("qulonglong"), QLatin1String("qint"), QLatin1String("qint8"),
+ QLatin1String("qint16"), QLatin1String("qint32"), QLatin1String("qint64"),
+ QLatin1String("quint"), QLatin1String("quint8"), QLatin1String("quint16"),
+ QLatin1String("quint32"), QLatin1String("quint64"), QLatin1String("qreal"),
+ QLatin1String("cond")
};
static const QString keywordTable[] = {
- QLatin1String("and"), QLatin1String("and_eq"), QLatin1String("asm"), QLatin1String("auto"), QLatin1String("bitand"), QLatin1String("bitor"), QLatin1String("break"),
- QLatin1String("case"), QLatin1String("catch"), QLatin1String("class"), QLatin1String("compl"), QLatin1String("const"), QLatin1String("const_cast"),
- QLatin1String("continue"), QLatin1String("default"), QLatin1String("delete"), QLatin1String("do"), QLatin1String("dynamic_cast"), QLatin1String("else"),
- QLatin1String("enum"), QLatin1String("explicit"), QLatin1String("export"), QLatin1String("extern"), QLatin1String("false"), QLatin1String("for"), QLatin1String("friend"),
- QLatin1String("goto"), QLatin1String("if"), QLatin1String("include"), QLatin1String("inline"), QLatin1String("monitor"), QLatin1String("mutable"), QLatin1String("namespace"),
- QLatin1String("new"), QLatin1String("not"), QLatin1String("not_eq"), QLatin1String("operator"), QLatin1String("or"), QLatin1String("or_eq"), QLatin1String("private"), QLatin1String("protected"),
- QLatin1String("public"), QLatin1String("register"), QLatin1String("reinterpret_cast"), QLatin1String("return"), QLatin1String("sizeof"),
- QLatin1String("static"), QLatin1String("static_cast"), QLatin1String("struct"), QLatin1String("switch"), QLatin1String("template"), QLatin1String("this"),
- QLatin1String("throw"), QLatin1String("true"), QLatin1String("try"), QLatin1String("typedef"), QLatin1String("typeid"), QLatin1String("typename"), QLatin1String("union"),
- QLatin1String("using"), QLatin1String("virtual"), QLatin1String("volatile"), QLatin1String("wchar_t"), QLatin1String("while"), QLatin1String("xor"),
- QLatin1String("xor_eq"), QLatin1String("synchronized"),
+ QLatin1String("and"), QLatin1String("and_eq"), QLatin1String("asm"),
+ QLatin1String("auto"), QLatin1String("bitand"), QLatin1String("bitor"),
+ QLatin1String("break"), QLatin1String("case"), QLatin1String("catch"),
+ QLatin1String("class"), QLatin1String("compl"), QLatin1String("const"),
+ QLatin1String("const_cast"), QLatin1String("continue"), QLatin1String("default"),
+ QLatin1String("delete"), QLatin1String("do"), QLatin1String("dynamic_cast"),
+ QLatin1String("else"), QLatin1String("enum"), QLatin1String("explicit"),
+ QLatin1String("export"), QLatin1String("extern"), QLatin1String("false"),
+ QLatin1String("for"), QLatin1String("friend"), QLatin1String("goto"),
+ QLatin1String("if"), QLatin1String("include"), QLatin1String("inline"),
+ QLatin1String("monitor"), QLatin1String("mutable"), QLatin1String("namespace"),
+ QLatin1String("new"), QLatin1String("not"), QLatin1String("not_eq"),
+ QLatin1String("operator"), QLatin1String("or"), QLatin1String("or_eq"),
+ QLatin1String("private"), QLatin1String("protected"), QLatin1String("public"),
+ QLatin1String("register"), QLatin1String("reinterpret_cast"), QLatin1String("return"),
+ QLatin1String("sizeof"), QLatin1String("static"), QLatin1String("static_cast"),
+ QLatin1String("struct"), QLatin1String("switch"), QLatin1String("template"),
+ QLatin1String("this"), QLatin1String("throw"), QLatin1String("true"),
+ QLatin1String("try"), QLatin1String("typedef"), QLatin1String("typeid"),
+ QLatin1String("typename"), QLatin1String("union"), QLatin1String("using"),
+ QLatin1String("virtual"), QLatin1String("volatile"), QLatin1String("wchar_t"),
+ QLatin1String("while"), QLatin1String("xor"), QLatin1String("xor_eq"),
+ QLatin1String("synchronized"),
// Qt specific
QLatin1String("signals"), QLatin1String("slots"), QLatin1String("emit")
};
@@ -494,8 +491,7 @@ QString CppCodeMarker::addMarkUp(const QString &in,
for (int j = sizeof(keywordTable) / sizeof(QString) - 1; j; --j)
keywords.insert(keywordTable[j]);
}
-#define readChar() \
- ch = (i < code.length()) ? code[i++].cell() : EOF
+#define readChar() ch = (i < code.length()) ? code[i++].cell() : EOF
QString code = in;
QString out;
diff --git a/src/qdoc/cppcodemarker.h b/src/qdoc/cppcodemarker.h
index 2a8456103..b585bce48 100644
--- a/src/qdoc/cppcodemarker.h
+++ b/src/qdoc/cppcodemarker.h
@@ -45,7 +45,8 @@ public:
bool recognizeExtension(const QString &ext) override;
bool recognizeLanguage(const QString &lang) override;
Atom::AtomType atomType() const override;
- QString markedUpCode(const QString &code, const Node *relative, const Location &location) override;
+ QString markedUpCode(const QString &code, const Node *relative,
+ const Location &location) override;
QString markedUpSynopsis(const Node *node, const Node *relative, Section::Style style) override;
QString markedUpQmlItem(const Node *node, bool summary) override;
QString markedUpName(const Node *node) override;
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index ce92448de..6a5087583 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -62,56 +62,26 @@ static QSet<QString> metaCommands_;
CppCodeParser::CppCodeParser()
{
if (topicCommands_.isEmpty()) {
- topicCommands_ << COMMAND_CLASS
- << COMMAND_DITAMAP
- << COMMAND_DONTDOCUMENT
- << COMMAND_ENUM
- << COMMAND_EXAMPLE
- << COMMAND_EXTERNALPAGE
- << COMMAND_FN
- << COMMAND_GROUP
- << COMMAND_HEADERFILE
- << COMMAND_MACRO
- << COMMAND_MODULE
- << COMMAND_NAMESPACE
- << COMMAND_PAGE
- << COMMAND_PROPERTY
- << COMMAND_TYPEALIAS
- << COMMAND_TYPEDEF
- << COMMAND_VARIABLE
- << COMMAND_QMLTYPE
- << COMMAND_QMLPROPERTY
- << COMMAND_QMLPROPERTYGROUP // mws 13/03/2019
- << COMMAND_QMLATTACHEDPROPERTY
- << COMMAND_QMLSIGNAL
- << COMMAND_QMLATTACHEDSIGNAL
- << COMMAND_QMLMETHOD
- << COMMAND_QMLATTACHEDMETHOD
- << COMMAND_QMLBASICTYPE
- << COMMAND_QMLMODULE
- << COMMAND_JSTYPE
- << COMMAND_JSPROPERTY
- << COMMAND_JSPROPERTYGROUP // mws 13/03/2019
- << COMMAND_JSATTACHEDPROPERTY
- << COMMAND_JSSIGNAL
- << COMMAND_JSATTACHEDSIGNAL
- << COMMAND_JSMETHOD
- << COMMAND_JSATTACHEDMETHOD
- << COMMAND_JSBASICTYPE
- << COMMAND_JSMODULE
- << COMMAND_STRUCT
- << COMMAND_UNION;
+ topicCommands_ << COMMAND_CLASS << COMMAND_DITAMAP << COMMAND_DONTDOCUMENT << COMMAND_ENUM
+ << COMMAND_EXAMPLE << COMMAND_EXTERNALPAGE << COMMAND_FN << COMMAND_GROUP
+ << COMMAND_HEADERFILE << COMMAND_MACRO << COMMAND_MODULE << COMMAND_NAMESPACE
+ << COMMAND_PAGE << COMMAND_PROPERTY << COMMAND_TYPEALIAS << COMMAND_TYPEDEF
+ << COMMAND_VARIABLE << COMMAND_QMLTYPE << COMMAND_QMLPROPERTY
+ << COMMAND_QMLPROPERTYGROUP // mws 13/03/2019
+ << COMMAND_QMLATTACHEDPROPERTY << COMMAND_QMLSIGNAL
+ << COMMAND_QMLATTACHEDSIGNAL << COMMAND_QMLMETHOD
+ << COMMAND_QMLATTACHEDMETHOD << COMMAND_QMLBASICTYPE << COMMAND_QMLMODULE
+ << COMMAND_JSTYPE << COMMAND_JSPROPERTY
+ << COMMAND_JSPROPERTYGROUP // mws 13/03/2019
+ << COMMAND_JSATTACHEDPROPERTY << COMMAND_JSSIGNAL << COMMAND_JSATTACHEDSIGNAL
+ << COMMAND_JSMETHOD << COMMAND_JSATTACHEDMETHOD << COMMAND_JSBASICTYPE
+ << COMMAND_JSMODULE << COMMAND_STRUCT << COMMAND_UNION;
}
if (metaCommands_.isEmpty()) {
metaCommands_ = commonMetaCommands();
- metaCommands_ << COMMAND_CONTENTSPAGE
- << COMMAND_INHEADERFILE
- << COMMAND_NEXTPAGE
- << COMMAND_OVERLOAD
- << COMMAND_PREVIOUSPAGE
- << COMMAND_QMLINSTANTIATES
- << COMMAND_REIMP
- << COMMAND_RELATES;
+ metaCommands_ << COMMAND_CONTENTSPAGE << COMMAND_INHEADERFILE << COMMAND_NEXTPAGE
+ << COMMAND_OVERLOAD << COMMAND_PREVIOUSPAGE << COMMAND_QMLINSTANTIATES
+ << COMMAND_REIMP << COMMAND_RELATES;
}
}
@@ -148,11 +118,10 @@ void CppCodeParser::initializeParser(const Config &config)
nodeTypeTestFuncMap_.insert(COMMAND_PROPERTY, &Node::isProperty);
nodeTypeTestFuncMap_.insert(COMMAND_VARIABLE, &Node::isVariable);
-
exampleFiles = config.getCanonicalPathList(CONFIG_EXAMPLES);
exampleDirs = config.getCanonicalPathList(CONFIG_EXAMPLEDIRS);
- QStringList exampleFilePatterns = config.getStringList(
- CONFIG_EXAMPLES + Config::dot + CONFIG_FILEEXTENSIONS);
+ QStringList exampleFilePatterns =
+ config.getStringList(CONFIG_EXAMPLES + Config::dot + CONFIG_FILEEXTENSIONS);
// Used for excluding dirs and files from the list of example files
const auto &excludeDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS);
@@ -165,8 +134,8 @@ void CppCodeParser::initializeParser(const Config &config)
else
exampleNameFilter = "*.cpp *.h *.js *.xq *.svg *.xml *.dita *.ui";
- QStringList exampleImagePatterns = config.getStringList(
- CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS);
+ QStringList exampleImagePatterns =
+ config.getStringList(CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS);
if (!exampleImagePatterns.isEmpty())
exampleImageFilter = exampleImagePatterns.join(' ');
@@ -215,15 +184,13 @@ const QSet<QString> &CppCodeParser::topicCommands()
/*!
Process the topic \a command found in the \a doc with argument \a arg.
*/
-Node *CppCodeParser::processTopicCommand(const Doc &doc,
- const QString &command,
+Node *CppCodeParser::processTopicCommand(const Doc &doc, const QString &command,
const ArgLocPair &arg)
{
ExtraFuncData extra;
if (command == COMMAND_FN) {
Q_UNREACHABLE();
- }
- else if (nodeTypeMap_.contains(command)) {
+ } else if (nodeTypeMap_.contains(command)) {
/*
We should only get in here if the command refers to
something that can appear in a C++ namespace,
@@ -232,7 +199,7 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
this way to allow the writer to refer to the entity
without including the namespace qualifier.
*/
- Node::NodeType type = nodeTypeMap_[command];
+ Node::NodeType type = nodeTypeMap_[command];
QStringList words = arg.first.split(QLatin1Char(' '));
QStringList path;
int idx = 0;
@@ -247,11 +214,12 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
node = qdb_->findNodeByNameAndType(path, nodeTypeTestFuncMap_[command]);
if (node == nullptr) {
if (isWorthWarningAbout(doc)) {
- doc.location().warning(tr("Cannot find '%1' specified with '\\%2' in any header file")
- .arg(arg.first).arg(command));
+ doc.location().warning(
+ tr("Cannot find '%1' specified with '\\%2' in any header file")
+ .arg(arg.first)
+ .arg(command));
}
- }
- else if (node->isAggregate()) {
+ } else if (node->isAggregate()) {
if (type == Node::Namespace) {
NamespaceNode *ns = static_cast<NamespaceNode *>(node);
ns->markSeen();
@@ -260,10 +228,8 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
/*
This treats a class as a namespace.
*/
- if ((type == Node::Class) ||
- (type == Node::Namespace) ||
- (type == Node::Struct) ||
- (type == Node::Union)) {
+ if ((type == Node::Class) || (type == Node::Namespace) || (type == Node::Struct)
+ || (type == Node::Union)) {
if (path.size() > 1) {
path.pop_back();
QString ns = path.join(QLatin1String("::"));
@@ -272,54 +238,46 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
}
}
return node;
- }
- else if (command == COMMAND_EXAMPLE) {
+ } else if (command == COMMAND_EXAMPLE) {
if (Config::generateExamples) {
ExampleNode *en = new ExampleNode(qdb_->primaryTreeRoot(), arg.first);
en->setLocation(doc.startLocation());
setExampleFileLists(en);
return en;
}
- }
- else if (command == COMMAND_EXTERNALPAGE) {
+ } else if (command == COMMAND_EXTERNALPAGE) {
ExternalPageNode *epn = new ExternalPageNode(qdb_->primaryTreeRoot(), arg.first);
epn->setLocation(doc.startLocation());
return epn;
- }
- else if (command == COMMAND_HEADERFILE) {
+ } else if (command == COMMAND_HEADERFILE) {
HeaderNode *hn = new HeaderNode(qdb_->primaryTreeRoot(), arg.first);
hn->setLocation(doc.startLocation());
return hn;
- }
- else if (command == COMMAND_GROUP) {
+ } else if (command == COMMAND_GROUP) {
CollectionNode *cn = qdb_->addGroup(arg.first);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
- }
- else if (command == COMMAND_MODULE) {
+ } else if (command == COMMAND_MODULE) {
CollectionNode *cn = qdb_->addModule(arg.first);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
- }
- else if (command == COMMAND_QMLMODULE) {
+ } else if (command == COMMAND_QMLMODULE) {
QStringList blankSplit = arg.first.split(QLatin1Char(' '));
CollectionNode *cn = qdb_->addQmlModule(blankSplit[0]);
cn->setLogicalModuleInfo(blankSplit);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
- }
- else if (command == COMMAND_JSMODULE) {
+ } else if (command == COMMAND_JSMODULE) {
QStringList blankSplit = arg.first.split(QLatin1Char(' '));
CollectionNode *cn = qdb_->addJsModule(blankSplit[0]);
cn->setLogicalModuleInfo(blankSplit);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
- }
- else if (command == COMMAND_PAGE) {
+ } else if (command == COMMAND_PAGE) {
Node::PageType ptype = Node::ArticlePage;
QStringList args = arg.first.split(QLatin1Char(' '));
if (args.size() > 1) {
@@ -365,18 +323,14 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
n->setLocation(doc.startLocation());
return n;
} else if (command == COMMAND_JSBASICTYPE) {
- QmlBasicTypeNode *n = new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first, Node::JsBasicType);
+ QmlBasicTypeNode *n =
+ new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first, Node::JsBasicType);
n->setLocation(doc.startLocation());
return n;
- }
- else if ((command == COMMAND_QMLSIGNAL) ||
- (command == COMMAND_QMLMETHOD) ||
- (command == COMMAND_QMLATTACHEDSIGNAL) ||
- (command == COMMAND_QMLATTACHEDMETHOD) ||
- (command == COMMAND_JSSIGNAL) ||
- (command == COMMAND_JSMETHOD) ||
- (command == COMMAND_JSATTACHEDSIGNAL) ||
- (command == COMMAND_JSATTACHEDMETHOD)) {
+ } else if ((command == COMMAND_QMLSIGNAL) || (command == COMMAND_QMLMETHOD)
+ || (command == COMMAND_QMLATTACHEDSIGNAL) || (command == COMMAND_QMLATTACHEDMETHOD)
+ || (command == COMMAND_JSSIGNAL) || (command == COMMAND_JSMETHOD)
+ || (command == COMMAND_JSATTACHEDSIGNAL) || (command == COMMAND_JSATTACHEDMETHOD)) {
Q_UNREACHABLE();
}
return nullptr;
@@ -401,11 +355,8 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
\note The two QML types \e{Component} and \e{QtObject}
never have a module qualifier.
*/
-bool CppCodeParser::splitQmlPropertyArg(const QString &arg,
- QString &type,
- QString &module,
- QString &qmlTypeName,
- QString &name,
+bool CppCodeParser::splitQmlPropertyArg(const QString &arg, QString &type, QString &module,
+ QString &qmlTypeName, QString &name,
const Location &location)
{
QStringList blankSplit = arg.split(QLatin1Char(' '));
@@ -426,8 +377,7 @@ bool CppCodeParser::splitQmlPropertyArg(const QString &arg,
}
QString msg = "Unrecognizable QML module/component qualifier for " + arg;
location.warning(tr(msg.toLatin1().data()));
- }
- else {
+ } else {
QString msg = "Missing property type for " + arg;
location.warning(tr(msg.toLatin1().data()));
}
@@ -463,15 +413,16 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
if (qmlType == nullptr)
qmlType = new QmlTypeNode(qdb_->primaryTreeRoot(), qmlTypeName);
- for (int i=0; i<topics.size(); ++i) {
+ for (int i = 0; i < topics.size(); ++i) {
QString cmd = topics.at(i).topic;
arg = topics.at(i).args;
- if ((cmd == COMMAND_QMLPROPERTY) || (cmd == COMMAND_QMLATTACHEDPROPERTY) ||
- (cmd == COMMAND_JSPROPERTY) || (cmd == COMMAND_JSATTACHEDPROPERTY)) {
+ if ((cmd == COMMAND_QMLPROPERTY) || (cmd == COMMAND_QMLATTACHEDPROPERTY)
+ || (cmd == COMMAND_JSPROPERTY) || (cmd == COMMAND_JSATTACHEDPROPERTY)) {
bool attached = topics.at(i).topic.contains(QLatin1String("attached"));
if (splitQmlPropertyArg(arg, type, module, qmlTypeName, property, doc.location())) {
if (qmlType != qdb_->findQmlType(module, qmlTypeName)) {
- QString msg = tr("All properties in a group must belong to the same type: '%1'").arg(arg);
+ QString msg = tr("All properties in a group must belong to the same type: '%1'")
+ .arg(arg);
doc.startLocation().warning(msg);
continue;
}
@@ -488,7 +439,8 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
sharedNodes << qpn;
}
} else {
- doc.startLocation().warning(tr("Command '\\%1'; not allowed with QML/JS property commands").arg(cmd));
+ doc.startLocation().warning(
+ tr("Command '\\%1'; not allowed with QML/JS property commands").arg(cmd));
}
}
@@ -522,10 +474,8 @@ const QSet<QString> &CppCodeParser::metaCommands()
\a node is guaranteed to be non-null.
*/
-void CppCodeParser::processMetaCommand(const Doc &doc,
- const QString &command,
- const ArgLocPair &argLocPair,
- Node *node)
+void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
+ const ArgLocPair &argLocPair, Node *node)
{
QString arg = argLocPair.first;
if (command == COMMAND_INHEADERFILE) {
@@ -533,8 +483,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
static_cast<Aggregate *>(node)->addIncludeFile(arg);
else
doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_INHEADERFILE));
- }
- else if (command == COMMAND_OVERLOAD) {
+ } else if (command == COMMAND_OVERLOAD) {
/*
Note that this might set the overload flag of the
primary function. This is ok because the overload
@@ -547,8 +496,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
static_cast<SharedCommentNode *>(node)->setOverloadFlags();
else
doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_OVERLOAD));
- }
- else if (command == COMMAND_REIMP) {
+ } else if (command == COMMAND_REIMP) {
if (node->parent() && !node->parent()->isInternal()) {
if (node->isFunction()) {
FunctionNode *fn = static_cast<FunctionNode *>(node);
@@ -558,38 +506,37 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
// set, issue a warning.
if (fn->overridesThis().isEmpty() && isWorthWarningAbout(doc)) {
doc.location().warning(tr("Cannot find base function for '\\%1' in %2()")
- .arg(COMMAND_REIMP).arg(node->name()),
+ .arg(COMMAND_REIMP)
+ .arg(node->name()),
tr("The function either doesn't exist in any "
"base class with the same signature or it "
"exists but isn't virtual."));
}
fn->setReimpFlag();
- }
- else {
- doc.location().warning(tr("Ignored '\\%1' in %2").arg(COMMAND_REIMP).arg(node->name()));
+ } else {
+ doc.location().warning(
+ tr("Ignored '\\%1' in %2").arg(COMMAND_REIMP).arg(node->name()));
}
}
- }
- else if (command == COMMAND_RELATES) {
+ } else if (command == COMMAND_RELATES) {
QStringList path = arg.split("::");
Aggregate *aggregate = qdb_->findRelatesNode(path);
if (aggregate == nullptr)
aggregate = new ProxyNode(node->root(), arg);
if (node->parent() == aggregate) { // node is already a child of aggregate
- doc.location().warning(tr("Invalid '\\%1' (already a member of '%2')")
- .arg(COMMAND_RELATES, arg));
+ doc.location().warning(
+ tr("Invalid '\\%1' (already a member of '%2')").arg(COMMAND_RELATES, arg));
} else {
if (node->isAggregate()) {
doc.location().warning(tr("Invalid '\\%1' not allowed in '\\%2'")
- .arg(COMMAND_RELATES, node->nodeTypeString()));
+ .arg(COMMAND_RELATES, node->nodeTypeString()));
} else if (!node->isRelatedNonmember() &&
//!node->parent()->name().isEmpty() &&
- !node->parent()->isNamespace() &&
- !node->parent()->isHeader()) {
+ !node->parent()->isNamespace() && !node->parent()->isHeader()) {
if (!doc.isInternal()) {
doc.location().warning(tr("Invalid '\\%1' ('%2' must be global)")
- .arg(COMMAND_RELATES, node->name()));
+ .arg(COMMAND_RELATES, node->name()));
}
} else if (!node->isRelatedNonmember() && !node->parent()->isHeader()) {
aggregate->adoptChild(node);
@@ -603,51 +550,41 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
Node *clone = node->clone(aggregate);
if (clone == nullptr) {
doc.location().warning(tr("Invalid '\\%1' (multiple uses not allowed in '%2')")
- .arg(COMMAND_RELATES, node->nodeTypeString()));
+ .arg(COMMAND_RELATES, node->nodeTypeString()));
} else {
clone->setRelatedNonmember(true);
}
}
}
- }
- else if (command == COMMAND_CONTENTSPAGE) {
+ } else if (command == COMMAND_CONTENTSPAGE) {
setLink(node, Node::ContentsLink, arg);
- }
- else if (command == COMMAND_NEXTPAGE) {
+ } else if (command == COMMAND_NEXTPAGE) {
setLink(node, Node::NextLink, arg);
- }
- else if (command == COMMAND_PREVIOUSPAGE) {
+ } else if (command == COMMAND_PREVIOUSPAGE) {
setLink(node, Node::PreviousLink, arg);
- }
- else if (command == COMMAND_STARTPAGE) {
+ } else if (command == COMMAND_STARTPAGE) {
setLink(node, Node::StartLink, arg);
- }
- else if (command == COMMAND_QMLINHERITS) {
+ } else if (command == COMMAND_QMLINHERITS) {
if (node->name() == arg)
doc.location().warning(tr("%1 tries to inherit itself").arg(arg));
else if (node->isQmlType() || node->isJsType()) {
QmlTypeNode *qmlType = static_cast<QmlTypeNode *>(node);
qmlType->setQmlBaseName(arg);
}
- }
- else if (command == COMMAND_QMLINSTANTIATES) {
+ } else if (command == COMMAND_QMLINSTANTIATES) {
if (node->isQmlType() || node->isJsType()) {
ClassNode *classNode = qdb_->findClassNode(arg.split("::"));
if (classNode)
node->setClassNode(classNode);
else
doc.location().warning(tr("C++ class %1 not found: \\instantiates %1").arg(arg));
- }
- else
+ } else
doc.location().warning(tr("\\instantiates is only allowed in \\qmltype"));
- }
- else if (command == COMMAND_QMLDEFAULT) {
+ } else if (command == COMMAND_QMLDEFAULT) {
node->markDefault();
- }
- else if (command == COMMAND_QMLREADONLY) {
+ } else if (command == COMMAND_QMLREADONLY) {
node->markReadOnly(1);
- }
- else if ((command == COMMAND_QMLABSTRACT) || (command == COMMAND_ABSTRACT)) {
+ } else if ((command == COMMAND_QMLABSTRACT) || (command == COMMAND_ABSTRACT)) {
if (node->isQmlType() || node->isJsType())
node->setAbstract(true);
} else if (command == COMMAND_DEPRECATED) {
@@ -656,13 +593,14 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
// Note: \ingroup and \inpublicgroup are the same (and now recognized as such).
qdb_->addToGroup(arg, node);
} else if (command == COMMAND_INMODULE) {
- qdb_->addToModule(arg,node);
+ qdb_->addToModule(arg, node);
} else if (command == COMMAND_INQMLMODULE) {
- qdb_->addToQmlModule(arg,node);
+ qdb_->addToQmlModule(arg, node);
} else if (command == COMMAND_INJSMODULE) {
qdb_->addToJsModule(arg, node);
} else if (command == COMMAND_MAINCLASS) {
- node->doc().location().warning(tr("'\\mainclass' is deprecated. Consider '\\ingroup mainclasses'"));
+ node->doc().location().warning(
+ tr("'\\mainclass' is deprecated. Consider '\\ingroup mainclasses'"));
} else if (command == COMMAND_OBSOLETE) {
node->setStatus(Node::Obsolete);
} else if (command == COMMAND_NONREENTRANT) {
@@ -695,8 +633,9 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
} else if (command == COMMAND_QTVARIABLE) {
node->setQtVariable(arg);
if (!node->isModule() && !node->isQmlModule())
- doc.location().warning(tr("Command '\\%1' is only meaningful in '\\module' and '\\qmlmodule'.")
- .arg(COMMAND_QTVARIABLE));
+ doc.location().warning(
+ tr("Command '\\%1' is only meaningful in '\\module' and '\\qmlmodule'.")
+ .arg(COMMAND_QTVARIABLE));
} else if (command == COMMAND_NOAUTOLIST) {
node->setNoAutoList(true);
}
@@ -721,7 +660,8 @@ void CppCodeParser::processMetaCommands(const Doc &doc, Node *node)
/*!
Parse QML/JS signal/method topic commands.
*/
-FunctionNode *CppCodeParser::parseOtherFuncArg(const QString &topic, const Location &location, const QString &funcArg)
+FunctionNode *CppCodeParser::parseOtherFuncArg(const QString &topic, const Location &location,
+ const QString &funcArg)
{
QString funcName;
QString returnType;
@@ -827,42 +767,40 @@ FunctionNode *CppCodeParser::parseMacroArg(const Location &location, const QStri
oldMacroNode->doc().location().warning(tr("(The previous doc is here)"));
}
return macro;
- }
+}
void CppCodeParser::setExampleFileLists(PageNode *pn)
{
QString examplePath = pn->name();
- QString proFileName = examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".pro";
- QString fullPath = Config::findFile(pn->doc().location(),
- exampleFiles,
- exampleDirs,
- proFileName);
+ QString proFileName =
+ examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".pro";
+ QString fullPath =
+ Config::findFile(pn->doc().location(), exampleFiles, exampleDirs, proFileName);
if (fullPath.isEmpty()) {
QString tmp = proFileName;
proFileName = examplePath + QLatin1Char('/') + "qbuild.pro";
- fullPath = Config::findFile(pn->doc().location(),
- exampleFiles,
- exampleDirs,
- proFileName);
+ fullPath = Config::findFile(pn->doc().location(), exampleFiles, exampleDirs, proFileName);
if (fullPath.isEmpty()) {
- proFileName = examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".qmlproject";
- fullPath = Config::findFile(pn->doc().location(),
- exampleFiles,
- exampleDirs,
- proFileName);
+ proFileName = examplePath + QLatin1Char('/')
+ + examplePath.split(QLatin1Char('/')).last() + ".qmlproject";
+ fullPath =
+ Config::findFile(pn->doc().location(), exampleFiles, exampleDirs, proFileName);
if (fullPath.isEmpty()) {
- proFileName = examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".pyproject";
- fullPath = Config::findFile(pn->doc().location(),
- exampleFiles,
- exampleDirs,
+ proFileName = examplePath + QLatin1Char('/')
+ + examplePath.split(QLatin1Char('/')).last() + ".pyproject";
+ fullPath = Config::findFile(pn->doc().location(), exampleFiles, exampleDirs,
proFileName);
if (fullPath.isEmpty()) {
- QString details = QLatin1String("Example directories: ") + exampleDirs.join(QLatin1Char(' '));
+ QString details = QLatin1String("Example directories: ")
+ + exampleDirs.join(QLatin1Char(' '));
if (!exampleFiles.isEmpty())
- details += QLatin1String(", example files: ") + exampleFiles.join(QLatin1Char(' '));
- pn->location().warning(tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName), details);
- pn->location().warning(tr(" EXAMPLE PATH DOES NOT EXIST: %1").arg(examplePath), details);
+ details += QLatin1String(", example files: ")
+ + exampleFiles.join(QLatin1Char(' '));
+ pn->location().warning(
+ tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName), details);
+ pn->location().warning(tr(" EXAMPLE PATH DOES NOT EXIST: %1").arg(examplePath),
+ details);
return;
}
}
@@ -874,11 +812,13 @@ void CppCodeParser::setExampleFileLists(PageNode *pn)
sizeOfBoringPartOfName = sizeOfBoringPartOfName - 2;
fullPath.truncate(fullPath.lastIndexOf('/'));
- QStringList exampleFiles = Config::getFilesHere(fullPath, exampleNameFilter, Location(), excludeDirs, excludeFiles);
+ QStringList exampleFiles = Config::getFilesHere(fullPath, exampleNameFilter, Location(),
+ excludeDirs, excludeFiles);
// Search for all image files under the example project, excluding doc/images directory.
QSet<QString> excludeDocDirs(excludeDirs);
excludeDocDirs.insert(QDir(fullPath).canonicalPath() + "/doc/images");
- QStringList imageFiles = Config::getFilesHere(fullPath, exampleImageFilter, Location(), excludeDocDirs, excludeFiles);
+ QStringList imageFiles = Config::getFilesHere(fullPath, exampleImageFilter, Location(),
+ excludeDocDirs, excludeFiles);
if (!exampleFiles.isEmpty()) {
// move main.cpp and to the end, if it exists
QString mainCpp;
@@ -889,12 +829,13 @@ void CppCodeParser::setExampleFileLists(PageNode *pn)
mainCpp = fileName;
return true;
}
- return fileName.contains("/qrc_") || fileName.contains("/moc_") || fileName.contains("/ui_");
+ return fileName.contains("/qrc_") || fileName.contains("/moc_")
+ || fileName.contains("/ui_");
};
- exampleFiles.erase(std::remove_if(exampleFiles.begin(), exampleFiles.end(),
- isGeneratedOrMainCpp),
- exampleFiles.end());
+ exampleFiles.erase(
+ std::remove_if(exampleFiles.begin(), exampleFiles.end(), isGeneratedOrMainCpp),
+ exampleFiles.end());
if (!mainCpp.isEmpty())
exampleFiles.append(mainCpp);
@@ -918,10 +859,8 @@ void CppCodeParser::setExampleFileLists(PageNode *pn)
*/
bool CppCodeParser::isJSMethodTopic(const QString &t)
{
- return (t == COMMAND_JSSIGNAL ||
- t == COMMAND_JSMETHOD ||
- t == COMMAND_JSATTACHEDSIGNAL ||
- t == COMMAND_JSATTACHEDMETHOD);
+ return (t == COMMAND_JSSIGNAL || t == COMMAND_JSMETHOD || t == COMMAND_JSATTACHEDSIGNAL
+ || t == COMMAND_JSATTACHEDMETHOD);
}
/*!
@@ -930,10 +869,8 @@ bool CppCodeParser::isJSMethodTopic(const QString &t)
*/
bool CppCodeParser::isQMLMethodTopic(const QString &t)
{
- return (t == COMMAND_QMLSIGNAL ||
- t == COMMAND_QMLMETHOD ||
- t == COMMAND_QMLATTACHEDSIGNAL ||
- t == COMMAND_QMLATTACHEDMETHOD);
+ return (t == COMMAND_QMLSIGNAL || t == COMMAND_QMLMETHOD || t == COMMAND_QMLATTACHEDSIGNAL
+ || t == COMMAND_QMLATTACHEDMETHOD);
}
/*!
@@ -954,7 +891,8 @@ bool CppCodeParser::isQMLPropertyTopic(const QString &t)
return (t == COMMAND_QMLPROPERTY || t == COMMAND_QMLATTACHEDPROPERTY);
}
-void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeList &nodes, DocList &docs)
+void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeList &nodes,
+ DocList &docs)
{
if (isQMLPropertyTopic(topic) || isJSPropertyTopic(topic)) {
processQmlProperties(doc, nodes, docs);
diff --git a/src/qdoc/cppcodeparser.h b/src/qdoc/cppcodeparser.h
index d6b1cead0..04e556dc6 100644
--- a/src/qdoc/cppcodeparser.h
+++ b/src/qdoc/cppcodeparser.h
@@ -41,14 +41,17 @@ class CppCodeParser : public CodeParser
{
Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeParser)
- struct ExtraFuncData {
+ struct ExtraFuncData
+ {
Aggregate *root; // Used as the parent.
Node::NodeType type; // The node type: Function, etc.
bool isAttached; // If true, the method is attached.
- bool isMacro; // If true, we are parsing a macro signature.
- ExtraFuncData() : root(nullptr), type(Node::Function), isAttached(false), isMacro(false) { }
+ bool isMacro; // If true, we are parsing a macro signature.
+ ExtraFuncData() : root(nullptr), type(Node::Function), isAttached(false), isMacro(false) {}
ExtraFuncData(Aggregate *r, Node::NodeType t, bool a)
- : root(r), type(t), isAttached(a), isMacro(false) { }
+ : root(r), type(t), isAttached(a), isMacro(false)
+ {
+ }
};
public:
@@ -60,7 +63,8 @@ public:
QStringList headerFileNameFilter() override;
QStringList sourceFileNameFilter() override;
FunctionNode *parseMacroArg(const Location &location, const QString &macroArg);
- FunctionNode *parseOtherFuncArg(const QString &topic, const Location &location, const QString &funcArg);
+ FunctionNode *parseOtherFuncArg(const QString &topic, const Location &location,
+ const QString &funcArg);
static bool isJSMethodTopic(const QString &t);
static bool isQMLMethodTopic(const QString &t);
static bool isJSPropertyTopic(const QString &t);
@@ -69,17 +73,13 @@ public:
protected:
static const QSet<QString> &topicCommands();
static const QSet<QString> &metaCommands();
- virtual Node *processTopicCommand(const Doc &doc,
- const QString &command,
+ virtual Node *processTopicCommand(const Doc &doc, const QString &command,
const ArgLocPair &arg);
void processQmlProperties(const Doc &doc, NodeList &nodes, DocList &docs);
- bool splitQmlPropertyArg(const QString &arg,
- QString &type,
- QString &module,
- QString &element,
- QString &name,
- const Location &location);
- void processMetaCommand(const Doc &doc, const QString &command, const ArgLocPair &argLocPair, Node *node);
+ bool splitQmlPropertyArg(const QString &arg, QString &type, QString &module, QString &element,
+ QString &name, const Location &location);
+ void processMetaCommand(const Doc &doc, const QString &command, const ArgLocPair &argLocPair,
+ Node *node);
void processMetaCommands(const Doc &doc, Node *node);
void processMetaCommands(NodeList &nodes, DocList &docs);
void processTopicArgs(const Doc &doc, const QString &topic, NodeList &nodes, DocList &docs);
@@ -89,7 +89,7 @@ private:
void setExampleFileLists(PageNode *pn);
protected:
- typedef bool (Node::*NodeTypeTestFunc) () const;
+ typedef bool (Node::*NodeTypeTestFunc)() const;
QMap<QString, NodeTypeTestFunc> nodeTypeTestFuncMap_;
QMap<QString, Node::NodeType> nodeTypeMap_;
diff --git a/src/qdoc/doc.cpp b/src/qdoc/doc.cpp
index 83033ca51..9929a2a2a 100644
--- a/src/qdoc/doc.cpp
+++ b/src/qdoc/doc.cpp
@@ -174,117 +174,116 @@ enum {
NOT_A_CMD
};
-static struct {
+static struct
+{
const char *english;
int no;
QString *alias;
-} cmds[] = {
- { "a", CMD_A, nullptr },
- { "annotatedlist", CMD_ANNOTATEDLIST, nullptr },
- { "b", CMD_B, nullptr },
- { "badcode", CMD_BADCODE, nullptr },
- { "bold", CMD_BOLD, nullptr },
- { "br", CMD_BR, nullptr },
- { "brief", CMD_BRIEF, nullptr },
- { "c", CMD_C, nullptr },
- { "caption", CMD_CAPTION, nullptr },
- { "code", CMD_CODE, nullptr },
- { "codeline", CMD_CODELINE, nullptr },
- { "div", CMD_DIV, nullptr},
- { "dots", CMD_DOTS, nullptr },
- { "e", CMD_E, nullptr },
- { "else", CMD_ELSE, nullptr },
- { "endcode", CMD_ENDCODE, nullptr },
- { "enddiv", CMD_ENDDIV, nullptr },
- { "endfootnote", CMD_ENDFOOTNOTE, nullptr },
- { "endif", CMD_ENDIF, nullptr },
- { "endlegalese", CMD_ENDLEGALESE, nullptr },
- { "endlink", CMD_ENDLINK, nullptr },
- { "endlist", CMD_ENDLIST, nullptr },
- { "endmapref", CMD_ENDMAPREF, nullptr },
- { "endomit", CMD_ENDOMIT, nullptr },
- { "endquotation", CMD_ENDQUOTATION, nullptr },
- { "endraw", CMD_ENDRAW, nullptr },
- { "endsection1", CMD_ENDSECTION1, nullptr }, // ### don't document for now
- { "endsection2", CMD_ENDSECTION2, nullptr }, // ### don't document for now
- { "endsection3", CMD_ENDSECTION3, nullptr }, // ### don't document for now
- { "endsection4", CMD_ENDSECTION4, nullptr }, // ### don't document for now
- { "endsidebar", CMD_ENDSIDEBAR, nullptr },
- { "endtable", CMD_ENDTABLE, nullptr },
- { "endtopicref", CMD_ENDTOPICREF, nullptr },
- { "footnote", CMD_FOOTNOTE, nullptr },
- { "generatelist", CMD_GENERATELIST, nullptr },
- { "granularity", CMD_GRANULARITY, nullptr }, // ### don't document for now
- { "header", CMD_HEADER, nullptr },
- { "hr", CMD_HR, nullptr },
- { "i", CMD_I, nullptr},
- { "if", CMD_IF, nullptr },
- { "image", CMD_IMAGE, nullptr },
- { "important", CMD_IMPORTANT, nullptr },
- { "include", CMD_INCLUDE, nullptr },
- { "inlineimage", CMD_INLINEIMAGE, nullptr },
- { "index", CMD_INDEX, nullptr }, // ### don't document for now
- { "input", CMD_INPUT, nullptr },
- { "keyword", CMD_KEYWORD, nullptr },
- { "l", CMD_L, nullptr },
- { "legalese", CMD_LEGALESE, nullptr},
- { "li", CMD_LI, nullptr},
- { "link", CMD_LINK, nullptr },
- { "list", CMD_LIST, nullptr },
- { "mapref", CMD_MAPREF, nullptr },
- { "meta", CMD_META, nullptr },
- { "newcode", CMD_NEWCODE, nullptr },
- { "note", CMD_NOTE, nullptr },
- { "o", CMD_O, nullptr },
- { "oldcode", CMD_OLDCODE, nullptr },
- { "omit", CMD_OMIT, nullptr },
- { "omitvalue", CMD_OMITVALUE, nullptr },
- { "overload", CMD_OVERLOAD, nullptr },
- { "printline", CMD_PRINTLINE, nullptr },
- { "printto", CMD_PRINTTO, nullptr },
- { "printuntil", CMD_PRINTUNTIL, nullptr },
- { "quotation", CMD_QUOTATION, nullptr },
- { "quotefile", CMD_QUOTEFILE, nullptr },
- { "quotefromfile", CMD_QUOTEFROMFILE, nullptr },
- { "quotefunction", CMD_QUOTEFUNCTION, nullptr },
- { "raw", CMD_RAW, nullptr },
- { "row", CMD_ROW, nullptr },
- { "sa", CMD_SA, nullptr },
- { "section1", CMD_SECTION1, nullptr },
- { "section2", CMD_SECTION2, nullptr },
- { "section3", CMD_SECTION3, nullptr },
- { "section4", CMD_SECTION4, nullptr },
- { "sidebar", CMD_SIDEBAR, nullptr },
- { "sincelist", CMD_SINCELIST, nullptr },
- { "skipline", CMD_SKIPLINE, nullptr },
- { "skipto", CMD_SKIPTO, nullptr },
- { "skipuntil", CMD_SKIPUNTIL, nullptr },
- { "snippet", CMD_SNIPPET, nullptr },
- { "span", CMD_SPAN, nullptr },
- { "sub", CMD_SUB, nullptr },
- { "sup", CMD_SUP, nullptr },
- { "table", CMD_TABLE, nullptr },
- { "tableofcontents", CMD_TABLEOFCONTENTS, nullptr },
- { "target", CMD_TARGET, nullptr },
- { "topicref", CMD_TOPICREF, nullptr },
- { "tt", CMD_TT, nullptr },
- { "uicontrol", CMD_UICONTROL, nullptr },
- { "underline", CMD_UNDERLINE, nullptr },
- { "unicode", CMD_UNICODE, nullptr },
- { "value", CMD_VALUE, nullptr },
- { "warning", CMD_WARNING, nullptr },
- { "qml", CMD_QML, nullptr },
- { "endqml", CMD_ENDQML, nullptr },
- { "cpp", CMD_CPP, nullptr },
- { "endcpp", CMD_ENDCPP, nullptr },
- { "qmltext", CMD_QMLTEXT, nullptr },
- { "endqmltext", CMD_ENDQMLTEXT, nullptr },
- { "cpptext", CMD_CPPTEXT, nullptr },
- { "endcpptext", CMD_ENDCPPTEXT, nullptr },
- { "js", CMD_JS, nullptr },
- { "endjs", CMD_ENDJS, nullptr},
- { nullptr, 0, nullptr }
-};
+} cmds[] = { { "a", CMD_A, nullptr },
+ { "annotatedlist", CMD_ANNOTATEDLIST, nullptr },
+ { "b", CMD_B, nullptr },
+ { "badcode", CMD_BADCODE, nullptr },
+ { "bold", CMD_BOLD, nullptr },
+ { "br", CMD_BR, nullptr },
+ { "brief", CMD_BRIEF, nullptr },
+ { "c", CMD_C, nullptr },
+ { "caption", CMD_CAPTION, nullptr },
+ { "code", CMD_CODE, nullptr },
+ { "codeline", CMD_CODELINE, nullptr },
+ { "div", CMD_DIV, nullptr },
+ { "dots", CMD_DOTS, nullptr },
+ { "e", CMD_E, nullptr },
+ { "else", CMD_ELSE, nullptr },
+ { "endcode", CMD_ENDCODE, nullptr },
+ { "enddiv", CMD_ENDDIV, nullptr },
+ { "endfootnote", CMD_ENDFOOTNOTE, nullptr },
+ { "endif", CMD_ENDIF, nullptr },
+ { "endlegalese", CMD_ENDLEGALESE, nullptr },
+ { "endlink", CMD_ENDLINK, nullptr },
+ { "endlist", CMD_ENDLIST, nullptr },
+ { "endmapref", CMD_ENDMAPREF, nullptr },
+ { "endomit", CMD_ENDOMIT, nullptr },
+ { "endquotation", CMD_ENDQUOTATION, nullptr },
+ { "endraw", CMD_ENDRAW, nullptr },
+ { "endsection1", CMD_ENDSECTION1, nullptr }, // ### don't document for now
+ { "endsection2", CMD_ENDSECTION2, nullptr }, // ### don't document for now
+ { "endsection3", CMD_ENDSECTION3, nullptr }, // ### don't document for now
+ { "endsection4", CMD_ENDSECTION4, nullptr }, // ### don't document for now
+ { "endsidebar", CMD_ENDSIDEBAR, nullptr },
+ { "endtable", CMD_ENDTABLE, nullptr },
+ { "endtopicref", CMD_ENDTOPICREF, nullptr },
+ { "footnote", CMD_FOOTNOTE, nullptr },
+ { "generatelist", CMD_GENERATELIST, nullptr },
+ { "granularity", CMD_GRANULARITY, nullptr }, // ### don't document for now
+ { "header", CMD_HEADER, nullptr },
+ { "hr", CMD_HR, nullptr },
+ { "i", CMD_I, nullptr },
+ { "if", CMD_IF, nullptr },
+ { "image", CMD_IMAGE, nullptr },
+ { "important", CMD_IMPORTANT, nullptr },
+ { "include", CMD_INCLUDE, nullptr },
+ { "inlineimage", CMD_INLINEIMAGE, nullptr },
+ { "index", CMD_INDEX, nullptr }, // ### don't document for now
+ { "input", CMD_INPUT, nullptr },
+ { "keyword", CMD_KEYWORD, nullptr },
+ { "l", CMD_L, nullptr },
+ { "legalese", CMD_LEGALESE, nullptr },
+ { "li", CMD_LI, nullptr },
+ { "link", CMD_LINK, nullptr },
+ { "list", CMD_LIST, nullptr },
+ { "mapref", CMD_MAPREF, nullptr },
+ { "meta", CMD_META, nullptr },
+ { "newcode", CMD_NEWCODE, nullptr },
+ { "note", CMD_NOTE, nullptr },
+ { "o", CMD_O, nullptr },
+ { "oldcode", CMD_OLDCODE, nullptr },
+ { "omit", CMD_OMIT, nullptr },
+ { "omitvalue", CMD_OMITVALUE, nullptr },
+ { "overload", CMD_OVERLOAD, nullptr },
+ { "printline", CMD_PRINTLINE, nullptr },
+ { "printto", CMD_PRINTTO, nullptr },
+ { "printuntil", CMD_PRINTUNTIL, nullptr },
+ { "quotation", CMD_QUOTATION, nullptr },
+ { "quotefile", CMD_QUOTEFILE, nullptr },
+ { "quotefromfile", CMD_QUOTEFROMFILE, nullptr },
+ { "quotefunction", CMD_QUOTEFUNCTION, nullptr },
+ { "raw", CMD_RAW, nullptr },
+ { "row", CMD_ROW, nullptr },
+ { "sa", CMD_SA, nullptr },
+ { "section1", CMD_SECTION1, nullptr },
+ { "section2", CMD_SECTION2, nullptr },
+ { "section3", CMD_SECTION3, nullptr },
+ { "section4", CMD_SECTION4, nullptr },
+ { "sidebar", CMD_SIDEBAR, nullptr },
+ { "sincelist", CMD_SINCELIST, nullptr },
+ { "skipline", CMD_SKIPLINE, nullptr },
+ { "skipto", CMD_SKIPTO, nullptr },
+ { "skipuntil", CMD_SKIPUNTIL, nullptr },
+ { "snippet", CMD_SNIPPET, nullptr },
+ { "span", CMD_SPAN, nullptr },
+ { "sub", CMD_SUB, nullptr },
+ { "sup", CMD_SUP, nullptr },
+ { "table", CMD_TABLE, nullptr },
+ { "tableofcontents", CMD_TABLEOFCONTENTS, nullptr },
+ { "target", CMD_TARGET, nullptr },
+ { "topicref", CMD_TOPICREF, nullptr },
+ { "tt", CMD_TT, nullptr },
+ { "uicontrol", CMD_UICONTROL, nullptr },
+ { "underline", CMD_UNDERLINE, nullptr },
+ { "unicode", CMD_UNICODE, nullptr },
+ { "value", CMD_VALUE, nullptr },
+ { "warning", CMD_WARNING, nullptr },
+ { "qml", CMD_QML, nullptr },
+ { "endqml", CMD_ENDQML, nullptr },
+ { "cpp", CMD_CPP, nullptr },
+ { "endcpp", CMD_ENDCPP, nullptr },
+ { "qmltext", CMD_QMLTEXT, nullptr },
+ { "endqmltext", CMD_ENDQMLTEXT, nullptr },
+ { "cpptext", CMD_CPPTEXT, nullptr },
+ { "endcpptext", CMD_ENDCPPTEXT, nullptr },
+ { "js", CMD_JS, nullptr },
+ { "endjs", CMD_ENDJS, nullptr },
+ { nullptr, 0, nullptr } };
typedef QHash<QString, int> QHash_QString_int;
typedef QHash<QString, Macro> QHash_QString_Macro;
@@ -296,24 +295,20 @@ Q_GLOBAL_STATIC(QHash_QString_Macro, macroHash)
class DocPrivateExtra
{
public:
- Doc::Sections granularity_;
- Doc::Sections section_; // ###
- QVector<Atom *> tableOfContents_;
- QVector<int> tableOfContentsLevels_;
- QVector<Atom *> keywords_;
- QVector<Atom *> targets_;
- QStringMultiMap metaMap_;
-
- DocPrivateExtra()
- : granularity_(Doc::Part)
- , section_(Doc::NoSection)
- { }
+ Doc::Sections granularity_;
+ Doc::Sections section_; // ###
+ QVector<Atom *> tableOfContents_;
+ QVector<int> tableOfContentsLevels_;
+ QVector<Atom *> keywords_;
+ QVector<Atom *> targets_;
+ QStringMultiMap metaMap_;
+
+ DocPrivateExtra() : granularity_(Doc::Part), section_(Doc::NoSection) {}
};
struct Shared // ### get rid of
{
- Shared()
- : count(1) { }
+ Shared() : count(1) {}
void ref() { ++count; }
bool deref() { return (--count == 0); }
@@ -323,8 +318,7 @@ struct Shared // ### get rid of
static QString cleanLink(const QString &link)
{
int colonPos = link.indexOf(':');
- if ((colonPos == -1) ||
- (!link.startsWith("file:") && !link.startsWith("mailto:")))
+ if ((colonPos == -1) || (!link.startsWith("file:") && !link.startsWith("mailto:")))
return link;
return link.mid(colonPos + 1).simplified();
}
@@ -334,8 +328,7 @@ typedef QMap<QString, ArgList> CommandMap;
class DocPrivate : public Shared
{
public:
- DocPrivate(const Location &start = Location::null,
- const Location &end = Location::null,
+ DocPrivate(const Location &start = Location::null, const Location &end = Location::null,
const QString &source = QString());
~DocPrivate();
@@ -361,9 +354,7 @@ public:
DitaRefList ditamap_;
};
-DocPrivate::DocPrivate(const Location &start,
- const Location &end,
- const QString &source)
+DocPrivate::DocPrivate(const Location &start, const Location &end, const QString &source)
: start_loc(start),
end_loc(end),
src(source),
@@ -404,9 +395,7 @@ bool DocPrivate::isEnumDocSimplifiable() const
while (atom) {
if (atom->type() == Atom::AutoLink || atom->type() == Atom::String) {
justMetColon = atom->string().endsWith(QLatin1Char(':'));
- }
- else if ((atom->type() == Atom::ListLeft) &&
- (atom->string() == ATOM_LIST_VALUE)) {
+ } else if ((atom->type() == Atom::ListLeft) && (atom->string() == ATOM_LIST_VALUE)) {
if (justMetColon || numValueTables > 0)
return false;
++numValueTables;
@@ -421,9 +410,7 @@ class DocParser
Q_DECLARE_TR_FUNCTIONS(QDoc::DocParser)
public:
- void parse(const QString &source,
- DocPrivate *docPrivate,
- const QSet<QString> &metaCommandSet,
+ void parse(const QString &source, DocPrivate *docPrivate, const QSet<QString> &metaCommandSet,
const QSet<QString> &possibleTopics);
static int endCmdFor(int cmd);
@@ -443,8 +430,7 @@ public:
private:
Location &location();
- QString detailsUnknownCommand(const QSet<QString> &metaCommandSet,
- const QString &str);
+ QString detailsUnknownCommand(const QSet<QString> &metaCommandSet, const QString &str);
void insertTarget(const QString &target, bool keyword);
void include(const QString &fileName, const QString &identifier);
void startFormat(const QString &format, int cmd);
@@ -463,8 +449,7 @@ private:
void appendToCode(const QString &code, Atom::AtomType defaultType);
void startNewPara();
void enterPara(Atom::AtomType leftType = Atom::ParaLeft,
- Atom::AtomType rightType = Atom::ParaRight,
- const QString &string = QString());
+ Atom::AtomType rightType = Atom::ParaRight, const QString &string = QString());
void leavePara();
void leaveValue();
void leaveValueList();
@@ -472,7 +457,8 @@ private:
CodeMarker *quoteFromFile();
bool expandMacro();
void expandMacro(const QString &name, const QString &def, int numParams);
- QString expandMacroToString(const QString &name, const QString &def, int numParams, const QString &matchExpr);
+ QString expandMacroToString(const QString &name, const QString &def, int numParams,
+ const QString &matchExpr);
Doc::Sections getSectioningUnit();
QString getArgument(bool verbatim = false);
QString getBracedArgument(bool verbatim);
@@ -504,12 +490,8 @@ private:
Location cachedLoc;
int cachedPos;
- DocPrivate* priv;
- enum ParagraphState {
- OutsideParagraph,
- InSingleLineParagraph,
- InMultiLineParagraph
- };
+ DocPrivate *priv;
+ enum ParagraphState { OutsideParagraph, InSingleLineParagraph, InMultiLineParagraph };
ParagraphState paraState;
bool inTableHeader;
bool inTableRow;
@@ -546,10 +528,8 @@ bool DocParser::quoting = false;
found in \a source. These metacommands are not markup text
commands. They are topic commands and related metacommands.
*/
-void DocParser::parse(const QString &source,
- DocPrivate *docPrivate,
- const QSet<QString> &metaCommandSet,
- const QSet<QString> &possibleTopics)
+void DocParser::parse(const QString &source, DocPrivate *docPrivate,
+ const QSet<QString> &metaCommandSet, const QSet<QString> &possibleTopics)
{
input_ = source;
pos = 0;
@@ -592,8 +572,7 @@ void DocParser::parse(const QString &source,
if (ch.isLetterOrNumber()) {
cmdStr += ch;
++pos;
- }
- else {
+ } else {
break;
}
}
@@ -604,31 +583,30 @@ void DocParser::parse(const QString &source,
if (input_.at(pos).isSpace()) {
skipAllSpaces();
appendChar(QLatin1Char(' '));
- }
- else {
+ } else {
appendChar(input_.at(pos++));
}
}
- }
- else {
+ } else {
// Ignore quoting atoms to make appendToCode()
// append to the correct atom.
if (!quoting || !isQuote(priv->text.lastAtom()))
lastAtom = priv->text.lastAtom();
- int cmd = cmdHash()->value(cmdStr,NOT_A_CMD);
+ int cmd = cmdHash()->value(cmdStr, NOT_A_CMD);
switch (cmd) {
case CMD_A:
enterPara();
p1 = getArgument();
- append(Atom::FormattingLeft,ATOM_FORMATTING_PARAMETER);
+ append(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER);
append(Atom::String, p1);
- append(Atom::FormattingRight,ATOM_FORMATTING_PARAMETER);
+ append(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER);
priv->params.insert(p1);
break;
case CMD_BADCODE:
leavePara();
- append(Atom::CodeBad, getCode(CMD_BADCODE, marker, getMetaCommandArgument(cmdStr)));
+ append(Atom::CodeBad,
+ getCode(CMD_BADCODE, marker, getMetaCommandArgument(cmdStr)));
break;
case CMD_BR:
enterPara();
@@ -660,18 +638,19 @@ void DocParser::parse(const QString &source,
break;
case CMD_QML:
leavePara();
- append(Atom::Qml, getCode(CMD_QML,
- CodeMarker::markerForLanguage(QLatin1String("QML")),
- getMetaCommandArgument(cmdStr)));
+ append(Atom::Qml,
+ getCode(CMD_QML, CodeMarker::markerForLanguage(QLatin1String("QML")),
+ getMetaCommandArgument(cmdStr)));
break;
case CMD_QMLTEXT:
append(Atom::QmlText);
break;
case CMD_JS:
leavePara();
- append(Atom::JavaScript, getCode(CMD_JS,
- CodeMarker::markerForLanguage(QLatin1String("JavaScript")),
- getMetaCommandArgument(cmdStr)));
+ append(Atom::JavaScript,
+ getCode(CMD_JS,
+ CodeMarker::markerForLanguage(QLatin1String("JavaScript")),
+ getMetaCommandArgument(cmdStr)));
break;
case CMD_DIV:
leavePara();
@@ -764,7 +743,7 @@ void DocParser::parse(const QString &source,
case CMD_ENDLINK:
if (closeCommand(cmd)) {
if (priv->text.lastAtom()->type() == Atom::String
- && priv->text.lastAtom()->string().endsWith(QLatin1Char(' ')))
+ && priv->text.lastAtom()->string().endsWith(QLatin1Char(' ')))
priv->text.lastAtom()->chopString();
append(Atom::FormattingRight, ATOM_FORMATTING_LINK);
}
@@ -773,10 +752,8 @@ void DocParser::parse(const QString &source,
if (closeCommand(cmd)) {
leavePara();
if (openedLists.top().isStarted()) {
- append(Atom::ListItemRight,
- openedLists.top().styleString());
- append(Atom::ListRight,
- openedLists.top().styleString());
+ append(Atom::ListItemRight, openedLists.top().styleString());
+ append(Atom::ListRight, openedLists.top().styleString());
}
openedLists.pop();
}
@@ -836,13 +813,12 @@ void DocParser::parse(const QString &source,
append(Atom::SinceList, getRestOfLine().simplified());
break;
case CMD_GENERATELIST: {
- QString arg1 = getArgument();
- QString arg2 = getOptionalArgument();
- if (!arg2.isEmpty())
- arg1 += " " + arg2;
- append(Atom::GeneratedList, arg1);
- }
- break;
+ QString arg1 = getArgument();
+ QString arg2 = getOptionalArgument();
+ if (!arg2.isEmpty())
+ arg1 += " " + arg2;
+ append(Atom::GeneratedList, arg1);
+ } break;
case CMD_GRANULARITY:
priv->constructExtra();
priv->extra->granularity_ = getSectioningUnit();
@@ -855,16 +831,17 @@ void DocParser::parse(const QString &source,
} else {
if (openedCommands.contains(CMD_TABLE))
location().warning(tr("Cannot use '\\%1' within '\\%2'")
- .arg(cmdName(CMD_HEADER))
- .arg(cmdName(openedCommands.top())));
+ .arg(cmdName(CMD_HEADER))
+ .arg(cmdName(openedCommands.top())));
else
location().warning(tr("Cannot use '\\%1' outside of '\\%2'")
- .arg(cmdName(CMD_HEADER))
- .arg(cmdName(CMD_TABLE)));
+ .arg(cmdName(CMD_HEADER))
+ .arg(cmdName(CMD_TABLE)));
}
break;
case CMD_I:
- location().warning(tr("'\\i' is deprecated. Use '\\e' for italic or '\\li' for list item"));
+ location().warning(tr(
+ "'\\i' is deprecated. Use '\\e' for italic or '\\li' for list item"));
Q_FALLTHROUGH();
case CMD_E:
startFormat(ATOM_FORMATTING_ITALIC, cmd);
@@ -908,15 +885,15 @@ void DocParser::parse(const QString &source,
indexStartedPara = true;
} else {
const Atom *last = priv->text.lastAtom();
- if (indexStartedPara &&
- (last->type() != Atom::FormattingRight ||
- last->string() != ATOM_FORMATTING_INDEX))
+ if (indexStartedPara
+ && (last->type() != Atom::FormattingRight
+ || last->string() != ATOM_FORMATTING_INDEX))
indexStartedPara = false;
}
startFormat(ATOM_FORMATTING_INDEX, cmd);
break;
case CMD_KEYWORD:
- insertTarget(getRestOfLine(),true);
+ insertTarget(getRestOfLine(), true);
break;
case CMD_L:
enterPara();
@@ -926,14 +903,14 @@ void DocParser::parse(const QString &source,
p1 = getArgument();
append(p1, p2);
if (!p2.isEmpty() && !(priv->text.lastAtom()->error().isEmpty()))
- location().warning(tr("Check parameter in '[ ]' of '\\l' command: '%1', "
- "possible misspelling, or unrecognized module name")
- .arg(priv->text.lastAtom()->error()));
+ location().warning(
+ tr("Check parameter in '[ ]' of '\\l' command: '%1', "
+ "possible misspelling, or unrecognized module name")
+ .arg(priv->text.lastAtom()->error()));
if (isLeftBraceAhead()) {
currentLinkAtom = priv->text.lastAtom();
startFormat(ATOM_FORMATTING_LINK, cmd);
- }
- else {
+ } else {
append(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
append(Atom::String, cleanLink(p1));
append(Atom::FormattingRight, ATOM_FORMATTING_LINK);
@@ -942,9 +919,10 @@ void DocParser::parse(const QString &source,
p1 = getArgument();
append(p1, p2);
if (!p2.isEmpty() && !(priv->text.lastAtom()->error().isEmpty()))
- location().warning(tr("Check parameter in '[ ]' of '\\l' command: '%1', "
- "possible misspelling, or unrecognized module name")
- .arg(priv->text.lastAtom()->error()));
+ location().warning(
+ tr("Check parameter in '[ ]' of '\\l' command: '%1', "
+ "possible misspelling, or unrecognized module name")
+ .arg(priv->text.lastAtom()->error()));
append(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
append(Atom::String, cleanLink(p1));
append(Atom::FormattingRight, ATOM_FORMATTING_LINK);
@@ -969,8 +947,7 @@ void DocParser::parse(const QString &source,
case CMD_LIST:
if (openCommand(cmd)) {
leavePara();
- openedLists.push(OpenedList(location(),
- getOptionalArgument()));
+ openedLists.push(OpenedList(location(), getOptionalArgument()));
}
break;
case CMD_TOPICREF:
@@ -1030,9 +1007,9 @@ void DocParser::parse(const QString &source,
if (!inTableHeader && !inTableRow) {
location().warning(tr("Missing '\\%1' or '\\%2' before '\\%3'")
- .arg(cmdName(CMD_HEADER))
- .arg(cmdName(CMD_ROW))
- .arg(cmdName(CMD_LI)));
+ .arg(cmdName(CMD_HEADER))
+ .arg(cmdName(CMD_ROW))
+ .arg(cmdName(CMD_LI)));
append(Atom::TableRowLeft);
inTableRow = true;
} else if (inTableItem) {
@@ -1044,9 +1021,9 @@ void DocParser::parse(const QString &source,
inTableItem = true;
} else
location().warning(tr("Command '\\%1' outside of '\\%2' and '\\%3'")
- .arg(cmdName(cmd))
- .arg(cmdName(CMD_LIST))
- .arg(cmdName(CMD_TABLE)));
+ .arg(cmdName(cmd))
+ .arg(cmdName(CMD_LIST))
+ .arg(cmdName(CMD_TABLE)));
break;
case CMD_OLDCODE:
leavePara();
@@ -1130,7 +1107,9 @@ void DocParser::parse(const QString &source,
append(Atom::CodeQuoteArgument, slashed(marker->functionEndRegExp(p1)));
}
quoter.quoteTo(location(), cmdStr, slashed(marker->functionBeginRegExp(p1)));
- append(Atom::Code, quoter.quoteUntil(location(), cmdStr, slashed(marker->functionEndRegExp(p1))));
+ append(Atom::Code,
+ quoter.quoteUntil(location(), cmdStr,
+ slashed(marker->functionEndRegExp(p1))));
quoter.reset();
break;
}
@@ -1138,8 +1117,8 @@ void DocParser::parse(const QString &source,
leavePara();
p1 = getRestOfLine();
if (p1.isEmpty())
- location().warning(tr("Missing format name after '\\%1'")
- .arg(cmdName(CMD_RAW)));
+ location().warning(
+ tr("Missing format name after '\\%1'").arg(cmdName(CMD_RAW)));
append(Atom::FormatIf, p1);
append(Atom::RawString, untabifyEtc(getUntilEnd(cmd)));
append(Atom::FormatElse);
@@ -1151,17 +1130,17 @@ void DocParser::parse(const QString &source,
if (isLeftBraceAhead())
p1 = getArgument(true);
leaveTableRow();
- append(Atom::TableRowLeft,p1);
+ append(Atom::TableRowLeft, p1);
inTableRow = true;
} else {
if (openedCommands.contains(CMD_TABLE))
location().warning(tr("Cannot use '\\%1' within '\\%2'")
- .arg(cmdName(CMD_ROW))
- .arg(cmdName(openedCommands.top())));
+ .arg(cmdName(CMD_ROW))
+ .arg(cmdName(openedCommands.top())));
else
location().warning(tr("Cannot use '\\%1' outside of '\\%2'")
- .arg(cmdName(CMD_ROW))
- .arg(cmdName(CMD_TABLE)));
+ .arg(cmdName(CMD_ROW))
+ .arg(cmdName(CMD_TABLE)));
}
break;
case CMD_SA:
@@ -1258,7 +1237,7 @@ void DocParser::parse(const QString &source,
append(Atom::TableOfContents, p1);
break;
case CMD_TARGET:
- insertTarget(getRestOfLine(),false);
+ insertTarget(getRestOfLine(), false);
break;
case CMD_TT:
startFormat(ATOM_FORMATTING_TELETYPE, cmd);
@@ -1276,7 +1255,7 @@ void DocParser::parse(const QString &source,
uint unicodeChar = p1.toUInt(&ok, 0);
if (!ok || (unicodeChar == 0x0000) || (unicodeChar > 0xFFFE))
location().warning(tr("Invalid Unicode character '%1' specified with '%2'")
- .arg(p1, cmdName(CMD_UNICODE)));
+ .arg(p1, cmdName(CMD_UNICODE)));
else
append(Atom::String, QChar(unicodeChar));
break;
@@ -1286,7 +1265,8 @@ void DocParser::parse(const QString &source,
if (openedLists.top().style() == OpenedList::Value) {
QString p2;
p1 = getArgument();
- if (p1.startsWith(QLatin1String("[since ")) && p1.endsWith(QLatin1String("]"))) {
+ if (p1.startsWith(QLatin1String("[since "))
+ && p1.endsWith(QLatin1String("]"))) {
p2 = p1.mid(7, p1.length() - 8);
p1 = getArgument();
}
@@ -1327,32 +1307,33 @@ void DocParser::parse(const QString &source,
if (!p1.isEmpty()) {
append(Atom::ParaLeft);
append(Atom::String, "This function overloads ");
- append(Atom::AutoLink,p1);
+ append(Atom::AutoLink, p1);
append(Atom::String, ".");
append(Atom::ParaRight);
} else {
append(Atom::ParaLeft);
- append(Atom::String,"This is an overloaded function.");
+ append(Atom::String, "This is an overloaded function.");
append(Atom::ParaRight);
p1 = getMetaCommandArgument(cmdStr);
}
- priv->metaCommandMap[cmdStr].append(ArgLocPair(p1,location()));
+ priv->metaCommandMap[cmdStr].append(ArgLocPair(p1, location()));
break;
case NOT_A_CMD:
if (metaCommandSet.contains(cmdStr)) {
priv->metacommandsUsed.insert(cmdStr);
QString arg = getMetaCommandArgument(cmdStr);
- priv->metaCommandMap[cmdStr].append(ArgLocPair(arg,location()));
+ priv->metaCommandMap[cmdStr].append(ArgLocPair(arg, location()));
if (possibleTopics.contains(cmdStr)) {
if (!cmdStr.endsWith(QLatin1String("propertygroup")))
- priv->topics_.append(Topic(cmdStr,arg));
+ priv->topics_.append(Topic(cmdStr, arg));
}
} else if (macroHash()->contains(cmdStr)) {
const Macro &macro = macroHash()->value(cmdStr);
int numPendingFi = 0;
int numFormatDefs = 0;
QString matchExpr;
- for (auto it = macro.otherDefs.constBegin(); it != macro.otherDefs.constEnd(); ++it) {
+ for (auto it = macro.otherDefs.constBegin();
+ it != macro.otherDefs.constEnd(); ++it) {
if (it.key() == "match") {
matchExpr = it.value();
} else {
@@ -1372,15 +1353,12 @@ void DocParser::parse(const QString &source,
if (!macro.defaultDef.isEmpty()) {
if (numFormatDefs > 0) {
- macro.defaultDefLocation.warning(
- tr("Macro cannot have both "
- "format-specific and qdoc-"
- "syntax definitions"));
+ macro.defaultDefLocation.warning(tr("Macro cannot have both "
+ "format-specific and qdoc-"
+ "syntax definitions"));
} else {
- QString expanded = expandMacroToString(cmdStr,
- macro.defaultDef,
- macro.numParams,
- matchExpr);
+ QString expanded = expandMacroToString(cmdStr, macro.defaultDef,
+ macro.numParams, matchExpr);
input_.replace(backslashPos, endPos - backslashPos, expanded);
len = input_.length();
pos = backslashPos;
@@ -1408,15 +1386,14 @@ void DocParser::parse(const QString &source,
} else if (latin1Ch == '_' || latin1Ch == '@') {
++numStrangeSymbols;
++curPos;
- } else if ((latin1Ch == ':') &&
- (curPos < cmdStr.size() - 1) &&
- (cmdStr.at(curPos + 1) == QLatin1Char(':'))) {
+ } else if ((latin1Ch == ':') && (curPos < cmdStr.size() - 1)
+ && (cmdStr.at(curPos + 1) == QLatin1Char(':'))) {
++numStrangeSymbols;
curPos += 2;
} else if (latin1Ch == '(') {
if (curPos > 0) {
- if ((curPos < cmdStr.size() - 1) &&
- (cmdStr.at(curPos + 1) == QLatin1Char(')'))) {
+ if ((curPos < cmdStr.size() - 1)
+ && (cmdStr.at(curPos + 1) == QLatin1Char(')'))) {
++numStrangeSymbols;
pos += 2;
break;
@@ -1439,7 +1416,7 @@ void DocParser::parse(const QString &source,
// The QML and JS property group commands are no longer required
// for grouping QML and JS properties. They are allowed but ignored.
location().warning(tr("Unknown command '\\%1'").arg(cmdStr),
- detailsUnknownCommand(metaCommandSet,cmdStr));
+ detailsUnknownCommand(metaCommandSet, cmdStr));
}
enterPara();
append(Atom::UnknownCommand, cmdStr);
@@ -1471,10 +1448,9 @@ void DocParser::parse(const QString &source,
} else if (*format == ATOM_FORMATTING_LINK) {
// hack for C++ to support links like
// \l{QString::}{count()}
- if (currentLinkAtom &&
- currentLinkAtom->string().endsWith("::")) {
- QString suffix = Text::subText(currentLinkAtom,
- priv->text.lastAtom()).toString();
+ if (currentLinkAtom && currentLinkAtom->string().endsWith("::")) {
+ QString suffix =
+ Text::subText(currentLinkAtom, priv->text.lastAtom()).toString();
currentLinkAtom->appendString(suffix);
}
currentLinkAtom = nullptr;
@@ -1515,9 +1491,7 @@ void DocParser::parse(const QString &source,
} else {
if (ch.isSpace()) {
++pos;
- if ((ch == '\n') &&
- (paraState == InSingleLineParagraph ||
- isBlankLine())) {
+ if ((ch == '\n') && (paraState == InSingleLineParagraph || isBlankLine())) {
leavePara();
newWord = false;
} else {
@@ -1552,7 +1526,8 @@ void DocParser::parse(const QString &source,
} else if (latin1Ch == '_' || latin1Ch == '@') {
++numStrangeSymbols;
++pos;
- } else if (latin1Ch == ':' && pos < len - 1 && input_.at(pos + 1) == QLatin1Char(':')) {
+ } else if (latin1Ch == ':' && pos < len - 1
+ && input_.at(pos + 1) == QLatin1Char(':')) {
++numStrangeSymbols;
pos += 2;
} else if (latin1Ch == '(') {
@@ -1587,8 +1562,7 @@ void DocParser::parse(const QString &source,
appendWord(word);
else
append(Atom::AutoLink, word);
- }
- else {
+ } else {
appendWord(word);
}
}
@@ -1606,8 +1580,7 @@ void DocParser::parse(const QString &source,
if (openedCommands.top() != CMD_OMIT) {
location().warning(tr("Missing '\\%1'").arg(endCmdName(openedCommands.top())));
- }
- else if (preprocessorSkipping.count() > 0) {
+ } else if (preprocessorSkipping.count() > 0) {
location().warning(tr("Missing '\\%1'").arg(cmdName(CMD_ENDIF)));
}
@@ -1635,8 +1608,7 @@ Location &DocParser::location()
return cachedLoc;
}
-QString DocParser::detailsUnknownCommand(const QSet<QString> &metaCommandSet,
- const QString &str)
+QString DocParser::detailsUnknownCommand(const QSet<QString> &metaCommandSet, const QString &str)
{
QSet<QString> commandSet = metaCommandSet;
int i = 0;
@@ -1648,7 +1620,8 @@ QString DocParser::detailsUnknownCommand(const QSet<QString> &metaCommandSet,
if (aliasMap()->contains(str))
return tr("The command '\\%1' was renamed '\\%2' by the configuration"
" file. Use the new name.")
- .arg(str).arg((*aliasMap())[str]);
+ .arg(str)
+ .arg((*aliasMap())[str]);
QString best = nearestName(str, commandSet);
if (best.isEmpty())
@@ -1661,15 +1634,13 @@ void DocParser::insertTarget(const QString &target, bool keyword)
if (targetMap_.contains(target)) {
location().warning(tr("Duplicate target name '%1'").arg(target));
targetMap_[target].warning(tr("(The previous occurrence is here)"));
- }
- else {
+ } else {
targetMap_.insert(target, location());
priv->constructExtra();
if (keyword) {
append(Atom::Keyword, target);
priv->extra->keywords_.append(priv->text.lastAtom());
- }
- else {
+ } else {
append(Atom::Target, target);
priv->extra->targets_.append(priv->text.lastAtom());
}
@@ -1685,14 +1656,11 @@ void DocParser::include(const QString &fileName, const QString &identifier)
QString filePath = Doc::config()->getIncludeFilePath(fileName);
if (filePath.isEmpty()) {
location().warning(tr("Cannot find qdoc include file '%1'").arg(fileName));
- }
- else {
+ } else {
QFile inFile(filePath);
if (!inFile.open(QFile::ReadOnly)) {
- location().warning(tr("Cannot open qdoc include file '%1'")
- .arg(userFriendlyFilePath));
- }
- else {
+ location().warning(tr("Cannot open qdoc include file '%1'").arg(userFriendlyFilePath));
+ } else {
location().push(userFriendlyFilePath);
QTextStream inStream(&inFile);
@@ -1703,15 +1671,14 @@ void DocParser::include(const QString &fileName, const QString &identifier)
input_.insert(pos, includedStuff);
len = input_.length();
openedInputs.push(pos + includedStuff.length());
- }
- else {
+ } else {
QStringList lineBuffer = includedStuff.split(QLatin1Char('\n'));
int i = 0;
int startLine = -1;
while (i < lineBuffer.size()) {
if (lineBuffer[i].startsWith("//!")) {
if (lineBuffer[i].contains(identifier)) {
- startLine = i+1;
+ startLine = i + 1;
break;
}
}
@@ -1719,31 +1686,28 @@ void DocParser::include(const QString &fileName, const QString &identifier)
}
if (startLine < 0) {
location().warning(tr("Cannot find '%1' in '%2'")
- .arg(identifier)
- .arg(userFriendlyFilePath));
+ .arg(identifier)
+ .arg(userFriendlyFilePath));
return;
-
}
QString result;
i = startLine;
do {
if (lineBuffer[i].startsWith("//!")) {
- if (i<lineBuffer.size()) {
+ if (i < lineBuffer.size()) {
if (lineBuffer[i].contains(identifier)) {
break;
}
}
- }
- else
+ } else
result += lineBuffer[i] + QLatin1Char('\n');
++i;
} while (i < lineBuffer.size());
if (result.isEmpty()) {
location().warning(tr("Empty qdoc snippet '%1' in '%2'")
- .arg(identifier)
- .arg(userFriendlyFilePath));
- }
- else {
+ .arg(identifier)
+ .arg(userFriendlyFilePath));
+ } else {
input_.insert(pos, result);
len = input_.length();
openedInputs.push(pos + result.length());
@@ -1759,8 +1723,7 @@ void DocParser::startFormat(const QString &format, int cmd)
for (const auto &item : qAsConst(pendingFormats)) {
if (item == format) {
- location().warning(tr("Cannot nest '\\%1' commands")
- .arg(cmdName(cmd)));
+ location().warning(tr("Cannot nest '\\%1' commands").arg(cmdName(cmd)));
return;
}
}
@@ -1772,8 +1735,7 @@ void DocParser::startFormat(const QString &format, int cmd)
pendingFormats.insert(braceDepth, format);
++braceDepth;
++pos;
- }
- else {
+ } else {
append(Atom::String, getArgument());
append(Atom::FormattingRight, format);
if (format == ATOM_FORMATTING_INDEX && indexStartedPara) {
@@ -1791,24 +1753,15 @@ bool DocParser::openCommand(int cmd)
if (cmd != CMD_LINK) {
if (outer == CMD_LIST) {
ok = (cmd == CMD_FOOTNOTE || cmd == CMD_LIST);
- }
- else if (outer == CMD_SIDEBAR) {
- ok = (cmd == CMD_LIST ||
- cmd == CMD_QUOTATION ||
- cmd == CMD_SIDEBAR);
- }
- else if (outer == CMD_QUOTATION) {
+ } else if (outer == CMD_SIDEBAR) {
+ ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_SIDEBAR);
+ } else if (outer == CMD_QUOTATION) {
ok = (cmd == CMD_LIST);
- }
- else if (outer == CMD_TABLE) {
- ok = (cmd == CMD_LIST ||
- cmd == CMD_FOOTNOTE ||
- cmd == CMD_QUOTATION);
- }
- else if (outer == CMD_FOOTNOTE || outer == CMD_LINK) {
+ } else if (outer == CMD_TABLE) {
+ ok = (cmd == CMD_LIST || cmd == CMD_FOOTNOTE || cmd == CMD_QUOTATION);
+ } else if (outer == CMD_FOOTNOTE || outer == CMD_LINK) {
ok = false;
- }
- else if (outer == CMD_TOPICREF)
+ } else if (outer == CMD_TOPICREF)
ok = (cmd == CMD_TOPICREF || cmd == CMD_MAPREF);
else if (outer == CMD_MAPREF)
ok = false;
@@ -1816,8 +1769,7 @@ bool DocParser::openCommand(int cmd)
if (ok) {
openedCommands.push(cmd);
- }
- else {
+ } else {
location().warning(tr("Can't use '\\%1' in '\\%2'").arg(cmdName(cmd)).arg(cmdName(outer)));
}
return ok;
@@ -1828,8 +1780,7 @@ bool DocParser::closeCommand(int endCmd)
if (endCmdFor(openedCommands.top()) == endCmd && openedCommands.size() > 1) {
openedCommands.pop();
return true;
- }
- else {
+ } else {
bool contains = false;
QStack<int> opened2 = openedCommands;
while (opened2.size() > 1) {
@@ -1843,12 +1794,11 @@ bool DocParser::closeCommand(int endCmd)
if (contains) {
while (endCmdFor(openedCommands.top()) != endCmd && openedCommands.size() > 1) {
location().warning(tr("Missing '\\%1' before '\\%2'")
- .arg(endCmdName(openedCommands.top()))
- .arg(cmdName(endCmd)));
+ .arg(endCmdName(openedCommands.top()))
+ .arg(cmdName(endCmd)));
openedCommands.pop();
}
- }
- else {
+ } else {
location().warning(tr("Unexpected '\\%1'").arg(cmdName(endCmd)));
}
return false;
@@ -1860,25 +1810,21 @@ void DocParser::startSection(Doc::Sections unit, int cmd)
leaveValueList();
if (currentSection == Doc::NoSection) {
- currentSection = (Doc::Sections) (unit);
+ currentSection = (Doc::Sections)(unit);
priv->constructExtra();
priv->extra->section_ = currentSection;
- }
- else
- endSection(unit,cmd);
+ } else
+ endSection(unit, cmd);
append(Atom::SectionLeft, QString::number(unit));
priv->constructExtra();
priv->extra->tableOfContents_.append(priv->text.lastAtom());
priv->extra->tableOfContentsLevels_.append(unit);
- enterPara(Atom::SectionHeadingLeft,
- Atom::SectionHeadingRight,
- QString::number(unit));
+ enterPara(Atom::SectionHeadingLeft, Atom::SectionHeadingRight, QString::number(unit));
currentSection = unit;
-
}
-void DocParser::endSection(int , int) // (int unit, int endCmd)
+void DocParser::endSection(int, int) // (int unit, int endCmd)
{
leavePara();
append(Atom::SectionRight, QString::number(currentSection));
@@ -1903,12 +1849,10 @@ void DocParser::parseAlso()
// hack for C++ to support links like \l{QString::}{count()}
if (target.endsWith("::"))
target += str;
- }
- else {
+ } else {
str = target;
}
- }
- else {
+ } else {
target = getArgument();
str = cleanLink(target);
if (target == QLatin1String("and") || target == QLatin1String("."))
@@ -1917,10 +1861,8 @@ void DocParser::parseAlso()
if (!skipMe) {
Text also;
- also << Atom(Atom::Link, target)
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << str
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+ also << Atom(Atom::Link, target) << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << str << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
priv->addAlso(also);
}
@@ -1928,8 +1870,7 @@ void DocParser::parseAlso()
if (pos < len && input_[pos] == ',') {
pos++;
skipSpacesOrOneEndl();
- }
- else if (input_[pos] != '\n') {
+ } else if (input_[pos] != '\n') {
location().warning(tr("Missing comma in '\\%1'").arg(cmdName(CMD_SA)));
}
}
@@ -1978,8 +1919,7 @@ void DocParser::appendChar(QChar ch)
if (ch == QLatin1Char(' ')) {
if (!atom->string().endsWith(QLatin1Char(' ')))
atom->appendChar(QLatin1Char(' '));
- }
- else
+ } else
atom->appendChar(ch);
}
@@ -1987,8 +1927,7 @@ void DocParser::appendWord(const QString &word)
{
if (priv->text.lastAtom()->type() != Atom::String) {
append(Atom::String, word);
- }
- else
+ } else
priv->text.lastAtom()->appendString(word);
}
@@ -2017,14 +1956,12 @@ void DocParser::startNewPara()
enterPara();
}
-void DocParser::enterPara(Atom::AtomType leftType,
- Atom::AtomType rightType,
- const QString &string)
+void DocParser::enterPara(Atom::AtomType leftType, Atom::AtomType rightType, const QString &string)
{
if (paraState == OutsideParagraph) {
- if ((priv->text.lastAtom()->type() != Atom::ListItemLeft) &&
- (priv->text.lastAtom()->type() != Atom::DivLeft)) {
+ if ((priv->text.lastAtom()->type() != Atom::ListItemLeft)
+ && (priv->text.lastAtom()->type() != Atom::DivLeft)) {
leaveValueList();
}
@@ -2035,8 +1972,7 @@ void DocParser::enterPara(Atom::AtomType leftType,
pendingParaString = string;
if (leftType == Atom::SectionHeadingLeft) {
paraState = InSingleLineParagraph;
- }
- else {
+ } else {
paraState = InMultiLineParagraph;
}
skipSpacesOrOneEndl();
@@ -2053,10 +1989,9 @@ void DocParser::leavePara()
if (priv->text.lastAtom()->type() == pendingParaLeftType) {
priv->text.stripLastAtom();
- }
- else {
- if (priv->text.lastAtom()->type() == Atom::String &&
- priv->text.lastAtom()->string().endsWith(QLatin1Char(' '))) {
+ } else {
+ if (priv->text.lastAtom()->type() == Atom::String
+ && priv->text.lastAtom()->string().endsWith(QLatin1Char(' '))) {
priv->text.lastAtom()->chopString();
}
append(pendingParaRightType, pendingParaString);
@@ -2074,8 +2009,7 @@ void DocParser::leaveValue()
if (openedLists.isEmpty()) {
openedLists.push(OpenedList(OpenedList::Value));
append(Atom::ListLeft, ATOM_LIST_VALUE);
- }
- else {
+ } else {
if (priv->text.lastAtom()->type() == Atom::Nop)
priv->text.stripLastAtom();
append(Atom::ListItemRight, ATOM_LIST_VALUE);
@@ -2085,8 +2019,7 @@ void DocParser::leaveValue()
void DocParser::leaveValueList()
{
leavePara();
- if (!openedLists.isEmpty() &&
- (openedLists.top().style() == OpenedList::Value)) {
+ if (!openedLists.isEmpty() && (openedLists.top().style() == OpenedList::Value)) {
if (priv->text.lastAtom()->type() == Atom::Nop)
priv->text.stripLastAtom();
append(Atom::ListItemRight, ATOM_LIST_VALUE);
@@ -2143,9 +2076,7 @@ bool DocParser::expandMacro()
if (macroHash()->contains(cmdStr)) {
const Macro &macro = macroHash()->value(cmdStr);
if (!macro.defaultDef.isEmpty()) {
- QString expanded = expandMacroToString(cmdStr,
- macro.defaultDef,
- macro.numParams,
+ QString expanded = expandMacroToString(cmdStr, macro.defaultDef, macro.numParams,
macro.otherDefs.value("match"));
input_.replace(backslashPos, pos - backslashPos, expanded);
len = input_.length();
@@ -2168,25 +2099,23 @@ bool DocParser::expandMacro()
return false;
}
-void DocParser::expandMacro(const QString &name,
- const QString &def,
- int numParams)
+void DocParser::expandMacro(const QString &name, const QString &def, int numParams)
{
if (numParams == 0) {
append(Atom::RawString, def);
- }
- else {
+ } else {
QStringList args;
QString rawString;
for (int i = 0; i < numParams; ++i) {
if (numParams == 1 || isLeftBraceAhead()) {
args << getArgument(true);
- }
- else {
+ } else {
location().warning(tr("Macro '\\%1' invoked with too few"
" arguments (expected %2, got %3)")
- .arg(name).arg(numParams).arg(i));
+ .arg(name)
+ .arg(numParams)
+ .arg(i));
numParams = i;
break;
}
@@ -2195,16 +2124,14 @@ void DocParser::expandMacro(const QString &name,
int j = 0;
while (j < def.size()) {
int paramNo;
- if (((paramNo = def[j].unicode()) >= 1) &&
- (paramNo <= numParams)) {
+ if (((paramNo = def[j].unicode()) >= 1) && (paramNo <= numParams)) {
if (!rawString.isEmpty()) {
append(Atom::RawString, rawString);
rawString.clear();
}
append(Atom::String, args[paramNo - 1]);
j += 1;
- }
- else {
+ } else {
rawString += def[j++];
}
}
@@ -2213,7 +2140,8 @@ void DocParser::expandMacro(const QString &name,
}
}
-QString DocParser::expandMacroToString(const QString &name, const QString &def, int numParams, const QString &matchExpr)
+QString DocParser::expandMacroToString(const QString &name, const QString &def, int numParams,
+ const QString &matchExpr)
{
QString rawString;
@@ -2224,11 +2152,12 @@ QString DocParser::expandMacroToString(const QString &name, const QString &def,
for (int i = 0; i < numParams; ++i) {
if (numParams == 1 || isLeftBraceAhead()) {
args << getArgument(true);
- }
- else {
+ } else {
location().warning(tr("Macro '\\%1' invoked with too few"
" arguments (expected %2, got %3)")
- .arg(name).arg(numParams).arg(i));
+ .arg(name)
+ .arg(numParams)
+ .arg(i));
numParams = i;
break;
}
@@ -2237,12 +2166,10 @@ QString DocParser::expandMacroToString(const QString &name, const QString &def,
int j = 0;
while (j < def.size()) {
int paramNo;
- if (((paramNo = def[j].unicode()) >= 1) &&
- (paramNo <= numParams)) {
+ if (((paramNo = def[j].unicode()) >= 1) && (paramNo <= numParams)) {
rawString += args[paramNo - 1];
j += 1;
- }
- else {
+ } else {
rawString += def[j++];
}
}
@@ -2269,20 +2196,15 @@ Doc::Sections DocParser::getSectioningUnit()
if (name == "section1") {
return Doc::Section1;
- }
- else if (name == "section2") {
+ } else if (name == "section2") {
return Doc::Section2;
- }
- else if (name == "section3") {
+ } else if (name == "section3") {
return Doc::Section3;
- }
- else if (name == "section4") {
+ } else if (name == "section4") {
return Doc::Section4;
- }
- else if (name.isEmpty()) {
+ } else if (name.isEmpty()) {
return Doc::NoSection;
- }
- else {
+ } else {
location().warning(tr("Invalid section '%1'").arg(name));
return Doc::NoSection;
}
@@ -2356,8 +2278,8 @@ QString DocParser::getArgument(bool verbatim)
int startPos = pos;
QString arg = getBracedArgument(verbatim);
if (arg.isEmpty()) {
- while ((pos < input_.length()) &&
- ((delimDepth > 0) || ((delimDepth == 0) && !input_[pos].isSpace()))) {
+ while ((pos < input_.length())
+ && ((delimDepth > 0) || ((delimDepth == 0) && !input_[pos].isSpace()))) {
switch (input_[pos].unicode()) {
case '(':
case '[':
@@ -2385,9 +2307,8 @@ QString DocParser::getArgument(bool verbatim)
}
}
endPos = pos;
- if ((arg.length() > 1) &&
- (QString(".,:;!?").indexOf(input_[pos - 1]) != -1) &&
- !arg.endsWith("...")) {
+ if ((arg.length() > 1) && (QString(".,:;!?").indexOf(input_[pos - 1]) != -1)
+ && !arg.endsWith("...")) {
arg.truncate(arg.length() - 1);
--pos;
}
@@ -2443,11 +2364,9 @@ QString DocParser::getBracketedArgument()
QString DocParser::getOptionalArgument()
{
skipSpacesOrOneEndl();
- if (pos + 1 < input_.length() && input_[pos] == '\\' &&
- input_[pos + 1].isLetterOrNumber()) {
+ if (pos + 1 < input_.length() && input_[pos] == '\\' && input_[pos + 1].isLetterOrNumber()) {
return QString();
- }
- else {
+ } else {
return getArgument();
}
}
@@ -2467,12 +2386,9 @@ QString DocParser::getRestOfLine()
if (input_[pos] == '\\' && !trailingSlash) {
trailingSlash = true;
++pos;
- while ((pos < input_.size()) &&
- input_[pos].isSpace() &&
- (input_[pos] != '\n'))
+ while ((pos < input_.size()) && input_[pos].isSpace() && (input_[pos] != '\n'))
++pos;
- }
- else {
+ } else {
trailingSlash = false;
++pos;
}
@@ -2534,8 +2450,7 @@ QString DocParser::getUntilEnd(int cmd)
if (end == -1) {
location().warning(tr("Missing '\\%1'").arg(cmdName(endCmd)));
pos = input_.length();
- }
- else {
+ } else {
t = input_.mid(pos, end - pos);
pos = end + rx.matchedLength();
}
@@ -2550,10 +2465,8 @@ QString DocParser::getCode(int cmd, CodeMarker *marker, const QString &argStr)
QStringList args = argStr.split(" ", QString::SkipEmptyParts);
int paramNo, j = 0;
while (j < code.size()) {
- if (code[j] == '\\'
- && j < code.size() - 1
- && (paramNo = code[j + 1].digitValue()) >= 1
- && paramNo <= args.size()) {
+ if (code[j] == '\\' && j < code.size() - 1 && (paramNo = code[j + 1].digitValue()) >= 1
+ && paramNo <= args.size()) {
QString p = args[paramNo - 1];
code.replace(j, 2, p);
j += qMin(1, p.size());
@@ -2624,9 +2537,7 @@ bool DocParser::isLeftBracketAhead()
*/
void DocParser::skipSpacesOnLine()
{
- while ((pos < input_.length()) &&
- input_[pos].isSpace() &&
- (input_[pos].unicode() != '\n'))
+ while ((pos < input_.length()) && input_[pos].isSpace() && (input_[pos].unicode() != '\n'))
++pos;
}
@@ -2641,8 +2552,7 @@ void DocParser::skipSpacesOrOneEndl()
if (ch == '\n') {
if (firstEndl == -1) {
firstEndl = pos;
- }
- else {
+ } else {
pos = firstEndl;
break;
}
@@ -2659,9 +2569,8 @@ void DocParser::skipAllSpaces()
void DocParser::skipToNextPreprocessorCommand()
{
- QRegExp rx("\\\\(?:" + cmdName(CMD_IF) + QLatin1Char('|') +
- cmdName(CMD_ELSE) + QLatin1Char('|') +
- cmdName(CMD_ENDIF) + ")\\b");
+ QRegExp rx("\\\\(?:" + cmdName(CMD_IF) + QLatin1Char('|') + cmdName(CMD_ELSE) + QLatin1Char('|')
+ + cmdName(CMD_ENDIF) + ")\\b");
int end = rx.indexIn(input_, pos + 1); // ### + 1 necessary?
if (end == -1)
@@ -2776,8 +2685,7 @@ int DocParser::indentLevel(const QString &str)
for (int i = 0; i < str.length(); ++i) {
if (str[i] == '\n') {
column = 0;
- }
- else {
+ } else {
if (str[i] != ' ' && column < minIndent)
minIndent = column;
++column;
@@ -2798,8 +2706,7 @@ QString DocParser::unindent(int level, const QString &str)
if (str[i] == QLatin1Char('\n')) {
t += '\n';
column = 0;
- }
- else {
+ } else {
if (column >= level)
t += str[i];
++column;
@@ -2821,9 +2728,7 @@ QString DocParser::slashed(const QString &str)
bool DocParser::isCode(const Atom *atom)
{
Atom::AtomType type = atom->type();
- return (type == Atom::Code
- || type == Atom::Qml
- || type == Atom::JavaScript);
+ return (type == Atom::Code || type == Atom::Qml || type == Atom::JavaScript);
}
/*!
@@ -2832,10 +2737,8 @@ bool DocParser::isCode(const Atom *atom)
bool DocParser::isQuote(const Atom *atom)
{
Atom::AtomType type = atom->type();
- return (type == Atom::CodeQuoteArgument
- || type == Atom::CodeQuoteCommand
- || type == Atom::SnippetCommand
- || type == Atom::SnippetIdentifier
+ return (type == Atom::CodeQuoteArgument || type == Atom::CodeQuoteCommand
+ || type == Atom::SnippetCommand || type == Atom::SnippetIdentifier
|| type == Atom::SnippetLocation);
}
@@ -2847,19 +2750,15 @@ bool DocParser::isQuote(const Atom *atom)
QML documentation, there is the case where the qdoc \e{qmlproperty}
command can appear multiple times in a qdoc comment.
*/
-Doc::Doc(const Location &start_loc,
- const Location &end_loc,
- const QString &source,
- const QSet<QString> &metaCommandSet,
- const QSet<QString> &topics)
+Doc::Doc(const Location &start_loc, const Location &end_loc, const QString &source,
+ const QSet<QString> &metaCommandSet, const QSet<QString> &topics)
{
priv = new DocPrivate(start_loc, end_loc, source);
DocParser parser;
parser.parse(source, priv, metaCommandSet, topics);
}
-Doc::Doc(const Doc &doc)
- : priv(nullptr)
+Doc::Doc(const Doc &doc) : priv(nullptr)
{
operator=(doc);
}
@@ -2890,15 +2789,14 @@ void Doc::simplifyEnumDoc()
Atom *atom = priv->text.firstAtom();
while (atom) {
- if ((atom->type() == Atom::ListLeft) &&
- (atom->string() == ATOM_LIST_VALUE)) {
- while (atom && ((atom->type() != Atom::ListRight) ||
- (atom->string() != ATOM_LIST_VALUE)))
+ if ((atom->type() == Atom::ListLeft) && (atom->string() == ATOM_LIST_VALUE)) {
+ while (atom
+ && ((atom->type() != Atom::ListRight)
+ || (atom->string() != ATOM_LIST_VALUE)))
atom = atom->next();
if (atom)
atom = atom->next();
- }
- else {
+ } else {
newText << *atom;
atom = atom->next();
}
@@ -2979,8 +2877,7 @@ Text Doc::trimmedBriefText(const QString &className) const
should be rethought.
*/
while (atom) {
- if (atom->type() == Atom::AutoLink
- || atom->type() == Atom::String) {
+ if (atom->type() == Atom::AutoLink || atom->type() == Atom::String) {
briefStr += atom->string();
} else if (atom->type() == Atom::C) {
briefStr += Generator::plainCode(atom->string());
@@ -2990,20 +2887,17 @@ Text Doc::trimmedBriefText(const QString &className) const
QStringList w = briefStr.split(QLatin1Char(' '));
if (!w.isEmpty() && w.first() == "Returns") {
- }
- else {
+ } else {
if (!w.isEmpty() && w.first() == "The")
w.removeFirst();
if (!w.isEmpty() && (w.first() == className || w.first() == classNameOnly))
w.removeFirst();
- if (!w.isEmpty() && ((w.first() == "class") ||
- (w.first() == "function") ||
- (w.first() == "macro") ||
- (w.first() == "widget") ||
- (w.first() == "namespace") ||
- (w.first() == "header")))
+ if (!w.isEmpty()
+ && ((w.first() == "class") || (w.first() == "function") || (w.first() == "macro")
+ || (w.first() == "widget") || (w.first() == "namespace")
+ || (w.first() == "header")))
w.removeFirst();
if (!w.isEmpty() && (w.first() == "is" || w.first() == "provides"))
@@ -3039,8 +2933,7 @@ Doc::Sections Doc::granularity() const
{
if (priv == nullptr || priv->extra == nullptr) {
return DocPrivateExtra().granularity_;
- }
- else {
+ } else {
return priv->extra->granularity_;
}
}
@@ -3166,9 +3059,9 @@ void Doc::initialize(const Config &config)
if (reverseAliasMap.contains(alias)) {
config.lastLocation().warning(tr("Command name '\\%1' cannot stand"
" for both '\\%2' and '\\%3'")
- .arg(alias)
- .arg(reverseAliasMap[alias])
- .arg(a));
+ .arg(alias)
+ .arg(reverseAliasMap[alias])
+ .arg(a));
} else {
reverseAliasMap.insert(alias, a);
}
@@ -3212,11 +3105,11 @@ void Doc::initialize(const Config &config)
" inconsistent number"
" of arguments (%2"
" %3, %4 %5)")
- .arg(macroName)
- .arg(f)
- .arg(m)
- .arg(other)
- .arg(macro.numParams));
+ .arg(macroName)
+ .arg(f)
+ .arg(m)
+ .arg(other)
+ .arg(macro.numParams));
silent = true;
}
if (macro.numParams < m)
@@ -3230,9 +3123,8 @@ void Doc::initialize(const Config &config)
// If any of the formats define quotinginformation, activate quoting
DocParser::quoting = config.getBool(CONFIG_QUOTINGINFORMATION);
for (const auto &format : config.getOutputFormats())
- DocParser::quoting = DocParser::quoting || config.getBool(format
- + Config::dot
- + CONFIG_QUOTINGINFORMATION);
+ DocParser::quoting = DocParser::quoting
+ || config.getBool(format + Config::dot + CONFIG_QUOTINGINFORMATION);
}
/*!
@@ -3279,8 +3171,7 @@ void Doc::trimCStyleComment(Location &location, QString &str)
break;
cleaned += ' ';
metAsterColumn = true;
- }
- else {
+ } else {
if (str[i] == '\n') {
if (!metAsterColumn)
break;
@@ -3298,24 +3189,18 @@ void Doc::trimCStyleComment(Location &location, QString &str)
str = str.mid(3, str.length() - 5);
}
-QString Doc::resolveFile(const Location &location,
- const QString &fileName,
+QString Doc::resolveFile(const Location &location, const QString &fileName,
QString *userFriendlyFilePath)
{
- const QString result = Config::findFile(location,
- DocParser::exampleFiles,
- DocParser::exampleDirs,
- fileName, userFriendlyFilePath);
- qCDebug(lcQdoc).noquote().nospace() << __FUNCTION__ << "(location="
- << location.fileName() << ':' << location.lineNo()
- << ", fileName=\"" << fileName << "\"), resolved to \""
- << result;
+ const QString result = Config::findFile(location, DocParser::exampleFiles,
+ DocParser::exampleDirs, fileName, userFriendlyFilePath);
+ qCDebug(lcQdoc).noquote().nospace()
+ << __FUNCTION__ << "(location=" << location.fileName() << ':' << location.lineNo()
+ << ", fileName=\"" << fileName << "\"), resolved to \"" << result;
return result;
}
-CodeMarker *Doc::quoteFromFile(const Location &location,
- Quoter &quoter,
- const QString &fileName)
+CodeMarker *Doc::quoteFromFile(const Location &location, Quoter &quoter, const QString &fileName)
{
quoter.reset();
@@ -3324,17 +3209,17 @@ CodeMarker *Doc::quoteFromFile(const Location &location,
QString userFriendlyFilePath;
const QString filePath = resolveFile(location, fileName, &userFriendlyFilePath);
if (filePath.isEmpty()) {
- QString details = QLatin1String("Example directories: ") + DocParser::exampleDirs.join(QLatin1Char(' '));
+ QString details = QLatin1String("Example directories: ")
+ + DocParser::exampleDirs.join(QLatin1Char(' '));
if (!DocParser::exampleFiles.isEmpty())
- details += QLatin1String(", example files: ") + DocParser::exampleFiles.join(QLatin1Char(' '));
+ details += QLatin1String(", example files: ")
+ + DocParser::exampleFiles.join(QLatin1Char(' '));
location.warning(tr("Cannot find file to quote from: '%1'").arg(fileName), details);
- }
- else {
+ } else {
QFile inFile(filePath);
if (!inFile.open(QFile::ReadOnly)) {
location.warning(tr("Cannot open file to quote from: '%1'").arg(userFriendlyFilePath));
- }
- else {
+ } else {
QTextStream inStream(&inFile);
code = DocParser::untabifyEtc(inStream.readAll());
}
@@ -3373,8 +3258,7 @@ QString Doc::canonicalTitle(const QString &title)
begun = true;
dashAppended = false;
lastAlnum = result.size();
- }
- else if (!dashAppended) {
+ } else if (!dashAppended) {
if (begun)
result += QLatin1Char('-');
dashAppended = true;
@@ -3415,6 +3299,9 @@ TopicRef::~TopicRef()
Returns a reference to the structure that will be used
for generating a DITA mao.
*/
-const DitaRefList& Doc::ditamap() const { return priv->ditamap_; }
+const DitaRefList &Doc::ditamap() const
+{
+ return priv->ditamap_;
+}
QT_END_NAMESPACE
diff --git a/src/qdoc/doc.h b/src/qdoc/doc.h
index 38c469ee3..758901f1d 100644
--- a/src/qdoc/doc.h
+++ b/src/qdoc/doc.h
@@ -58,10 +58,14 @@ struct Topic
{
QString topic;
QString args;
- Topic() { }
- Topic(QString &t, const QString &a) : topic(t), args(a) { }
+ Topic() {}
+ Topic(QString &t, const QString &a) : topic(t), args(a) {}
bool isEmpty() const { return topic.isEmpty(); }
- void clear() { topic.clear(); args.clear(); }
+ void clear()
+ {
+ topic.clear();
+ args.clear();
+ }
};
typedef QVector<Topic> TopicList;
@@ -70,8 +74,8 @@ typedef QVector<DitaRef *> DitaRefList;
class DitaRef
{
public:
- DitaRef() { }
- virtual ~DitaRef() { }
+ DitaRef() {}
+ virtual ~DitaRef() {}
const QString &navtitle() const { return navtitle_; }
const QString &href() const { return href_; }
@@ -79,7 +83,7 @@ public:
void setHref(const QString &t) { href_ = t; }
virtual bool isMapRef() const = 0;
virtual const DitaRefList *subrefs() const { return nullptr; }
- virtual void appendSubref(DitaRef *) { }
+ virtual void appendSubref(DitaRef *) {}
private:
QString navtitle_;
@@ -89,7 +93,7 @@ private:
class TopicRef : public DitaRef
{
public:
- TopicRef() { }
+ TopicRef() {}
~TopicRef() override;
bool isMapRef() const override { return false; }
@@ -103,7 +107,7 @@ private:
class MapRef : public DitaRef
{
public:
- MapRef() { }
+ MapRef() {}
bool isMapRef() const override { return true; }
};
@@ -125,18 +129,15 @@ public:
};
Doc() : priv(nullptr) {}
- Doc(const Location &start_loc,
- const Location &end_loc,
- const QString &source,
- const QSet<QString> &metaCommandSet,
- const QSet<QString> &topics);
+ Doc(const Location &start_loc, const Location &end_loc, const QString &source,
+ const QSet<QString> &metaCommandSet, const QSet<QString> &topics);
Doc(const Doc &doc);
~Doc();
Doc &operator=(const Doc &doc);
void simplifyEnumDoc();
void setBody(const Text &body);
- const DitaRefList& ditamap() const;
+ const DitaRefList &ditamap() const;
const Location &location() const;
const Location &startLocation() const;
@@ -172,8 +173,7 @@ public:
static void trimCStyleComment(Location &location, QString &str);
static QString resolveFile(const Location &location, const QString &fileName,
QString *userFriendlyFilePath = nullptr);
- static CodeMarker *quoteFromFile(const Location &location,
- Quoter &quoter,
+ static CodeMarker *quoteFromFile(const Location &location, Quoter &quoter,
const QString &fileName);
static QString canonicalTitle(const QString &title);
static const Config *config() { return config_; }
diff --git a/src/qdoc/editdistance.cpp b/src/qdoc/editdistance.cpp
index ff4630e15..841f5f48d 100644
--- a/src/qdoc/editdistance.cpp
+++ b/src/qdoc/editdistance.cpp
@@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE
int editDistance(const QString &s, const QString &t)
{
-#define D( i, j ) d[(i) * n + (j)]
+#define D(i, j) d[(i)*n + (j)]
int i;
int j;
int m = s.length() + 1;
@@ -45,22 +45,22 @@ int editDistance(const QString &s, const QString &t)
int result;
for (i = 0; i < m; ++i)
- D( i, 0 ) = i;
+ D(i, 0) = i;
for (j = 0; j < n; ++j)
- D( 0, j ) = j;
+ D(0, j) = j;
for (i = 1; i < m; ++i) {
for (j = 1; j < n; ++j) {
- if ( s[i - 1] == t[j - 1] ) {
- D( i, j ) = D( i - 1, j - 1 );
+ if (s[i - 1] == t[j - 1]) {
+ D(i, j) = D(i - 1, j - 1);
} else {
- int x = D( i - 1, j );
- int y = D( i - 1, j - 1 );
- int z = D( i, j - 1 );
- D( i, j ) = 1 + qMin( qMin(x, y), z );
+ int x = D(i - 1, j);
+ int y = D(i - 1, j - 1);
+ int z = D(i, j - 1);
+ D(i, j) = 1 + qMin(qMin(x, y), z);
}
}
}
- result = D( m - 1, n - 1 );
+ result = D(m - 1, n - 1);
delete[] d;
return result;
#undef D
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp
index a65b47333..846db961a 100644
--- a/src/qdoc/generator.cpp
+++ b/src/qdoc/generator.cpp
@@ -47,7 +47,7 @@
#include <QtCore/qdir.h>
#ifndef QT_BOOTSTRAPPED
-# include "QtCore/qurl.h"
+# include "QtCore/qurl.h"
#endif
QT_BEGIN_NAMESPACE
@@ -55,8 +55,8 @@ QT_BEGIN_NAMESPACE
Generator *Generator::currentGenerator_;
QStringList Generator::exampleDirs;
QStringList Generator::exampleImgExts;
-QMap<QString, QMap<QString, QString> > Generator::fmtLeftMaps;
-QMap<QString, QMap<QString, QString> > Generator::fmtRightMaps;
+QMap<QString, QMap<QString, QString>> Generator::fmtLeftMaps;
+QMap<QString, QMap<QString, QString>> Generator::fmtRightMaps;
QVector<Generator *> Generator::generators;
QStringList Generator::imageDirs;
QStringList Generator::imageFiles;
@@ -117,9 +117,7 @@ Generator::~Generator()
generators.removeAll(this);
}
-void Generator::appendFullName(Text &text,
- const Node *apparentNode,
- const Node *relative,
+void Generator::appendFullName(Text &text, const Node *apparentNode, const Node *relative,
const Node *actualNode)
{
if (actualNode == nullptr)
@@ -130,16 +128,13 @@ void Generator::appendFullName(Text &text,
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
}
-void Generator::appendFullName(Text &text,
- const Node *apparentNode,
- const QString &fullName,
+void Generator::appendFullName(Text &text, const Node *apparentNode, const QString &fullName,
const Node *actualNode)
{
if (actualNode == nullptr)
actualNode = apparentNode;
text << Atom(Atom::LinkNode, CodeMarker::stringForNode(actualNode))
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << Atom(Atom::String, fullName)
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) << Atom(Atom::String, fullName)
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
}
@@ -148,7 +143,7 @@ void Generator::appendFullNames(Text &text, const NodeList &nodes, const Node *r
int index = 0;
for (const auto &node : nodes) {
appendFullName(text, node, relative);
- text << comma(index++,nodes.count());
+ text << comma(index++, nodes.count());
}
}
@@ -175,7 +170,7 @@ void Generator::signatureList(const NodeList &nodes, const Node *relative, CodeM
Text text;
int count = 0;
text << Atom(Atom::ListLeft, QString("bullet"));
- for (const auto &node: nodes) {
+ for (const auto &node : nodes) {
text << Atom(Atom::ListItemNumber, QString::number(++count));
text << Atom(Atom::ListItemLeft, QString("bullet"));
appendSignature(text, node);
@@ -187,7 +182,7 @@ void Generator::signatureList(const NodeList &nodes, const Node *relative, CodeM
int Generator::appendSortedNames(Text &text, const ClassNode *cn, const QVector<RelatedClass> &rc)
{
- QMap<QString,Text> classMap;
+ QMap<QString, Text> classMap;
for (const auto &relatedClass : rc) {
ClassNode *rcn = relatedClass.node_;
if (rcn && rcn->isInAPI()) {
@@ -208,12 +203,12 @@ int Generator::appendSortedNames(Text &text, const ClassNode *cn, const QVector<
int Generator::appendSortedQmlNames(Text &text, const Node *base, const NodeList &subs)
{
- QMap<QString,Text> classMap;
+ QMap<QString, Text> classMap;
for (const auto sub : subs) {
Text text;
- if (!base->isQtQuickNode() || !sub->isQtQuickNode() ||
- (base->logicalModuleName() == sub->logicalModuleName())) {
+ if (!base->isQtQuickNode() || !sub->isQtQuickNode()
+ || (base->logicalModuleName() == sub->logicalModuleName())) {
appendFullName(text, sub, base);
classMap[text.toString().toLower()] = text;
}
@@ -254,8 +249,8 @@ void Generator::writeOutFileNames()
QFile *Generator::openSubPageFile(const Node *node, const QString &fileName)
{
QString path = outputDir() + QLatin1Char('/');
- if (Generator::useOutputSubdirs() && !node->outputSubdirectory().isEmpty() &&
- !outputDir().endsWith(node->outputSubdirectory())) {
+ if (Generator::useOutputSubdirs() && !node->outputSubdirectory().isEmpty()
+ && !outputDir().endsWith(node->outputSubdirectory())) {
path += node->outputSubdirectory() + QLatin1Char('/');
}
path += fileName;
@@ -264,11 +259,10 @@ QFile *Generator::openSubPageFile(const Node *node, const QString &fileName)
auto outFile = new QFile(outPath);
if (!redirectDocumentationToDevNull_ && outFile->exists()) {
node->location().error(
- tr("Output file already exists; overwriting %1").arg(outFile->fileName()));
+ tr("Output file already exists; overwriting %1").arg(outFile->fileName()));
}
if (!outFile->open(QFile::WriteOnly)) {
- node->location().fatal(
- tr("Cannot open output file '%1'").arg(outFile->fileName()));
+ node->location().fatal(tr("Cannot open output file '%1'").arg(outFile->fileName()));
}
qCDebug(lcQdoc, "Writing: %s", qPrintable(path));
outFileNames_ << fileName;
@@ -286,7 +280,7 @@ QFile *Generator::openSubPageFile(const Node *node, const QString &fileName)
void Generator::beginFilePage(const Node *node, const QString &fileName)
{
QFile *outFile = openSubPageFile(node, fileName);
- QTextStream* out = new QTextStream(outFile);
+ QTextStream *out = new QTextStream(outFile);
#ifndef QT_NO_TEXTCODEC
if (outputCodec)
out->setCodec(outputCodec);
@@ -294,17 +288,17 @@ void Generator::beginFilePage(const Node *node, const QString &fileName)
outStreamStack.push(out);
}
- /*!
- Creates the file named \a fileName in the output directory.
- Attaches a QTextStream to the created file, which is written
- to all over the place using out(). This function calls another
- function, \c beginFilePage(), which is really just most of what
- this function used to contain. We needed a different version
- that doesn't store the \a fileName in the \a node as the output
- file name.
-
- \sa beginFilePage()
- */
+/*!
+ Creates the file named \a fileName in the output directory.
+ Attaches a QTextStream to the created file, which is written
+ to all over the place using out(). This function calls another
+ function, \c beginFilePage(), which is really just most of what
+ this function used to contain. We needed a different version
+ that doesn't store the \a fileName in the \a node as the output
+ file name.
+
+ \sa beginFilePage()
+*/
void Generator::beginSubPage(const Node *node, const QString &fileName)
{
beginFilePage(node, fileName);
@@ -342,11 +336,10 @@ static void transmogrify(QString &input, QString &output)
uint u = c.unicode();
if (u >= 'A' && u <= 'Z')
u += 'a' - 'A';
- if ((u >= 'a' && u <= 'z') || (u >= '0' && u <= '9')) {
+ if ((u >= 'a' && u <= 'z') || (u >= '0' && u <= '9')) {
output += QLatin1Char(u);
begun = true;
- }
- else if (begun) {
+ } else if (begun) {
output += QLatin1Char('-');
begun = false;
}
@@ -391,8 +384,8 @@ QString Generator::fileBase(const Node *node) const
if (node->isExample()) {
base.append(QLatin1String("-example"));
}
- } else if (node->isQmlType() || node->isQmlBasicType() ||
- node->isJsType() || node->isJsBasicType()) {
+ } else if (node->isQmlType() || node->isQmlBasicType() || node->isJsType()
+ || node->isJsBasicType()) {
base = node->name();
/*
To avoid file name conflicts in the html directory,
@@ -401,9 +394,7 @@ QString Generator::fileBase(const Node *node) const
module name.
*/
if (!node->logicalModuleName().isEmpty()) {
- base.prepend(node->logicalModuleName()
- + outputSuffix(node)
- + QLatin1Char('-'));
+ base.prepend(node->logicalModuleName() + outputSuffix(node) + QLatin1Char('-'));
}
base.prepend(outputPrefix(node));
} else if (node->isProxyNode()) {
@@ -441,8 +432,7 @@ QString Generator::fileBase(const Node *node) const
empty (default value), retrieve the file extension from
the generator.
*/
-QString Generator::linkForExampleFile(const QString &path,
- const Node *parent,
+QString Generator::linkForExampleFile(const QString &path, const Node *parent,
const QString &fileExt)
{
QString link = path;
@@ -464,8 +454,7 @@ QString Generator::linkForExampleFile(const QString &path,
Helper function to construct a title for a file or image page
included in an example.
*/
-QString Generator::exampleFileTitle(const ExampleNode *relative,
- const QString &fileName)
+QString Generator::exampleFileTitle(const ExampleNode *relative, const QString &fileName)
{
QString suffix;
if (relative->files().contains(fileName))
@@ -504,9 +493,7 @@ QString Generator::cleanRef(const QString &ref)
const QChar c = ref[0];
const uint u = c.unicode();
- if ((u >= 'a' && u <= 'z') ||
- (u >= 'A' && u <= 'Z') ||
- (u >= '0' && u <= '9')) {
+ if ((u >= 'a' && u <= 'z') || (u >= 'A' && u <= 'Z') || (u >= '0' && u <= '9')) {
clean += c;
} else if (u == '~') {
clean += "dtor.";
@@ -519,10 +506,8 @@ QString Generator::cleanRef(const QString &ref)
for (int i = 1; i < ref.length(); i++) {
const QChar c = ref[i];
const uint u = c.unicode();
- if ((u >= 'a' && u <= 'z') ||
- (u >= 'A' && u <= 'Z') ||
- (u >= '0' && u <= '9') || u == '-' ||
- u == '_' || u == ':' || u == '.') {
+ if ((u >= 'a' && u <= 'z') || (u >= 'A' && u <= 'Z') || (u >= '0' && u <= '9') || u == '-'
+ || u == '_' || u == ':' || u == '.') {
clean += c;
} else if (c.isSpace()) {
clean += QLatin1Char('-');
@@ -589,26 +574,23 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
parentName = fileBase(node) + QLatin1Char('.') + currentGenerator()->fileExtension();
else
return QString();
- }
- else if (node->isQmlType() || node->isQmlBasicType() ||
- node->isJsType() || node->isJsBasicType()) {
+ } else if (node->isQmlType() || node->isQmlBasicType() || node->isJsType()
+ || node->isJsBasicType()) {
QString fb = fileBase(node);
if (fb.startsWith(outputPrefix(node)))
return fb + QLatin1Char('.') + currentGenerator()->fileExtension();
else {
QString mq;
if (!node->logicalModuleName().isEmpty()) {
- mq = node->logicalModuleName().replace(QChar('.'),QChar('-'));
+ mq = node->logicalModuleName().replace(QChar('.'), QChar('-'));
mq = mq.toLower() + QLatin1Char('-');
}
- return fdl + outputPrefix(node) + mq + fileBase(node) +
- QLatin1Char('.') + currentGenerator()->fileExtension();
+ return fdl + outputPrefix(node) + mq + fileBase(node) + QLatin1Char('.')
+ + currentGenerator()->fileExtension();
}
- }
- else if (node->isTextPageNode() || node->isCollectionNode()) {
+ } else if (node->isTextPageNode() || node->isCollectionNode()) {
parentName = fileBase(node) + QLatin1Char('.') + currentGenerator()->fileExtension();
- }
- else if (fileBase(node).isEmpty())
+ } else if (fileBase(node).isEmpty())
return QString();
Node *parentNode = nullptr;
@@ -627,8 +609,7 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
case Node::Proxy:
parentName = fileBase(node) + QLatin1Char('.') + currentGenerator()->fileExtension();
break;
- case Node::Function:
- {
+ case Node::Function: {
const FunctionNode *fn = static_cast<const FunctionNode *>(node);
switch (fn->metaness()) {
case FunctionNode::JsSignal:
@@ -649,8 +630,8 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
else if (fn->hasOneAssociatedProperty() && fn->doc().isEmpty())
return fullDocumentLocation(fn->firstAssociatedProperty());
else if (fn->overloadNumber() > 0)
- anchorRef = QLatin1Char('#') + cleanRef(fn->name())
- + QLatin1Char('-') + QString::number(fn->overloadNumber());
+ anchorRef = QLatin1Char('#') + cleanRef(fn->name()) + QLatin1Char('-')
+ + QString::number(fn->overloadNumber());
else
anchorRef = QLatin1Char('#') + cleanRef(fn->name());
break;
@@ -665,8 +646,7 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
case Node::Enum:
anchorRef = QLatin1Char('#') + node->name() + "-enum";
break;
- case Node::Typedef:
- {
+ case Node::Typedef: {
const TypedefNode *tdef = static_cast<const TypedefNode *>(node);
if (tdef->associatedEnum()) {
return fullDocumentLocation(tdef->associatedEnum());
@@ -694,13 +674,12 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
case Node::HeaderFile:
case Node::Module:
case Node::JsModule:
- case Node::QmlModule:
- {
+ case Node::QmlModule: {
parentName = fileBase(node);
- parentName.replace(QLatin1Char('/'), QLatin1Char('-')).replace(QLatin1Char('.'), QLatin1Char('-'));
+ parentName.replace(QLatin1Char('/'), QLatin1Char('-'))
+ .replace(QLatin1Char('.'), QLatin1Char('-'));
parentName += QLatin1Char('.') + currentGenerator()->fileExtension();
- }
- break;
+ } break;
default:
break;
}
@@ -721,10 +700,8 @@ void Generator::generateAlsoList(const Node *node, CodeMarker *marker)
if (!alsoList.isEmpty()) {
Text text;
- text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD)
- << "See also "
- << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD);
+ text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "See also "
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD);
for (int i = 0; i < alsoList.size(); ++i)
text << alsoList.at(i) << separator(i, alsoList.size());
@@ -734,30 +711,21 @@ void Generator::generateAlsoList(const Node *node, CodeMarker *marker)
}
}
-const Atom *Generator::generateAtomList(const Atom *atom,
- const Node *relative,
- CodeMarker *marker,
- bool generate,
- int &numAtoms)
+const Atom *Generator::generateAtomList(const Atom *atom, const Node *relative, CodeMarker *marker,
+ bool generate, int &numAtoms)
{
while (atom != nullptr) {
if (atom->type() == Atom::FormatIf) {
int numAtoms0 = numAtoms;
bool rightFormat = canHandleFormat(atom->string());
- atom = generateAtomList(atom->next(),
- relative,
- marker,
- generate && rightFormat,
+ atom = generateAtomList(atom->next(), relative, marker, generate && rightFormat,
numAtoms);
if (atom == nullptr)
return nullptr;
if (atom->type() == Atom::FormatElse) {
++numAtoms;
- atom = generateAtomList(atom->next(),
- relative,
- marker,
- generate && !rightFormat,
+ atom = generateAtomList(atom->next(), relative, marker, generate && !rightFormat,
numAtoms);
if (atom == nullptr)
return nullptr;
@@ -765,23 +733,16 @@ const Atom *Generator::generateAtomList(const Atom *atom,
if (atom->type() == Atom::FormatEndif) {
if (generate && numAtoms0 == numAtoms) {
- relative->location().warning(tr("Output format %1 not handled %2")
- .arg(format()).arg(outFileName()));
+ relative->location().warning(
+ tr("Output format %1 not handled %2").arg(format()).arg(outFileName()));
Atom unhandledFormatAtom(Atom::UnhandledFormat, format());
- generateAtomList(&unhandledFormatAtom,
- relative,
- marker,
- generate,
- numAtoms);
+ generateAtomList(&unhandledFormatAtom, relative, marker, generate, numAtoms);
}
atom = atom->next();
}
- }
- else if (atom->type() == Atom::FormatElse ||
- atom->type() == Atom::FormatEndif) {
+ } else if (atom->type() == Atom::FormatElse || atom->type() == Atom::FormatEndif) {
return atom;
- }
- else {
+ } else {
int n = 1;
if (generate) {
n += generateAtom(atom, relative, marker);
@@ -816,54 +777,49 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
out() << "<p>";
generateText(text, node, marker);
out() << "</p>";
- }
- else if (func->isCtor()) {
+ } else if (func->isCtor()) {
Text text;
text << "Default constructs an instance of ";
text << func->parent()->name() << ".";
out() << "<p>";
generateText(text, node, marker);
out() << "</p>";
- }
- else if (func->isCCtor()) {
+ } else if (func->isCCtor()) {
Text text;
text << "Copy constructor.";
out() << "<p>";
generateText(text, node, marker);
out() << "</p>";
- }
- else if (func->isMCtor()) {
+ } else if (func->isMCtor()) {
Text text;
text << "Move-copy constructor.";
out() << "<p>";
generateText(text, node, marker);
out() << "</p>";
- }
- else if (func->isCAssign()) {
+ } else if (func->isCAssign()) {
Text text;
text << "Copy-assignment operator.";
out() << "<p>";
generateText(text, node, marker);
out() << "</p>";
- }
- else if (func->isMAssign()) {
+ } else if (func->isMAssign()) {
Text text;
text << "Move-assignment operator.";
out() << "<p>";
generateText(text, node, marker);
out() << "</p>";
- }
- else if (!node->isWrapper() && !node->isMarkedReimp()) {
+ } else if (!node->isWrapper() && !node->isMarkedReimp()) {
if (!func->isIgnored()) // undocumented functions added by Q_OBJECT
- node->location().warning(tr("No documentation for '%1'").arg(node->plainSignature()));
+ node->location().warning(
+ tr("No documentation for '%1'").arg(node->plainSignature()));
}
} else if (!node->isWrapper() && !node->isMarkedReimp()) {
// Don't require documentation of things defined in Q_GADGET
if (node->name() != QLatin1String("QtGadgetHelper"))
- node->location().warning(tr("No documentation for '%1'").arg(node->plainSignature()));
+ node->location().warning(
+ tr("No documentation for '%1'").arg(node->plainSignature()));
}
- }
- else if (!node->isSharingComment()) {
+ } else if (!node->isSharingComment()) {
if (node->isFunction()) {
const FunctionNode *fn = static_cast<const FunctionNode *>(node);
if (!fn->overridesThis().isEmpty())
@@ -886,8 +842,8 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
const auto &documentedItemList = enume->doc().enumItemNames();
QSet<QString> documentedItems(documentedItemList.cbegin(), documentedItemList.cend());
const QSet<QString> allItems = definedItems + documentedItems;
- if (allItems.count() > definedItems.count() ||
- allItems.count() > documentedItems.count()) {
+ if (allItems.count() > definedItems.count()
+ || allItems.count() > documentedItems.count()) {
for (const auto &it : allItems) {
if (!definedItems.contains(it)) {
QString details;
@@ -896,10 +852,13 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
details = tr("Maybe you meant '%1'?").arg(best);
node->doc().location().warning(tr("No such enum item '%1' in %2")
- .arg(it).arg(node->plainFullName()), details);
+ .arg(it)
+ .arg(node->plainFullName()),
+ details);
} else if (!documentedItems.contains(it)) {
node->doc().location().warning(tr("Undocumented enum item '%1' in %2")
- .arg(it).arg(node->plainFullName()));
+ .arg(it)
+ .arg(node->plainFullName()));
}
}
}
@@ -912,9 +871,9 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
if (!documentedNames.contains(name)) {
if (fn->isActive() || fn->isPreliminary()) {
if (!fn->isMarkedReimp() && !fn->isOverload()) {
- fn->doc().location().warning(
- tr("Undocumented parameter '%1' in %2")
- .arg(name).arg(node->plainFullName()));
+ fn->doc().location().warning(tr("Undocumented parameter '%1' in %2")
+ .arg(name)
+ .arg(node->plainFullName()));
}
}
}
@@ -926,7 +885,8 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
if (!best.isEmpty())
details = tr("Maybe you meant '%1'?").arg(best);
fn->doc().location().warning(tr("No such parameter '%1' in %2")
- .arg(name).arg(fn->plainFullName()),
+ .arg(name)
+ .arg(fn->plainFullName()),
details);
}
}
@@ -936,11 +896,12 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
for all functions with a return type.
mws 13/12/2018
*/
- if (!fn->isObsolete() && fn->returnsBool() &&
- !fn->isMarkedReimp() && !fn->isOverload()) {
+ if (!fn->isObsolete() && fn->returnsBool() && !fn->isMarkedReimp()
+ && !fn->isOverload()) {
if (!fn->doc().body().contains("return"))
- node->doc().location().warning(tr("Undocumented return value "
- "(hint: use 'return' or 'returns' in the text"));
+ node->doc().location().warning(
+ tr("Undocumented return value "
+ "(hint: use 'return' or 'returns' in the text"));
}
}
}
@@ -964,7 +925,7 @@ void Generator::generateRequiredLinks(const Node *node, CodeMarker *marker)
if (exampleUrl.isEmpty()) {
if (!en->noAutoList()) {
generateFileList(en, marker, false); // files
- generateFileList(en, marker, true); // images
+ generateFileList(en, marker, true); // images
}
} else {
generateLinkToExample(en, marker, exampleUrl);
@@ -978,8 +939,7 @@ void Generator::generateRequiredLinks(const Node *node, CodeMarker *marker)
the path is appended to \a baseUrl, after a '/' character if \a baseUrl did
not already end in one.
*/
-void Generator::generateLinkToExample(const ExampleNode *en,
- CodeMarker *marker,
+void Generator::generateLinkToExample(const ExampleNode *en, CodeMarker *marker,
const QString &baseUrl)
{
QString exampleUrl(baseUrl);
@@ -1001,17 +961,14 @@ void Generator::generateLinkToExample(const ExampleNode *en,
// Construct a path to the example; <install path>/<example name>
QStringList path = QStringList()
- << config()->getString(CONFIG_EXAMPLESINSTALLPATH)
- << en->name();
+ << config()->getString(CONFIG_EXAMPLESINSTALLPATH) << en->name();
path.removeAll({});
Text text;
text << Atom::ParaLeft
<< Atom(Atom::Link, exampleUrl.replace(placeholder, path.join(separator)))
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << Atom(Atom::String, link)
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
- << Atom::ParaRight;
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) << Atom(Atom::String, link)
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom::ParaRight;
generateText(text, nullptr, marker);
}
@@ -1021,12 +978,8 @@ void Generator::addImageToCopy(const ExampleNode *en, const QString &file)
QDir dirInfo;
QString userFriendlyFilePath;
const QString prefix("/images/used-in-examples/");
- QString srcPath = Config::findFile(en->location(),
- QStringList(),
- exampleDirs,
- file,
- exampleImgExts,
- &userFriendlyFilePath);
+ QString srcPath = Config::findFile(en->location(), QStringList(), exampleDirs, file,
+ exampleImgExts, &userFriendlyFilePath);
outFileNames_ << prefix.mid(1) + userFriendlyFilePath;
userFriendlyFilePath.truncate(userFriendlyFilePath.lastIndexOf('/'));
QString imgOutDir = outDir_ + prefix + userFriendlyFilePath;
@@ -1054,7 +1007,7 @@ void Generator::generateFileList(const ExampleNode *en, CodeMarker *marker, bool
paths = en->images();
tag = "Images:";
atomType = Atom::ExampleImageLink;
- } else { //files
+ } else { // files
paths = en->files();
tag = "Files:";
}
@@ -1074,13 +1027,9 @@ void Generator::generateFileList(const ExampleNode *en, CodeMarker *marker, bool
openedList.next();
text << Atom(Atom::ListItemNumber, openedList.numberString())
- << Atom(Atom::ListItemLeft, openedList.styleString())
- << Atom::ParaLeft
- << Atom(atomType, file)
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << file
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
- << Atom::ParaRight
+ << Atom(Atom::ListItemLeft, openedList.styleString()) << Atom::ParaLeft
+ << Atom(atomType, file) << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) << file
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom::ParaRight
<< Atom(Atom::ListItemRight, openedList.styleString());
path = file;
}
@@ -1093,10 +1042,8 @@ void Generator::generateInheritedBy(const ClassNode *classe, CodeMarker *marker)
{
if (!classe->derivedClasses().isEmpty()) {
Text text;
- text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD)
- << "Inherited by: "
- << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD);
+ text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
+ << "Inherited by: " << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD);
appendSortedNames(text, classe, classe->derivedClasses());
text << Atom::ParaRight;
@@ -1108,10 +1055,8 @@ void Generator::generateInherits(const ClassNode *classe, CodeMarker *marker)
{
if (!classe->baseClasses().isEmpty()) {
Text text;
- text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD)
- << "Inherits: "
- << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD);
+ text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
+ << "Inherits: " << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD);
int index = 0;
const QVector<RelatedClass> &baseClasses = classe->baseClasses();
@@ -1121,8 +1066,7 @@ void Generator::generateInherits(const ClassNode *classe, CodeMarker *marker)
if (cls.access_ == Node::Protected) {
text << " (protected)";
- }
- else if (cls.access_ == Node::Private) {
+ } else if (cls.access_ == Node::Private) {
text << " (private)";
}
text << separator(index++, classe->baseClasses().count());
@@ -1188,7 +1132,8 @@ void Generator::generateDocumentation(Node *node)
// other use cases pop up.
QString name = cn->name().toLower();
name.replace(QChar(' '), QString("-"));
- QString filename = cn->tree()->physicalModuleName() + "-" + name + "." + fileExtension();
+ QString filename =
+ cn->tree()->physicalModuleName() + "-" + name + "." + fileExtension();
beginSubPage(node, filename);
generateGenericCollectionPage(cn, marker);
endSubPage();
@@ -1198,8 +1143,8 @@ void Generator::generateDocumentation(Node *node)
generatePageNode(static_cast<PageNode *>(node), marker);
endSubPage();
} else if (node->isAggregate()) {
- if ((node->isClassNode() || node->isHeader() || node->isNamespace()) &&
- node->docMustBeGenerated()) {
+ if ((node->isClassNode() || node->isHeader() || node->isNamespace())
+ && node->docMustBeGenerated()) {
beginSubPage(node, fileName(node));
generateCppReferencePage(static_cast<Aggregate *>(node), marker);
endSubPage();
@@ -1240,10 +1185,8 @@ void Generator::generateMaintainerList(const Aggregate *node, CodeMarker *marker
if (!sl.isEmpty()) {
Text text;
- text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
- << "Maintained by: "
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD);
+ text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
+ << "Maintained by: " << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD);
for (int i = 0; i < sl.size(); ++i)
text << sl.at(i) << separator(i, sl.size());
@@ -1257,8 +1200,7 @@ void Generator::generateMaintainerList(const Aggregate *node, CodeMarker *marker
Output the "Inherit by" list for the QML element,
if it is inherited by any other elements.
*/
-void Generator::generateQmlInheritedBy(const QmlTypeNode *qcn,
- CodeMarker *marker)
+void Generator::generateQmlInheritedBy(const QmlTypeNode *qcn, CodeMarker *marker)
{
if (qcn) {
NodeList subs;
@@ -1277,10 +1219,8 @@ void Generator::generateQmlInheritedBy(const QmlTypeNode *qcn,
Extract sections of markup text surrounded by \e qmltext
and \e endqmltext and output them.
*/
-bool Generator::generateQmlText(const Text &text,
- const Node *relative,
- CodeMarker *marker,
- const QString &/* qmlName */ )
+bool Generator::generateQmlText(const Text &text, const Node *relative, CodeMarker *marker,
+ const QString & /* qmlName */)
{
const Atom *atom = text.firstAtom();
bool result = false;
@@ -1314,7 +1254,8 @@ void Generator::generateReimplementsClause(const FunctionNode *fn, CodeMarker *m
if (overrides->hasDoc()) {
Text text;
text << Atom::ParaLeft << "Reimplements: ";
- QString fullName = overrides->parent()->name() + "::" + overrides->signature(false, true);
+ QString fullName =
+ overrides->parent()->name() + "::" + overrides->signature(false, true);
appendFullName(text, overrides->parent(), fullName, overrides);
text << "." << Atom::ParaRight;
generateText(text, fn, marker);
@@ -1325,13 +1266,14 @@ void Generator::generateReimplementsClause(const FunctionNode *fn, CodeMarker *m
if (sameName && sameName->hasDoc()) {
Text text;
text << Atom::ParaLeft << "Reimplements an access function for property: ";
- QString fullName = sameName->parent()->name() + "::" + sameName->name();
+ QString fullName = sameName->parent()->name() + "::" + sameName->name();
appendFullName(text, sameName->parent(), fullName, sameName);
text << "." << Atom::ParaRight;
generateText(text, fn, marker);
} else {
- fn->doc().location().warning(tr("Illegal \\reimp; no documented virtual function for %1")
- .arg(fn->plainSignature()));
+ fn->doc().location().warning(
+ tr("Illegal \\reimp; no documented virtual function for %1")
+ .arg(fn->plainSignature()));
}
}
}
@@ -1353,16 +1295,10 @@ void Generator::generateSince(const Node *node, CodeMarker *marker)
{
if (!node->since().isEmpty()) {
Text text;
- text << Atom::ParaLeft
- << "This "
- << typeString(node)
- << " was introduced ";
+ text << Atom::ParaLeft << "This " << typeString(node) << " was introduced ";
if (node->isEnumType())
text << "or modified ";
- text << "in "
- << formatSince(node)
- << "."
- << Atom::ParaRight;
+ text << "in " << formatSince(node) << "." << Atom::ParaRight;
generateText(text, node, marker);
}
}
@@ -1376,13 +1312,9 @@ void Generator::generateStatus(const Node *node, CodeMarker *marker)
// Do nothing.
break;
case Node::Preliminary:
- text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
- << "This "
- << typeString(node)
- << " is under development and is subject to change."
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
- << Atom::ParaRight;
+ text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "This "
+ << typeString(node) << " is under development and is subject to change."
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << Atom::ParaRight;
break;
case Node::Deprecated:
text << Atom::ParaLeft;
@@ -1418,11 +1350,10 @@ void Generator::generateStatus(const Node *node, CodeMarker *marker)
void Generator::generatePrivateSignalNote(const Node *node, CodeMarker *marker)
{
Text text;
- text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
- << "Note: "
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
- << "This is a private signal. It can be used in signal connections but cannot be emitted by the user."
+ text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
+ << "Note: " << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
+ << "This is a private signal. It can be used in signal connections but cannot be emitted "
+ "by the user."
<< Atom::ParaRight;
generateText(text, node, marker);
}
@@ -1434,16 +1365,11 @@ void Generator::generatePrivateSignalNote(const Node *node, CodeMarker *marker)
void Generator::generateInvokableNote(const Node *node, CodeMarker *marker)
{
Text text;
- text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
- << "Note: "
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
+ text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
+ << "Note: " << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
<< "This function can be invoked via the meta-object system and from QML. See "
- << Atom(Atom::Link,"Q_INVOKABLE")
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << "Q_INVOKABLE"
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
- << "."
+ << Atom(Atom::Link, "Q_INVOKABLE") << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << "Q_INVOKABLE" << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << "."
<< Atom::ParaRight;
generateText(text, node, marker);
}
@@ -1453,19 +1379,13 @@ void Generator::generateInvokableNote(const Node *node, CodeMarker *marker)
is the node that represents the entity where a qdoc comment
was found, and \a text represents the qdoc comment.
*/
-bool Generator::generateText(const Text &text,
- const Node *relative,
- CodeMarker *marker)
+bool Generator::generateText(const Text &text, const Node *relative, CodeMarker *marker)
{
bool result = false;
if (text.firstAtom() != nullptr) {
int numAtoms = 0;
initializeTextOutput();
- generateAtomList(text.firstAtom(),
- relative,
- marker,
- true,
- numAtoms);
+ generateAtomList(text.firstAtom(), relative, marker, true, numAtoms);
result = true;
}
return result;
@@ -1480,16 +1400,14 @@ bool Generator::generateText(const Text &text,
nonreentrant, and true is returned. If there are no exceptions,
the three node lists remain empty and false is returned.
*/
-bool Generator::hasExceptions(const Node *node,
- NodeList &reentrant,
- NodeList &threadsafe,
+bool Generator::hasExceptions(const Node *node, NodeList &reentrant, NodeList &threadsafe,
NodeList &nonreentrant)
{
bool result = false;
Node::ThreadSafeness ts = node->threadSafeness();
const NodeList &children = static_cast<const Aggregate *>(node)->childNodes();
for (auto child : children) {
- if (!child->isObsolete()){
+ if (!child->isObsolete()) {
switch (child->threadSafeness()) {
case Node::Reentrant:
reentrant.append(child);
@@ -1515,11 +1433,8 @@ bool Generator::hasExceptions(const Node *node,
static void startNote(Text &text)
{
- text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
- << "Note:"
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
- << " ";
+ text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
+ << "Note:" << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " ";
}
/*!
@@ -1535,30 +1450,19 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker)
Node::ThreadSafeness ts = node->threadSafeness();
bool exceptions = false;
- rlink << Atom(Atom::Link,"reentrant")
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << "reentrant"
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+ rlink << Atom(Atom::Link, "reentrant") << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << "reentrant" << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
- tlink << Atom(Atom::Link,"thread-safe")
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << "thread-safe"
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+ tlink << Atom(Atom::Link, "thread-safe") << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << "thread-safe" << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
switch (ts) {
case Node::UnspecifiedSafeness:
break;
case Node::NonReentrant:
- text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD)
- << "Warning:"
- << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD)
- << " This "
- << typeString(node)
- << " is not "
- << rlink
- << "."
- << Atom::ParaRight;
+ text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
+ << "Warning:" << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " This "
+ << typeString(node) << " is not " << rlink << "." << Atom::ParaRight;
break;
case Node::Reentrant:
case Node::ThreadSafe:
@@ -1575,8 +1479,7 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker)
text << ".";
else
text << " with the following exceptions:";
- }
- else {
+ } else {
text << "This " << typeString(node) << " is ";
if (ts == Node::ThreadSafe)
text << tlink;
@@ -1589,46 +1492,33 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker)
default:
break;
}
- generateText(text,node,marker);
+ generateText(text, node, marker);
if (exceptions) {
text.clear();
if (ts == Node::Reentrant) {
if (!nonreentrant.isEmpty()) {
startNote(text);
- text << "These functions are not "
- << rlink
- << ":"
- << Atom::ParaRight;
+ text << "These functions are not " << rlink << ":" << Atom::ParaRight;
signatureList(nonreentrant, node, marker);
}
if (!threadsafe.isEmpty()) {
text.clear();
startNote(text);
- text << "These functions are also "
- << tlink
- << ":"
- << Atom::ParaRight;
+ text << "These functions are also " << tlink << ":" << Atom::ParaRight;
generateText(text, node, marker);
signatureList(threadsafe, node, marker);
}
- }
- else { // thread-safe
+ } else { // thread-safe
if (!reentrant.isEmpty()) {
startNote(text);
- text << "These functions are only "
- << rlink
- << ":"
- << Atom::ParaRight;
+ text << "These functions are only " << rlink << ":" << Atom::ParaRight;
signatureList(reentrant, node, marker);
}
if (!nonreentrant.isEmpty()) {
text.clear();
startNote(text);
- text << "These functions are not "
- << rlink
- << ":"
- << Atom::ParaRight;
+ text << "These functions are not " << rlink << ":" << Atom::ParaRight;
signatureList(nonreentrant, node, marker);
}
}
@@ -1683,19 +1573,15 @@ void Generator::generateOverloadedSignal(const Node *node, CodeMarker *marker)
return;
Text text;
- text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
- << "Note:"
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
- << " Signal "
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_ITALIC)
- << node->name()
+ text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
+ << "Note:" << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " Signal "
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_ITALIC) << node->name()
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_ITALIC)
<< " is overloaded in this class. "
"To connect to this signal by using the function pointer syntax, Qt "
"provides a convenient helper for obtaining the function pointer as "
"shown in this example:"
- << Atom(Atom::Code, marker->markedUpCode(code, node, node->location()));
+ << Atom(Atom::Code, marker->markedUpCode(code, node, node->location()));
generateText(text, node, marker);
}
@@ -1750,7 +1636,7 @@ QString Generator::getMetadataElement(const Aggregate *inner, const QString &tag
QStringList Generator::getMetadataElements(const Aggregate *inner, const QString &t)
{
QStringList s;
- QStringMultiMap& metaTagMap = const_cast<QStringMultiMap&>(inner->doc().metaTagMap());
+ QStringMultiMap &metaTagMap = const_cast<QStringMultiMap &>(inner->doc().metaTagMap());
s = metaTagMap.values(t);
if (!s.isEmpty())
metaTagMap.remove(t);
@@ -1763,19 +1649,13 @@ QStringList Generator::getMetadataElements(const Aggregate *inner, const QString
QString Generator::imageFileName(const Node *relative, const QString &fileBase)
{
QString userFriendlyFilePath;
- QString filePath = Config::findFile(relative->doc().location(),
- imageFiles,
- imageDirs,
- fileBase,
- imgFileExts[format()],
- &userFriendlyFilePath);
+ QString filePath = Config::findFile(relative->doc().location(), imageFiles, imageDirs, fileBase,
+ imgFileExts[format()], &userFriendlyFilePath);
if (filePath.isEmpty())
return QString();
- QString path = Config::copyFile(relative->doc().location(),
- filePath,
- userFriendlyFilePath,
+ QString path = Config::copyFile(relative->doc().location(), filePath, userFriendlyFilePath,
outputDir() + QLatin1String("/images"));
int images_slash = path.lastIndexOf("images/");
QString relImagePath;
@@ -1796,8 +1676,7 @@ QString Generator::indent(int level, const QString &markedCode)
while (i < markedCode.length()) {
if (markedCode.at(i) == QLatin1Char('\n')) {
column = 0;
- }
- else {
+ } else {
if (column == 0) {
for (int j = 0; j < level; j++)
t += QLatin1Char(' ');
@@ -1809,8 +1688,6 @@ QString Generator::indent(int level, const QString &markedCode)
return t;
}
-
-
void Generator::initialize(const Config &config)
{
outputFormats = config.getOutputFormats();
@@ -1847,13 +1724,15 @@ void Generator::initialize(const Config &config)
config.lastLocation().warning(tr("Formatting '%1' must "
"have exactly one "
"parameter (found %2)")
- .arg(n).arg(numParams));
+ .arg(n)
+ .arg(numParams));
} else if (numOccs > 1) {
config.lastLocation().fatal(tr("Formatting '%1' must "
"contain exactly one "
"occurrence of '\\1' "
"(found %2)")
- .arg(n).arg(numOccs));
+ .arg(n)
+ .arg(numOccs));
} else {
int paramPos = def.indexOf("\1");
fmtLeftMaps[f].insert(n, def.left(paramPos));
@@ -1889,15 +1768,16 @@ void Generator::initialize(const Config &config)
Creates template-specific subdirs (e.g. /styles and /scripts for HTML)
and copies the files to them.
*/
-void Generator::copyTemplateFiles(const Config &config, const QString &configVar, const QString &subDir)
+void Generator::copyTemplateFiles(const Config &config, const QString &configVar,
+ const QString &subDir)
{
QStringList files = config.getCanonicalPathList(configVar, true);
if (!files.isEmpty()) {
QDir dirInfo;
QString templateDir = outDir_ + QLatin1Char('/') + subDir;
if (!dirInfo.exists(templateDir) && !dirInfo.mkdir(templateDir)) {
- config.lastLocation().fatal(tr("Cannot create %1 directory '%2'")
- .arg(subDir, templateDir));
+ config.lastLocation().fatal(
+ tr("Cannot create %1 directory '%2'").arg(subDir, templateDir));
} else {
for (const auto &file : files) {
if (!file.isEmpty())
@@ -1945,7 +1825,8 @@ void Generator::initializeFormat(const Config &config)
return;
if (!dirInfo.exists(outDir_ + "/images") && !dirInfo.mkdir(outDir_ + "/images"))
- config.lastLocation().fatal(tr("Cannot create images directory '%1'").arg(outDir_ + "/images"));
+ config.lastLocation().fatal(
+ tr("Cannot create images directory '%1'").arg(outDir_ + "/images"));
copyTemplateFiles(config, format() + Config::dot + CONFIG_STYLESHEETS, "style");
copyTemplateFiles(config, format() + Config::dot + CONFIG_SCRIPTS, "scripts");
@@ -2021,42 +1902,36 @@ QString Generator::outputSuffix(const Node *node)
return QString();
}
-bool Generator::parseArg(const QString &src,
- const QString &tag,
- int *pos,
- int n,
- QStringRef *contents,
- QStringRef *par1,
- bool debug)
-{
-#define SKIP_CHAR(c) \
- if (debug) \
- qDebug() << "looking for " << c << " at " << QString(src.data() + i, n - i); \
- if (i >= n || src[i] != c) { \
- if (debug) \
- qDebug() << " char '" << c << "' not found"; \
- return false; \
-} \
+bool Generator::parseArg(const QString &src, const QString &tag, int *pos, int n,
+ QStringRef *contents, QStringRef *par1, bool debug)
+{
+#define SKIP_CHAR(c) \
+ if (debug) \
+ qDebug() << "looking for " << c << " at " << QString(src.data() + i, n - i); \
+ if (i >= n || src[i] != c) { \
+ if (debug) \
+ qDebug() << " char '" << c << "' not found"; \
+ return false; \
+ } \
++i;
-
-#define SKIP_SPACE \
- while (i < n && src[i] == ' ') \
- ++i;
+#define SKIP_SPACE \
+ while (i < n && src[i] == ' ') \
+ ++i;
int i = *pos;
int j = i;
// assume "<@" has been parsed outside
- //SKIP_CHAR('<');
- //SKIP_CHAR('@');
+ // SKIP_CHAR('<');
+ // SKIP_CHAR('@');
if (tag != QStringRef(&src, i, tag.length())) {
return false;
}
if (debug)
- qDebug() << "haystack:" << src << "needle:" << tag << "i:" <<i;
+ qDebug() << "haystack:" << src << "needle:" << tag << "i:" << i;
// skip tag
i += tag.length();
@@ -2188,8 +2063,7 @@ void Generator::supplementAlsoList(const Node *node, QVector<Text> &alsoList)
alternateFunc = fn->parent()->findFunctionChild(alternateName, QString());
}
}
- }
- else if (!fn->name().isEmpty()) {
+ } else if (!fn->name().isEmpty()) {
alternateName = "set";
alternateName += fn->name()[0].toUpper();
alternateName += fn->name().mid(1);
@@ -2208,8 +2082,7 @@ void Generator::supplementAlsoList(const Node *node, QVector<Text> &alsoList)
Text also;
also << Atom(Atom::Link, alternateName)
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << alternateName
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) << alternateName
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
alsoList.prepend(also);
}
@@ -2221,8 +2094,8 @@ void Generator::supplementAlsoList(const Node *node, QVector<Text> &alsoList)
void Generator::terminate()
{
for (const auto &generator : qAsConst(generators)) {
- if (outputFormats.contains(generator->format()))
- generator->terminateGenerator();
+ if (outputFormats.contains(generator->format()))
+ generator->terminateGenerator();
}
fmtLeftMaps.clear();
@@ -2233,15 +2106,14 @@ void Generator::terminate()
outDir_.clear();
}
-void Generator::terminateGenerator()
-{
-}
+void Generator::terminateGenerator() {}
/*!
Trims trailing whitespace off the \a string and returns
the trimmed string.
*/
-QString Generator::trimmedTrailing(const QString &string, const QString &prefix, const QString &suffix)
+QString Generator::trimmedTrailing(const QString &string, const QString &prefix,
+ const QString &suffix)
{
QString trimmed = string;
while (trimmed.length() > 0 && trimmed[trimmed.length() - 1].isSpace())
@@ -2304,8 +2176,8 @@ QString Generator::typeString(const Node *node)
void Generator::unknownAtom(const Atom *atom)
{
- Location::internalError(tr("unknown atom type '%1' in %2 generator")
- .arg(atom->typeString()).arg(format()));
+ Location::internalError(
+ tr("unknown atom type '%1' in %2 generator").arg(atom->typeString()).arg(format()));
}
QT_END_NAMESPACE
diff --git a/src/qdoc/generator.h b/src/qdoc/generator.h
index 10fd5131a..6723884f1 100644
--- a/src/qdoc/generator.h
+++ b/src/qdoc/generator.h
@@ -68,11 +68,9 @@ public:
QString fullDocumentLocation(const Node *node, bool useSubdir = false);
const Config *config() { return config_; }
- QString linkForExampleFile(const QString &path,
- const Node *parent,
+ QString linkForExampleFile(const QString &path, const Node *parent,
const QString &fileExt = QString());
- static QString exampleFileTitle(const ExampleNode *relative,
- const QString &fileName);
+ static QString exampleFileTitle(const ExampleNode *relative, const QString &fileName);
static Generator *currentGenerator() { return currentGenerator_; }
static Generator *generatorForFormat(const QString &format);
static void initialize(const Config &config);
@@ -110,7 +108,7 @@ protected:
void endSubPage();
virtual QString fileBase(const Node *node) const;
virtual QString fileExtension() const = 0;
- virtual void generateQAPage() { }
+ virtual void generateQAPage() {}
virtual void generateExampleFilePage(const Node *, const QString &, CodeMarker *) {}
virtual void generateAlsoList(const Node *node, CodeMarker *marker);
virtual int generateAtom(const Atom *, const Node *, CodeMarker *) { return 0; }
@@ -128,9 +126,7 @@ protected:
virtual void generateMaintainerList(const Aggregate *node, CodeMarker *marker);
virtual void generateQmlInheritedBy(const QmlTypeNode *qcn, CodeMarker *marker);
virtual void generateQmlInherits(QmlTypeNode *, CodeMarker *) {}
- virtual bool generateQmlText(const Text &text,
- const Node *relative,
- CodeMarker *marker,
+ virtual bool generateQmlText(const Text &text, const Node *relative, CodeMarker *marker,
const QString &qmlName);
virtual bool generateText(const Text &text, const Node *relative, CodeMarker *marker);
virtual QString imageFileName(const Node *relative, const QString &fileBase);
@@ -142,20 +138,17 @@ protected:
static QString outputSuffix(const Node *node);
static void singularPlural(Text &text, const NodeList &nodes);
static void supplementAlsoList(const Node *node, QVector<Text> &alsoList);
- static QString trimmedTrailing(const QString &string,
- const QString &prefix,
+ static QString trimmedTrailing(const QString &string, const QString &prefix,
const QString &suffix);
void initializeTextOutput();
QString fileName(const Node *node, const QString &extension = QString()) const;
QMap<QString, QString> &formattingLeftMap();
QMap<QString, QString> &formattingRightMap();
- const Atom *generateAtomList(const Atom *atom,
- const Node *relative,
- CodeMarker *marker,
- bool generate,
- int &numGeneratedAtoms);
+ const Atom *generateAtomList(const Atom *atom, const Node *relative, CodeMarker *marker,
+ bool generate, int &numGeneratedAtoms);
void generateRequiredLinks(const Node *node, CodeMarker *marker);
- void generateLinkToExample(const ExampleNode *en, CodeMarker *marker, const QString &exampleUrl);
+ void generateLinkToExample(const ExampleNode *en, CodeMarker *marker,
+ const QString &exampleUrl);
virtual void generateFileList(const ExampleNode *en, CodeMarker *marker, bool images);
static QString formatSince(const Node *node);
void generateSince(const Node *node, CodeMarker *marker);
@@ -168,41 +161,30 @@ protected:
void generateOverloadedSignal(const Node *node, CodeMarker *marker);
static QString getOverloadedSignalCode(const Node *node);
QString indent(int level, const QString &markedCode);
- QTextStream& out();
+ QTextStream &out();
QString outFileName();
- bool parseArg(const QString &src,
- const QString &tag,
- int *pos,
- int n,
- QStringRef *contents,
- QStringRef *par1 = nullptr,
- bool debug = false);
+ bool parseArg(const QString &src, const QString &tag, int *pos, int n, QStringRef *contents,
+ QStringRef *par1 = nullptr, bool debug = false);
void setImageFileExtensions(const QStringList &extensions);
void unknownAtom(const Atom *atom);
int appendSortedQmlNames(Text &text, const Node *base, const NodeList &subs);
- static bool hasExceptions(const Node *node,
- NodeList &reentrant,
- NodeList &threadsafe,
+ static bool hasExceptions(const Node *node, NodeList &reentrant, NodeList &threadsafe,
NodeList &nonreentrant);
QMap<QString, QStringList> editionGroupMap;
QMap<QString, QStringList> editionModuleMap;
QString naturalLanguage;
#ifndef QT_NO_TEXTCODEC
- QTextCodec* outputCodec;
+ QTextCodec *outputCodec;
QString outputEncoding;
#endif
QString tagFile_;
QStack<QTextStream *> outStreamStack;
- void appendFullName(Text &text,
- const Node *apparentNode,
- const Node *relative,
+ void appendFullName(Text &text, const Node *apparentNode, const Node *relative,
const Node *actualNode = nullptr);
- void appendFullName(Text &text,
- const Node *apparentNode,
- const QString &fullName,
+ void appendFullName(Text &text, const Node *apparentNode, const QString &fullName,
const Node *actualNode);
void appendFullNames(Text &text, const NodeList &nodes, const Node *relative);
int appendSortedNames(Text &text, const ClassNode *classe,
@@ -216,8 +198,8 @@ private:
static Generator *currentGenerator_;
static QStringList exampleDirs;
static QStringList exampleImgExts;
- static QMap<QString, QMap<QString, QString> > fmtLeftMaps;
- static QMap<QString, QMap<QString, QString> > fmtRightMaps;
+ static QMap<QString, QMap<QString, QString>> fmtLeftMaps;
+ static QMap<QString, QMap<QString, QString>> fmtRightMaps;
static QVector<Generator *> generators;
static QStringList imageDirs;
static QStringList imageFiles;
@@ -246,8 +228,7 @@ private:
void generateReimplementsClause(const FunctionNode *fn, CodeMarker *marker);
static bool compareNodes(Node *a, Node *b) { return (a->name() < b->name()); }
static bool comparePaths(QString a, QString b) { return (a < b); }
- static void copyTemplateFiles(const Config &config,
- const QString &configVar,
+ static void copyTemplateFiles(const Config &config, const QString &configVar,
const QString &subDir);
protected:
diff --git a/src/qdoc/helpprojectwriter.cpp b/src/qdoc/helpprojectwriter.cpp
index 4ef77f06a..6f231f232 100644
--- a/src/qdoc/helpprojectwriter.cpp
+++ b/src/qdoc/helpprojectwriter.cpp
@@ -41,16 +41,13 @@
QT_BEGIN_NAMESPACE
-HelpProjectWriter::HelpProjectWriter(const Config &config,
- const QString &defaultFileName,
+HelpProjectWriter::HelpProjectWriter(const Config &config, const QString &defaultFileName,
Generator *g)
{
reset(config, defaultFileName, g);
}
-void HelpProjectWriter::reset(const Config &config,
- const QString &defaultFileName,
- Generator *g)
+void HelpProjectWriter::reset(const Config &config, const QString &defaultFileName, Generator *g)
{
projects.clear();
gen_ = g;
@@ -83,15 +80,19 @@ void HelpProjectWriter::reset(const Config &config,
project.indexTitle = config.getString(prefix + "indexTitle");
project.indexRoot = config.getString(prefix + "indexRoot");
const auto &filterAttributes = config.getStringList(prefix + "filterAttributes");
- project.filterAttributes = QSet<QString>(filterAttributes.cbegin(), filterAttributes.cend());
+ project.filterAttributes =
+ QSet<QString>(filterAttributes.cbegin(), filterAttributes.cend());
project.includeIndexNodes = config.getBool(prefix + "includeIndexNodes");
const QSet<QString> customFilterNames = config.subVars(prefix + "customFilters");
for (const auto &filterName : customFilterNames) {
- QString name = config.getString(prefix + "customFilters" + Config::dot + filterName + Config::dot + "name");
- const auto &filters = config.getStringList(prefix + "customFilters" + Config::dot + filterName + Config::dot + "filterAttributes");
+ QString name = config.getString(prefix + "customFilters" + Config::dot + filterName
+ + Config::dot + "name");
+ const auto &filters =
+ config.getStringList(prefix + "customFilters" + Config::dot + filterName
+ + Config::dot + "filterAttributes");
project.customFilters[name] = QSet<QString>(filters.cbegin(), filters.cend());
}
- //customFilters = config.defs.
+ // customFilters = config.defs.
const auto excludedPrefixes = config.getStringSet(prefix + "excluded");
for (auto name : excludedPrefixes)
@@ -128,7 +129,7 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList
typeHash["union"] = Node::Union;
typeHash["header"] = Node::HeaderFile;
typeHash["headerfile"] = Node::HeaderFile;
- typeHash["doc"] = Node::Page; // to be removed from qdocconf files
+ typeHash["doc"] = Node::Page; // to be removed from qdocconf files
typeHash["fake"] = Node::Page; // to be removed from qdocconf files
typeHash["page"] = Node::Page;
typeHash["enum"] = Node::Enum;
@@ -155,7 +156,6 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList
pageTypeHash["page"] = Node::Page;
pageTypeHash["externalpage"] = Node::ExternalPage;
-
NodeTypeSet fullSubset;
for (auto it = pageTypeHash.constBegin(); it != pageTypeHash.constEnd(); ++it)
fullSubset.insert(it.value());
@@ -215,29 +215,25 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const
if (node->parent() && !node->parent()->name().isEmpty()) {
// "name"
if (node->isEnumType() || node->isTypedef())
- details << node->parent()->name()+"::"+node->name();
+ details << node->parent()->name() + "::" + node->name();
else
details << node->name();
// "id"
if (!node->isRelatedNonmember())
- details << node->parent()->name()+"::"+node->name();
+ details << node->parent()->name() + "::" + node->name();
else
details << node->name();
- }
- else if (node->isQmlType() || node->isQmlBasicType()) {
+ } else if (node->isQmlType() || node->isQmlBasicType()) {
details << node->name();
details << "QML." + node->name();
- }
- else if (node->isJsType() || node->isJsBasicType()) {
+ } else if (node->isJsType() || node->isJsBasicType()) {
details << node->name();
details << "JS." + node->name();
- }
- else if (node->isTextPageNode()) {
+ } else if (node->isTextPageNode()) {
const PageNode *fake = static_cast<const PageNode *>(node);
details << fake->fullTitle();
details << fake->fullTitle();
- }
- else {
+ } else {
details << node->name();
details << node->name();
}
@@ -245,8 +241,7 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const
return details;
}
-bool HelpProjectWriter::generateSection(HelpProject &project,
- QXmlStreamWriter & /* writer */,
+bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter & /* writer */,
const Node *node)
{
if (!node->url().isEmpty() && !(project.includeIndexNodes && !node->url().startsWith("http")))
@@ -271,16 +266,15 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
// No selectors: accept all nodes.
if (subproject.selectors.isEmpty()) {
project.subprojects[i].nodes[objName] = node;
- }
- else if (subproject.selectors.contains(node->nodeType())) {
+ } else if (subproject.selectors.contains(node->nodeType())) {
// Add all group members for '[group|module|qmlmodule]:name' selector
if (node->isGroup() || node->isModule() || node->isQmlModule()) {
if (project.subprojects[i].groups.contains(node->name().toLower())) {
const CollectionNode *cn = static_cast<const CollectionNode *>(node);
const auto members = cn->members();
for (const Node *m : members) {
- QString memberName = m->isTextPageNode()
- ? m->fullTitle() : m->fullDocumentName();
+ QString memberName =
+ m->isTextPageNode() ? m->fullTitle() : m->fullDocumentName();
project.subprojects[i].nodes[memberName] = m;
}
}
@@ -291,8 +285,8 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
else {
// Accept only doc nodes with subtypes contained in the selector's
// mask.
- if (subproject.selectors[node->nodeType()].contains(node->nodeType()) &&
- !node->isExternalPage() && !node->fullTitle().isEmpty()) {
+ if (subproject.selectors[node->nodeType()].contains(node->nodeType())
+ && !node->isExternalPage() && !node->fullTitle().isEmpty()) {
project.subprojects[i].nodes[objName] = node;
}
@@ -316,13 +310,12 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
for (const Atom *keyword : keywords) {
if (!keyword->string().isEmpty()) {
QStringList details;
- details << keyword->string()
- << keyword->string()
+ details << keyword->string() << keyword->string()
<< gen_->fullDocumentLocation(node, false);
project.keywords.append(details);
- }
- else
- node->doc().location().warning(tr("Bad keyword in %1").arg(gen_->fullDocumentLocation(node, false)));
+ } else
+ node->doc().location().warning(
+ tr("Bad keyword in %1").arg(gen_->fullDocumentLocation(node, false)));
}
}
project.keywords.append(keywordDetails(node));
@@ -334,55 +327,51 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
case Node::Enum:
project.keywords.append(keywordDetails(node));
- {
- const EnumNode *enumNode = static_cast<const EnumNode *>(node);
- const auto items = enumNode->items();
- for (const auto &item : items) {
- QStringList details;
+ {
+ const EnumNode *enumNode = static_cast<const EnumNode *>(node);
+ const auto items = enumNode->items();
+ for (const auto &item : items) {
+ QStringList details;
- if (enumNode->itemAccess(item.name()) == Node::Private)
- continue;
+ if (enumNode->itemAccess(item.name()) == Node::Private)
+ continue;
- if (!node->parent()->name().isEmpty()) {
- details << node->parent()->name()+"::"+item.name(); // "name"
- details << node->parent()->name()+"::"+item.name(); // "id"
- } else {
- details << item.name(); // "name"
- details << item.name(); // "id"
+ if (!node->parent()->name().isEmpty()) {
+ details << node->parent()->name() + "::" + item.name(); // "name"
+ details << node->parent()->name() + "::" + item.name(); // "id"
+ } else {
+ details << item.name(); // "name"
+ details << item.name(); // "id"
+ }
+ details << gen_->fullDocumentLocation(node, false);
+ project.keywords.append(details);
}
- details << gen_->fullDocumentLocation(node, false);
- project.keywords.append(details);
}
- }
break;
case Node::Group:
case Node::Module:
case Node::QmlModule:
- case Node::JsModule:
- {
- const CollectionNode *cn = static_cast<const CollectionNode *>(node);
- if (!cn->fullTitle().isEmpty()) {
- if (cn->doc().hasKeywords()) {
- const auto keywords = cn->doc().keywords();
- for (const Atom *keyword : keywords) {
- if (!keyword->string().isEmpty()) {
- QStringList details;
- details << keyword->string()
- << keyword->string()
- << gen_->fullDocumentLocation(node, false);
- project.keywords.append(details);
- }
- else
- cn->doc().location().warning(
- tr("Bad keyword in %1").arg(gen_->fullDocumentLocation(node, false))
- );
- }
+ case Node::JsModule: {
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
+ if (!cn->fullTitle().isEmpty()) {
+ if (cn->doc().hasKeywords()) {
+ const auto keywords = cn->doc().keywords();
+ for (const Atom *keyword : keywords) {
+ if (!keyword->string().isEmpty()) {
+ QStringList details;
+ details << keyword->string() << keyword->string()
+ << gen_->fullDocumentLocation(node, false);
+ project.keywords.append(details);
+ } else
+ cn->doc().location().warning(
+ tr("Bad keyword in %1")
+ .arg(gen_->fullDocumentLocation(node, false)));
}
- project.keywords.append(keywordDetails(node));
}
+ project.keywords.append(keywordDetails(node));
}
- break;
+ } break;
case Node::Property:
case Node::QmlProperty:
@@ -390,8 +379,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
project.keywords.append(keywordDetails(node));
break;
- case Node::Function:
- {
+ case Node::Function: {
const FunctionNode *funcNode = static_cast<const FunctionNode *>(node);
/*
@@ -419,11 +407,9 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
if (node->parent())
project.memberStatus[node->parent()].insert(node->status());
- }
- break;
+ } break;
- case Node::Typedef:
- {
+ case Node::Typedef: {
const TypedefNode *typedefNode = static_cast<const TypedefNode *>(node);
QStringList typedefDetails = keywordDetails(node);
const EnumNode *enumNode = typedefNode->associatedEnum();
@@ -433,14 +419,11 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
typedefDetails[2] = gen_->fullDocumentLocation(enumNode, false);
project.keywords.append(typedefDetails);
- }
- break;
+ } break;
- case Node::Variable:
- {
+ case Node::Variable: {
project.keywords.append(keywordDetails(node));
- }
- break;
+ } break;
// Page nodes (such as manual pages) contain subtypes, titles and other
// attributes.
@@ -452,8 +435,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
for (const Atom *keyword : keywords) {
if (!keyword->string().isEmpty()) {
QStringList details;
- details << keyword->string()
- << keyword->string()
+ details << keyword->string() << keyword->string()
<< gen_->fullDocumentLocation(node, false);
project.keywords.append(details);
} else {
@@ -466,8 +448,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
}
break;
}
- default:
- ;
+ default:;
}
// Add all images referenced in the page to the set of files to include.
@@ -485,7 +466,8 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
return true;
}
-void HelpProjectWriter::generateSections(HelpProject &project, QXmlStreamWriter &writer, const Node *node)
+void HelpProjectWriter::generateSections(HelpProject &project, QXmlStreamWriter &writer,
+ const Node *node)
{
/*
Don't include index nodes in the help file.
@@ -542,7 +524,7 @@ void HelpProjectWriter::writeHashFile(QFile &file)
}
void HelpProjectWriter::writeSection(QXmlStreamWriter &writer, const QString &path,
- const QString &value)
+ const QString &value)
{
writer.writeStartElement(QStringLiteral("section"));
writer.writeAttribute(QStringLiteral("ref"), path);
@@ -553,11 +535,10 @@ void HelpProjectWriter::writeSection(QXmlStreamWriter &writer, const QString &pa
/*!
Write subsections for all members, compatibility members and obsolete members.
*/
-void HelpProjectWriter::addMembers(HelpProject &project, QXmlStreamWriter &writer,
- const Node *node)
+void HelpProjectWriter::addMembers(HelpProject &project, QXmlStreamWriter &writer, const Node *node)
{
QString href = gen_->fullDocumentLocation(node, false);
- href = href.left(href.size()-5);
+ href = href.left(href.size() - 5);
if (href.isEmpty())
return;
@@ -567,9 +548,9 @@ void HelpProjectWriter::addMembers(HelpProject &project, QXmlStreamWriter &write
// Do not generate a 'List of all members' for namespaces or header files,
// but always generate it for derived classes and QML classes
- if (!node->isNamespace() && !node->isHeader() &&
- (derivedClass || node->isQmlType() || node->isJsType() ||
- !project.memberStatus[node].isEmpty())) {
+ if (!node->isNamespace() && !node->isHeader()
+ && (derivedClass || node->isQmlType() || node->isJsType()
+ || !project.memberStatus[node].isEmpty())) {
QString membersPath = href + QStringLiteral("-members.html");
writeSection(writer, membersPath, tr("List of all members"));
}
@@ -579,8 +560,7 @@ void HelpProjectWriter::addMembers(HelpProject &project, QXmlStreamWriter &write
}
}
-void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer,
- const Node *node)
+void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer, const Node *node)
{
QString href = gen_->fullDocumentLocation(node, false);
QString objName = node->name();
@@ -593,7 +573,8 @@ void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer
writer.writeStartElement("section");
writer.writeAttribute("ref", href);
if (node->parent() && !node->parent()->name().isEmpty())
- writer.writeAttribute("title", tr("%1::%2 Class Reference").arg(node->parent()->name()).arg(objName));
+ writer.writeAttribute(
+ "title", tr("%1::%2 Class Reference").arg(node->parent()->name()).arg(objName));
else
writer.writeAttribute("title", tr("%1 Class Reference").arg(objName));
@@ -632,22 +613,18 @@ void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer
writer.writeAttribute("title", pn->fullTitle());
writer.writeEndElement(); // section
- }
- break;
+ } break;
case Node::Group:
case Node::Module:
case Node::JsModule:
- case Node::QmlModule:
- {
- const CollectionNode *cn = static_cast<const CollectionNode *>(node);
- writer.writeStartElement("section");
- writer.writeAttribute("ref", href);
- writer.writeAttribute("title", cn->fullTitle());
- writer.writeEndElement(); // section
- }
- break;
- default:
- ;
+ case Node::QmlModule: {
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
+ writer.writeStartElement("section");
+ writer.writeAttribute("ref", href);
+ writer.writeAttribute("title", cn->fullTitle());
+ writer.writeEndElement(); // section
+ } break;
+ default:;
}
}
@@ -689,7 +666,8 @@ void HelpProjectWriter::generateProject(HelpProject &project)
writer.writeEndElement();
// Write customFilter elements.
- for (auto it = project.customFilters.constBegin(); it != project.customFilters.constEnd(); ++it) {
+ for (auto it = project.customFilters.constBegin(); it != project.customFilters.constEnd();
+ ++it) {
writer.writeStartElement("customFilter");
writer.writeAttribute("name", it.key());
QStringList sortedAttributes = it.value().values();
@@ -768,8 +746,7 @@ void HelpProjectWriter::generateProject(HelpProject &project)
sectionStack.top() += 1;
}
break;
- default:
- ;
+ default:;
}
if (atom == indexBody.lastAtom())
@@ -778,14 +755,13 @@ void HelpProjectWriter::generateProject(HelpProject &project)
}
} else
rootNode->doc().location().warning(
- tr("Failed to find index: %1").arg(subproject.indexTitle)
- );
+ tr("Failed to find index: %1").arg(subproject.indexTitle));
} else {
writer.writeStartElement("section");
- QString indexPath = gen_->fullDocumentLocation(qdb_->findNodeForTarget(subproject.indexTitle, nullptr),
- false);
+ QString indexPath = gen_->fullDocumentLocation(
+ qdb_->findNodeForTarget(subproject.indexTitle, nullptr), false);
writer.writeAttribute("ref", indexPath);
writer.writeAttribute("title", subproject.title);
@@ -801,8 +777,8 @@ void HelpProjectWriter::generateProject(HelpProject &project)
bool contentsFound = false;
for (const auto *node : qAsConst(subproject.nodes)) {
QString nextTitle = node->links().value(Node::NextLink).first;
- if (!nextTitle.isEmpty() &&
- node->links().value(Node::ContentsLink).first.isEmpty()) {
+ if (!nextTitle.isEmpty()
+ && node->links().value(Node::ContentsLink).first.isEmpty()) {
const Node *nextPage = qdb_->findNodeForTarget(nextTitle, nullptr);
@@ -849,7 +825,7 @@ void HelpProjectWriter::generateProject(HelpProject &project)
writer.writeAttribute("name", details[0]);
writer.writeAttribute("id", details[1]);
writer.writeAttribute("ref", details[2]);
- writer.writeEndElement(); //keyword
+ writer.writeEndElement(); // keyword
}
writer.writeEndElement(); // keywords
@@ -857,7 +833,8 @@ void HelpProjectWriter::generateProject(HelpProject &project)
// The list of files to write is the union of generated files and
// other files (images and extras) included in the project
- QSet<QString> files = QSet<QString>(gen_->outputFileNames().cbegin(), gen_->outputFileNames().cend());
+ QSet<QString> files =
+ QSet<QString>(gen_->outputFileNames().cbegin(), gen_->outputFileNames().cend());
files.unite(project.files);
files.unite(project.extraFiles);
QStringList sortedFiles = files.values();
diff --git a/src/qdoc/helpprojectwriter.h b/src/qdoc/helpprojectwriter.h
index 222a5f097..be5439dfb 100644
--- a/src/qdoc/helpprojectwriter.h
+++ b/src/qdoc/helpprojectwriter.h
@@ -83,30 +83,22 @@ class HelpProjectWriter
Q_DECLARE_TR_FUNCTIONS(QDoc::HelpProjectWriter)
public:
- HelpProjectWriter(const Config &config,
- const QString &defaultFileName,
- Generator *g);
- void reset(const Config &config,
- const QString &defaultFileName,
- Generator *g);
+ HelpProjectWriter(const Config &config, const QString &defaultFileName, Generator *g);
+ void reset(const Config &config, const QString &defaultFileName, Generator *g);
void addExtraFile(const QString &file);
void addExtraFiles(const QSet<QString> &files);
void generate();
private:
void generateProject(HelpProject &project);
- void generateSections(HelpProject &project, QXmlStreamWriter &writer,
- const Node *node);
- bool generateSection(HelpProject &project, QXmlStreamWriter &writer,
- const Node *node);
+ void generateSections(HelpProject &project, QXmlStreamWriter &writer, const Node *node);
+ bool generateSection(HelpProject &project, QXmlStreamWriter &writer, const Node *node);
QStringList keywordDetails(const Node *node) const;
void writeHashFile(QFile &file);
void writeNode(HelpProject &project, QXmlStreamWriter &writer, const Node *node);
void readSelectors(SubProject &subproject, const QStringList &selectors);
- void addMembers(HelpProject &project, QXmlStreamWriter &writer,
- const Node *node);
- void writeSection(QXmlStreamWriter &writer, const QString &path,
- const QString &value);
+ void addMembers(HelpProject &project, QXmlStreamWriter &writer, const Node *node);
+ void writeSection(QXmlStreamWriter &writer, const QString &path, const QString &value);
QDocDatabase *qdb_;
Generator *gen_;
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index 05241753d..23183614b 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -66,9 +66,7 @@ static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)");
static QRegExp spanTag("</@(?:comment|preprocessor|string|char|number|op|type|name|keyword)>");
static QRegExp unknownTag("</?@[^>]*>");
-static void addLink(const QString &linkTarget,
- const QStringRef &nestedStuff,
- QString *res)
+static void addLink(const QString &linkTarget, const QStringRef &nestedStuff, QString *res)
{
if (!linkTarget.isEmpty()) {
*res += QLatin1String("<a href=\"");
@@ -76,8 +74,7 @@ static void addLink(const QString &linkTarget,
*res += QLatin1String("\">");
*res += nestedStuff;
*res += QLatin1String("</a>");
- }
- else {
+ } else {
*res += nestedStuff;
}
}
@@ -112,26 +109,29 @@ HtmlGenerator::~HtmlGenerator()
*/
void HtmlGenerator::initializeGenerator(const Config &config)
{
- static const struct {
+ static const struct
+ {
const char *key;
const char *left;
const char *right;
- } defaults[] = {
- { ATOM_FORMATTING_BOLD, "<b>", "</b>" },
- { ATOM_FORMATTING_INDEX, "<!--", "-->" },
- { ATOM_FORMATTING_ITALIC, "<i>", "</i>" },
- { ATOM_FORMATTING_PARAMETER, "<i>", "</i>" },
- { ATOM_FORMATTING_SUBSCRIPT, "<sub>", "</sub>" },
- { ATOM_FORMATTING_SUPERSCRIPT, "<sup>", "</sup>" },
- { ATOM_FORMATTING_TELETYPE, "<code>", "</code>" }, // <tt> tag is not supported in HTML5
- { ATOM_FORMATTING_UICONTROL, "<b>", "</b>" },
- { ATOM_FORMATTING_UNDERLINE, "<u>", "</u>" },
- { nullptr, nullptr, nullptr }
- };
+ } defaults[] = { { ATOM_FORMATTING_BOLD, "<b>", "</b>" },
+ { ATOM_FORMATTING_INDEX, "<!--", "-->" },
+ { ATOM_FORMATTING_ITALIC, "<i>", "</i>" },
+ { ATOM_FORMATTING_PARAMETER, "<i>", "</i>" },
+ { ATOM_FORMATTING_SUBSCRIPT, "<sub>", "</sub>" },
+ { ATOM_FORMATTING_SUPERSCRIPT, "<sup>", "</sup>" },
+ { ATOM_FORMATTING_TELETYPE, "<code>",
+ "</code>" }, // <tt> tag is not supported in HTML5
+ { ATOM_FORMATTING_UICONTROL, "<b>", "</b>" },
+ { ATOM_FORMATTING_UNDERLINE, "<u>", "</u>" },
+ { nullptr, nullptr, nullptr } };
Generator::initializeGenerator(config);
obsoleteLinks = config.getBool(CONFIG_OBSOLETELINKS);
- setImageFileExtensions(QStringList() << "png" << "jpg" << "jpeg" << "gif");
+ setImageFileExtensions(QStringList() << "png"
+ << "jpg"
+ << "jpeg"
+ << "gif");
/*
The formatting maps are owned by Generator. They are cleared in
@@ -140,44 +140,27 @@ void HtmlGenerator::initializeGenerator(const Config &config)
int i = 0;
while (defaults[i].key) {
formattingLeftMap().insert(QLatin1String(defaults[i].key), QLatin1String(defaults[i].left));
- formattingRightMap().insert(QLatin1String(defaults[i].key), QLatin1String(defaults[i].right));
+ formattingRightMap().insert(QLatin1String(defaults[i].key),
+ QLatin1String(defaults[i].right));
i++;
}
- style = config.getString(HtmlGenerator::format() +
- Config::dot +
- CONFIG_STYLE);
- endHeader = config.getString(HtmlGenerator::format() +
- Config::dot +
- CONFIG_ENDHEADER);
- postHeader = config.getString(HtmlGenerator::format() +
- Config::dot +
- HTMLGENERATOR_POSTHEADER);
- postPostHeader = config.getString(HtmlGenerator::format() +
- Config::dot +
- HTMLGENERATOR_POSTPOSTHEADER);
- prologue = config.getString(HtmlGenerator::format() +
- Config::dot +
- HTMLGENERATOR_PROLOGUE);
-
- footer = config.getString(HtmlGenerator::format() +
- Config::dot +
- HTMLGENERATOR_FOOTER);
- address = config.getString(HtmlGenerator::format() +
- Config::dot +
- HTMLGENERATOR_ADDRESS);
- pleaseGenerateMacRef = config.getBool(HtmlGenerator::format() +
- Config::dot +
- HTMLGENERATOR_GENERATEMACREFS);
- noNavigationBar = config.getBool(HtmlGenerator::format() +
- Config::dot +
- HTMLGENERATOR_NONAVIGATIONBAR);
- navigationSeparator = config.getString(HtmlGenerator::format() +
- Config::dot +
- HTMLGENERATOR_NAVIGATIONSEPARATOR);
- tocDepth = config.getInt(HtmlGenerator::format() +
- Config::dot +
- HTMLGENERATOR_TOCDEPTH);
+ style = config.getString(HtmlGenerator::format() + Config::dot + CONFIG_STYLE);
+ endHeader = config.getString(HtmlGenerator::format() + Config::dot + CONFIG_ENDHEADER);
+ postHeader = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTHEADER);
+ postPostHeader =
+ config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTPOSTHEADER);
+ prologue = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_PROLOGUE);
+
+ footer = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_FOOTER);
+ address = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_ADDRESS);
+ pleaseGenerateMacRef =
+ config.getBool(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_GENERATEMACREFS);
+ noNavigationBar =
+ config.getBool(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_NONAVIGATIONBAR);
+ navigationSeparator = config.getString(HtmlGenerator::format() + Config::dot
+ + HTMLGENERATOR_NAVIGATIONSEPARATOR);
+ tocDepth = config.getInt(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_TOCDEPTH);
project = config.getString(CONFIG_PROJECT);
@@ -201,16 +184,10 @@ void HtmlGenerator::initializeGenerator(const Config &config)
const QSet<QString> editionNames = config.subVars(CONFIG_EDITION);
for (const auto &editionName : editionNames) {
- QStringList editionModules = config.getStringList(CONFIG_EDITION +
- Config::dot +
- editionName +
- Config::dot +
- "modules");
- QStringList editionGroups = config.getStringList(CONFIG_EDITION +
- Config::dot +
- editionName +
- Config::dot +
- "groups");
+ QStringList editionModules = config.getStringList(CONFIG_EDITION + Config::dot + editionName
+ + Config::dot + "modules");
+ QStringList editionGroups = config.getStringList(CONFIG_EDITION + Config::dot + editionName
+ + Config::dot + "groups");
if (!editionModules.isEmpty())
editionModuleMap[editionName] = editionModules;
@@ -236,46 +213,33 @@ void HtmlGenerator::initializeGenerator(const Config &config)
headerStyles = config.getString(HtmlGenerator::format() + Config::dot + CONFIG_HEADERSTYLES);
QString prefix = CONFIG_QHP + Config::dot + project + Config::dot;
- manifestDir = QLatin1String("qthelp://") + config.getString(prefix + QLatin1String("namespace"));
- manifestDir += QLatin1Char('/') + config.getString(prefix + QLatin1String("virtualFolder")) + QLatin1Char('/');
+ manifestDir =
+ QLatin1String("qthelp://") + config.getString(prefix + QLatin1String("namespace"));
+ manifestDir += QLatin1Char('/') + config.getString(prefix + QLatin1String("virtualFolder"))
+ + QLatin1Char('/');
readManifestMetaContent(config);
examplesPath = config.getString(CONFIG_EXAMPLESINSTALLPATH);
if (!examplesPath.isEmpty())
examplesPath += QLatin1Char('/');
// Retrieve the config for the navigation bar
- homepage = config.getString(CONFIG_NAVIGATION
- + Config::dot
- + CONFIG_HOMEPAGE);
+ homepage = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_HOMEPAGE);
- hometitle = config.getString(CONFIG_NAVIGATION
- + Config::dot
- + CONFIG_HOMETITLE, homepage);
+ hometitle = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_HOMETITLE, homepage);
- landingpage = config.getString(CONFIG_NAVIGATION
- + Config::dot
- + CONFIG_LANDINGPAGE);
+ landingpage = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGPAGE);
- landingtitle = config.getString(CONFIG_NAVIGATION
- + Config::dot
- + CONFIG_LANDINGTITLE, landingpage);
+ landingtitle =
+ config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGTITLE, landingpage);
- cppclassespage = config.getString(CONFIG_NAVIGATION
- + Config::dot
- + CONFIG_CPPCLASSESPAGE);
+ cppclassespage = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_CPPCLASSESPAGE);
- cppclassestitle = config.getString(CONFIG_NAVIGATION
- + Config::dot
- + CONFIG_CPPCLASSESTITLE,
+ cppclassestitle = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_CPPCLASSESTITLE,
QLatin1String("C++ Classes"));
- qmltypespage = config.getString(CONFIG_NAVIGATION
- + Config::dot
- + CONFIG_QMLTYPESPAGE);
+ qmltypespage = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_QMLTYPESPAGE);
- qmltypestitle = config.getString(CONFIG_NAVIGATION
- + Config::dot
- + CONFIG_QMLTYPESTITLE,
+ qmltypestitle = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_QMLTYPESTITLE,
QLatin1String("QML Types"));
buildversion = config.getString(CONFIG_BUILDVERSION);
@@ -324,11 +288,10 @@ void HtmlGenerator::generateDocs()
generateQAPage();
if (!generating()) {
- QString fileBase = project.toLower().simplified().replace(QLatin1Char(' '), QLatin1Char('-'));
- qdb_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index",
- projectUrl,
- projectDescription,
- this);
+ QString fileBase =
+ project.toLower().simplified().replace(QLatin1Char(' '), QLatin1Char('-'));
+ qdb_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index", projectUrl,
+ projectDescription, this);
}
if (!preparing()) {
@@ -350,7 +313,8 @@ void HtmlGenerator::generateQAPage()
beginSubPage(node, "aaa-" + defaultModuleName().toLower() + "-qa-page.html");
CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath());
QString title = "Quality Assurance Page for " + defaultModuleName();
- QString t = "Quality assurance information for checking the " + defaultModuleName() + " documentation.";
+ QString t = "Quality assurance information for checking the " + defaultModuleName()
+ + " documentation.";
generateHeader(title, node, marker);
generateTitle(title, Text() << t, LargeSubTitle, node, marker);
@@ -366,30 +330,27 @@ void HtmlGenerator::generateQAPage()
<< "class=\"even\"><th class=\"tblConst\">Destination Module</th>"
<< "<th class=\"tblval\">Link Count</th></tr>\n";
QString fileName;
- for (int i = 0; i< strings.size(); ++i) {
+ for (int i = 0; i < strings.size(); ++i) {
fileName = generateLinksToLinksPage(strings.at(i), marker);
out() << "<tr><td class=\"topAlign\"><tt>"
- << "<a href=\"" << fileName << "\">"
- << strings.at(i) << "</a>"
- << "</tt></td><td class=\"topAlign\"><tt>" << counts.at(i)
- << "</tt></td></tr>\n";
+ << "<a href=\"" << fileName << "\">" << strings.at(i) << "</a>"
+ << "</tt></td><td class=\"topAlign\"><tt>" << counts.at(i) << "</tt></td></tr>\n";
}
int count = 0;
fileName = generateLinksToBrokenLinksPage(marker, count);
if (count != 0) {
out() << "<tr><td class=\"topAlign\"><tt>"
<< "<a href=\"" << fileName << "\">"
- << "Broken Links" << "</a>"
- << "</tt></td><td class=\"topAlign\"><tt>" << count
- << "</tt></td></tr>\n";
-
+ << "Broken Links"
+ << "</a>"
+ << "</tt></td><td class=\"topAlign\"><tt>" << count << "</tt></td></tr>\n";
}
out() << "</table>\n";
t = "The Optimal \"depends\" Variable";
out() << "<h2>" << protectEnc(t) << "</h2>\n";
- t = "Consider replacing the depends variable in " + defaultModuleName().toLower() +
- ".qdocconf with this one, if the two are not identical:";
+ t = "Consider replacing the depends variable in " + defaultModuleName().toLower()
+ + ".qdocconf with this one, if the two are not identical:";
out() << "<p>" << protectEnc(t) << "</p>\n";
out() << "<p>" << protectEnc(depends) << "</p>\n";
}
@@ -400,20 +361,14 @@ void HtmlGenerator::generateQAPage()
/*!
Generate an html file with the contents of a C++ or QML source file.
*/
-void HtmlGenerator::generateExampleFilePage(const Node *en,
- const QString &file,
- CodeMarker *marker)
+void HtmlGenerator::generateExampleFilePage(const Node *en, const QString &file, CodeMarker *marker)
{
SubTitleSize subTitleSize = LargeSubTitle;
QString fullTitle = en->fullTitle();
beginFilePage(en, linkForExampleFile(file, en));
generateHeader(fullTitle, en, marker);
- generateTitle(fullTitle,
- Text() << en->subtitle(),
- subTitleSize,
- en,
- marker);
+ generateTitle(fullTitle, Text() << en->subtitle(), subTitleSize, en, marker);
Text text;
Quoter quoter;
@@ -441,14 +396,15 @@ QString HtmlGenerator::generateLinksToLinksPage(const QString &module, CodeMarke
QString title = "Links from " + defaultModuleName() + " to " + module;
generateHeader(title, node, marker);
generateTitle(title, Text(), SmallSubTitle, node, marker);
- out() << "<p>This is a list of links from " << defaultModuleName()
- << " to " << module << ". ";
+ out() << "<p>This is a list of links from " << defaultModuleName() << " to " << module << ". ";
out() << "Click on a link to go to the location of the link. The link is marked ";
out() << "with red asterisks. ";
out() << "Click on the marked link to see if it goes to the right place.</p>\n";
const TargetList *tlist = qdb_->getTargetList(module);
if (tlist) {
- out() << "<table class=\"valuelist\"><tr valign=\"top\" class=\"odd\"><th class=\"tblConst\">Link to link...</th><th class=\"tblval\">In file...</th><th class=\"tbldscr\">Somewhere after line number...</th></tr>\n";
+ out() << "<table class=\"valuelist\"><tr valign=\"top\" class=\"odd\"><th "
+ "class=\"tblConst\">Link to link...</th><th class=\"tblval\">In file...</th><th "
+ "class=\"tbldscr\">Somewhere after line number...</th></tr>\n";
for (const TargetLoc *t : *tlist) {
// e.g.: <a name="link-8421"></a><a href="layout.html">Layout Management</a>
out() << "<tr><td class=\"topAlign\">";
@@ -490,7 +446,9 @@ QString HtmlGenerator::generateLinksToBrokenLinksPage(CodeMarker *marker, int &c
out() << "<p>This is a list of broken links in " << defaultModuleName() << ". ";
out() << "Click on a link to go to the broken link. ";
out() << "The link's target could not be found.</p>\n";
- out() << "<table class=\"valuelist\"><tr valign=\"top\" class=\"odd\"><th class=\"tblConst\">Link to broken link...</th><th class=\"tblval\">In file...</th><th class=\"tbldscr\">Somewhere after line number...</th></tr>\n";
+ out() << "<table class=\"valuelist\"><tr valign=\"top\" class=\"odd\"><th "
+ "class=\"tblConst\">Link to broken link...</th><th class=\"tblval\">In "
+ "file...</th><th class=\"tbldscr\">Somewhere after line number...</th></tr>\n";
for (const TargetLoc *t : *tlist) {
// e.g.: <a name="link-8421"></a><a href="layout.html">Layout Management</a>
out() << "<tr><td class=\"topAlign\">";
@@ -518,42 +476,40 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
static bool in_para = false;
switch (atom->type()) {
- case Atom::AutoLink:
- {
+ case Atom::AutoLink: {
QString name = atom->string();
if (relative && relative->name() == name.replace(QLatin1String("()"), QLatin1String())) {
out() << protectEnc(atom->string());
break;
}
}
- Q_FALLTHROUGH();
+ Q_FALLTHROUGH();
case Atom::NavAutoLink:
if (!inLink_ && !inContents_ && !inSectionHeading_) {
const Node *node = nullptr;
QString link = getAutoLink(atom, relative, &node);
if (link.isEmpty()) {
if (autolinkErrors())
- relative->doc().location().warning(tr("Can't autolink to '%1'").arg(atom->string()));
- }
- else if (node && node->isObsolete()) {
+ relative->doc().location().warning(
+ tr("Can't autolink to '%1'").arg(atom->string()));
+ } else if (node && node->isObsolete()) {
if ((relative->parent() != node) && !relative->isObsolete())
link.clear();
}
if (link.isEmpty()) {
out() << protectEnc(atom->string());
- }
- else {
+ } else {
if (Generator::writeQaPages() && node && (atom->type() != Atom::NavAutoLink)) {
QString text = atom->string();
QString target = qdb_->getNewLinkTarget(relative, node, outFileName(), text);
- out() << "<a id=\"" << Doc::canonicalTitle(target) << "\" class=\"qa-mark\"></a>";
+ out() << "<a id=\"" << Doc::canonicalTitle(target)
+ << "\" class=\"qa-mark\"></a>";
}
beginLink(link, node, relative);
generateLink(atom, marker);
endLink();
}
- }
- else {
+ } else {
out() << protectEnc(atom->string());
}
break;
@@ -592,12 +548,16 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
break;
case Atom::Qml:
out() << "<pre class=\"qml\">"
- << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative, false, Node::QML), codePrefix, codeSuffix)
+ << trimmedTrailing(highlightedCode(indent(codeIndent, atom->string()), relative,
+ false, Node::QML),
+ codePrefix, codeSuffix)
<< "</pre>\n";
break;
case Atom::JavaScript:
out() << "<pre class=\"js\">"
- << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative, false, Node::JS), codePrefix, codeSuffix)
+ << trimmedTrailing(highlightedCode(indent(codeIndent, atom->string()), relative,
+ false, Node::JS),
+ codePrefix, codeSuffix)
<< "</pre>\n";
break;
case Atom::CodeNew:
@@ -605,7 +565,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
Q_FALLTHROUGH();
case Atom::Code:
out() << "<pre class=\"cpp\">"
- << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative), codePrefix, codeSuffix)
+ << trimmedTrailing(highlightedCode(indent(codeIndent, atom->string()), relative),
+ codePrefix, codeSuffix)
<< "</pre>\n";
break;
case Atom::CodeOld:
@@ -613,7 +574,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
Q_FALLTHROUGH();
case Atom::CodeBad:
out() << "<pre class=\"cpp plain\">"
- << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))), codePrefix, codeSuffix)
+ << trimmedTrailing(protectEnc(plainCode(indent(codeIndent, atom->string()))),
+ codePrefix, codeSuffix)
<< "</pre>\n";
break;
case Atom::DivLeft:
@@ -644,15 +606,14 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
case Atom::FormattingLeft:
if (atom->string().startsWith("span ")) {
out() << '<' + atom->string() << '>';
- }
- else
+ } else
out() << formattingLeftMap()[atom->string()];
if (atom->string() == ATOM_FORMATTING_PARAMETER) {
if (atom->next() != nullptr && atom->next()->type() == Atom::String) {
QRegExp subscriptRegExp("([a-z]+)_([0-9n])");
if (subscriptRegExp.exactMatch(atom->next()->string())) {
- out() << subscriptRegExp.cap(1) << "<sub>"
- << subscriptRegExp.cap(2) << "</sub>";
+ out() << subscriptRegExp.cap(1) << "<sub>" << subscriptRegExp.cap(2)
+ << "</sub>";
skipAhead = 1;
}
}
@@ -661,45 +622,35 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
case Atom::FormattingRight:
if (atom->string() == ATOM_FORMATTING_LINK) {
endLink();
- }
- else if (atom->string().startsWith("span ")) {
+ } else if (atom->string().startsWith("span ")) {
out() << "</span>";
- }
- else {
+ } else {
out() << formattingRightMap()[atom->string()];
}
break;
- case Atom::AnnotatedList:
- {
- const CollectionNode *cn = qdb_->getCollectionNode(atom->string(), Node::Group);
- if (cn)
- generateList(cn, marker, atom->string());
- }
- break;
+ case Atom::AnnotatedList: {
+ const CollectionNode *cn = qdb_->getCollectionNode(atom->string(), Node::Group);
+ if (cn)
+ generateList(cn, marker, atom->string());
+ } break;
case Atom::GeneratedList:
if (atom->string() == QLatin1String("annotatedclasses")) {
generateAnnotatedList(relative, marker, qdb_->getCppClasses());
- }
- else if (atom->string() == QLatin1String("annotatedexamples")) {
+ } else if (atom->string() == QLatin1String("annotatedexamples")) {
generateAnnotatedLists(relative, marker, qdb_->getExamples());
- }
- else if (atom->string() == QLatin1String("annotatedattributions")) {
+ } else if (atom->string() == QLatin1String("annotatedattributions")) {
generateAnnotatedLists(relative, marker, qdb_->getAttributions());
- }
- else if (atom->string() == QLatin1String("classes")) {
+ } else if (atom->string() == QLatin1String("classes")) {
generateCompactList(Generic, relative, qdb_->getCppClasses(), true, QStringLiteral(""));
- }
- else if (atom->string().contains("classes ")) {
+ } else if (atom->string().contains("classes ")) {
QString rootName = atom->string().mid(atom->string().indexOf("classes") + 7).trimmed();
generateCompactList(Generic, relative, qdb_->getCppClasses(), true, rootName);
- }
- else if (atom->string() == QLatin1String("qmlbasictypes")) {
- generateCompactList(Generic, relative, qdb_->getQmlBasicTypes(), true, QStringLiteral(""));
- }
- else if (atom->string() == QLatin1String("qmltypes")) {
+ } else if (atom->string() == QLatin1String("qmlbasictypes")) {
+ generateCompactList(Generic, relative, qdb_->getQmlBasicTypes(), true,
+ QStringLiteral(""));
+ } else if (atom->string() == QLatin1String("qmltypes")) {
generateCompactList(Generic, relative, qdb_->getQmlTypes(), true, QStringLiteral(""));
- }
- else if ((idx = atom->string().indexOf(QStringLiteral("bymodule"))) != -1) {
+ } else if ((idx = atom->string().indexOf(QStringLiteral("bymodule"))) != -1) {
QString moduleName = atom->string().mid(idx + 8).trimmed();
Node::NodeType type = typeFromString(atom);
QDocDatabase *qdb = QDocDatabase::qdocDB();
@@ -711,135 +662,119 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
if (!m.isEmpty()) {
generateAnnotatedList(relative, marker, m);
}
- }
- else
+ } else
generateAnnotatedList(relative, marker, cn->members());
}
- }
- else if (atom->string().startsWith("examplefiles") ||
- atom->string().startsWith("exampleimages")) {
+ } else if (atom->string().startsWith("examplefiles")
+ || atom->string().startsWith("exampleimages")) {
if (relative->isExample()) {
qDebug() << "GENERATE FILE LIST CALLED" << relative->name() << atom->string();
- }
- else
- relative->location().warning(QString("'\\generatelist \1' can only be used with '\\example' topic command").arg(atom->string()));
- }
- else if (atom->string() == QLatin1String("classhierarchy")) {
+ } else
+ relative->location().warning(QString("'\\generatelist \1' can only be used with "
+ "'\\example' topic command")
+ .arg(atom->string()));
+ } else if (atom->string() == QLatin1String("classhierarchy")) {
generateClassHierarchy(relative, qdb_->getCppClasses());
- }
- else if (atom->string() == QLatin1String("obsoleteclasses")) {
- generateCompactList(Generic, relative, qdb_->getObsoleteClasses(), false, QStringLiteral("Q"));
- }
- else if (atom->string() == QLatin1String("obsoleteqmltypes")) {
- generateCompactList(Generic, relative, qdb_->getObsoleteQmlTypes(), false, QStringLiteral(""));
- }
- else if (atom->string() == QLatin1String("obsoletecppmembers")) {
- generateCompactList(Obsolete, relative, qdb_->getClassesWithObsoleteMembers(), false, QStringLiteral("Q"));
- }
- else if (atom->string() == QLatin1String("obsoleteqmlmembers")) {
- generateCompactList(Obsolete, relative, qdb_->getQmlTypesWithObsoleteMembers(), false, QStringLiteral(""));
- }
- else if (atom->string() == QLatin1String("functionindex")) {
+ } else if (atom->string() == QLatin1String("obsoleteclasses")) {
+ generateCompactList(Generic, relative, qdb_->getObsoleteClasses(), false,
+ QStringLiteral("Q"));
+ } else if (atom->string() == QLatin1String("obsoleteqmltypes")) {
+ generateCompactList(Generic, relative, qdb_->getObsoleteQmlTypes(), false,
+ QStringLiteral(""));
+ } else if (atom->string() == QLatin1String("obsoletecppmembers")) {
+ generateCompactList(Obsolete, relative, qdb_->getClassesWithObsoleteMembers(), false,
+ QStringLiteral("Q"));
+ } else if (atom->string() == QLatin1String("obsoleteqmlmembers")) {
+ generateCompactList(Obsolete, relative, qdb_->getQmlTypesWithObsoleteMembers(), false,
+ QStringLiteral(""));
+ } else if (atom->string() == QLatin1String("functionindex")) {
generateFunctionIndex(relative);
- }
- else if (atom->string() == QLatin1String("attributions")) {
+ } else if (atom->string() == QLatin1String("attributions")) {
generateAnnotatedList(relative, marker, qdb_->getAttributions());
- }
- else if (atom->string() == QLatin1String("legalese")) {
+ } else if (atom->string() == QLatin1String("legalese")) {
generateLegaleseList(relative, marker);
- }
- else if (atom->string() == QLatin1String("overviews")) {
+ } else if (atom->string() == QLatin1String("overviews")) {
generateList(relative, marker, "overviews");
- }
- else if (atom->string() == QLatin1String("cpp-modules")) {
+ } else if (atom->string() == QLatin1String("cpp-modules")) {
generateList(relative, marker, "cpp-modules");
- }
- else if (atom->string() == QLatin1String("qml-modules")) {
+ } else if (atom->string() == QLatin1String("qml-modules")) {
generateList(relative, marker, "qml-modules");
- }
- else if (atom->string() == QLatin1String("namespaces")) {
+ } else if (atom->string() == QLatin1String("namespaces")) {
generateAnnotatedList(relative, marker, qdb_->getNamespaces());
- }
- else if (atom->string() == QLatin1String("related")) {
+ } else if (atom->string() == QLatin1String("related")) {
generateList(relative, marker, "related");
} else {
const CollectionNode *cn = qdb_->getCollectionNode(atom->string(), Node::Group);
if (cn) {
if (!generateGroupList(const_cast<CollectionNode *>(cn)))
- relative->location().warning(QString("'\\generatelist \1' group is empty").arg(atom->string()));
+ relative->location().warning(
+ QString("'\\generatelist \1' group is empty").arg(atom->string()));
} else {
- relative->location().warning(QString("'\\generatelist \1' no such group").arg(atom->string()));
+ relative->location().warning(
+ QString("'\\generatelist \1' no such group").arg(atom->string()));
}
}
break;
- case Atom::SinceList:
- {
- const NodeMultiMap &nsmap = qdb_->getSinceMap(atom->string());
- if (nsmap.isEmpty())
- break;
+ case Atom::SinceList: {
+ const NodeMultiMap &nsmap = qdb_->getSinceMap(atom->string());
+ if (nsmap.isEmpty())
+ break;
- const NodeMap &ncmap = qdb_->getClassMap(atom->string());
- const NodeMap &nqcmap = qdb_->getQmlTypeMap(atom->string());
+ const NodeMap &ncmap = qdb_->getClassMap(atom->string());
+ const NodeMap &nqcmap = qdb_->getQmlTypeMap(atom->string());
- Sections sections(nsmap);
- out() << "<ul>\n";
- const QVector<Section> sinceSections = sections.sinceSections();
- for (const auto &section : sinceSections) {
- if (!section.members().isEmpty()) {
- out() << "<li>"
- << "<a href=\"#"
- << Doc::canonicalTitle(section.title())
- << "\">"
- << section.title()
- << "</a></li>\n";
- }
+ Sections sections(nsmap);
+ out() << "<ul>\n";
+ const QVector<Section> sinceSections = sections.sinceSections();
+ for (const auto &section : sinceSections) {
+ if (!section.members().isEmpty()) {
+ out() << "<li>"
+ << "<a href=\"#" << Doc::canonicalTitle(section.title()) << "\">"
+ << section.title() << "</a></li>\n";
}
- out() << "</ul>\n";
+ }
+ out() << "</ul>\n";
- int idx = 0;
- for (const auto &section : sinceSections) {
- if (!section.members().isEmpty()) {
- out() << "<a name=\""
- << Doc::canonicalTitle(section.title())
- << "\"></a>\n";
- out() << "<h3>" << protectEnc(section.title()) << "</h3>\n";
- if (idx == Sections::SinceClasses)
- generateCompactList(Generic, nullptr, ncmap, false, QStringLiteral("Q"));
- else if (idx == Sections::SinceQmlTypes)
- generateCompactList(Generic, nullptr, nqcmap, false, QStringLiteral(""));
- else if (idx == Sections::SinceMemberFunctions) {
- ParentMaps parentmaps;
- ParentMaps::iterator pmap;
- const QVector<Node *> members = section.members();
- for (const auto &member : members) {
- Node *parent = (*member).parent();
- pmap = parentmaps.find(parent);
- if (pmap == parentmaps.end())
- pmap = parentmaps.insert(parent, NodeMultiMap());
- pmap->insert(member->name(), member);
- }
- for (auto map = parentmaps.begin(); map != parentmaps.end(); ++map) {
- NodeVector nv = map->values().toVector();
- out() << "<p>Class ";
-
- out() << "<a href=\""
- << linkForNode(map.key(), nullptr)
- << "\">";
- QStringList pieces = map.key()->fullName().split("::");
- out() << protectEnc(pieces.last());
- out() << "</a>" << ":</p>\n";
-
- generateSection(nv, nullptr, marker);
- out() << "<br/>";
- }
- } else {
- generateSection(section.members(), nullptr, marker);
+ int idx = 0;
+ for (const auto &section : sinceSections) {
+ if (!section.members().isEmpty()) {
+ out() << "<a name=\"" << Doc::canonicalTitle(section.title()) << "\"></a>\n";
+ out() << "<h3>" << protectEnc(section.title()) << "</h3>\n";
+ if (idx == Sections::SinceClasses)
+ generateCompactList(Generic, nullptr, ncmap, false, QStringLiteral("Q"));
+ else if (idx == Sections::SinceQmlTypes)
+ generateCompactList(Generic, nullptr, nqcmap, false, QStringLiteral(""));
+ else if (idx == Sections::SinceMemberFunctions) {
+ ParentMaps parentmaps;
+ ParentMaps::iterator pmap;
+ const QVector<Node *> members = section.members();
+ for (const auto &member : members) {
+ Node *parent = (*member).parent();
+ pmap = parentmaps.find(parent);
+ if (pmap == parentmaps.end())
+ pmap = parentmaps.insert(parent, NodeMultiMap());
+ pmap->insert(member->name(), member);
}
+ for (auto map = parentmaps.begin(); map != parentmaps.end(); ++map) {
+ NodeVector nv = map->values().toVector();
+ out() << "<p>Class ";
+
+ out() << "<a href=\"" << linkForNode(map.key(), nullptr) << "\">";
+ QStringList pieces = map.key()->fullName().split("::");
+ out() << protectEnc(pieces.last());
+ out() << "</a>"
+ << ":</p>\n";
+
+ generateSection(nv, nullptr, marker);
+ out() << "<br/>";
+ }
+ } else {
+ generateSection(section.members(), nullptr, marker);
}
- ++idx;
}
+ ++idx;
}
- break;
+ } break;
case Atom::BR:
out() << "<br />\n";
break;
@@ -847,8 +782,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << "<hr />\n";
break;
case Atom::Image:
- case Atom::InlineImage:
- {
+ case Atom::InlineImage: {
QString fileName = imageFileName(relative, atom->string());
QString text;
if (atom->next() != nullptr)
@@ -857,10 +791,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << "<p class=\"centerAlign\">";
if (fileName.isEmpty()) {
relative->location().warning(tr("Missing image: %1").arg(protectEnc(atom->string())));
- out() << "<font color=\"red\">[Missing image "
- << protectEnc(atom->string()) << "]</font>";
- }
- else {
+ out() << "<font color=\"red\">[Missing image " << protectEnc(atom->string())
+ << "]</font>";
+ } else {
QString prefix;
out() << "<img src=\"" << protectEnc(prefix + fileName) << '"';
if (!text.isEmpty())
@@ -873,8 +806,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
}
if (atom->type() == Atom::Image)
out() << "</p>";
- }
- break;
+ } break;
case Atom::ImageText:
break;
case Atom::ImportantLeft:
@@ -905,8 +837,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << "<br/>";
break;
case Atom::Link:
- case Atom::NavLink:
- {
+ case Atom::NavLink: {
inObsoleteLink = false;
const Node *node = nullptr;
QString link = getLink(atom, relative, &node);
@@ -917,8 +848,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
QString target = qdb_->getNewLinkTarget(relative, node, outFileName(), text, true);
out() << "<a id=\"" << Doc::canonicalTitle(target) << "\" class=\"qa-mark\"></a>";
}
- }
- else {
+ } else {
if (Generator::writeQaPages() && node && (atom->type() != Atom::NavLink)) {
QString text = atom->next()->next()->string();
QString target = qdb_->getNewLinkTarget(relative, node, outFileName(), text);
@@ -928,34 +858,27 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
}
beginLink(link, node, relative);
skipAhead = 1;
- }
- break;
- case Atom::ExampleFileLink:
- {
+ } break;
+ case Atom::ExampleFileLink: {
QString link = linkForExampleFile(atom->string(), relative);
if (link.isEmpty() && !noLinkErrors())
relative->doc().location().warning(tr("Can't link to '%1'").arg(atom->string()));
beginLink(link);
skipAhead = 1;
- }
- break;
- case Atom::ExampleImageLink:
- {
+ } break;
+ case Atom::ExampleImageLink: {
QString link = atom->string();
if (link.isEmpty() && !noLinkErrors())
relative->doc().location().warning(tr("Can't link to '%1'").arg(atom->string()));
link = "images/used-in-examples/" + link;
beginLink(link);
skipAhead = 1;
- }
- break;
- case Atom::LinkNode:
- {
+ } break;
+ case Atom::LinkNode: {
const Node *node = CodeMarker::nodeForString(atom->string());
beginLink(linkForNode(node, relative), node, relative);
skipAhead = 1;
- }
- break;
+ } break;
case Atom::ListLeft:
if (in_para) {
out() << "</p>\n";
@@ -963,11 +886,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
}
if (atom->string() == ATOM_LIST_BULLET) {
out() << "<ul>\n";
- }
- else if (atom->string() == ATOM_LIST_TAG) {
+ } else if (atom->string() == ATOM_LIST_TAG) {
out() << "<dl>\n";
- }
- else if (atom->string() == ATOM_LIST_VALUE) {
+ } else if (atom->string() == ATOM_LIST_VALUE) {
out() << "<div class=\"table\"><table class=\"valuelist\">";
threeColumnEnumValueTable_ = isThreeColumnEnumValueTable(atom);
if (threeColumnEnumValueTable_) {
@@ -983,34 +904,29 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << "<th class=\"tblval\">Value</th>";
out() << "<th class=\"tbldscr\">Description</th></tr>\n";
+ } else {
+ out() << "<tr><th class=\"tblConst\">Constant</th><th "
+ "class=\"tblVal\">Value</th></tr>\n";
}
- else {
- out() << "<tr><th class=\"tblConst\">Constant</th><th class=\"tblVal\">Value</th></tr>\n";
- }
- }
- else {
+ } else {
QString olType;
if (atom->string() == ATOM_LIST_UPPERALPHA) {
olType = "A";
- }
- else if (atom->string() == ATOM_LIST_LOWERALPHA) {
+ } else if (atom->string() == ATOM_LIST_LOWERALPHA) {
olType = "a";
- }
- else if (atom->string() == ATOM_LIST_UPPERROMAN) {
+ } else if (atom->string() == ATOM_LIST_UPPERROMAN) {
olType = "I";
- }
- else if (atom->string() == ATOM_LIST_LOWERROMAN) {
+ } else if (atom->string() == ATOM_LIST_LOWERROMAN) {
olType = "i";
- }
- else { // (atom->string() == ATOM_LIST_NUMERIC)
+ } else { // (atom->string() == ATOM_LIST_NUMERIC)
olType = "1";
}
if (atom->next() != nullptr && atom->next()->string().toInt() > 1) {
- out() << QString("<ol class=\"%1\" type=\"%1\" start=\"%2\">").arg(olType)
- .arg(atom->next()->string());
- }
- else
+ out() << QString("<ol class=\"%1\" type=\"%1\" start=\"%2\">")
+ .arg(olType)
+ .arg(atom->next()->string());
+ } else
out() << QString("<ol class=\"%1\" type=\"%1\">").arg(olType);
}
break;
@@ -1019,8 +935,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
case Atom::ListTagLeft:
if (atom->string() == ATOM_LIST_TAG) {
out() << "<dt>";
- }
- else { // (atom->string() == ATOM_LIST_VALUE)
+ } else { // (atom->string() == ATOM_LIST_VALUE)
QPair<QString, int> pair = getAtomListValue(atom);
skipAhead = pair.second;
QString t = protectEnc(plainCode(marker->markedUpEnumValue(pair.first, relative)));
@@ -1045,15 +960,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
case Atom::ListItemLeft:
if (atom->string() == ATOM_LIST_TAG) {
out() << "<dd>";
- }
- else if (atom->string() == ATOM_LIST_VALUE) {
+ } else if (atom->string() == ATOM_LIST_VALUE) {
if (threeColumnEnumValueTable_) {
out() << "</td><td class=\"topAlign\">";
if (matchAhead(atom, Atom::ListItemRight))
out() << "&nbsp;";
}
- }
- else {
+ } else {
out() << "<li>";
}
if (matchAhead(atom, Atom::ParaLeft))
@@ -1062,25 +975,20 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
case Atom::ListItemRight:
if (atom->string() == ATOM_LIST_TAG) {
out() << "</dd>\n";
- }
- else if (atom->string() == ATOM_LIST_VALUE) {
+ } else if (atom->string() == ATOM_LIST_VALUE) {
out() << "</td></tr>\n";
- }
- else {
+ } else {
out() << "</li>\n";
}
break;
case Atom::ListRight:
if (atom->string() == ATOM_LIST_BULLET) {
out() << "</ul>\n";
- }
- else if (atom->string() == ATOM_LIST_TAG) {
+ } else if (atom->string() == ATOM_LIST_TAG) {
out() << "</dl>\n";
- }
- else if (atom->string() == ATOM_LIST_VALUE) {
+ } else if (atom->string() == ATOM_LIST_VALUE) {
out() << "</table></div>\n";
- }
- else {
+ } else {
out() << "</ol>\n";
}
break;
@@ -1096,7 +1004,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << "</p>\n";
in_para = false;
}
- //if (!matchAhead(atom, Atom::ListItemRight) && !matchAhead(atom, Atom::TableItemRight))
+ // if (!matchAhead(atom, Atom::ListItemRight) && !matchAhead(atom, Atom::TableItemRight))
// out() << "</p>\n";
break;
case Atom::QuotationLeft:
@@ -1116,8 +1024,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
break;
case Atom::SectionHeadingLeft: {
int unit = atom->string().toInt() + hOffset(relative);
- out() << "<h" + QString::number(unit) + QLatin1Char(' ')
- << "id=\"" << Doc::canonicalTitle(Text::sectionHeading(atom).toString()) << "\">";
+ out() << "<h" + QString::number(unit) + QLatin1Char(' ') << "id=\""
+ << Doc::canonicalTitle(Text::sectionHeading(atom).toString()) << "\">";
inSectionHeading_ = true;
break;
}
@@ -1132,13 +1040,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
case Atom::String:
if (inLink_ && !inContents_ && !inSectionHeading_) {
generateLink(atom, marker);
- }
- else {
+ } else {
out() << protectEnc(atom->string());
}
break;
- case Atom::TableLeft:
- {
+ case Atom::TableLeft: {
QPair<QString, QString> pair = getTableWidthAttr(atom);
QString attr = pair.second;
QString width = pair.first;
@@ -1153,8 +1059,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << " width=\"" << width << '"';
out() << ">\n ";
numTableRows_ = 0;
- }
- break;
+ } break;
case Atom::TableRight:
out() << "</table></div>\n";
break;
@@ -1167,8 +1072,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
if (matchAhead(atom, Atom::TableHeaderLeft)) {
skipAhead = 1;
out() << "\n<tr class=\"qt-style\">";
- }
- else {
+ } else {
out() << "</thead>\n";
inTableHeader_ = false;
}
@@ -1184,21 +1088,19 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
case Atom::TableRowRight:
out() << "</tr>\n";
break;
- case Atom::TableItemLeft:
- {
+ case Atom::TableItemLeft: {
if (inTableHeader_)
out() << "<th ";
else
out() << "<td ";
- for (int i=0; i<atom->count(); ++i) {
+ for (int i = 0; i < atom->count(); ++i) {
if (i > 0)
out() << ' ';
QString p = atom->string(i);
if (p.contains('=')) {
out() << p;
- }
- else {
+ } else {
QStringList spans = p.split(QLatin1Char(','));
if (spans.size() == 2) {
if (spans.at(0) != "1")
@@ -1215,8 +1117,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
}
if (matchAhead(atom, Atom::ParaLeft))
skipAhead = 1;
- }
- break;
+ } break;
case Atom::TableItemRight:
if (inTableHeader_)
out() << "</th>";
@@ -1237,8 +1138,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << "<b class=\"redFont\">&lt;Missing HTML&gt;</b>";
break;
case Atom::UnknownCommand:
- out() << "<b class=\"redFont\"><code>\\" << protectEnc(atom->string())
- << "</code></b>";
+ out() << "<b class=\"redFont\"><code>\\" << protectEnc(atom->string()) << "</code></b>";
break;
case Atom::QmlText:
case Atom::EndQmlText:
@@ -1280,8 +1180,7 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
ns = static_cast<NamespaceNode *>(aggregate);
summarySections = &sections.stdSummarySections();
detailsSections = &sections.stdDetailsSections();
- }
- else if (aggregate->isClassNode()) {
+ } else if (aggregate->isClassNode()) {
rawTitle = aggregate->plainName();
fullTitle = aggregate->plainFullName();
if (aggregate->isStruct())
@@ -1291,8 +1190,7 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
title = rawTitle + " " + word;
summarySections = &sections.stdCppClassSummarySections();
detailsSections = &sections.stdCppClassDetailsSections();
- }
- else if (aggregate->isHeader()) {
+ } else if (aggregate->isHeader()) {
title = fullTitle = rawTitle = aggregate->fullTitle();
summarySections = &sections.stdSummarySections();
detailsSections = &sections.stdDetailsSections();
@@ -1302,9 +1200,9 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
if (rawTitle != fullTitle) {
if (aggregate->parent()->isClassNode()) {
QString word2 = aggregate->parent()->typeWord(false);
- subtitleText << word << " " << rawTitle << " is declared in " << word2
- << " " << Atom(Atom::AutoLink, aggregate->parent()->plainName())
- << "." << Atom(Atom::LineBreak);
+ subtitleText << word << " " << rawTitle << " is declared in " << word2 << " "
+ << Atom(Atom::AutoLink, aggregate->parent()->plainName()) << "."
+ << Atom(Atom::LineBreak);
} else {
subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" << Atom(Atom::LineBreak);
}
@@ -1321,14 +1219,12 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
<< ns->tree()->camelCaseModuleName() << ". The full namespace is "
<< "documented in module " << NS->tree()->camelCaseModuleName()
<< Atom(Atom::LinkNode, CodeMarker::stringForNode(NS))
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << Atom(Atom::String, " here.")
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) << Atom(Atom::String, " here.")
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
out() << "<p>";
generateText(brief, ns, marker);
out() << "</p>\n";
- }
- else
+ } else
generateBrief(aggregate, marker);
if (!aggregate->parent()->isClassNode())
generateRequisites(aggregate, marker);
@@ -1398,11 +1294,14 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
QString command = "documentation";
if (aggregate->isClassNode())
command = "\'\\class\' comment";
- aggregate->location().warning(tr("No %1 for '%2'").arg(command).arg(aggregate->plainSignature()));
+ aggregate->location().warning(
+ tr("No %1 for '%2'").arg(command).arg(aggregate->plainSignature()));
} else {
generateExtractionMark(aggregate, DetailedDescriptionMark);
out() << "<div class=\"descr\">\n" // QTBUG-9504
- << "<h2 id=\"" << detailsRef << "\">" << "Detailed Description" << "</h2>\n";
+ << "<h2 id=\"" << detailsRef << "\">"
+ << "Detailed Description"
+ << "</h2>\n";
generateBody(aggregate, marker);
out() << "</div>\n"; // QTBUG-9504
generateAlsoList(aggregate, marker);
@@ -1410,7 +1309,7 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
generateExtractionMark(aggregate, EndMark);
}
- for (const auto &section :qAsConst(*detailsSections)) {
+ for (const auto &section : qAsConst(*detailsSections)) {
bool headerGenerated = false;
if (section.isEmpty())
continue;
@@ -1442,8 +1341,7 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
names.clear();
} else if (member->isProperty()) {
const PropertyNode *prop = reinterpret_cast<const PropertyNode *>(member);
- if (!prop->getters().isEmpty() &&
- !names.contains(prop->getters().first()->name()))
+ if (!prop->getters().isEmpty() && !names.contains(prop->getters().first()->name()))
names << prop->getters().first()->name();
if (!prop->setters().isEmpty())
names << prop->setters().first()->name();
@@ -1458,10 +1356,9 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
const auto &enumItemNameList = enume->doc().enumItemNames();
const auto &omitEnumItemNameList = enume->doc().omitEnumItemNames();
const auto items = QSet<QString>(enumItemNameList.cbegin(), enumItemNameList.cend())
- - QSet<QString>(omitEnumItemNameList.cbegin(), omitEnumItemNameList.cend());
+ - QSet<QString>(omitEnumItemNameList.cbegin(), omitEnumItemNameList.cend());
for (const QString &enumName : items) {
- names << plainCode(marker->markedUpEnumValue(enumName,
- enume));
+ names << plainCode(marker->markedUpEnumValue(enumName, enume));
}
}
}
@@ -1506,7 +1403,9 @@ void HtmlGenerator::generateProxyPage(Aggregate *aggregate, CodeMarker *marker)
if (!aggregate->doc().isEmpty()) {
generateExtractionMark(aggregate, DetailedDescriptionMark);
out() << "<div class=\"descr\">\n" // QTBUG-9504
- << "<h2 id=\"" << detailsRef << "\">" << "Detailed Description" << "</h2>\n";
+ << "<h2 id=\"" << detailsRef << "\">"
+ << "Detailed Description"
+ << "</h2>\n";
generateBody(aggregate, marker);
out() << "</div>\n"; // QTBUG-9504
generateAlsoList(aggregate, marker);
@@ -1546,8 +1445,10 @@ void HtmlGenerator::generateProxyPage(Aggregate *aggregate, CodeMarker *marker)
names << enume->flagsType()->name();
const auto &enumItemNameList = enume->doc().enumItemNames();
const auto &omitEnumItemNameList = enume->doc().omitEnumItemNames();
- const auto items = QSet<QString>(enumItemNameList.cbegin(), enumItemNameList.cend())
- - QSet<QString>(omitEnumItemNameList.cbegin(), omitEnumItemNameList.cend());
+ const auto items =
+ QSet<QString>(enumItemNameList.cbegin(), enumItemNameList.cend())
+ - QSet<QString>(omitEnumItemNameList.cbegin(),
+ omitEnumItemNameList.cend());
for (const QString &enumName : items)
names << plainCode(marker->markedUpEnumValue(enumName, enume));
}
@@ -1601,8 +1502,7 @@ void HtmlGenerator::generateQmlTypePage(QmlTypeNode *qcn, CodeMarker *marker)
for (const auto &section : stdQmlTypeSummarySections) {
if (!section.isEmpty()) {
QString ref = registerRef(section.title().toLower());
- out() << "<a name=\"" << ref
- << "\"></a>" << divNavTop << '\n';
+ out() << "<a name=\"" << ref << "\"></a>" << divNavTop << '\n';
out() << "<h2 id=\"" << ref << "\">" << protectEnc(section.title()) << "</h2>\n";
generateQmlSummary(section.members(), qcn, marker);
}
@@ -1611,7 +1511,9 @@ void HtmlGenerator::generateQmlTypePage(QmlTypeNode *qcn, CodeMarker *marker)
generateExtractionMark(qcn, DetailedDescriptionMark);
QString detailsRef = registerRef("details");
out() << "<a name=\"" << detailsRef << "\"></a>" << divNavTop << '\n';
- out() << "<h2 id=\"" << detailsRef << "\">" << "Detailed Description" << "</h2>\n";
+ out() << "<h2 id=\"" << detailsRef << "\">"
+ << "Detailed Description"
+ << "</h2>\n";
generateBody(qcn, marker);
ClassNode *cn = qcn->classNode();
if (cn)
@@ -1651,27 +1553,23 @@ void HtmlGenerator::generateQmlBasicTypePage(QmlBasicTypeNode *qbtn, CodeMarker
generateHeader(htmlTitle, qbtn, marker);
Sections sections(qbtn);
- generateTableOfContents(qbtn,marker,&sections.stdQmlTypeSummarySections());
+ generateTableOfContents(qbtn, marker, &sections.stdQmlTypeSummarySections());
generateKeywordAnchors(qbtn);
- generateTitle(htmlTitle,
- Text() << qbtn->subtitle(),
- subTitleSize,
- qbtn,
- marker);
+ generateTitle(htmlTitle, Text() << qbtn->subtitle(), subTitleSize, qbtn, marker);
const QVector<Section> &stdQmlTypeSummarySections = sections.stdQmlTypeSummarySections();
for (const auto &section : stdQmlTypeSummarySections) {
if (!section.isEmpty()) {
QString ref = registerRef(section.title().toLower());
- out() << "<a name=\"" << ref
- << "\"></a>" << divNavTop << '\n';
+ out() << "<a name=\"" << ref << "\"></a>" << divNavTop << '\n';
out() << "<h2 id=\"" << ref << "\">" << protectEnc(section.title()) << "</h2>\n";
generateQmlSummary(section.members(), qbtn, marker);
}
}
generateExtractionMark(qbtn, DetailedDescriptionMark);
- out() << "<div class=\"descr\"> <a name=\"" << registerRef("details") << "\"></a>\n"; // QTBUG-9504
+ out() << "<div class=\"descr\"> <a name=\"" << registerRef("details")
+ << "\"></a>\n"; // QTBUG-9504
generateBody(qbtn, marker);
out() << "</div>\n"; // QTBUG-9504
@@ -1707,20 +1605,17 @@ void HtmlGenerator::generatePageNode(PageNode *pn, CodeMarker *marker)
Don't generate a TOC for the home page.
*/
if ((pn->name() != QLatin1String("index.html")))
- generateTableOfContents(pn,marker,nullptr);
+ generateTableOfContents(pn, marker, nullptr);
generateKeywordAnchors(pn);
- generateTitle(fullTitle,
- Text() << pn->subtitle(),
- subTitleSize,
- pn,
- marker);
+ generateTitle(fullTitle, Text() << pn->subtitle(), subTitleSize, pn, marker);
if (pn->isExample()) {
generateBrief(pn, marker, nullptr, false);
}
generateExtractionMark(pn, DetailedDescriptionMark);
- out() << "<div class=\"descr\"> <a name=\"" << registerRef("details") << "\"></a>\n"; // QTBUG-9504
+ out() << "<div class=\"descr\"> <a name=\"" << registerRef("details")
+ << "\"></a>\n"; // QTBUG-9504
generateBody(pn, marker);
out() << "</div>\n"; // QTBUG-9504
@@ -1740,7 +1635,7 @@ void HtmlGenerator::generateCollectionNode(CollectionNode *cn, CodeMarker *marke
QString ref;
generateHeader(fullTitle, cn, marker);
- generateTableOfContents(cn,marker, nullptr);
+ generateTableOfContents(cn, marker, nullptr);
generateKeywordAnchors(cn);
generateTitle(fullTitle, Text() << cn->subtitle(), subTitleSize, cn, marker);
@@ -1775,11 +1670,13 @@ void HtmlGenerator::generateCollectionNode(CollectionNode *cn, CodeMarker *marke
ref = registerRef("details");
out() << "<a name=\"" << ref << "\"></a>" << divNavTop << '\n';
out() << "<div class=\"descr\">\n"; // QTBUG-9504
- out() << "<h2 id=\"" << ref << "\">" << "Detailed Description" << "</h2>\n";
- }
- else {
+ out() << "<h2 id=\"" << ref << "\">"
+ << "Detailed Description"
+ << "</h2>\n";
+ } else {
generateExtractionMark(cn, DetailedDescriptionMark);
- out() << "<div class=\"descr\"> <a name=\"" << registerRef("details") << "\"></a>\n"; // QTBUG-9504
+ out() << "<div class=\"descr\"> <a name=\"" << registerRef("details")
+ << "\"></a>\n"; // QTBUG-9504
}
generateBody(cn, marker);
@@ -1838,10 +1735,8 @@ QString HtmlGenerator::fileExtension() const
/*!
Output navigation list in the html file.
*/
-void HtmlGenerator::generateNavigationBar(const QString &title,
- const Node *node,
- CodeMarker *marker,
- const QString &buildversion,
+void HtmlGenerator::generateNavigationBar(const QString &title, const Node *node,
+ CodeMarker *marker, const QString &buildversion,
bool tableItems)
{
if (noNavigationBar || node == nullptr)
@@ -1850,63 +1745,47 @@ void HtmlGenerator::generateNavigationBar(const QString &title,
Text navigationbar;
// Set list item types based on the navigation bar type
- Atom::AtomType itemLeft = tableItems ?
- Atom::TableItemLeft : Atom::ListItemLeft;
- Atom::AtomType itemRight = tableItems ?
- Atom::TableItemRight : Atom::ListItemRight;
+ Atom::AtomType itemLeft = tableItems ? Atom::TableItemLeft : Atom::ListItemLeft;
+ Atom::AtomType itemRight = tableItems ? Atom::TableItemRight : Atom::ListItemRight;
if (hometitle == title)
return;
if (!homepage.isEmpty())
- navigationbar << Atom(itemLeft)
- << Atom(Atom::NavLink, homepage)
+ navigationbar << Atom(itemLeft) << Atom(Atom::NavLink, homepage)
<< Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
<< Atom(Atom::String, hometitle)
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
- << Atom(itemRight);
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(itemRight);
if (!landingpage.isEmpty() && landingtitle != title)
- navigationbar << Atom(itemLeft)
- << Atom(Atom::NavLink, landingpage)
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << Atom(Atom::String, landingtitle)
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
- << Atom(itemRight);
+ navigationbar << Atom(itemLeft) << Atom(Atom::NavLink, landingpage)
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << Atom(Atom::String, landingtitle)
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(itemRight);
if (node->isClassNode()) {
if (!cppclassespage.isEmpty() && !cppclassestitle.isEmpty())
- navigationbar << Atom(itemLeft)
- << Atom(Atom::NavLink, cppclassespage)
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << Atom(Atom::String, cppclassestitle)
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
- << Atom(itemRight);
+ navigationbar << Atom(itemLeft) << Atom(Atom::NavLink, cppclassespage)
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << Atom(Atom::String, cppclassestitle)
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(itemRight);
if (!node->name().isEmpty())
- navigationbar << Atom(itemLeft)
- << Atom(Atom::String, node->name())
- << Atom(itemRight);
- }
- else if (node->isQmlType() || node->isQmlBasicType() ||
- node->isJsType() || node->isJsBasicType()) {
+ navigationbar << Atom(itemLeft) << Atom(Atom::String, node->name()) << Atom(itemRight);
+ } else if (node->isQmlType() || node->isQmlBasicType() || node->isJsType()
+ || node->isJsBasicType()) {
if (!qmltypespage.isEmpty() && !qmltypestitle.isEmpty())
- navigationbar << Atom(itemLeft)
- << Atom(Atom::NavLink, qmltypespage)
+ navigationbar << Atom(itemLeft) << Atom(Atom::NavLink, qmltypespage)
<< Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
<< Atom(Atom::String, qmltypestitle)
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
- << Atom(itemRight)
- << Atom(itemLeft)
- << Atom(Atom::String, title)
- << Atom(itemRight);
- }
- else {
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(itemRight)
+ << Atom(itemLeft) << Atom(Atom::String, title) << Atom(itemRight);
+ } else {
if (node->isAggregate()) {
QStringList groups = static_cast<const Aggregate *>(node)->groupNames();
if (groups.length() == 1) {
- const Node *groupNode = qdb_->findNodeByNameAndType(QStringList(groups[0]), &Node::isGroup);
+ const Node *groupNode =
+ qdb_->findNodeByNameAndType(QStringList(groups[0]), &Node::isGroup);
if (groupNode && !groupNode->title().isEmpty()) {
- navigationbar << Atom(itemLeft)
- << Atom(Atom::NavLink, groupNode->name())
+ navigationbar << Atom(itemLeft) << Atom(Atom::NavLink, groupNode->name())
<< Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
<< Atom(Atom::String, groupNode->title())
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
@@ -1915,9 +1794,7 @@ void HtmlGenerator::generateNavigationBar(const QString &title,
}
}
if (!navigationbar.isEmpty()) {
- navigationbar << Atom(itemLeft)
- << Atom(Atom::String, title)
- << Atom(itemRight);
+ navigationbar << Atom(itemLeft) << Atom(Atom::String, title) << Atom(itemRight);
}
}
@@ -1928,7 +1805,7 @@ void HtmlGenerator::generateNavigationBar(const QString &title,
navigationbar.clear();
- if (tableItems) {
+ if (tableItems) {
out() << "</tr></table><table class=\"buildversion\"><tr>\n"
<< "<td id=\"buildversion\" width=\"100%\" align=\"right\">";
} else {
@@ -1951,9 +1828,7 @@ void HtmlGenerator::generateNavigationBar(const QString &title,
out() << "</li>\n";
}
-void HtmlGenerator::generateHeader(const QString &title,
- const Node *node,
- CodeMarker *marker)
+void HtmlGenerator::generateHeader(const QString &title, const Node *node, CodeMarker *marker)
{
#ifndef QT_NO_TEXTCODEC
out() << QString("<?xml version=\"1.0\" encoding=\"%1\"?>\n").arg(outputEncoding);
@@ -1967,25 +1842,22 @@ void HtmlGenerator::generateHeader(const QString &title,
if (node && !node->doc().location().isEmpty())
out() << "<!-- " << node->doc().location().fileName() << " -->\n";
- //determine the rest of the <title> element content: "title | titleSuffix version"
+ // determine the rest of the <title> element content: "title | titleSuffix version"
QString titleSuffix;
if (!landingtitle.isEmpty()) {
- //for normal pages: "title | landingtitle version"
+ // for normal pages: "title | landingtitle version"
titleSuffix = landingtitle;
- }
- else if (!hometitle.isEmpty()) {
+ } else if (!hometitle.isEmpty()) {
// for pages that set the homepage title but not landing page title:
// "title | hometitle version"
if (title != hometitle)
titleSuffix = hometitle;
- }
- else if (!project.isEmpty()) {
- //for projects outside of Qt or Qt 5: "title | project version"
+ } else if (!project.isEmpty()) {
+ // for projects outside of Qt or Qt 5: "title | project version"
if (title != project)
titleSuffix = project;
- }
- else
- //default: "title | Qt version"
+ } else
+ // default: "title | Qt version"
titleSuffix = QLatin1String("Qt ");
if (title == titleSuffix)
@@ -1996,10 +1868,7 @@ void HtmlGenerator::generateHeader(const QString &title,
divider = QLatin1String(" | ");
// Generating page title
- out() << " <title>"
- << protectEnc(title)
- << divider
- << titleSuffix;
+ out() << " <title>" << protectEnc(title) << divider << titleSuffix;
// append a full version to the suffix if neither suffix nor title
// include (a prefix of) version information
@@ -2037,8 +1906,8 @@ void HtmlGenerator::generateHeader(const QString &title,
refMap.clear();
if (node && !node->links().empty()) {
- QPair<QString,QString> linkPair;
- QPair<QString,QString> anchorPair;
+ QPair<QString, QString> linkPair;
+ QPair<QString, QString> anchorPair;
const Node *linkNode;
bool useSeparator = false;
@@ -2052,8 +1921,7 @@ void HtmlGenerator::generateHeader(const QString &title,
else
anchorPair = anchorForNode(linkNode);
- out() << " <link rel=\"prev\" href=\""
- << anchorPair.first << "\" />\n";
+ out() << " <link rel=\"prev\" href=\"" << anchorPair.first << "\" />\n";
navigationLinks += "<a class=\"prevPage\" href=\"" + anchorPair.first + "\">";
if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty())
@@ -2073,8 +1941,7 @@ void HtmlGenerator::generateHeader(const QString &title,
else
anchorPair = anchorForNode(linkNode);
- out() << " <link rel=\"next\" href=\""
- << anchorPair.first << "\" />\n";
+ out() << " <link rel=\"next\" href=\"" << anchorPair.first << "\" />\n";
if (useSeparator)
navigationLinks += navigationSeparator;
@@ -2095,8 +1962,7 @@ void HtmlGenerator::generateHeader(const QString &title,
anchorPair = linkPair;
else
anchorPair = anchorForNode(linkNode);
- out() << " <link rel=\"start\" href=\""
- << anchorPair.first << "\" />\n";
+ out() << " <link rel=\"start\" href=\"" << anchorPair.first << "\" />\n";
}
}
@@ -2104,10 +1970,8 @@ void HtmlGenerator::generateHeader(const QString &title,
out() << "<p class=\"naviNextPrevious headerNavi\">\n" << navigationLinks << "</p><p/>\n";
}
-void HtmlGenerator::generateTitle(const QString &title,
- const Text &subtitle,
- SubTitleSize subTitleSize,
- const Node *relative,
+void HtmlGenerator::generateTitle(const QString &title, const Text &subtitle,
+ SubTitleSize subTitleSize, const Node *relative,
CodeMarker *marker)
{
out() << QString(prologue).replace("\\" + COMMAND_VERSION, qdb_->version());
@@ -2152,35 +2016,31 @@ void HtmlGenerator::generateRequisites(Aggregate *aggregate, CodeMarker *marker)
const QString instantiatedByText = "Instantiated By";
const QString qtVariableText = "qmake";
- //add the include files to the map
+ // add the include files to the map
if (!aggregate->includeFiles().isEmpty()) {
text.clear();
- text << highlightedCode(indent(codeIndent, marker->markedUpIncludes(aggregate->includeFiles())),
- aggregate);
+ text << highlightedCode(
+ indent(codeIndent, marker->markedUpIncludes(aggregate->includeFiles())), aggregate);
requisites.insert(headerText, text);
}
- //The order of the requisites matter
+ // The order of the requisites matter
QStringList requisiteorder;
- requisiteorder << headerText
- << qtVariableText
- << sinceText
- << instantiatedByText
- << inheritsText
- << inheritedBytext;
-
- //add the since and project into the map
+ requisiteorder << headerText << qtVariableText << sinceText << instantiatedByText
+ << inheritsText << inheritedBytext;
+
+ // add the since and project into the map
if (!aggregate->since().isEmpty()) {
text.clear();
- text << formatSince(aggregate)
- << Atom::ParaRight;
+ text << formatSince(aggregate) << Atom::ParaRight;
requisites.insert(sinceText, text);
}
if (aggregate->isClassNode() || aggregate->isNamespace()) {
- //add the QT variable to the map
+ // add the QT variable to the map
if (!aggregate->physicalModuleName().isEmpty()) {
- const CollectionNode *cn = qdb_->getCollectionNode(aggregate->physicalModuleName(), Node::Module);
+ const CollectionNode *cn =
+ qdb_->getCollectionNode(aggregate->physicalModuleName(), Node::Module);
if (cn && !cn->qtVariable().isEmpty()) {
text.clear();
text << "QT += " + cn->qtVariable();
@@ -2198,10 +2058,9 @@ void HtmlGenerator::generateRequisites(Aggregate *aggregate, CodeMarker *marker)
<< Atom(Atom::String, classe->qmlElement()->name())
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
requisites.insert(instantiatedByText, text);
-
}
- //add the inherits to the map
+ // add the inherits to the map
if (!classe->baseClasses().isEmpty()) {
int index = 0;
text.clear();
@@ -2212,8 +2071,7 @@ void HtmlGenerator::generateRequisites(Aggregate *aggregate, CodeMarker *marker)
if (cls.access_ == Node::Protected) {
text << " (protected)";
- }
- else if (cls.access_ == Node::Private) {
+ } else if (cls.access_ == Node::Private) {
text << " (private)";
}
text << comma(index++, classe->baseClasses().count());
@@ -2224,7 +2082,7 @@ void HtmlGenerator::generateRequisites(Aggregate *aggregate, CodeMarker *marker)
requisites.insert(inheritsText, text);
}
- //add the inherited-by to the map
+ // add the inherited-by to the map
if (!classe->derivedClasses().isEmpty()) {
text.clear();
text << Atom::ParaLeft;
@@ -2236,16 +2094,16 @@ void HtmlGenerator::generateRequisites(Aggregate *aggregate, CodeMarker *marker)
}
if (!requisites.isEmpty()) {
- //generate the table
+ // generate the table
out() << "<div class=\"table\"><table class=\"alignedsummary\">\n";
for (auto it = requisiteorder.constBegin(); it != requisiteorder.constEnd(); ++it) {
if (requisites.contains(*it)) {
out() << "<tr>"
- << "<td class=\"memItemLeft rightAlign topAlign\"> "
- << *it << ":"
- "</td><td class=\"memItemRight bottomAlign\"> ";
+ << "<td class=\"memItemLeft rightAlign topAlign\"> " << *it
+ << ":"
+ "</td><td class=\"memItemRight bottomAlign\"> ";
if (*it == headerText)
out() << requisites.value(*it).toString();
@@ -2275,9 +2133,10 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
const QString inheritsText = "Inherits:";
const QString instantiatesText = "Instantiates:";
- //add the module name and version to the map
+ // add the module name and version to the map
QString logicalModuleVersion;
- const CollectionNode *collection = qdb_->getCollectionNode(qcn->logicalModuleName(), qcn->nodeType());
+ const CollectionNode *collection =
+ qdb_->getCollectionNode(qcn->logicalModuleName(), qcn->nodeType());
if (collection != nullptr)
logicalModuleVersion = collection->logicalModuleVersion();
else
@@ -2285,52 +2144,50 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
if (logicalModuleVersion.isEmpty() || qcn->logicalModuleName().isEmpty())
qcn->doc().location().warning(tr("Could not resolve QML import "
- "statement for type '%1'").arg(qcn->name()),
+ "statement for type '%1'")
+ .arg(qcn->name()),
tr("Maybe you forgot to use the "
- "'\\%1' command?").arg(COMMAND_INQMLMODULE));
+ "'\\%1' command?")
+ .arg(COMMAND_INQMLMODULE));
text.clear();
text << "import " + qcn->logicalModuleName() + QLatin1Char(' ') + logicalModuleVersion;
requisites.insert(importText, text);
- //add the since and project into the map
+ // add the since and project into the map
if (!qcn->since().isEmpty()) {
text.clear();
- text << formatSince(qcn)
- << Atom::ParaRight;
+ text << formatSince(qcn) << Atom::ParaRight;
requisites.insert(sinceText, text);
}
- //add the instantiates to the map
+ // add the instantiates to the map
ClassNode *cn = qcn->classNode();
if (cn && !cn->isInternal()) {
text.clear();
- text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
+ text << Atom(Atom::LinkNode, CodeMarker::stringForNode(qcn));
text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
- text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn));
+ text << Atom(Atom::LinkNode, CodeMarker::stringForNode(cn));
text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
text << Atom(Atom::String, cn->name());
text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
requisites.insert(instantiatesText, text);
}
- //add the inherits to the map
+ // add the inherits to the map
QmlTypeNode *base = qcn->qmlBaseNode();
while (base && base->isInternal()) {
base = base->qmlBaseNode();
}
if (base) {
text.clear();
- text << Atom::ParaLeft
- << Atom(Atom::LinkNode,CodeMarker::stringForNode(base))
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << Atom(Atom::String, base->name())
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
- << Atom::ParaRight;
+ text << Atom::ParaLeft << Atom(Atom::LinkNode, CodeMarker::stringForNode(base))
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) << Atom(Atom::String, base->name())
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom::ParaRight;
requisites.insert(inheritsText, text);
}
- //add the inherited-by to the map
+ // add the inherited-by to the map
NodeList subs;
QmlTypeNode::subclasses(qcn, subs);
if (!subs.isEmpty()) {
@@ -2342,27 +2199,22 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
requisites.insert(inheritedBytext, text);
}
- //The order of the requisites matter
- const QStringList requisiteorder {
- importText,
- sinceText,
- instantiatesText,
- inheritsText,
- inheritedBytext };
+ // The order of the requisites matter
+ const QStringList requisiteorder { importText, sinceText, instantiatesText, inheritsText,
+ inheritedBytext };
if (!requisites.isEmpty()) {
- //generate the table
+ // generate the table
out() << "<div class=\"table\"><table class=\"alignedsummary\">\n";
for (const auto &requisite : requisiteorder) {
if (requisites.contains(requisite)) {
out() << "<tr>"
- << "<td class=\"memItemLeft rightAlign topAlign\"> "
- << requisite
- << "</td><td class=\"memItemRight bottomAlign\"> ";
+ << "<td class=\"memItemLeft rightAlign topAlign\"> " << requisite
+ << "</td><td class=\"memItemRight bottomAlign\"> ";
if (requisite == importText)
- out()<<requisites.value(requisite).toString();
+ out() << requisites.value(requisite).toString();
else
generateText(requisites.value(requisite), qcn, marker);
out() << "</td></tr>";
@@ -2372,15 +2224,16 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
}
}
-void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker,
- const Node *relative, bool addLink)
+void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, const Node *relative,
+ bool addLink)
{
Text brief = node->doc().briefText();
if (!brief.isEmpty()) {
if (!brief.lastAtom()->string().endsWith('.')) {
brief << Atom(Atom::String, ".");
- node->doc().location().warning(tr("'\\brief' statement does not end with a full stop."));
+ node->doc().location().warning(
+ tr("'\\brief' statement does not end with a full stop."));
}
generateExtractionMark(node, BriefMark);
out() << "<p>";
@@ -2403,8 +2256,7 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker,
Revised for the new doc format.
Generates a table of contents beginning at \a node.
*/
-void HtmlGenerator::generateTableOfContents(const Node *node,
- CodeMarker *marker,
+void HtmlGenerator::generateTableOfContents(const Node *node, CodeMarker *marker,
QVector<Section> *sections)
{
QVector<Atom *> toc;
@@ -2429,23 +2281,14 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
if (node->isModule()) {
if (node->hasNamespaces()) {
- out() << "<li class=\"level"
- << sectionNumber
- << "\"><a href=\"#"
- << registerRef("namespaces")
- << "\">Namespaces</a></li>\n";
+ out() << "<li class=\"level" << sectionNumber << "\"><a href=\"#"
+ << registerRef("namespaces") << "\">Namespaces</a></li>\n";
}
if (node->hasClasses()) {
- out() << "<li class=\"level"
- << sectionNumber
- << "\"><a href=\"#"
- << registerRef("classes")
- << "\">Classes</a></li>\n";
+ out() << "<li class=\"level" << sectionNumber << "\"><a href=\"#"
+ << registerRef("classes") << "\">Classes</a></li>\n";
}
- out() << "<li class=\"level"
- << sectionNumber
- << "\"><a href=\"#"
- << registerRef("details")
+ out() << "<li class=\"level" << sectionNumber << "\"><a href=\"#" << registerRef("details")
<< "\">Detailed Description</a></li>\n";
for (int i = 0; i < toc.size(); ++i) {
if (toc.at(i)->string().toInt() == 1) {
@@ -2453,36 +2296,24 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
break;
}
}
- }
- else if (sections && (node->isClassNode() ||
- node->isNamespace() ||
- node->isQmlType() ||
- node->isJsType())) {
+ } else if (sections
+ && (node->isClassNode() || node->isNamespace() || node->isQmlType()
+ || node->isJsType())) {
for (const auto &section : qAsConst(*sections)) {
if (!section.members().isEmpty()) {
- out() << "<li class=\"level"
- << sectionNumber
- << "\"><a href=\"#"
- << registerRef(section.plural())
- << "\">" << section.title()
- << "</a></li>\n";
+ out() << "<li class=\"level" << sectionNumber << "\"><a href=\"#"
+ << registerRef(section.plural()) << "\">" << section.title() << "</a></li>\n";
}
if (!section.reimplementedMembers().isEmpty()) {
QString ref = QString("Reimplemented ") + section.plural();
- out() << "<li class=\"level"
- << sectionNumber
- << "\"><a href=\"#"
- << registerRef(ref.toLower())
- << "\">" << QString("Reimplemented ") + section.title()
- << "</a></li>\n";
+ out() << "<li class=\"level" << sectionNumber << "\"><a href=\"#"
+ << registerRef(ref.toLower()) << "\">"
+ << QString("Reimplemented ") + section.title() << "</a></li>\n";
}
}
if (!node->isNamespace() || node->hasDoc()) {
- out() << "<li class=\"level"
- << sectionNumber
- << "\"><a href=\"#"
- << registerRef("details")
- << "\">Detailed Description</a></li>\n";
+ out() << "<li class=\"level" << sectionNumber << "\"><a href=\"#"
+ << registerRef("details") << "\">Detailed Description</a></li>\n";
}
for (int i = 0; i < toc.size(); ++i) {
if (toc.at(i)->string().toInt() == 1) {
@@ -2494,19 +2325,14 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
for (const auto &atom : toc) {
sectionNumber = atom->string().toInt() + detailsBase;
- //restrict the ToC depth to the one set by the HTML.tocdepth variable or
- //print all levels if tocDepth is not set.
+ // restrict the ToC depth to the one set by the HTML.tocdepth variable or
+ // print all levels if tocDepth is not set.
if (sectionNumber <= tocDepth || tocDepth < 0) {
int numAtoms;
Text headingText = Text::sectionHeading(atom);
QString s = headingText.toString();
- out() << "<li class=\"level"
- << sectionNumber
- << "\">";
- out() << "<a href=\""
- << '#'
- << Doc::canonicalTitle(s)
- << "\">";
+ out() << "<li class=\"level" << sectionNumber << "\">";
+ out() << "<a href=\"" << '#' << Doc::canonicalTitle(s) << "\">";
generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms);
out() << "</a></li>\n";
}
@@ -2522,7 +2348,8 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
/*!
Outputs a placeholder div where the style can add customized sidebar content.
*/
-void HtmlGenerator::generateSidebar() {
+void HtmlGenerator::generateSidebar()
+{
out() << "<div class=\"sidebar\">";
out() << "<div class=\"sidebar-content\" id=\"sidebar-content\"></div>";
out() << "</div>\n";
@@ -2574,12 +2401,12 @@ QString HtmlGenerator::generateAllQmlMembersFile(const Sections &sections, CodeM
generateFullName(aggregate, nullptr);
out() << ", including inherited members.</p>\n";
- ClassKeysNodesList& cknl = sections.allMembersSection().classKeysNodesList();
+ ClassKeysNodesList &cknl = sections.allMembersSection().classKeysNodesList();
if (!cknl.isEmpty()) {
- for (int i=0; i<cknl.size(); i++) {
- ClassKeysNodes* ckn = cknl[i];
+ for (int i = 0; i < cknl.size(); i++) {
+ ClassKeysNodes *ckn = cknl[i];
const QmlTypeNode *qcn = ckn->first;
- KeysAndNodes& kn = ckn->second;
+ KeysAndNodes &kn = ckn->second;
QStringList &keys = kn.first;
NodeVector &nodes = kn.second;
if (nodes.isEmpty())
@@ -2590,12 +2417,11 @@ QString HtmlGenerator::generateAllQmlMembersFile(const Sections &sections, CodeM
out() << ".</p>\n";
}
out() << "<ul>\n";
- for (int j=0; j<keys.size(); j++) {
+ for (int j = 0; j < keys.size(); j++) {
Node *node = nodes[j];
if (node->access() == Node::Private || node->isInternal())
continue;
- if (node->isSharingComment() &&
- node->sharedCommentNode()->isPropertyGroup())
+ if (node->isSharingComment() && node->sharedCommentNode()->isPropertyGroup())
continue;
std::function<void(Node *)> generate = [&](Node *n) {
@@ -2608,7 +2434,8 @@ QString HtmlGenerator::generateAllQmlMembersFile(const Sections &sections, CodeM
// Indent property group members
if (n->isPropertyGroup()) {
out() << "<ul>\n";
- const QVector<Node *> &collective = static_cast<SharedCommentNode *>(n)->collective();
+ const QVector<Node *> &collective =
+ static_cast<SharedCommentNode *>(n)->collective();
std::for_each(collective.begin(), collective.end(), generate);
out() << "</ul>\n";
}
@@ -2711,8 +2538,7 @@ QString HtmlGenerator::generateObsoleteQmlMembersFile(const Sections &sections,
for (const auto &section : summary_spv) {
QString ref = registerRef(section->title().toLower());
- out() << "<a name=\"" << ref
- << "\"></a>" << divNavTop << '\n';
+ out() << "<a name=\"" << ref << "\"></a>" << divNavTop << '\n';
out() << "<h2 id=\"" << ref << "\">" << protectEnc(section->title()) << "</h2>\n";
generateQmlSummary(section->obsoleteMembers(), aggregate, marker);
}
@@ -2743,7 +2569,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap &classM
topLevel.insert(classe->name(), classe);
}
- QStack<NodeMap > stack;
+ QStack<NodeMap> stack;
stack.push(topLevel);
out() << "<ul>\n";
@@ -2751,8 +2577,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap &classM
if (stack.top().isEmpty()) {
stack.pop();
out() << "</ul>\n";
- }
- else {
+ } else {
ClassNode *child = static_cast<ClassNode *>(*stack.top().begin());
out() << "<li>";
generateFullName(child, relative);
@@ -2777,8 +2602,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap &classM
Output an annotated list of the nodes in \a nodeMap.
A two-column table is output.
*/
-void HtmlGenerator::generateAnnotatedList(const Node *relative,
- CodeMarker *marker,
+void HtmlGenerator::generateAnnotatedList(const Node *relative, CodeMarker *marker,
const NodeMultiMap &nmm)
{
if (nmm.isEmpty() || relative == nullptr)
@@ -2788,8 +2612,7 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative,
/*!
*/
-void HtmlGenerator::generateAnnotatedList(const Node *relative,
- CodeMarker *marker,
+void HtmlGenerator::generateAnnotatedList(const Node *relative, CodeMarker *marker,
const NodeList &unsortedNodes)
{
NodeMultiMap nmm;
@@ -2822,19 +2645,16 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative,
out() << "<td class=\"tblDescr\"><p>";
generateText(brief, node, marker);
out() << "</p></td>";
- }
- else if (!node->reconstitutedBrief().isEmpty()) {
+ } else if (!node->reconstitutedBrief().isEmpty()) {
out() << "<td class=\"tblDescr\"><p>";
out() << node->reconstitutedBrief();
out() << "</p></td>";
}
- }
- else {
+ } else {
out() << "<td class=\"tblDescr\"><p>";
if (!node->reconstitutedBrief().isEmpty()) {
out() << node->reconstitutedBrief();
- }
- else
+ } else
out() << protectEnc(node->doc().briefText().toString());
out() << "</p></td>";
}
@@ -2847,15 +2667,14 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative,
Outputs a series of annotated lists from the nodes in \a nmm,
divided into sections based by the key names in the multimap.
*/
-void HtmlGenerator::generateAnnotatedLists(const Node *relative,
- CodeMarker *marker,
- const NodeMultiMap &nmm)
+void HtmlGenerator::generateAnnotatedLists(const Node *relative, CodeMarker *marker,
+ const NodeMultiMap &nmm)
{
const auto &uniqueKeys = nmm.uniqueKeys();
for (const QString &name : uniqueKeys) {
if (!name.isEmpty()) {
- out() << "<h2 id=\"" << registerRef(name.toLower())
- << "\">" << protectEnc(name) << "</h2>\n";
+ out() << "<h2 id=\"" << registerRef(name.toLower()) << "\">" << protectEnc(name)
+ << "</h2>\n";
}
generateAnnotatedList(relative, marker, nmm.values(name));
}
@@ -2871,10 +2690,8 @@ void HtmlGenerator::generateAnnotatedLists(const Node *relative,
the name of the first and last classes in the class map
\a nmm.
*/
-void HtmlGenerator::generateCompactList(ListType listType,
- const Node *relative,
- const NodeMultiMap &nmm,
- bool includeAlphabet,
+void HtmlGenerator::generateCompactList(ListType listType, const Node *relative,
+ const NodeMultiMap &nmm, bool includeAlphabet,
QString commonPrefix)
{
if (nmm.isEmpty())
@@ -2889,8 +2706,8 @@ void HtmlGenerator::generateCompactList(ListType listType,
QXtWidget in paragraph 33 (X). This is the only place where we
assume that NumParagraphs is 37. Each paragraph is a NodeMultiMap.
*/
- NodeMultiMap paragraph[NumParagraphs+1];
- QString paragraphName[NumParagraphs+1];
+ NodeMultiMap paragraph[NumParagraphs + 1];
+ QString paragraphName[NumParagraphs + 1];
QSet<char> usedParagraphNames;
for (auto c = nmm.constBegin(); c != nmm.constEnd(); ++c) {
@@ -2905,8 +2722,7 @@ void HtmlGenerator::generateCompactList(ListType listType,
if (key[0].digitValue() != -1) {
paragraphNr = key[0].digitValue();
- }
- else if (key[0] >= QLatin1Char('a') && key[0] <= QLatin1Char('z')) {
+ } else if (key[0] >= QLatin1Char('a') && key[0] <= QLatin1Char('z')) {
paragraphNr = 10 + key[0].unicode() - 'a';
}
@@ -2923,10 +2739,10 @@ void HtmlGenerator::generateCompactList(ListType listType,
We now want to compute the paragraph offset. Paragraphs 0 to 6
start at offsets 0, 3, 4, 8, 9, 14, 23.
*/
- int paragraphOffset[NumParagraphs + 1]; // 37 + 1
+ int paragraphOffset[NumParagraphs + 1]; // 37 + 1
paragraphOffset[0] = 0;
- for (int i=0; i<NumParagraphs; i++) // i = 0..36
- paragraphOffset[i+1] = paragraphOffset[i] + paragraph[i].count();
+ for (int i = 0; i < NumParagraphs; i++) // i = 0..36
+ paragraphOffset[i + 1] = paragraphOffset[i] + paragraph[i].count();
/*
Output the alphabet as a row of links.
@@ -2952,9 +2768,8 @@ void HtmlGenerator::generateCompactList(ListType listType,
QString previousName;
bool multipleOccurrences = false;
- for (int i=0; i<nmm.count(); i++) {
- while ((curParNr < NumParagraphs) &&
- (curParOffset == paragraph[curParNr].count())) {
+ for (int i = 0; i < nmm.count(); i++) {
+ while ((curParNr < NumParagraphs) && (curParOffset == paragraph[curParNr].count())) {
++curParNr;
curParOffset = 0;
}
@@ -2974,9 +2789,7 @@ void HtmlGenerator::generateCompactList(ListType listType,
QChar c = paragraphName[curParNr][0].toLower();
out() << QString("<a name=\"%1\"></a>").arg(c);
}
- out() << "<b>"
- << paragraphName[curParNr]
- << "</b>";
+ out() << "<b>" << paragraphName[curParNr] << "</b>";
out() << "</dt>\n";
}
@@ -2984,12 +2797,11 @@ void HtmlGenerator::generateCompactList(ListType listType,
Output a <dd> for the current offset in the current paragraph.
*/
out() << "<dd>";
- if ((curParNr < NumParagraphs) &&
- !paragraphName[curParNr].isEmpty()) {
+ if ((curParNr < NumParagraphs) && !paragraphName[curParNr].isEmpty()) {
NodeMultiMap::Iterator it;
NodeMultiMap::Iterator next;
it = paragraph[curParNr].begin();
- for (int i=0; i<curParOffset; i++)
+ for (int i = 0; i < curParOffset; i++)
++it;
if (listType == Generic) {
@@ -2998,8 +2810,7 @@ void HtmlGenerator::generateCompactList(ListType listType,
require some special formatting.
*/
out() << "<a href=\"" << linkForNode(it.value(), relative) << "\">";
- }
- else if (listType == Obsolete) {
+ } else if (listType == Obsolete) {
QString fileName = fileBase(it.value()) + "-obsolete." + fileExtension();
QString link;
if (useOutputSubdirs()) {
@@ -3023,8 +2834,7 @@ void HtmlGenerator::generateCompactList(ListType listType,
if (multipleOccurrences)
name += ": " + it.value()->tree()->camelCaseModuleName();
pieces << name;
- }
- else
+ } else
pieces = it.value()->fullName(relative).split("::");
out() << protectEnc(pieces.last());
out() << "</a>";
@@ -3095,21 +2905,16 @@ void HtmlGenerator::generateLegaleseList(const Node *relative, CodeMarker *marke
}
}
-void HtmlGenerator::generateQmlItem(const Node *node,
- const Node *relative,
- CodeMarker *marker,
+void HtmlGenerator::generateQmlItem(const Node *node, const Node *relative, CodeMarker *marker,
bool summary)
{
- QString marked = marker->markedUpQmlItem(node,summary);
+ QString marked = marker->markedUpQmlItem(node, summary);
QRegExp templateTag("(<[^@>]*>)");
if (marked.indexOf(templateTag) != -1) {
- QString contents = protectEnc(marked.mid(templateTag.pos(1),
- templateTag.cap(1).length()));
- marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
- contents);
+ QString contents = protectEnc(marked.mid(templateTag.pos(1), templateTag.cap(1).length()));
+ marked.replace(templateTag.pos(1), templateTag.cap(1).length(), contents);
}
- marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
- "<i>\\1<sub>\\2</sub></i>");
+ marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), "<i>\\1<sub>\\2</sub></i>");
marked.replace("<@param>", "<i>");
marked.replace("</@param>", "</i>");
@@ -3141,10 +2946,7 @@ bool HtmlGenerator::generateGroupList(CollectionNode *cn)
const auto members = cn->members();
for (const auto *node : members) {
out() << "<li>"
- << "<a href=\"#"
- << Doc::canonicalTitle(node->title())
- << "\">"
- << node->title()
+ << "<a href=\"#" << Doc::canonicalTitle(node->title()) << "\">" << node->title()
<< "</a></li>\n";
}
out() << "</ul>\n";
@@ -3171,8 +2973,7 @@ void HtmlGenerator::generateList(const Node *relative, CodeMarker *marker, const
for (auto *collectionNode : collectionList)
nodeList.append(collectionNode);
generateAnnotatedList(relative, marker, nodeList);
- }
- else {
+ } else {
/*
\generatelist {selector} is only allowed in a
comment where the topic is \group, \module,
@@ -3180,7 +2981,8 @@ void HtmlGenerator::generateList(const Node *relative, CodeMarker *marker, const
*/
if (relative && !relative->isCollectionNode()) {
relative->doc().location().warning(tr("\\generatelist {%1} is only allowed in \\group, "
- "\\module, \\qmlmodule, and \\jsmodule comments.").arg(selector));
+ "\\module, \\qmlmodule, and \\jsmodule comments.")
+ .arg(selector));
return;
}
Node *n = const_cast<Node *>(relative);
@@ -3201,8 +3003,7 @@ void HtmlGenerator::generateSection(const NodeVector &nv, const Node *relative,
}
if (alignNames) {
out() << "<div class=\"table\"><table class=\"alignedsummary\">\n";
- }
- else {
+ } else {
if (twoColumn)
out() << "<div class=\"table\"><table class=\"propsummary\">\n"
<< "<tr><td class=\"topAlign\">";
@@ -3216,8 +3017,7 @@ void HtmlGenerator::generateSection(const NodeVector &nv, const Node *relative,
if (alignNames) {
out() << "<tr><td class=\"memItemLeft rightAlign topAlign\"> ";
- }
- else {
+ } else {
if (twoColumn && i == (nv.count() + 1) / 2)
out() << "</ul></td><td class=\"topAlign\"><ul>\n";
out() << "<li class=\"fn\">";
@@ -3240,13 +3040,12 @@ void HtmlGenerator::generateSection(const NodeVector &nv, const Node *relative,
}
}
-void HtmlGenerator::generateSectionList(const Section& section,
- const Node *relative,
- CodeMarker *marker,
- Section::Status status)
+void HtmlGenerator::generateSectionList(const Section &section, const Node *relative,
+ CodeMarker *marker, Section::Status status)
{
bool alignNames = true;
- const NodeVector &members = (status == Section::Obsolete ? section.obsoleteMembers() : section.members());
+ const NodeVector &members =
+ (status == Section::Obsolete ? section.obsoleteMembers() : section.members());
if (!members.isEmpty()) {
bool hasPrivateSignals = false;
bool isInvokable = false;
@@ -3260,8 +3059,7 @@ void HtmlGenerator::generateSectionList(const Section& section,
}
if (alignNames) {
out() << "<div class=\"table\"><table class=\"alignedsummary\">\n";
- }
- else {
+ } else {
if (twoColumn)
out() << "<div class=\"table\"><table class=\"propsummary\">\n"
<< "<tr><td class=\"topAlign\">";
@@ -3275,8 +3073,7 @@ void HtmlGenerator::generateSectionList(const Section& section,
if (alignNames) {
out() << "<tr><td class=\"memItemLeft topAlign rightAlign\"> ";
- }
- else {
+ } else {
if (twoColumn && i == (members.count() + 1) / 2)
out() << "</ul></td><td class=\"topAlign\"><ul>\n";
out() << "<li class=\"fn\">";
@@ -3295,8 +3092,7 @@ void HtmlGenerator::generateSectionList(const Section& section,
hasPrivateSignals = true;
if (alignNames)
out() << "</td><td class=\"memItemRight bottomAlign\">[see note below]";
- }
- else if (fn->isInvokable()) {
+ } else if (fn->isInvokable()) {
isInvokable = true;
if (alignNames)
out() << "</td><td class=\"memItemRight bottomAlign\">[see note below]";
@@ -3321,14 +3117,15 @@ void HtmlGenerator::generateSectionList(const Section& section,
generateInvokableNote(relative, marker);
}
- if (status != Section::Obsolete && section.style() == Section::Summary && !section.inheritedMembers().isEmpty()) {
+ if (status != Section::Obsolete && section.style() == Section::Summary
+ && !section.inheritedMembers().isEmpty()) {
out() << "<ul>\n";
generateSectionInheritedList(section, relative);
out() << "</ul>\n";
}
}
-void HtmlGenerator::generateSectionInheritedList(const Section& section, const Node *relative)
+void HtmlGenerator::generateSectionInheritedList(const Section &section, const Node *relative)
{
const QVector<QPair<Aggregate *, int>> &inheritedMembers = section.inheritedMembers();
for (const auto &member : inheritedMembers) {
@@ -3336,23 +3133,17 @@ void HtmlGenerator::generateSectionInheritedList(const Section& section, const N
out() << member.second << ' ';
if (member.second == 1) {
out() << section.singular();
- }
- else {
+ } else {
out() << section.plural();
}
- out() << " inherited from <a href=\"" << fileName(member.first)
- << '#' << Generator::cleanRef(section.title().toLower()) << "\">"
- << protectEnc(member.first->plainFullName(relative))
- << "</a></li>\n";
+ out() << " inherited from <a href=\"" << fileName(member.first) << '#'
+ << Generator::cleanRef(section.title().toLower()) << "\">"
+ << protectEnc(member.first->plainFullName(relative)) << "</a></li>\n";
}
}
-void HtmlGenerator::generateSynopsis(const Node *node,
- const Node *relative,
- CodeMarker *marker,
- Section::Style style,
- bool alignNames,
- const QString *prefix)
+void HtmlGenerator::generateSynopsis(const Node *node, const Node *relative, CodeMarker *marker,
+ Section::Style style, bool alignNames, const QString *prefix)
{
QString marked = marker->markedUpSynopsis(node, relative, style);
@@ -3360,19 +3151,16 @@ void HtmlGenerator::generateSynopsis(const Node *node,
marked.prepend(*prefix);
QRegExp templateTag("(<[^@>]*>)");
if (marked.indexOf(templateTag) != -1) {
- QString contents = protectEnc(marked.mid(templateTag.pos(1),
- templateTag.cap(1).length()));
- marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
- contents);
+ QString contents = protectEnc(marked.mid(templateTag.pos(1), templateTag.cap(1).length()));
+ marked.replace(templateTag.pos(1), templateTag.cap(1).length(), contents);
}
- marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
- "<i>\\1<sub>\\2</sub></i>");
+ marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), "<i>\\1<sub>\\2</sub></i>");
marked.replace("<@param>", "<i>");
marked.replace("</@param>", "</i>");
if (style == Section::Summary) {
- marked.remove("<@name>"); // was "<b>"
- marked.remove("</@name>"); // was "</b>"
+ marked.remove("<@name>"); // was "<b>"
+ marked.remove("</@name>"); // was "</b>"
}
if (style == Section::AllMembers) {
@@ -3392,8 +3180,7 @@ void HtmlGenerator::generateSynopsis(const Node *node,
out() << highlightedCode(marked, relative, alignNames);
}
-QString HtmlGenerator::highlightedCode(const QString &markedCode,
- const Node *relative,
+QString HtmlGenerator::highlightedCode(const QString &markedCode, const Node *relative,
bool alignNames, Node::Genus genus)
{
QString src = markedCode;
@@ -3427,45 +3214,39 @@ QString HtmlGenerator::highlightedCode(const QString &markedCode,
QString link = linkForNode(n, relative);
addLink(link, arg, &html);
html += QLatin1String("</b>");
- }
- else if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
+ } else if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
const FunctionNode *fn = qdb_->findFunctionNode(par1.toString(), relative, genus);
QString link = linkForNode(fn, relative);
addLink(link, arg, &html);
par1 = QStringRef();
- }
- else if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) {
+ } else if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) {
par1 = QStringRef();
const Node *n = qdb_->findTypeNode(arg.toString(), relative, genus);
html += QLatin1String("<span class=\"type\">");
if (n && (n->isQmlBasicType() || n->isJsBasicType())) {
if (relative && (relative->genus() == n->genus() || genus == n->genus()))
- addLink(linkForNode(n,relative), arg, &html);
+ addLink(linkForNode(n, relative), arg, &html);
else
html += arg;
- }
- else
- addLink(linkForNode(n,relative), arg, &html);
+ } else
+ addLink(linkForNode(n, relative), arg, &html);
html += QLatin1String("</span>");
- }
- else if (parseArg(src, headerTag, &i, srcSize, &arg, &par1)) {
+ } else if (parseArg(src, headerTag, &i, srcSize, &arg, &par1)) {
par1 = QStringRef();
if (arg.startsWith(QLatin1Char('&')))
html += arg;
else {
const Node *n = qdb_->findNodeForInclude(QStringList(arg.toString()));
if (n && n != relative)
- addLink(linkForNode(n,relative), arg, &html);
+ addLink(linkForNode(n, relative), arg, &html);
else
html += arg;
}
- }
- else {
+ } else {
html += charLangle;
html += charAt;
}
- }
- else {
+ } else {
html += src.at(i++);
}
}
@@ -3485,15 +3266,15 @@ QString HtmlGenerator::highlightedCode(const QString &markedCode,
html = QString();
html.reserve(src.size());
static const QLatin1String spanTags[] = {
- QLatin1String("comment>"), QLatin1String("<span class=\"comment\">"),
- QLatin1String("preprocessor>"), QLatin1String("<span class=\"preprocessor\">"),
- QLatin1String("string>"), QLatin1String("<span class=\"string\">"),
- QLatin1String("char>"), QLatin1String("<span class=\"char\">"),
- QLatin1String("number>"), QLatin1String("<span class=\"number\">"),
- QLatin1String("op>"), QLatin1String("<span class=\"operator\">"),
- QLatin1String("type>"), QLatin1String("<span class=\"type\">"),
- QLatin1String("name>"), QLatin1String("<span class=\"name\">"),
- QLatin1String("keyword>"), QLatin1String("<span class=\"keyword\">")
+ QLatin1String("comment>"), QLatin1String("<span class=\"comment\">"),
+ QLatin1String("preprocessor>"), QLatin1String("<span class=\"preprocessor\">"),
+ QLatin1String("string>"), QLatin1String("<span class=\"string\">"),
+ QLatin1String("char>"), QLatin1String("<span class=\"char\">"),
+ QLatin1String("number>"), QLatin1String("<span class=\"number\">"),
+ QLatin1String("op>"), QLatin1String("<span class=\"operator\">"),
+ QLatin1String("type>"), QLatin1String("<span class=\"type\">"),
+ QLatin1String("name>"), QLatin1String("<span class=\"name\">"),
+ QLatin1String("keyword>"), QLatin1String("<span class=\"keyword\">")
};
int nTags = 9;
// Update the upper bound of k in the following code to match the length
@@ -3504,9 +3285,8 @@ QString HtmlGenerator::highlightedCode(const QString &markedCode,
i += 2;
bool handled = false;
for (int k = 0; k != nTags; ++k) {
- const QLatin1String& tag = spanTags[2 * k];
- if (i + tag.size() <= src.length() &&
- tag == QStringRef(&src, i, tag.size())) {
+ const QLatin1String &tag = spanTags[2 * k];
+ if (i + tag.size() <= src.length() && tag == QStringRef(&src, i, tag.size())) {
html += spanTags[2 * k + 1];
i += tag.size();
handled = true;
@@ -3520,14 +3300,12 @@ QString HtmlGenerator::highlightedCode(const QString &markedCode,
++i;
}
continue;
- }
- else if (src.at(i + 1) == QLatin1Char('/') && src.at(i + 2) == QLatin1Char('@')) {
+ } else if (src.at(i + 1) == QLatin1Char('/') && src.at(i + 2) == QLatin1Char('@')) {
i += 3;
bool handled = false;
for (int k = 0; k != nTags; ++k) {
- const QLatin1String& tag = spanTags[2 * k];
- if (i + tag.size() <= src.length() &&
- tag == QStringRef(&src, i, tag.size())) {
+ const QLatin1String &tag = spanTags[2 * k];
+ if (i + tag.size() <= src.length() && tag == QStringRef(&src, i, tag.size())) {
html += QLatin1String("</span>");
i += tag.size();
handled = true;
@@ -3581,11 +3359,11 @@ QString HtmlGenerator::protectEnc(const QString &string)
QString HtmlGenerator::protect(const QString &string, const QString &outputEncoding)
{
-#define APPEND(x) \
- if (html.isEmpty()) { \
- html = string; \
- html.truncate(i); \
-} \
+#define APPEND(x) \
+ if (html.isEmpty()) { \
+ html = string; \
+ html.truncate(i); \
+ } \
html += (x);
QString html;
@@ -3637,7 +3415,8 @@ QString HtmlGenerator::fileName(const Node *node)
return Generator::fileName(node);
}
-void HtmlGenerator::generateFullName(const Node *apparentNode, const Node *relative, const Node *actualNode)
+void HtmlGenerator::generateFullName(const Node *apparentNode, const Node *relative,
+ const Node *actualNode)
{
if (actualNode == nullptr)
actualNode = apparentNode;
@@ -3649,8 +3428,7 @@ void HtmlGenerator::generateFullName(const Node *apparentNode, const Node *relat
out() << "</a>";
}
-void HtmlGenerator::generateDetailedMember(const Node *node,
- const PageNode *relative,
+void HtmlGenerator::generateDetailedMember(const Node *node, const PageNode *relative,
CodeMarker *marker)
{
const EnumNode *etn;
@@ -3675,8 +3453,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
if (collective.size() > 1)
out() << "</div>";
out() << divNavTop << '\n';
- }
- else {
+ } else {
nodeRef = refForNode(node);
if (node->isEnumType() && (etn = static_cast<const EnumNode *>(node))->flagsType()) {
#ifdef GENERATE_MAC_REFS
@@ -3688,8 +3465,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
out() << "<br/>";
generateSynopsis(etn->flagsType(), relative, marker, Section::Details);
out() << "</h3>\n";
- }
- else {
+ } else {
out() << "<h3 class=\"fn\" id=\"" << nodeRef << "\">";
out() << "<a name=\"" + nodeRef + "\"></a>";
generateSynopsis(node, relative, marker, Section::Details);
@@ -3723,24 +3499,19 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
out() << "<p><b>Notifier signal:</b></p>\n";
generateSectionList(notifiers, node, marker);
}
- }
- else if (node->isFunction()) {
+ } else if (node->isFunction()) {
const FunctionNode *fn = static_cast<const FunctionNode *>(node);
if (fn->isPrivateSignal())
generatePrivateSignalNote(node, marker);
if (fn->isInvokable())
generateInvokableNote(node, marker);
generateAssociatedPropertyNotes(const_cast<FunctionNode *>(fn));
- }
- else if (node->isEnumType()) {
+ } else if (node->isEnumType()) {
const EnumNode *etn = static_cast<const EnumNode *>(node);
if (etn->flagsType()) {
- out() << "<p>The " << protectEnc(etn->flagsType()->name())
- << " type is a typedef for "
- << "<a href=\"" << qflagsHref_ << "\">QFlags</a>&lt;"
- << protectEnc(etn->name())
- << "&gt;. It stores an OR combination of "
- << protectEnc(etn->name())
+ out() << "<p>The " << protectEnc(etn->flagsType()->name()) << " type is a typedef for "
+ << "<a href=\"" << qflagsHref_ << "\">QFlags</a>&lt;" << protectEnc(etn->name())
+ << "&gt;. It stores an OR combination of " << protectEnc(etn->name())
<< " values.</p>\n";
}
}
@@ -3759,7 +3530,8 @@ void HtmlGenerator::generateMacRef(const Node *node, CodeMarker *marker)
const QStringList macRefs = marker->macRefsForNode(node);
for (const auto &macRef : macRefs)
- out() << "<a name=\"" << "//apple_ref/" << macRef << "\"></a>\n";
+ out() << "<a name=\""
+ << "//apple_ref/" << macRef << "\"></a>\n";
}
#endif
@@ -3785,8 +3557,7 @@ void HtmlGenerator::beginLink(const QString &link, const Node *node, const Node
if (link_.isEmpty()) {
if (showBrokenLinks)
out() << "<i>";
- }
- else if (node == nullptr || (relative != nullptr && node->status() == relative->status()))
+ } else if (node == nullptr || (relative != nullptr && node->status() == relative->status()))
out() << "<a href=\"" << link_ << "\">";
else if (node->isObsolete())
out() << "<a href=\"" << link_ << "\" class=\"obsolete\">";
@@ -3801,8 +3572,7 @@ void HtmlGenerator::endLink()
if (link_.isEmpty()) {
if (showBrokenLinks)
out() << "</i>";
- }
- else {
+ } else {
if (inObsoleteLink) {
out() << "<sup>(obsolete)</sup>";
}
@@ -3817,8 +3587,7 @@ void HtmlGenerator::endLink()
Generates the summary list for the \a members. Only used for
sections of QML element documentation.
*/
-void HtmlGenerator::generateQmlSummary(const NodeVector &members,
- const Node *relative,
+void HtmlGenerator::generateQmlSummary(const NodeVector &members, const Node *relative,
CodeMarker *marker)
{
if (!members.isEmpty()) {
@@ -3851,8 +3620,7 @@ void HtmlGenerator::generateQmlSummary(const NodeVector &members,
Outputs the html detailed documentation for a section
on a QML element reference page.
*/
-void HtmlGenerator::generateDetailedQmlMember(Node *node,
- const Aggregate *relative,
+void HtmlGenerator::generateDetailedQmlMember(Node *node, const Aggregate *relative,
CodeMarker *marker)
{
#ifdef GENERATE_MAC_REFS
@@ -3865,13 +3633,12 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node,
"<div class=\"table\"><table class=\"qmlname\">\n");
QString qmlItemStart("<tr valign=\"top\" class=\"odd\" id=\"%1\">\n"
- "<td class=\"%2\"><p>\n");
+ "<td class=\"%2\"><p>\n");
QString qmlItemEnd("</p></td></tr>\n");
QString qmlItemFooter("</table></div></div>\n");
-
- std::function<void (QmlPropertyNode *)> generateQmlProperty = [&](QmlPropertyNode *n) {
+ std::function<void(QmlPropertyNode *)> generateQmlProperty = [&](QmlPropertyNode *n) {
out() << qmlItemStart.arg(refForNode(n), "tblQmlPropNode");
if (!n->isReadOnlySet() && n->declarativeCppNode())
@@ -3886,7 +3653,7 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node,
out() << qmlItemEnd;
};
- std::function<void (Node *)> generateQmlMethod = [&](Node *n) {
+ std::function<void(Node *)> generateQmlMethod = [&](Node *n) {
out() << qmlItemStart.arg(refForNode(n), "tblQmlFuncNode");
generateSynopsis(n, relative, marker, Section::Details, false);
out() << qmlItemEnd;
@@ -3894,7 +3661,7 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node,
out() << "<div class=\"qmlitem\">";
if (node->isPropertyGroup()) {
- const SharedCommentNode *scn = static_cast<const SharedCommentNode*>(node);
+ const SharedCommentNode *scn = static_cast<const SharedCommentNode *>(node);
out() << qmlItemHeader;
if (!scn->name().isEmpty()) {
out() << "<tr valign=\"top\" class=\"even\" id=\"" << refForNode(scn) << "\">";
@@ -3958,7 +3725,7 @@ void HtmlGenerator::generateQmlInherits(QmlTypeNode *qcn, CodeMarker *marker)
if (base) {
Text text;
text << Atom::ParaLeft << "Inherits ";
- text << Atom(Atom::LinkNode,CodeMarker::stringForNode(base));
+ text << Atom(Atom::LinkNode, CodeMarker::stringForNode(base));
text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
text << Atom(Atom::String, base->name());
text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
@@ -3980,7 +3747,7 @@ void HtmlGenerator::generateQmlInstantiates(QmlTypeNode *qcn, CodeMarker *marker
if (cn && !cn->isInternal()) {
Text text;
text << Atom::ParaLeft;
- text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
+ text << Atom(Atom::LinkNode, CodeMarker::stringForNode(qcn));
text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
QString name = qcn->name();
/*
@@ -3992,7 +3759,7 @@ void HtmlGenerator::generateQmlInstantiates(QmlTypeNode *qcn, CodeMarker *marker
text << Atom(Atom::String, name);
text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
text << " instantiates the C++ class ";
- text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn));
+ text << Atom(Atom::LinkNode, CodeMarker::stringForNode(cn));
text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
text << Atom(Atom::String, cn->name());
text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
@@ -4010,11 +3777,11 @@ void HtmlGenerator::generateQmlInstantiates(QmlTypeNode *qcn, CodeMarker *marker
*/
void HtmlGenerator::generateInstantiatedBy(ClassNode *cn, CodeMarker *marker)
{
- if (cn && !cn->isInternal() && cn->qmlElement() != nullptr) {
+ if (cn && !cn->isInternal() && cn->qmlElement() != nullptr) {
const QmlTypeNode *qcn = cn->qmlElement();
Text text;
text << Atom::ParaLeft;
- text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn));
+ text << Atom(Atom::LinkNode, CodeMarker::stringForNode(cn));
text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
text << Atom(Atom::String, cn->name());
text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
@@ -4022,7 +3789,7 @@ void HtmlGenerator::generateInstantiatedBy(ClassNode *cn, CodeMarker *marker)
text << " is instantiated by QML Type ";
else
text << " is instantiated by Javascript Type ";
- text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
+ text << Atom(Atom::LinkNode, CodeMarker::stringForNode(qcn));
text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
text << Atom(Atom::String, qcn->name());
text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
@@ -4050,7 +3817,8 @@ void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType
for (const auto *propFuncNode : list) {
if (propFuncNode->isFunction()) {
const FunctionNode *func = static_cast<const FunctionNode *>(propFuncNode);
- out() << "$$$" + func->name() + func->parameters().rawSignature().remove(' ');
+ out() << "$$$" + func->name()
+ + func->parameters().rawSignature().remove(' ');
}
}
} else if (node->isEnumType()) {
@@ -4070,7 +3838,6 @@ void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType
}
}
-
/*!
This function outputs one or more manifest files in XML.
They are used by Creator.
@@ -4093,7 +3860,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
ExampleNodeMap &exampleNodeMap = qdb_->exampleNodeMap();
if (exampleNodeMap.isEmpty())
return;
- QString fileName = manifest +"-manifest.xml";
+ QString fileName = manifest + "-manifest.xml";
QFile file(outputDir() + QLatin1Char('/') + fileName);
bool demos = false;
if (manifest == QLatin1String("demos"))
@@ -4107,8 +3874,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
proceed = true;
break;
}
- }
- else if (!en->name().startsWith("demos")) {
+ } else if (!en->name().startsWith("demos")) {
proceed = true;
break;
}
@@ -4134,7 +3900,9 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
}
// attributes that are always written for the element
usedAttributes.clear();
- usedAttributes << "name" << "docUrl" << "projectPath";
+ usedAttributes << "name"
+ << "docUrl"
+ << "projectPath";
writer.writeStartElement(element);
writer.writeAttribute("name", en->title());
@@ -4143,21 +3911,21 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
QStringList proFiles;
const auto exampleFiles = en->files();
for (const QString &file : exampleFiles) {
- if (file.endsWith(".pro") || file.endsWith(".qmlproject") || file.endsWith(".pyproject"))
+ if (file.endsWith(".pro") || file.endsWith(".qmlproject")
+ || file.endsWith(".pyproject"))
proFiles << file;
}
if (!proFiles.isEmpty()) {
if (proFiles.size() == 1) {
writer.writeAttribute("projectPath", examplesPath + proFiles[0]);
- }
- else {
+ } else {
QString exampleName = en->name().split('/').last();
bool proWithExampleNameFound = false;
- for (int j = 0; j < proFiles.size(); j++)
- {
+ for (int j = 0; j < proFiles.size(); j++) {
if (proFiles[j].endsWith(QStringLiteral("%1/%1.pro").arg(exampleName))
- || proFiles[j].endsWith(QStringLiteral("%1/%1.qmlproject").arg(exampleName))
- || proFiles[j].endsWith(QStringLiteral("%1/%1.pyproject").arg(exampleName))) {
+ || proFiles[j].endsWith(QStringLiteral("%1/%1.qmlproject").arg(exampleName))
+ || proFiles[j].endsWith(
+ QStringLiteral("%1/%1.pyproject").arg(exampleName))) {
writer.writeAttribute("projectPath", examplesPath + proFiles[j]);
proWithExampleNameFound = true;
break;
@@ -4174,7 +3942,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
QString fullName = project + QLatin1Char('/') + en->title();
QSet<QString> tags;
- for (int idx=0; idx < manifestMetaContent.size(); ++idx) {
+ for (int idx = 0; idx < manifestMetaContent.size(); ++idx) {
const auto names = manifestMetaContent[idx].names;
for (const QString &name : names) {
bool match = false;
@@ -4245,20 +4013,14 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
if (s.endsWith(QLatin1Char(':')))
s.chop(1);
- if (s.length() < 2
- || s.at(0).isDigit()
- || s.at(0) == '-'
- || s == QLatin1String("qt")
- || s == QLatin1String("the")
- || s == QLatin1String("and")
- || s.startsWith(QLatin1String("example"))
- || s.startsWith(QLatin1String("chapter")))
+ if (s.length() < 2 || s.at(0).isDigit() || s.at(0) == '-' || s == QLatin1String("qt")
+ || s == QLatin1String("the") || s == QLatin1String("and")
+ || s.startsWith(QLatin1String("example")) || s.startsWith(QLatin1String("chapter")))
tag_it = tags.erase(tag_it);
else if (s != *tag_it) {
modified << s;
tag_it = tags.erase(tag_it);
- }
- else
+ } else
++tag_it;
}
tags += modified;
@@ -4277,7 +4039,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
writer.writeEndElement(); // tags
}
- QString ename = en->name().mid(en->name().lastIndexOf('/')+1);
+ QString ename = en->name().mid(en->name().lastIndexOf('/') + 1);
QMap<int, QString> filesToOpen;
const auto files = en->files();
for (const QString &file : files) {
@@ -4298,13 +4060,12 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
// main.qml takes precedence over main.cpp
else if (fileName.endsWith("main.qml")) {
filesToOpen.insert(3, file);
- }
- else if (fileName.endsWith("main.cpp")) {
+ } else if (fileName.endsWith("main.cpp")) {
filesToOpen.insert(4, file);
}
}
- for (auto it = filesToOpen.constEnd(); it != filesToOpen.constBegin(); ) {
+ for (auto it = filesToOpen.constEnd(); it != filesToOpen.constBegin();) {
writer.writeStartElement("fileToOpen");
if (--it == filesToOpen.constBegin()) {
writer.writeAttribute(QStringLiteral("mainFile"), QStringLiteral("true"));
@@ -4367,45 +4128,55 @@ void HtmlGenerator::reportOrphans(const Aggregate *parent)
case Node::Typedef:
child->location().warning(tr("Global typedef, %1, %2").arg(child->name()).arg(message));
break;
- case Node::Function:
- {
- const FunctionNode *fn = static_cast<const FunctionNode *>(child);
- switch (fn->metaness()) {
- case FunctionNode::QmlSignal:
- child->location().warning(tr("Global QML, signal, %1 %2").arg(child->name()).arg(message));
- break;
- case FunctionNode::QmlSignalHandler:
- child->location().warning(tr("Global QML signal handler, %1, %2").arg(child->name()).arg(message));
- break;
- case FunctionNode::QmlMethod:
- child->location().warning(tr("Global QML method, %1, %2").arg(child->name()).arg(message));
- break;
- case FunctionNode::JsSignal:
- child->location().warning(tr("Global JS, signal, %1 %2").arg(child->name()).arg(message));
- break;
- case FunctionNode::JsSignalHandler:
- child->location().warning(tr("Global JS signal handler, %1, %2").arg(child->name()).arg(message));
- break;
- case FunctionNode::JsMethod:
- child->location().warning(tr("Global JS method, %1, %2").arg(child->name()).arg(message));
- break;
- default:
- if (fn->isMacro())
- child->location().warning(tr("Global macro, %1, %2").arg(child->name()).arg(message));
- else
- child->location().warning(tr("Global function, %1(), %2").arg(child->name()).arg(message));
- break;
- }
+ case Node::Function: {
+ const FunctionNode *fn = static_cast<const FunctionNode *>(child);
+ switch (fn->metaness()) {
+ case FunctionNode::QmlSignal:
+ child->location().warning(
+ tr("Global QML, signal, %1 %2").arg(child->name()).arg(message));
+ break;
+ case FunctionNode::QmlSignalHandler:
+ child->location().warning(
+ tr("Global QML signal handler, %1, %2").arg(child->name()).arg(message));
+ break;
+ case FunctionNode::QmlMethod:
+ child->location().warning(
+ tr("Global QML method, %1, %2").arg(child->name()).arg(message));
+ break;
+ case FunctionNode::JsSignal:
+ child->location().warning(
+ tr("Global JS, signal, %1 %2").arg(child->name()).arg(message));
+ break;
+ case FunctionNode::JsSignalHandler:
+ child->location().warning(
+ tr("Global JS signal handler, %1, %2").arg(child->name()).arg(message));
+ break;
+ case FunctionNode::JsMethod:
+ child->location().warning(
+ tr("Global JS method, %1, %2").arg(child->name()).arg(message));
+ break;
+ default:
+ if (fn->isMacro())
+ child->location().warning(
+ tr("Global macro, %1, %2").arg(child->name()).arg(message));
+ else
+ child->location().warning(
+ tr("Global function, %1(), %2").arg(child->name()).arg(message));
break;
}
+ break;
+ }
case Node::Variable:
- child->location().warning(tr("Global variable, %1, %2").arg(child->name()).arg(message));
+ child->location().warning(
+ tr("Global variable, %1, %2").arg(child->name()).arg(message));
break;
case Node::JsProperty:
- child->location().warning(tr("Global JS property, %1, %2").arg(child->name()).arg(message));
+ child->location().warning(
+ tr("Global JS property, %1, %2").arg(child->name()).arg(message));
break;
case Node::QmlProperty:
- child->location().warning(tr("Global QML property, %1, %2").arg(child->name()).arg(message));
+ child->location().warning(
+ tr("Global QML property, %1, %2").arg(child->name()).arg(message));
break;
default:
break;
diff --git a/src/qdoc/htmlgenerator.h b/src/qdoc/htmlgenerator.h
index 86801e0af..1e3c46ef3 100644
--- a/src/qdoc/htmlgenerator.h
+++ b/src/qdoc/htmlgenerator.h
@@ -50,7 +50,6 @@ class HtmlGenerator : public XmlGenerator
Q_DECLARE_TR_FUNCTIONS(QDoc::HtmlGenerator)
public:
-
public:
HtmlGenerator();
~HtmlGenerator() override;
@@ -69,9 +68,7 @@ protected:
void generateExampleFilePage(const Node *en, const QString &file, CodeMarker *marker) override;
QString generateLinksToLinksPage(const QString &module, CodeMarker *marker);
QString generateLinksToBrokenLinksPage(CodeMarker *marker, int &count);
- virtual int generateAtom(const Atom *atom,
- const Node *relative,
- CodeMarker *marker) override;
+ virtual int generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker) override;
void generateCppReferencePage(Aggregate *aggregate, CodeMarker *marker) override;
void generateProxyPage(Aggregate *aggregate, CodeMarker *marker) override;
void generateQmlTypePage(QmlTypeNode *qcn, CodeMarker *marker) override;
@@ -88,12 +85,7 @@ protected:
private:
enum SubTitleSize { SmallSubTitle, LargeSubTitle };
- enum ExtractionMarkType {
- BriefMark,
- DetailedDescriptionMark,
- MemberMark,
- EndMark
- };
+ enum ExtractionMarkType { BriefMark, DetailedDescriptionMark, MemberMark, EndMark };
struct ManifestMetaFilter
{
@@ -102,29 +94,18 @@ private:
QSet<QString> tags;
};
- void generateNavigationBar(const QString &title,
- const Node *node,
- CodeMarker *marker,
- const QString &buildversion,
- bool tableItems = false);
- void generateHeader(const QString &title,
- const Node *node = nullptr,
+ void generateNavigationBar(const QString &title, const Node *node, CodeMarker *marker,
+ const QString &buildversion, bool tableItems = false);
+ void generateHeader(const QString &title, const Node *node = nullptr,
CodeMarker *marker = nullptr);
- void generateTitle(const QString &title,
- const Text &subTitle,
- SubTitleSize subTitleSize,
- const Node *relative,
- CodeMarker *marker);
+ void generateTitle(const QString &title, const Text &subTitle, SubTitleSize subTitleSize,
+ const Node *relative, CodeMarker *marker);
void generateFooter(const Node *node = nullptr);
- void generateRequisites(Aggregate *inner,
- CodeMarker *marker);
- void generateQmlRequisites(QmlTypeNode *qcn,
- CodeMarker *marker);
- void generateBrief(const Node *node,
- CodeMarker *marker,
- const Node *relative = nullptr, bool addLink=true);
- void generateTableOfContents(const Node *node,
- CodeMarker *marker,
+ void generateRequisites(Aggregate *inner, CodeMarker *marker);
+ void generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker);
+ void generateBrief(const Node *node, CodeMarker *marker, const Node *relative = nullptr,
+ bool addLink = true);
+ void generateTableOfContents(const Node *node, CodeMarker *marker,
QVector<Section> *sections = nullptr);
void generateSidebar();
QString generateAllMembersFile(const Section &section, CodeMarker *marker);
@@ -132,50 +113,36 @@ private:
QString generateObsoleteMembersFile(const Sections &sections, CodeMarker *marker);
QString generateObsoleteQmlMembersFile(const Sections &sections, CodeMarker *marker);
void generateClassHierarchy(const Node *relative, NodeMap &classMap);
- void generateAnnotatedList(const Node *relative, CodeMarker *marker, const NodeMultiMap &nodeMap);
- void generateAnnotatedLists(const Node *relative, CodeMarker *marker, const NodeMultiMap &nodeMap);
+ void generateAnnotatedList(const Node *relative, CodeMarker *marker,
+ const NodeMultiMap &nodeMap);
+ void generateAnnotatedLists(const Node *relative, CodeMarker *marker,
+ const NodeMultiMap &nodeMap);
void generateAnnotatedList(const Node *relative, CodeMarker *marker, const NodeList &nodes);
- void generateCompactList(ListType listType,
- const Node *relative,
- const NodeMultiMap &classMap,
- bool includeAlphabet,
- QString commonPrefix);
+ void generateCompactList(ListType listType, const Node *relative, const NodeMultiMap &classMap,
+ bool includeAlphabet, QString commonPrefix);
void generateFunctionIndex(const Node *relative);
void generateLegaleseList(const Node *relative, CodeMarker *marker);
bool generateGroupList(CollectionNode *cn);
void generateList(const Node *relative, CodeMarker *marker, const QString &selector);
- void generateSectionList(const Section& section,
- const Node *relative,
- CodeMarker *marker,
+ void generateSectionList(const Section &section, const Node *relative, CodeMarker *marker,
Section::Status = Section::Active);
- void generateQmlSummary(const NodeVector &members,
- const Node *relative,
- CodeMarker *marker);
- void generateQmlItem(const Node *node,
- const Node *relative,
- CodeMarker *marker,
- bool summary);
- void generateDetailedQmlMember(Node *node,
- const Aggregate *relative,
- CodeMarker *marker);
+ void generateQmlSummary(const NodeVector &members, const Node *relative, CodeMarker *marker);
+ void generateQmlItem(const Node *node, const Node *relative, CodeMarker *marker, bool summary);
+ void generateDetailedQmlMember(Node *node, const Aggregate *relative, CodeMarker *marker);
void generateQmlInherits(QmlTypeNode *qcn, CodeMarker *marker) override;
void generateQmlInstantiates(QmlTypeNode *qcn, CodeMarker *marker);
void generateInstantiatedBy(ClassNode *cn, CodeMarker *marker);
void generateSection(const NodeVector &nv, const Node *relative, CodeMarker *marker);
- void generateSynopsis(const Node *node,
- const Node *relative,
- CodeMarker *marker,
- Section::Style style,
- bool alignNames = false,
+ void generateSynopsis(const Node *node, const Node *relative, CodeMarker *marker,
+ Section::Style style, bool alignNames = false,
const QString *prefix = nullptr);
- void generateSectionInheritedList(const Section& section, const Node *relative);
- QString highlightedCode(const QString &markedCode,
- const Node *relative,
- bool alignNames = false,
- Node::Genus genus = Node::DontCare);
+ void generateSectionInheritedList(const Section &section, const Node *relative);
+ QString highlightedCode(const QString &markedCode, const Node *relative,
+ bool alignNames = false, Node::Genus genus = Node::DontCare);
- void generateFullName(const Node *apparentNode, const Node *relative, const Node *actualNode = nullptr);
+ void generateFullName(const Node *apparentNode, const Node *relative,
+ const Node *actualNode = nullptr);
void generateDetailedMember(const Node *node, const PageNode *relative, CodeMarker *marker);
void generateLink(const Atom *atom, CodeMarker *marker);
@@ -239,17 +206,16 @@ public:
static QString divNavTop;
};
-#define HTMLGENERATOR_ADDRESS "address"
-#define HTMLGENERATOR_FOOTER "footer"
-#define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me
-#define HTMLGENERATOR_POSTHEADER "postheader"
-#define HTMLGENERATOR_POSTPOSTHEADER "postpostheader"
-#define HTMLGENERATOR_PROLOGUE "prologue"
-#define HTMLGENERATOR_NONAVIGATIONBAR "nonavigationbar"
+#define HTMLGENERATOR_ADDRESS "address"
+#define HTMLGENERATOR_FOOTER "footer"
+#define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me
+#define HTMLGENERATOR_POSTHEADER "postheader"
+#define HTMLGENERATOR_POSTPOSTHEADER "postpostheader"
+#define HTMLGENERATOR_PROLOGUE "prologue"
+#define HTMLGENERATOR_NONAVIGATIONBAR "nonavigationbar"
#define HTMLGENERATOR_NAVIGATIONSEPARATOR "navigationseparator"
-#define HTMLGENERATOR_NOSUBDIRS "nosubdirs"
-#define HTMLGENERATOR_TOCDEPTH "tocdepth"
-
+#define HTMLGENERATOR_NOSUBDIRS "nosubdirs"
+#define HTMLGENERATOR_TOCDEPTH "tocdepth"
QT_END_NAMESPACE
diff --git a/src/qdoc/jscodemarker.cpp b/src/qdoc/jscodemarker.cpp
index cc1a234fb..d9ac99d6d 100644
--- a/src/qdoc/jscodemarker.cpp
+++ b/src/qdoc/jscodemarker.cpp
@@ -40,21 +40,17 @@
#include "tree.h"
#ifndef QT_NO_DECLARATIVE
-#include <private/qqmljsast_p.h>
-#include <private/qqmljsengine_p.h>
-#include <private/qqmljslexer_p.h>
-#include <private/qqmljsparser_p.h>
+# include <private/qqmljsast_p.h>
+# include <private/qqmljsengine_p.h>
+# include <private/qqmljslexer_p.h>
+# include <private/qqmljsparser_p.h>
#endif
QT_BEGIN_NAMESPACE
-JsCodeMarker::JsCodeMarker()
-{
-}
+JsCodeMarker::JsCodeMarker() {}
-JsCodeMarker::~JsCodeMarker()
-{
-}
+JsCodeMarker::~JsCodeMarker() {}
/*!
Returns \c true if the \a code is recognized by the parser.
@@ -102,15 +98,13 @@ Atom::AtomType JsCodeMarker::atomType() const
return Atom::JavaScript;
}
-QString JsCodeMarker::markedUpCode(const QString &code,
- const Node *relative,
+QString JsCodeMarker::markedUpCode(const QString &code, const Node *relative,
const Location &location)
{
return addMarkUp(code, relative, location);
}
-QString JsCodeMarker::addMarkUp(const QString &code,
- const Node * /* relative */,
+QString JsCodeMarker::addMarkUp(const QString &code, const Node * /* relative */,
const Location &location)
{
#ifndef QT_NO_DECLARATIVE
@@ -131,15 +125,16 @@ QString JsCodeMarker::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 JavaScript. The output is incomplete."));
+ location.warning(location.fileName()
+ + tr("Unable to analyze JavaScript. The output is incomplete."));
}
output = visitor.markedUpCode();
} else {
- location.warning(location.fileName() +
- tr("Unable to parse JavaScript: \"%1\" at line %2, column %3").arg(
- parser.errorMessage()).arg(parser.errorLineNumber()).arg(
- parser.errorColumnNumber()));
+ location.warning(location.fileName()
+ + tr("Unable to parse JavaScript: \"%1\" at line %2, column %3")
+ .arg(parser.errorMessage())
+ .arg(parser.errorLineNumber())
+ .arg(parser.errorColumnNumber()));
output = protect(code);
}
return output;
diff --git a/src/qdoc/jscodemarker.h b/src/qdoc/jscodemarker.h
index 3d2ffa1ef..3473cd09b 100644
--- a/src/qdoc/jscodemarker.h
+++ b/src/qdoc/jscodemarker.h
@@ -50,13 +50,11 @@ public:
bool recognizeLanguage(const QString &language) override;
Atom::AtomType atomType() const override;
- virtual QString markedUpCode(const QString &code,
- const Node *relative,
+ virtual QString markedUpCode(const QString &code, const Node *relative,
const Location &location) override;
private:
- QString addMarkUp(const QString &code, const Node *relative,
- const Location &location);
+ QString addMarkUp(const QString &code, const Node *relative, const Location &location);
};
QT_END_NAMESPACE
diff --git a/src/qdoc/location.cpp b/src/qdoc/location.cpp
index 2c088a5b5..aab8ede19 100644
--- a/src/qdoc/location.cpp
+++ b/src/qdoc/location.cpp
@@ -66,8 +66,7 @@ bool Location::logProgress_ = false;
/*!
Constructs an empty location.
*/
-Location::Location()
- : stk(nullptr), stkTop(&stkBottom), stkDepth(0), etcetera(false)
+Location::Location() : stk(nullptr), stkTop(&stkBottom), stkDepth(0), etcetera(false)
{
// nothing.
}
@@ -104,8 +103,7 @@ Location &Location::operator=(const Location &other)
if (other.stk == nullptr) {
stk = nullptr;
stkTop = &stkBottom;
- }
- else {
+ } else {
stk = new QStack<StackEntry>(*other.stk);
stkTop = &stk->top();
}
@@ -141,12 +139,9 @@ void Location::advance(QChar ch)
if (ch == QLatin1Char('\n')) {
stkTop->lineNo++;
stkTop->columnNo = 1;
- }
- else if (ch == QLatin1Char('\t')) {
- stkTop->columnNo =
- 1 + tabSize * (stkTop->columnNo + tabSize-1) / tabSize;
- }
- else {
+ } else if (ch == QLatin1Char('\t')) {
+ stkTop->columnNo = 1 + tabSize * (stkTop->columnNo + tabSize - 1) / tabSize;
+ } else {
stkTop->columnNo++;
}
}
@@ -181,15 +176,13 @@ void Location::pop()
{
if (--stkDepth == 0) {
stkBottom = StackEntry();
- }
- else {
+ } else {
stk->pop();
if (stk->isEmpty()) {
delete stk;
stk = nullptr;
stkTop = &stkBottom;
- }
- else {
+ } else {
stkTop = &stk->top();
}
}
@@ -219,7 +212,6 @@ QString Location::fileName() const
return fi.fileName();
}
-
/*!
Returns the suffix of the file name. Returns an empty string
if the file path is empty.
@@ -291,11 +283,11 @@ int Location::exitCode()
if (warningLimit < 0 || warningCount <= warningLimit)
return EXIT_SUCCESS;
- Location::null.emitMessage(Error,
- tr("Documentation warnings (%1) exceeded the limit (%2) for '%3'.")
- .arg(QString::number(warningCount),
- QString::number(warningLimit),
- project), QString());
+ Location::null.emitMessage(
+ Error,
+ tr("Documentation warnings (%1) exceeded the limit (%2) for '%3'.")
+ .arg(QString::number(warningCount), QString::number(warningLimit), project),
+ QString());
return warningCount;
}
@@ -341,10 +333,8 @@ void Location::initialize(const Config &config)
QRegExp regExp = config.getRegExp(CONFIG_SPURIOUS);
if (regExp.isValid()) {
spuriousRegExp = new QRegExp(regExp);
- }
- else {
- config.lastLocation().warning(tr("Invalid regular expression '%1'")
- .arg(regExp.pattern()));
+ } else {
+ config.lastLocation().warning(tr("Invalid regular expression '%1'").arg(regExp.pattern()));
}
}
@@ -388,7 +378,8 @@ void Location::logToStdErrAlways(const QString &message)
{
if (Generator::useTimestamps()) {
QTime t = QTime::currentTime();
- fprintf(stderr, "%s LOG: %s\n", t.toString().toLatin1().constData(), message.toLatin1().data());
+ fprintf(stderr, "%s LOG: %s\n", t.toString().toLatin1().constData(),
+ message.toLatin1().data());
} else {
fprintf(stderr, "LOG: %s\n", message.toLatin1().constData());
}
@@ -403,7 +394,8 @@ void Location::internalError(const QString &hint)
Location::null.fatal(tr("Internal error (%1)").arg(hint),
tr("There is a bug in %1. Seek advice from your local"
" %2 guru.")
- .arg(programName).arg(programName));
+ .arg(programName)
+ .arg(programName));
}
/*!
@@ -411,13 +403,9 @@ void Location::internalError(const QString &hint)
and outputs that string to \c stderr. \a type specifies
whether the \a message is an error or a warning.
*/
-void Location::emitMessage(MessageType type,
- const QString &message,
- const QString &details) const
+void Location::emitMessage(MessageType type, const QString &message, const QString &details) const
{
- if (type == Warning &&
- spuriousRegExp != nullptr &&
- spuriousRegExp->exactMatch(message))
+ if (type == Warning && spuriousRegExp != nullptr && spuriousRegExp->exactMatch(message))
return;
QString result = message;
diff --git a/src/qdoc/location.h b/src/qdoc/location.h
index 7a472ab5a..9ad601e1b 100644
--- a/src/qdoc/location.h
+++ b/src/qdoc/location.h
@@ -55,7 +55,11 @@ public:
void start();
void advance(QChar ch);
- void advanceLines(int n) { stkTop->lineNo += n; stkTop->columnNo = 1; }
+ void advanceLines(int n)
+ {
+ stkTop->lineNo += n;
+ stkTop->columnNo = 1;
+ }
void push(const QString &filePath);
void pop();
@@ -71,14 +75,10 @@ public:
int lineNo() const { return stkTop->lineNo; }
int columnNo() const { return stkTop->columnNo; }
bool etc() const { return etcetera; }
- void warning(const QString &message,
- const QString &details = QString()) const;
- void error(const QString &message,
- const QString &details = QString()) const;
- void fatal(const QString &message,
- const QString &details = QString()) const;
- void report(const QString &message,
- const QString &details = QString()) const;
+ void warning(const QString &message, const QString &details = QString()) const;
+ void error(const QString &message, const QString &details = QString()) const;
+ void fatal(const QString &message, const QString &details = QString()) const;
+ void report(const QString &message, const QString &details = QString()) const;
static const Location null;
@@ -104,9 +104,7 @@ private:
};
friend class QTypeInfo<StackEntry>;
- void emitMessage(MessageType type,
- const QString &message,
- const QString &details) const;
+ void emitMessage(MessageType type, const QString &message, const QString &details) const;
QString toString() const;
QString top() const;
diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp
index 1accb6449..2b2b7a6f8 100644
--- a/src/qdoc/main.cpp
+++ b/src/qdoc/main.cpp
@@ -56,7 +56,7 @@
#include <QtCore/qhashfunctions.h>
#ifndef QT_BOOTSTRAPPED
-# include <QtCore/qcoreapplication.h>
+# include <QtCore/qcoreapplication.h>
#endif
#include <algorithm>
@@ -76,7 +76,7 @@ typedef QPair<QString, QTranslator *> Translator;
static QVector<Translator> translators;
#endif
-static ClangCodeParser* clangParser_ = nullptr;
+static ClangCodeParser *clangParser_ = nullptr;
/*!
Read some XML indexes containing definitions from other
@@ -108,8 +108,7 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
for (const auto &format : formats) {
if (config.getBool(format + Config::dot + "nosubdirs")) {
useNoSubDirs = true;
- QString singleOutputSubdir =
- config.getString(format + Config::dot + "outputsubdir");
+ QString singleOutputSubdir = config.getString(format + Config::dot + "outputsubdir");
if (singleOutputSubdir.isEmpty())
singleOutputSubdir = "html";
subDirs << singleOutputSubdir;
@@ -118,9 +117,10 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
if (config.dependModules().size() > 0) {
if (config.indexDirs().size() > 0) {
- for (auto &dir : config.indexDirs()){
+ for (auto &dir : config.indexDirs()) {
if (dir.startsWith("..")) {
- const QString prefix(QDir(config.currentDir()).relativeFilePath(config.previousCurrentDir()));
+ const QString prefix(QDir(config.currentDir())
+ .relativeFilePath(config.previousCurrentDir()));
if (!prefix.isEmpty())
dir.prepend(prefix + QLatin1Char('/'));
}
@@ -137,16 +137,15 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
config.dependModules().removeOne("*");
asteriskUsed = true;
if (useNoSubDirs) {
- std::for_each(formats.begin(), formats.end(),
- [&](const QString &format) {
- QDir scanDir(config.getOutputDir(format));
- QStringList foundModules = scanDir.entryList(QStringList("*.index"), QDir::Files);
- std::transform(foundModules.begin(), foundModules.end(), foundModules.begin(),
- [](const QString &index) {
- return QFileInfo(index).baseName();
- });
- config.dependModules() << foundModules;
- });
+ std::for_each(formats.begin(), formats.end(), [&](const QString &format) {
+ QDir scanDir(config.getOutputDir(format));
+ QStringList foundModules =
+ scanDir.entryList(QStringList("*.index"), QDir::Files);
+ std::transform(
+ foundModules.begin(), foundModules.end(), foundModules.begin(),
+ [](const QString &index) { return QFileInfo(index).baseName(); });
+ config.dependModules() << foundModules;
+ });
} else {
for (const auto &indexDir : config.indexDirs()) {
QDir scanDir = QDir(indexDir);
@@ -160,7 +159,8 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
config.dependModules().removeAll(config.getString(CONFIG_PROJECT).toLower());
config.dependModules().removeDuplicates();
Location::logToStdErrAlways(QString("qdocconf file has depends = *;"
- " loading all %1 index files found").arg(config.dependModules().count()));
+ " loading all %1 index files found")
+ .arg(config.dependModules().count()));
}
for (const auto &module : config.dependModules()) {
QVector<QFileInfo> foundIndices;
@@ -170,8 +170,8 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
for (const auto &dir : config.indexDirs()) {
for (const auto &subDir : subDirs) {
- QString fileToLookFor = dir + QLatin1Char('/') + subDir
- + QLatin1Char('/') + module + ".index";
+ QString fileToLookFor = dir + QLatin1Char('/') + subDir + QLatin1Char('/')
+ + module + ".index";
if (QFile::exists(fileToLookFor)) {
QFileInfo tempFileInfo(fileToLookFor);
if (!foundIndices.contains(tempFileInfo))
@@ -194,28 +194,30 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
indexPaths.reserve(foundIndices.size());
for (const auto &found : qAsConst(foundIndices))
indexPaths << found.absoluteFilePath();
- Location::null.warning(QString("Multiple index files found for dependency \"%1\":\n%2").arg(
- module, indexPaths.join('\n')));
- Location::null.warning(QString("Using %1 as index file for dependency \"%2\"").arg(
- foundIndices[foundIndices.size() - 1].absoluteFilePath(),
- module));
+ Location::null.warning(
+ QString("Multiple index files found for dependency \"%1\":\n%2")
+ .arg(module, indexPaths.join('\n')));
+ Location::null.warning(
+ QString("Using %1 as index file for dependency \"%2\"")
+ .arg(foundIndices[foundIndices.size() - 1].absoluteFilePath(),
+ module));
indexToAdd = foundIndices[foundIndices.size() - 1].absoluteFilePath();
- }
- else if (foundIndices.size() == 1) {
+ } else if (foundIndices.size() == 1) {
indexToAdd = foundIndices[0].absoluteFilePath();
}
if (!indexToAdd.isEmpty()) {
if (!indexFiles.contains(indexToAdd))
indexFiles << indexToAdd;
- }
- else if (!asteriskUsed) {
- Location::null.warning(QString("\"%1\" Cannot locate index file for dependency \"%2\"").arg(
- config.getString(CONFIG_PROJECT), module));
+ } else if (!asteriskUsed) {
+ Location::null.warning(
+ QString("\"%1\" Cannot locate index file for dependency \"%2\"")
+ .arg(config.getString(CONFIG_PROJECT), module));
}
}
- }
- else {
- Location::null.warning(QLatin1String("Dependent modules specified, but no index directories were set. There will probably be errors for missing links."));
+ } else {
+ Location::null.warning(
+ QLatin1String("Dependent modules specified, but no index directories were set. "
+ "There will probably be errors for missing links."));
}
}
qdb->readIndexes(indexFiles);
@@ -243,7 +245,8 @@ static void processQdocconfFile(const QString &fileName, Config &config)
config.load(fileName);
QString project = config.getString(CONFIG_PROJECT);
if (project.isEmpty()) {
- Location::logToStdErrAlways(QLatin1String("qdoc can't run; no project set in qdocconf file"));
+ Location::logToStdErrAlways(
+ QLatin1String("qdoc can't run; no project set in qdocconf file"));
exit(1);
}
Location::terminate();
@@ -302,9 +305,10 @@ static void processQdocconfFile(const QString &fileName, Config &config)
if (!found) {
QTranslator *translator = new QTranslator(nullptr);
if (!translator->load(fileName)) {
- config.lastLocation().error(QCoreApplication::translate("QDoc", "Cannot load translator '%1'").arg(fileName));
- }
- else {
+ config.lastLocation().error(
+ QCoreApplication::translate("QDoc", "Cannot load translator '%1'")
+ .arg(fileName));
+ } else {
QCoreApplication::instance()->installTranslator(translator);
translators.append(Translator(fileName, translator));
}
@@ -347,8 +351,7 @@ static void processQdocconfFile(const QString &fileName, Config &config)
qCDebug(lcQdoc, " done loading index files");
}
qdb->newPrimaryTree(project);
- }
- else if (Generator::preparing())
+ } else if (Generator::preparing())
qdb->newPrimaryTree(project);
else
qdb->setPrimaryTree(project);
@@ -369,18 +372,16 @@ static void processQdocconfFile(const QString &fileName, Config &config)
// Store the title of the index (landing) page
NamespaceNode *root = qdb->primaryTreeRoot();
if (root) {
- QString title = config.getString(CONFIG_NAVIGATION
- + Config::dot
- + CONFIG_LANDINGPAGE);
- root->tree()->setIndexTitle(config.getString(CONFIG_NAVIGATION
- + Config::dot
- + CONFIG_LANDINGTITLE, title));
+ QString title = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGPAGE);
+ root->tree()->setIndexTitle(
+ config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGTITLE, title));
}
const auto &excludedDirList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS);
QSet<QString> excludedDirs = QSet<QString>(excludedDirList.cbegin(), excludedDirList.cend());
const auto &excludedFilesList = config.getCanonicalPathList(CONFIG_EXCLUDEFILES);
- QSet<QString> excludedFiles = QSet<QString>(excludedFilesList.cbegin(), excludedFilesList.cend());
+ QSet<QString> excludedFiles =
+ QSet<QString>(excludedFilesList.cbegin(), excludedFilesList.cend());
qCDebug(lcQdoc, "Adding doc/image dirs found in exampledirs to imagedirs");
QSet<QString> exampleImageDirs;
@@ -399,7 +400,8 @@ static void processQdocconfFile(const QString &fileName, Config &config)
QStringList sourceList;
qCDebug(lcQdoc, "Reading headerdirs");
- headerList = config.getAllFiles(CONFIG_HEADERS,CONFIG_HEADERDIRS, excludedDirs, excludedFiles);
+ headerList =
+ config.getAllFiles(CONFIG_HEADERS, CONFIG_HEADERDIRS, excludedDirs, excludedFiles);
QMap<QString, QString> headers;
QMultiMap<QString, QString> headerFileNames;
for (const auto &header : headerList) {
@@ -413,7 +415,8 @@ static void processQdocconfFile(const QString &fileName, Config &config)
}
qCDebug(lcQdoc, "Reading sourcedirs");
- sourceList = config.getAllFiles(CONFIG_SOURCES,CONFIG_SOURCEDIRS, excludedDirs, excludedFiles);
+ sourceList =
+ config.getAllFiles(CONFIG_SOURCES, CONFIG_SOURCEDIRS, excludedDirs, excludedFiles);
QMap<QString, QString> sources;
QMultiMap<QString, QString> sourceFileNames;
for (const auto &source : sourceList) {
@@ -491,8 +494,8 @@ static void processQdocconfFile(const QString &fileName, Config &config)
for (const auto &format : outputFormats) {
auto *generator = Generator::generatorForFormat(format);
if (generator == nullptr)
- outputFormatsLocation.fatal(QCoreApplication::translate("QDoc",
- "Unknown output format '%1'").arg(format));
+ outputFormatsLocation.fatal(
+ QCoreApplication::translate("QDoc", "Unknown output format '%1'").arg(format));
generator->initializeFormat(config);
generator->generateDocs();
}
diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index a1df93cb8..65c75e743 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -130,21 +130,21 @@ bool Node::changeType(NodeType from, NodeType to)
if (nodeType_ == from) {
nodeType_ = to;
switch (to) {
- case QmlType:
- case QmlModule:
- case QmlProperty:
- case QmlBasicType:
- setGenus(Node::QML);
- break;
- case JsType:
- case JsModule:
- case JsProperty:
- case JsBasicType:
- setGenus(Node::JS);
- break;
- default:
- setGenus(Node::CPP);
- break;
+ case QmlType:
+ case QmlModule:
+ case QmlProperty:
+ case QmlBasicType:
+ setGenus(Node::QML);
+ break;
+ case JsType:
+ case JsModule:
+ case JsProperty:
+ case JsBasicType:
+ setGenus(Node::JS);
+ break;
+ default:
+ setGenus(Node::CPP);
+ break;
}
return true;
}
@@ -158,8 +158,8 @@ bool Node::changeType(NodeType from, NodeType to)
*/
bool Node::nodeNameLessThan(const Node *n1, const Node *n2)
{
-#define LT_RETURN_IF_NOT_EQUAL(a, b) \
- if ((a) != (b)) \
+#define LT_RETURN_IF_NOT_EQUAL(a, b) \
+ if ((a) != (b)) \
return (a) < (b);
if (n1->isPageNode() && n2->isPageNode()) {
@@ -661,7 +661,7 @@ QString Node::fullName(const Node *relative) const
*/
bool Node::match(const QVector<int> &types) const
{
- for (int i=0; i<types.size(); ++i) {
+ for (int i = 0; i < types.size(); ++i) {
if (nodeType() == types.at(i))
return true;
}
@@ -721,8 +721,8 @@ Node::Node(NodeType type, Aggregate *parent, const QString &name)
operators_.insert("&=", "bitwise-and-assign");
operators_.insert("|=", "bitwise-or-assign");
operators_.insert("^=", "bitwise-xor-assign");
- operators_.insert("<<=" ,"bitwise-left-shift-assign");
- operators_.insert(">>=" ,"bitwise-right-shift-assign");
+ operators_.insert("<<=", "bitwise-left-shift-assign");
+ operators_.insert(">>=", "bitwise-right-shift-assign");
operators_.insert("||", "logical-or");
operators_.insert("&&", "logical-and");
operators_.insert("()", "call");
@@ -761,38 +761,38 @@ Node::Node(NodeType type, Aggregate *parent, const QString &name)
Node::PageType Node::getPageType(Node::NodeType t)
{
switch (t) {
- case Node::Namespace:
- case Node::Class:
- case Node::Struct:
- case Node::Union:
- case Node::HeaderFile:
- case Node::Enum:
- case Node::Function:
- case Node::Typedef:
- case Node::Property:
- case Node::Variable:
- case Node::QmlType:
- case Node::QmlProperty:
- case Node::QmlBasicType:
- case Node::JsType:
- case Node::JsProperty:
- case Node::JsBasicType:
- case Node::SharedComment:
- return Node::ApiPage;
- case Node::Example:
- return Node::ExamplePage;
- case Node::Page:
- case Node::ExternalPage:
- return Node::NoPageType;
- case Node::Group:
- case Node::Module:
- case Node::QmlModule:
- case Node::JsModule:
- case Node::Collection:
- return Node::OverviewPage;
- case Node::Proxy:
- default:
- return Node::NoPageType;
+ case Node::Namespace:
+ case Node::Class:
+ case Node::Struct:
+ case Node::Union:
+ case Node::HeaderFile:
+ case Node::Enum:
+ case Node::Function:
+ case Node::Typedef:
+ case Node::Property:
+ case Node::Variable:
+ case Node::QmlType:
+ case Node::QmlProperty:
+ case Node::QmlBasicType:
+ case Node::JsType:
+ case Node::JsProperty:
+ case Node::JsBasicType:
+ case Node::SharedComment:
+ return Node::ApiPage;
+ case Node::Example:
+ return Node::ExamplePage;
+ case Node::Page:
+ case Node::ExternalPage:
+ return Node::NoPageType;
+ case Node::Group:
+ case Node::Module:
+ case Node::QmlModule:
+ case Node::JsModule:
+ case Node::Collection:
+ return Node::OverviewPage;
+ case Node::Proxy:
+ default:
+ return Node::NoPageType;
}
}
@@ -808,38 +808,38 @@ Node::PageType Node::getPageType(Node::NodeType t)
Node::Genus Node::getGenus(Node::NodeType t)
{
switch (t) {
- case Node::Enum:
- case Node::Class:
- case Node::Struct:
- case Node::Union:
- case Node::Module:
- case Node::Typedef:
- case Node::Property:
- case Node::Variable:
- case Node::Function:
- case Node::Namespace:
- case Node::HeaderFile:
- return Node::CPP;
- case Node::QmlType:
- case Node::QmlModule:
- case Node::QmlProperty:
- case Node::QmlBasicType:
- return Node::QML;
- case Node::JsType:
- case Node::JsModule:
- case Node::JsProperty:
- case Node::JsBasicType:
- return Node::JS;
- case Node::Page:
- case Node::Group:
- case Node::Example:
- case Node::ExternalPage:
- return Node::DOC;
- case Node::Collection:
- case Node::SharedComment:
- case Node::Proxy:
- default:
- return Node::DontCare;
+ case Node::Enum:
+ case Node::Class:
+ case Node::Struct:
+ case Node::Union:
+ case Node::Module:
+ case Node::Typedef:
+ case Node::Property:
+ case Node::Variable:
+ case Node::Function:
+ case Node::Namespace:
+ case Node::HeaderFile:
+ return Node::CPP;
+ case Node::QmlType:
+ case Node::QmlModule:
+ case Node::QmlProperty:
+ case Node::QmlBasicType:
+ return Node::QML;
+ case Node::JsType:
+ case Node::JsModule:
+ case Node::JsProperty:
+ case Node::JsBasicType:
+ return Node::JS;
+ case Node::Page:
+ case Node::Group:
+ case Node::Example:
+ case Node::ExternalPage:
+ return Node::DOC;
+ case Node::Collection:
+ case Node::SharedComment:
+ case Node::Proxy:
+ default:
+ return Node::DontCare;
}
}
@@ -1079,19 +1079,16 @@ QString Node::accessString() const
QString Node::extractClassName(const QString &string) const
{
QString result;
- for (int i=0; i<=string.size(); ++i) {
+ for (int i = 0; i <= string.size(); ++i) {
QChar ch;
if (i != string.size())
ch = string.at(i);
QChar lower = ch.toLower();
- if ((lower >= QLatin1Char('a') && lower <= QLatin1Char('z')) ||
- ch.digitValue() >= 0 ||
- ch == QLatin1Char('_') ||
- ch == QLatin1Char(':')) {
+ if ((lower >= QLatin1Char('a') && lower <= QLatin1Char('z')) || ch.digitValue() >= 0
+ || ch == QLatin1Char('_') || ch == QLatin1Char(':')) {
result += ch;
- }
- else if (!result.isEmpty()) {
+ } else if (!result.isEmpty()) {
if (result != QLatin1String("const"))
return result;
result.clear();
@@ -1126,7 +1123,6 @@ Node::ThreadSafeness Node::inheritedThreadSafeness() const
return safeness_;
}
-
/*!
If this node is a QML or JS type node, return a pointer to
it. If it is a child of a QML or JS type node, return the
@@ -1193,7 +1189,7 @@ Aggregate *Node::root() const
/*!
Returns a pointer to the Tree this node is in.
*/
-Tree* Node::tree() const
+Tree *Node::tree() const
{
return root()->tree();
}
@@ -1203,7 +1199,7 @@ Tree* Node::tree() const
location, or both, depending on the suffix of the file
name from the file path in location \a t.
*/
-void Node::setLocation(const Location& t)
+void Node::setLocation(const Location &t)
{
QString suffix = t.fileSuffix();
if (suffix == "h")
@@ -1247,7 +1243,6 @@ QString Node::qualifyWithParentName()
return name_;
}
-
/*!
Returns the QML node's qualified name by stripping off the
"QML:" if present and prepending the logical module name.
@@ -1344,58 +1339,41 @@ QString Node::cleanId(const QString &str)
const QChar c = name[0];
const uint u = c.unicode();
- if ((u >= 'a' && u <= 'z') ||
- (u >= 'A' && u <= 'Z') ||
- (u >= '0' && u <= '9')) {
+ if ((u >= 'a' && u <= 'z') || (u >= 'A' && u <= 'Z') || (u >= '0' && u <= '9')) {
clean += c;
- }
- else if (u == '~') {
+ } else if (u == '~') {
clean += "dtor.";
- }
- else if (u == '_') {
+ } else if (u == '_') {
clean += "underscore.";
- }
- else {
+ } else {
clean += QLatin1Char('a');
}
for (int i = 1; i < name.length(); i++) {
const QChar c = name[i];
const uint u = c.unicode();
- if ((u >= 'a' && u <= 'z') ||
- (u >= 'A' && u <= 'Z') ||
- (u >= '0' && u <= '9') || u == '-' ||
- u == '_' || u == '.') {
+ if ((u >= 'a' && u <= 'z') || (u >= 'A' && u <= 'Z') || (u >= '0' && u <= '9') || u == '-'
+ || u == '_' || u == '.') {
clean += c;
- }
- else if (c.isSpace() || u == ':' ) {
+ } else if (c.isSpace() || u == ':') {
clean += QLatin1Char('-');
- }
- else if (u == '!') {
+ } else if (u == '!') {
clean += "-not";
- }
- else if (u == '&') {
+ } else if (u == '&') {
clean += "-and";
- }
- else if (u == '<') {
+ } else if (u == '<') {
clean += "-lt";
- }
- else if (u == '=') {
+ } else if (u == '=') {
clean += "-eq";
- }
- else if (u == '>') {
+ } else if (u == '>') {
clean += "-gt";
- }
- else if (u == '#') {
+ } else if (u == '#') {
clean += "-hash";
- }
- else if (u == '(') {
+ } else if (u == '(') {
clean += QLatin1Char('-');
- }
- else if (u == ')') {
+ } else if (u == ')') {
clean += QLatin1Char('-');
- }
- else {
+ } else {
clean += QLatin1Char('-');
clean += QString::number((int)u, 16);
}
@@ -2007,13 +1985,9 @@ Node *Aggregate::findChildNode(const QString &name, Node::Genus genus, int findF
Node *node = nodes.at(i);
if (genus == node->genus()) {
if (findFlags & TypesOnly) {
- if (!node->isTypedef()
- && !node->isClassNode()
- && !node->isQmlType()
- && !node->isQmlBasicType()
- && !node->isJsType()
- && !node->isJsBasicType()
- && !node->isEnumType())
+ if (!node->isTypedef() && !node->isClassNode() && !node->isQmlType()
+ && !node->isQmlBasicType() && !node->isJsType()
+ && !node->isJsBasicType() && !node->isEnumType())
continue;
} else if (findFlags & IgnoreModules && node->isModule())
continue;
@@ -2053,8 +2027,8 @@ void Aggregate::findChildren(const QString &name, NodeVector &nodes) const
nodes.reserve(nonfunctionCount);
}
if (nonfunctionCount > 0) {
- for (auto it = nonfunctionMap_.find(name);
- it != nonfunctionMap_.end() && it.key() == name; ++it) {
+ for (auto it = nonfunctionMap_.find(name); it != nonfunctionMap_.end() && it.key() == name;
+ ++it) {
nodes.append(it.value());
}
}
@@ -2067,10 +2041,10 @@ void Aggregate::findChildren(const QString &name, NodeVector &nodes) const
passed must be one of the isXxx() functions in class Node
that tests the node type.
*/
-Node *Aggregate::findNonfunctionChild(const QString &name, bool (Node::*isMatch) () const)
+Node *Aggregate::findNonfunctionChild(const QString &name, bool (Node::*isMatch)() const)
{
NodeList nodes = nonfunctionMap_.values(name);
- for (int i=0; i<nodes.size(); ++i) {
+ for (int i = 0; i < nodes.size(); ++i) {
Node *node = nodes.at(i);
if ((node->*(isMatch))())
return node;
@@ -2540,7 +2514,7 @@ void Aggregate::printChildren(const QString &title)
{
qDebug() << title << name() << children_.size();
if (children_.size() > 0) {
- for (int i=0; i<children_.size(); ++i) {
+ for (int i = 0; i < children_.size(); ++i) {
Node *n = children_.at(i);
qDebug() << " CHILD:" << n->name() << n->nodeTypeString();
}
@@ -2570,8 +2544,7 @@ void Aggregate::removeFunctionNode(FunctionNode *fn)
it.value() = fn->nextOverload();
fn->setNextOverload(nullptr);
fn->setOverloadNumber(0);
- }
- else {
+ } else {
functionMap_.erase(it);
}
} else {
@@ -2599,11 +2572,7 @@ void Aggregate::removeFunctionNode(FunctionNode *fn)
*/
static bool keep(FunctionNode *fn)
{
- if (fn->isPrivate() ||
- fn->isObsolete() ||
- fn->isInternal() ||
- fn->isSomeCtor() ||
- fn->isDtor())
+ if (fn->isPrivate() || fn->isObsolete() || fn->isInternal() || fn->isSomeCtor() || fn->isDtor())
return false;
return true;
}
@@ -2668,9 +2637,9 @@ bool Aggregate::hasObsoleteMembers() const
{
for (const auto *node : children_) {
if (!node->isPrivate() && node->isObsolete()) {
- if (node->isFunction() || node->isProperty() || node->isEnumType() ||
- node->isTypedef() || node->isTypeAlias() || node->isVariable() ||
- node->isQmlProperty() || node->isJsProperty())
+ if (node->isFunction() || node->isProperty() || node->isEnumType() || node->isTypedef()
+ || node->isTypeAlias() || node->isVariable() || node->isQmlProperty()
+ || node->isJsProperty())
return true;
}
}
@@ -2700,7 +2669,8 @@ void Aggregate::findAllObsoleteThings()
} else if (node->isQmlType() || node->isJsType()) {
Aggregate *a = static_cast<Aggregate *>(node);
if (a->hasObsoleteMembers())
- QDocDatabase::qmlTypesWithObsoleteMembers().insert(node->qualifyQmlName(), node);
+ QDocDatabase::qmlTypesWithObsoleteMembers().insert(node->qualifyQmlName(),
+ node);
} else if (node->isAggregate()) {
static_cast<Aggregate *>(node)->findAllObsoleteThings();
}
@@ -2716,14 +2686,15 @@ void Aggregate::findAllObsoleteThings()
void Aggregate::findAllClasses()
{
for (auto *node : qAsConst(children_)) {
- if (!node->isPrivate() && !node->isInternal() &&
- node->tree()->camelCaseModuleName() != QString("QDoc")) {
+ if (!node->isPrivate() && !node->isInternal()
+ && node->tree()->camelCaseModuleName() != QString("QDoc")) {
if (node->isClassNode()) {
QDocDatabase::cppClasses().insert(node->qualifyCppName().toLower(), node);
- } else if (node->isQmlType() || node->isQmlBasicType() || node->isJsType() || node->isJsBasicType()) {
+ } else if (node->isQmlType() || node->isQmlBasicType() || node->isJsType()
+ || node->isJsBasicType()) {
QString name = node->unqualifyQmlName();
QDocDatabase::qmlTypes().insert(name, node);
- //also add to the QML basic type map
+ // also add to the QML basic type map
if (node->isQmlBasicType() || node->isJsBasicType())
QDocDatabase::qmlBasicTypes().insert(name, node);
} else if (node->isExample()) {
@@ -2785,8 +2756,7 @@ void Aggregate::findAllSince()
FunctionNode *fn = static_cast<FunctionNode *>(node);
if (!fn->isObsolete() && !fn->isSomeCtor() && !fn->isDtor())
nsmap.value().insert(fn->name(), fn);
- }
- else if (node->isClassNode()) {
+ } else if (node->isClassNode()) {
// Insert classes into the since and class maps.
QString name = node->qualifyWithParentName();
nsmap.value().insert(name, node);
@@ -2837,7 +2807,7 @@ void Aggregate::resolveQmlInheritance()
} else {
if (!type->importList().isEmpty()) {
const ImportList &imports = type->importList();
- for (int i=0; i<imports.size(); ++i) {
+ for (int i = 0; i < imports.size(); ++i) {
base = QDocDatabase::qdocDB()->findQmlType(imports[i], type->qmlBaseName());
if (base && (base != type)) {
if (base->logicalModuleVersion()[0] != imports[i].version_[0])
@@ -2966,8 +2936,7 @@ void ClassNode::removePrivateAndInternalBases()
bases_.removeAt(i);
ignoredBases_.append(rc);
promotePublicBases(bc->baseClasses());
- }
- else {
+ } else {
++i;
}
found.insert(bc);
@@ -2981,8 +2950,7 @@ void ClassNode::removePrivateAndInternalBases()
const QVector<RelatedClass> &dd = dc->derivedClasses();
for (int j = dd.size() - 1; j >= 0; --j)
derived_.insert(i, dd.at(j));
- }
- else {
+ } else {
++i;
}
}
@@ -3000,8 +2968,7 @@ void ClassNode::resolvePropertyOverriddenFromPtrs(PropertyNode *pn)
PropertyNode *baseProperty = static_cast<PropertyNode *>(n);
cn->resolvePropertyOverriddenFromPtrs(baseProperty);
pn->setOverriddenFrom(baseProperty);
- }
- else
+ } else
cn->resolvePropertyOverriddenFromPtrs(pn);
}
}
@@ -3099,8 +3066,12 @@ void NamespaceNode::reportDocumentedChildrenInUndocumentedNamespace() const
QString msg1 = node->name();
if (node->isFunction())
msg1 += "()";
- msg1 += tr(" is documented, but namespace %1 is not documented in any module.").arg(name());
- QString msg2 = tr("Add /*! '\\%1 %2' ... */ or remove the qdoc comment marker (!) at that line number.").arg(COMMAND_NAMESPACE).arg(name());
+ msg1 += tr(" is documented, but namespace %1 is not documented in any module.")
+ .arg(name());
+ QString msg2 = tr("Add /*! '\\%1 %2' ... */ or remove the qdoc comment marker (!) at "
+ "that line number.")
+ .arg(COMMAND_NAMESPACE)
+ .arg(name());
node->doc().location().warning(msg1, msg2);
}
@@ -3346,8 +3317,7 @@ void ClassNode::addDerivedClass(Access access, ClassNode *node)
before the generate phase of qdoc. In an unresolved base
class, the pointer to the base class node is 0.
*/
-void ClassNode::addUnresolvedBaseClass(Access access,
- const QStringList &path,
+void ClassNode::addUnresolvedBaseClass(Access access, const QStringList &path,
const QString &signature)
{
bases_.append(RelatedClass(access, path, signature));
@@ -3454,7 +3424,8 @@ FunctionNode *ClassNode::findOverriddenFunction(const FunctionNode *fn)
}
if (cn != nullptr) {
FunctionNode *result = cn->findFunctionChild(fn);
- if (result != nullptr && !result->isInternal() && !result->isNonvirtual() && result->hasDoc())
+ if (result != nullptr && !result->isInternal() && !result->isNonvirtual()
+ && result->hasDoc())
return result;
result = cn->findOverriddenFunction(fn);
if (result != nullptr && !result->isNonvirtual())
@@ -3716,7 +3687,7 @@ bool PageNode::setTitle(const QString &title)
/*!
Add \a item to the enum type's item list.
*/
-void EnumNode::addItem(const EnumItem& item)
+void EnumNode::addItem(const EnumItem &item)
{
items_.append(item);
names_.insert(item.name());
@@ -3987,27 +3958,27 @@ static void buildTopicMetanessMap()
Node::Genus FunctionNode::getGenus(FunctionNode::Metaness t)
{
switch (t) {
- case FunctionNode::Plain:
- case FunctionNode::Signal:
- case FunctionNode::Slot:
- case FunctionNode::Ctor:
- case FunctionNode::Dtor:
- case FunctionNode::CCtor:
- case FunctionNode::MCtor:
- case FunctionNode::MacroWithParams:
- case FunctionNode::MacroWithoutParams:
- case FunctionNode::Native:
- case FunctionNode::CAssign:
- case FunctionNode::MAssign:
- return Node::CPP;
- case FunctionNode::QmlSignal:
- case FunctionNode::QmlSignalHandler:
- case FunctionNode::QmlMethod:
- return Node::QML;
- case FunctionNode::JsSignal:
- case FunctionNode::JsSignalHandler:
- case FunctionNode::JsMethod:
- return Node::JS;
+ case FunctionNode::Plain:
+ case FunctionNode::Signal:
+ case FunctionNode::Slot:
+ case FunctionNode::Ctor:
+ case FunctionNode::Dtor:
+ case FunctionNode::CCtor:
+ case FunctionNode::MCtor:
+ case FunctionNode::MacroWithParams:
+ case FunctionNode::MacroWithoutParams:
+ case FunctionNode::Native:
+ case FunctionNode::CAssign:
+ case FunctionNode::MAssign:
+ return Node::CPP;
+ case FunctionNode::QmlSignal:
+ case FunctionNode::QmlSignalHandler:
+ case FunctionNode::QmlMethod:
+ return Node::QML;
+ case FunctionNode::JsSignal:
+ case FunctionNode::JsSignalHandler:
+ case FunctionNode::JsMethod:
+ return Node::JS;
}
return Node::DontCare;
}
@@ -4066,19 +4037,19 @@ bool FunctionNode::changeMetaness(Metaness from, Metaness to)
if (metaness_ == from) {
metaness_ = to;
switch (to) {
- case QmlSignal:
- case QmlSignalHandler:
- case QmlMethod:
- setGenus(Node::QML);
- break;
- case JsSignal:
- case JsSignalHandler:
- case JsMethod:
- setGenus(Node::JS);
- break;
- default:
- setGenus(Node::CPP);
- break;
+ case QmlSignal:
+ case QmlSignalHandler:
+ case QmlMethod:
+ setGenus(Node::QML);
+ break;
+ case JsSignal:
+ case JsSignalHandler:
+ case JsMethod:
+ setGenus(Node::JS);
+ break;
+ default:
+ setGenus(Node::CPP);
+ break;
}
return true;
}
@@ -4157,20 +4128,20 @@ FunctionNode *FunctionNode::findPrimaryFunction()
QString FunctionNode::kindString() const
{
switch (metaness_) {
- case FunctionNode::QmlSignal:
- return "QML signal";
- case FunctionNode::QmlSignalHandler:
- return "QML signal handler";
- case FunctionNode::QmlMethod:
- return "QML method";
- case FunctionNode::JsSignal:
- return "JS signal";
- case FunctionNode::JsSignalHandler:
- return "JS signal handler";
- case FunctionNode::JsMethod:
- return "JS method";
- default:
- return "function";
+ case FunctionNode::QmlSignal:
+ return "QML signal";
+ case FunctionNode::QmlSignalHandler:
+ return "QML signal handler";
+ case FunctionNode::QmlMethod:
+ return "QML method";
+ case FunctionNode::JsSignal:
+ return "JS signal";
+ case FunctionNode::JsSignalHandler:
+ return "JS signal handler";
+ case FunctionNode::JsMethod:
+ return "JS method";
+ default:
+ return "function";
}
}
@@ -4283,9 +4254,9 @@ QString FunctionNode::signature(bool values, bool noReturnType) const
*/
PropertyNode::FunctionRole PropertyNode::role(const FunctionNode *fn) const
{
- for (int i=0; i<4; i++) {
+ for (int i = 0; i < 4; i++) {
if (functions_[i].contains(const_cast<FunctionNode *>(fn)))
- return (FunctionRole) i;
+ return (FunctionRole)i;
}
return Notifier;
}
@@ -4307,8 +4278,8 @@ Node *VariableNode::clone(Aggregate *parent)
*/
void FunctionNode::debug() const
{
- qDebug("QML METHOD %s returnType_ %s parentPath_ %s",
- qPrintable(name()), qPrintable(returnType_), qPrintable(parentPath_.join(' ')));
+ qDebug("QML METHOD %s returnType_ %s parentPath_ %s", qPrintable(name()),
+ qPrintable(returnType_), qPrintable(parentPath_.join(' ')));
}
/*!
@@ -4358,11 +4329,9 @@ bool FunctionNode::compare(const FunctionNode *fn) const
bool FunctionNode::isIgnored() const
{
if (!hasDoc() && !hasSharedDoc()) {
- if (name().startsWith(QLatin1String("qt_")) ||
- name() == QLatin1String("metaObject") ||
- name() == QLatin1String("tr") ||
- name() == QLatin1String("trUtf8") ||
- name() == QLatin1String("d_func")) {
+ if (name().startsWith(QLatin1String("qt_")) || name() == QLatin1String("metaObject")
+ || name() == QLatin1String("tr") || name() == QLatin1String("trUtf8")
+ || name() == QLatin1String("d_func")) {
return true;
}
QString s = signature(false, false);
@@ -4458,16 +4427,14 @@ QString PropertyNode::qualifiedDataType() const
if (type_.contains(QLatin1Char('*')) || type_.contains(QLatin1Char('&'))) {
// 'QWidget *' becomes 'QWidget *' const
return type_ + " const";
- }
- else {
+ } else {
/*
'int' becomes 'const int' ('int const' is
correct C++, but looks wrong)
*/
return "const " + type_;
}
- }
- else {
+ } else {
return type_;
}
}
@@ -4554,7 +4521,6 @@ void QmlTypeNode::subclasses(const Node *base, NodeList &subs)
}
}
-
/*!
If this QML type node has a base type node,
return the fully qualified name of that QML
@@ -4628,9 +4594,7 @@ QmlBasicTypeNode::QmlBasicTypeNode(Aggregate *parent, const QString &name, Node:
/*!
Constructor for the QML property node.
*/
-QmlPropertyNode::QmlPropertyNode(Aggregate *parent,
- const QString &name,
- const QString &type,
+QmlPropertyNode::QmlPropertyNode(Aggregate *parent, const QString &name, const QString &type,
bool attached)
: Node(parent->isJsType() ? JsProperty : QmlProperty, parent, name),
type_(type),
@@ -4672,16 +4636,20 @@ bool QmlPropertyNode::isWritable()
if (pn)
return pn->isWritable();
else
- defLocation().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
- "in C++ class documented as QML type: "
- "(property not found in the C++ class or its base classes)")
- .arg(logicalModuleName()).arg(qmlTypeName()).arg(name()));
- }
- else
+ defLocation().warning(
+ tr("No Q_PROPERTY for QML property %1::%2::%3 "
+ "in C++ class documented as QML type: "
+ "(property not found in the C++ class or its base classes)")
+ .arg(logicalModuleName())
+ .arg(qmlTypeName())
+ .arg(name()));
+ } else
defLocation().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
"in C++ class documented as QML type: "
"(C++ class not specified or not found).")
- .arg(logicalModuleName()).arg(qmlTypeName()).arg(name()));
+ .arg(logicalModuleName())
+ .arg(qmlTypeName())
+ .arg(name()));
}
}
return true;
@@ -4729,8 +4697,7 @@ PropertyNode *QmlPropertyNode::findCorrespondingCppProperty()
*/
return (pn2 ? pn2 : pn);
}
- }
- else
+ } else
return pn;
}
}
@@ -4767,8 +4734,7 @@ PropertyNode *QmlPropertyNode::findCorrespondingCppProperty()
appends this node to that Tree's proxy list so it will be
easy to find later.
*/
-ProxyNode::ProxyNode(Aggregate *parent, const QString &name)
- : Aggregate(Node::Proxy, parent, name)
+ProxyNode::ProxyNode(Aggregate *parent, const QString &name) : Aggregate(Node::Proxy, parent, name)
{
tree()->appendProxy(this);
}
@@ -4841,7 +4807,7 @@ bool CollectionNode::hasClasses() const
Loads \a out with all this collection node's members that
are namespace nodes.
*/
-void CollectionNode::getMemberNamespaces(NodeMap& out)
+void CollectionNode::getMemberNamespaces(NodeMap &out)
{
out.clear();
for (const auto &member : qAsConst(members_)) {
@@ -4854,7 +4820,7 @@ void CollectionNode::getMemberNamespaces(NodeMap& out)
Loads \a out with all this collection node's members that
are class nodes.
*/
-void CollectionNode::getMemberClasses(NodeMap& out) const
+void CollectionNode::getMemberClasses(NodeMap &out) const
{
out.clear();
for (const auto &i : qAsConst(members_)) {
@@ -4944,7 +4910,6 @@ Node *SharedCommentNode::clone(Aggregate *parent)
return scn;
}
-
/*!
Sets the related nonmember flag in this node and in each
node in the shared comment's collective.
diff --git a/src/qdoc/node.h b/src/qdoc/node.h
index 6594df921..5a97d194a 100644
--- a/src/qdoc/node.h
+++ b/src/qdoc/node.h
@@ -124,12 +124,7 @@ public:
ThreadSafe
};
- enum LinkType : unsigned char {
- StartLink,
- NextLink,
- PreviousLink,
- ContentsLink
- };
+ enum LinkType : unsigned char { StartLink, NextLink, PreviousLink, ContentsLink };
enum PageType : unsigned char {
NoPageType,
@@ -144,13 +139,9 @@ public:
OnBeyondZebra
};
- enum FlagValue {
- FlagValueDefault = -1,
- FlagValueFalse = 0,
- FlagValueTrue = 1
- };
+ enum FlagValue { FlagValueDefault = -1, FlagValueFalse = 0, FlagValueTrue = 1 };
- virtual ~Node() { }
+ virtual ~Node() {}
virtual Node *clone(Aggregate *) { return nullptr; } // currently only FunctionNode
virtual Tree *tree() const;
Aggregate *root() const;
@@ -178,7 +169,8 @@ public:
bool isEnumType() const { return nodeType_ == Enum; }
bool isExample() const { return nodeType_ == Example; }
bool isExternalPage() const { return nodeType_ == ExternalPage; }
- bool isFunction(Genus g = DontCare) const {
+ bool isFunction(Genus g = DontCare) const
+ {
return (nodeType_ != Function ? false : (genus() == g ? true : g == DontCare));
}
bool isGroup() const { return nodeType_ == Group; }
@@ -215,7 +207,10 @@ public:
virtual bool isAbstract() const { return false; }
virtual bool isAggregate() const { return false; } // means "can have children"
- virtual bool isFirstClassAggregate() const { return false; } // Aggregate but not proxy or prop group"
+ virtual bool isFirstClassAggregate() const
+ {
+ return false;
+ } // Aggregate but not proxy or prop group"
virtual bool isAlias() const { return false; }
virtual bool isAttached() const { return false; }
virtual bool isClassNode() const { return false; }
@@ -237,7 +232,7 @@ public:
QString plainFullName(const Node *relative = nullptr) const;
QString plainSignature() const;
QString fullName(const Node *relative = nullptr) const;
- virtual QString signature(bool , bool ) const { return plainName(); }
+ virtual QString signature(bool, bool) const { return plainName(); }
const QString &fileNameBase() const { return fileNameBase_; }
bool hasFileNameBase() const { return !fileNameBase_.isEmpty(); }
@@ -246,7 +241,8 @@ public:
void setAccess(Access t) { access_ = t; }
void setLocation(const Location &t);
void setDoc(const Doc &doc, bool replace = false);
- void setStatus(Status t) {
+ void setStatus(Status t)
+ {
if (status_ == Obsolete && t == Deprecated)
return;
status_ = t;
@@ -261,20 +257,20 @@ public:
void setIndexNodeFlag(bool isIndexNode = true) { indexNodeFlag_ = isIndexNode; }
void setHadDoc() { hadDoc_ = true; }
virtual void setRelatedNonmember(bool b) { relatedNonmember_ = b; }
- virtual void setOutputFileName(const QString &) { }
- virtual void addMember(Node *) { }
+ virtual void setOutputFileName(const QString &) {}
+ virtual void addMember(Node *) {}
virtual bool hasMembers() const { return false; }
virtual bool hasNamespaces() const { return false; }
virtual bool hasClasses() const { return false; }
- virtual void setAbstract(bool ) { }
- virtual void setWrapper() { }
- virtual void getMemberNamespaces(NodeMap &) { }
- virtual void getMemberClasses(NodeMap &) const { }
- virtual void setDataType(const QString &) { }
+ virtual void setAbstract(bool) {}
+ virtual void setWrapper() {}
+ virtual void getMemberNamespaces(NodeMap &) {}
+ virtual void getMemberClasses(NodeMap &) const {}
+ virtual void setDataType(const QString &) {}
virtual bool wasSeen() const { return false; }
- virtual void appendGroupName(const QString &) { }
+ virtual void appendGroupName(const QString &) {}
virtual QString element() const { return QString(); }
- virtual void setNoAutoList(bool ) { }
+ virtual void setNoAutoList(bool) {}
virtual bool docMustBeGenerated() const { return false; }
virtual QString title() const { return name(); }
@@ -283,9 +279,13 @@ public:
virtual bool setTitle(const QString &) { return false; }
virtual bool setSubtitle(const QString &) { return false; }
- void markInternal() { setAccess(Private); setStatus(Internal); }
- virtual void markDefault() { }
- virtual void markReadOnly(bool ) { }
+ void markInternal()
+ {
+ setAccess(Private);
+ setStatus(Internal);
+ }
+ virtual void markDefault() {}
+ virtual void markReadOnly(bool) {}
bool match(const QVector<int> &types) const;
Aggregate *parent() const { return parent_; }
@@ -295,19 +295,22 @@ public:
virtual QString nameForLists() const { return name_; }
virtual QString outputFileName() const { return QString(); }
virtual QString obsoleteLink() const { return QString(); }
- virtual void setObsoleteLink(const QString &) { }
- virtual void setQtVariable(const QString &) { }
+ virtual void setObsoleteLink(const QString &) {}
+ virtual void setQtVariable(const QString &) {}
virtual QString qtVariable() const { return QString(); }
virtual bool hasTag(const QString &) const { return false; }
- const QMap<LinkType, QPair<QString,QString> > &links() const { return linkMap_; }
+ const QMap<LinkType, QPair<QString, QString>> &links() const { return linkMap_; }
void setLink(LinkType linkType, const QString &link, const QString &desc);
Access access() const { return access_; }
QString accessString() const;
const Location &declLocation() const { return declLocation_; }
const Location &defLocation() const { return defLocation_; }
- const Location &location() const { return (defLocation_.isEmpty() ? declLocation_ : defLocation_); }
+ const Location &location() const
+ {
+ return (defLocation_.isEmpty() ? declLocation_ : defLocation_);
+ }
const Doc &doc() const { return doc_; }
bool isInAPI() const { return !isPrivate() && !isInternal() && hasDoc(); }
bool hasDoc() const { return (hadDoc_ || !doc_.isEmpty()); }
@@ -319,26 +322,26 @@ public:
QString templateStuff() const { return templateStuff_; }
const QString &reconstitutedBrief() const { return reconstitutedBrief_; }
QString nodeSubtypeString() const;
- virtual void addPageKeywords(const QString &) { }
+ virtual void addPageKeywords(const QString &) {}
bool isSharingComment() const { return (sharedCommentNode_ != nullptr); }
bool hasSharedDoc() const;
void setSharedCommentNode(SharedCommentNode *t) { sharedCommentNode_ = t; }
SharedCommentNode *sharedCommentNode() { return sharedCommentNode_; }
- //QString guid() const;
+ // QString guid() const;
QString extractClassName(const QString &string) const;
virtual QString qmlTypeName() const { return name_; }
virtual QString qmlFullBaseName() const { return QString(); }
virtual QString logicalModuleName() const { return QString(); }
virtual QString logicalModuleVersion() const { return QString(); }
virtual QString logicalModuleIdentifier() const { return QString(); }
- virtual void setLogicalModuleInfo(const QString &) { }
- virtual void setLogicalModuleInfo(const QStringList &) { }
+ virtual void setLogicalModuleInfo(const QString &) {}
+ virtual void setLogicalModuleInfo(const QStringList &) {}
virtual CollectionNode *logicalModule() const { return nullptr; }
- virtual void setQmlModule(CollectionNode *) { }
+ virtual void setQmlModule(CollectionNode *) {}
virtual ClassNode *classNode() { return nullptr; }
- virtual void setClassNode(ClassNode *) { }
+ virtual void setClassNode(ClassNode *) {}
QmlTypeNode *qmlTypeNode();
ClassNode *declarativeCppNode();
const QString &outputSubdirectory() const { return outSubDir_; }
@@ -379,29 +382,35 @@ private:
Location declLocation_;
Location defLocation_;
Doc doc_;
- QMap<LinkType, QPair<QString, QString> > linkMap_;
+ QMap<LinkType, QPair<QString, QString>> linkMap_;
QString fileNameBase_;
QString physicalModuleName_;
QString url_;
QString since_;
QString templateStuff_;
QString reconstitutedBrief_;
- //mutable QString uuid_;
+ // mutable QString uuid_;
QString outSubDir_;
static QStringMap operators_;
static int propertyGroupCount_;
- static QMap<QString,Node::NodeType> goals_;
+ static QMap<QString, Node::NodeType> goals_;
};
class PageNode : public Node
{
public:
- PageNode(Aggregate *parent, const QString &name) : Node(Page, parent, name),
- noAutoList_(false) { }
- PageNode(NodeType type, Aggregate *parent, const QString &name) : Node(type, parent, name),
- noAutoList_(false) { }
- PageNode(Aggregate *parent, const QString &name, PageType ptype) : Node(Page, parent, name),
- noAutoList_(false) { setPageType(ptype); }
+ PageNode(Aggregate *parent, const QString &name) : Node(Page, parent, name), noAutoList_(false)
+ {
+ }
+ PageNode(NodeType type, Aggregate *parent, const QString &name)
+ : Node(type, parent, name), noAutoList_(false)
+ {
+ }
+ PageNode(Aggregate *parent, const QString &name, PageType ptype)
+ : Node(Page, parent, name), noAutoList_(false)
+ {
+ setPageType(ptype);
+ }
bool isPageNode() const override { return true; }
bool isTextPageNode() const override { return !isAggregate(); } // PageNode but not Aggregate
@@ -410,14 +419,18 @@ public:
QString subtitle() const override { return subtitle_; }
QString fullTitle() const override;
bool setTitle(const QString &title) override;
- bool setSubtitle(const QString &subtitle) override { subtitle_ = subtitle; return true; }
+ bool setSubtitle(const QString &subtitle) override
+ {
+ subtitle_ = subtitle;
+ return true;
+ }
QString nameForLists() const override { return title(); }
virtual QString imageFileName() const { return QString(); }
- virtual void setImageFileName(const QString &) { }
+ virtual void setImageFileName(const QString &) {}
bool noAutoList() const { return noAutoList_; }
- void setNoAutoList(bool b) override { noAutoList_ = b; }
+ void setNoAutoList(bool b) override { noAutoList_ = b; }
const QStringList &groupNames() const { return groupNames_; }
void appendGroupName(const QString &t) override { groupNames_.append(t); }
@@ -442,7 +455,8 @@ class ExternalPageNode : public PageNode
{
public:
ExternalPageNode(Aggregate *parent, const QString &url)
- : PageNode(Node::ExternalPage, parent, url) {
+ : PageNode(Node::ExternalPage, parent, url)
+ {
setPageType(Node::ArticlePage);
setUrl(url);
}
@@ -452,7 +466,7 @@ class Aggregate : public PageNode
{
public:
Node *findChildNode(const QString &name, Node::Genus genus, int findFlags = 0) const;
- Node *findNonfunctionChild(const QString &name, bool (Node:: *) () const);
+ Node *findNonfunctionChild(const QString &name, bool (Node::*)() const);
void findChildren(const QString &name, NodeVector &nodes) const;
FunctionNode *findFunctionChild(const QString &name, const Parameters &parameters);
FunctionNode *findFunctionChild(const FunctionNode *clone);
@@ -499,7 +513,9 @@ public:
protected:
Aggregate(NodeType type, Aggregate *parent, const QString &name)
- : PageNode(type, parent, name), functionCount_(0) { }
+ : PageNode(type, parent, name), functionCount_(0)
+ {
+ }
~Aggregate() override;
void removeFunctionNode(FunctionNode *fn);
@@ -535,8 +551,10 @@ public:
class NamespaceNode : public Aggregate
{
public:
- NamespaceNode(Aggregate *parent, const QString &name) : Aggregate(Namespace, parent, name),
- seen_(false), tree_(nullptr), docNode_(nullptr) { }
+ NamespaceNode(Aggregate *parent, const QString &name)
+ : Aggregate(Namespace, parent, name), seen_(false), tree_(nullptr), docNode_(nullptr)
+ {
+ }
~NamespaceNode() override;
Tree *tree() const override { return (parent() ? parent()->tree() : tree_); }
@@ -567,13 +585,14 @@ private:
struct RelatedClass
{
- RelatedClass() { }
+ RelatedClass() {}
// constructor for resolved base class
- RelatedClass(Node::Access access, ClassNode *node)
- : access_(access), node_(node) { }
+ RelatedClass(Node::Access access, ClassNode *node) : access_(access), node_(node) {}
// constructor for unresolved base class
RelatedClass(Node::Access access, const QStringList &path, const QString &signature)
- : access_(access), node_(nullptr), path_(path), signature_(signature) { }
+ : access_(access), node_(nullptr), path_(path), signature_(signature)
+ {
+ }
QString accessString() const;
bool isPrivate() const { return (access_ == Node::Private); }
@@ -585,21 +604,23 @@ struct RelatedClass
struct UsingClause
{
- UsingClause() { }
- UsingClause(const QString &signature) : node_(nullptr), signature_(signature) { }
+ UsingClause() {}
+ UsingClause(const QString &signature) : node_(nullptr), signature_(signature) {}
const QString &signature() const { return signature_; }
const Node *node() { return node_; }
void setNode(const Node *n) { node_ = n; }
const Node *node_;
- QString signature_;
+ QString signature_;
};
class ClassNode : public Aggregate
{
public:
- ClassNode(NodeType type, Aggregate *parent, const QString &name) : Aggregate(type, parent, name),
- abstract_(false), wrapper_(false), qmlelement(nullptr) { }
+ ClassNode(NodeType type, Aggregate *parent, const QString &name)
+ : Aggregate(type, parent, name), abstract_(false), wrapper_(false), qmlelement(nullptr)
+ {
+ }
bool isFirstClassAggregate() const override { return true; }
bool isClassNode() const override { return true; }
bool isRelatableType() const override { return true; }
@@ -658,9 +679,20 @@ public:
bool isRelatableType() const override { return true; }
QString title() const override { return (title_.isEmpty() ? name() : title_); }
QString subtitle() const override { return subtitle_; }
- QString fullTitle() const override { return (title_.isEmpty() ? name() : name() + " - " + title_); }
- bool setTitle(const QString &title) override { title_ = title; return true; }
- bool setSubtitle(const QString &subtitle) override { subtitle_ = subtitle; return true; }
+ QString fullTitle() const override
+ {
+ return (title_.isEmpty() ? name() : name() + " - " + title_);
+ }
+ bool setTitle(const QString &title) override
+ {
+ title_ = title;
+ return true;
+ }
+ bool setSubtitle(const QString &subtitle) override
+ {
+ subtitle_ = subtitle;
+ return true;
+ }
QString nameForLists() const override { return title(); }
bool hasDocumentedChildren() const;
@@ -672,8 +704,7 @@ private:
class ExampleNode : public PageNode
{
public:
- ExampleNode(Aggregate *parent, const QString &name)
- : PageNode(Node::Example, parent, name) { }
+ ExampleNode(Aggregate *parent, const QString &name) : PageNode(Node::Example, parent, name) {}
QString imageFileName() const override { return imageFileName_; }
void setImageFileName(const QString &ifn) override { imageFileName_ = ifn; }
const QStringList &files() const { return files_; }
@@ -689,17 +720,18 @@ private:
QStringList images_;
};
-struct ImportRec {
- QString name_; // module name
- QString version_; // <major> . <minor>
- QString importId_; // "as" name
+struct ImportRec
+{
+ QString name_; // module name
+ QString version_; // <major> . <minor>
+ QString importId_; // "as" name
QString importUri_; // subdirectory of module directory
- ImportRec(const QString &name,
- const QString &version,
- const QString &importId,
+ ImportRec(const QString &name, const QString &version, const QString &importId,
const QString &importUri)
- : name_(name), version_(version), importId_(importId), importUri_(importUri) { }
+ : name_(name), version_(version), importId_(importId), importUri_(importUri)
+ {
+ }
QString &name() { return name_; }
QString &version() { return version_; }
QString &importId() { return importId_; }
@@ -714,7 +746,8 @@ class QmlTypeNode : public Aggregate
public:
QmlTypeNode(Aggregate *parent, const QString &name, NodeType type = QmlType);
bool isFirstClassAggregate() const override { return true; }
- bool isQtQuickNode() const override {
+ bool isQtQuickNode() const override
+ {
return (logicalModuleName() == QLatin1String("QtQuick"));
}
ClassNode *classNode() override { return cnode_; }
@@ -775,10 +808,7 @@ class QmlPropertyNode : public Node
Q_DECLARE_TR_FUNCTIONS(QDoc::QmlPropertyNode)
public:
- QmlPropertyNode(Aggregate *parent,
- const QString &name,
- const QString &type,
- bool attached);
+ QmlPropertyNode(Aggregate *parent, const QString &name, const QString &type, bool attached);
void setDataType(const QString &dataType) override { type_ = dataType; }
void setStored(bool stored) { stored_ = toFlagValue(stored); }
@@ -787,24 +817,18 @@ public:
const QString &dataType() const { return type_; }
QString qualifiedDataType() const { return type_; }
bool isReadOnlySet() const { return (readOnly_ != FlagValueDefault); }
- bool isStored() const { return fromFlagValue(stored_,true); }
- bool isDesignable() const { return fromFlagValue(designable_,false); }
+ bool isStored() const { return fromFlagValue(stored_, true); }
+ bool isDesignable() const { return fromFlagValue(designable_, false); }
bool isWritable();
bool isDefault() const override { return isdefault_; }
- bool isReadOnly() const override { return fromFlagValue(readOnly_,false); }
+ bool isReadOnly() const override { return fromFlagValue(readOnly_, false); }
bool isAlias() const override { return isAlias_; }
bool isAttached() const override { return attached_; }
bool isQtQuickNode() const override { return parent()->isQtQuickNode(); }
QString qmlTypeName() const override { return parent()->qmlTypeName(); }
- QString logicalModuleName() const override {
- return parent()->logicalModuleName();
- }
- QString logicalModuleVersion() const override {
- return parent()->logicalModuleVersion();
- }
- QString logicalModuleIdentifier() const override {
- return parent()->logicalModuleIdentifier();
- }
+ QString logicalModuleName() const override { return parent()->logicalModuleName(); }
+ QString logicalModuleVersion() const override { return parent()->logicalModuleVersion(); }
+ QString logicalModuleIdentifier() const override { return parent()->logicalModuleIdentifier(); }
QString element() const override { return parent()->name(); }
void markDefault() override { isdefault_ = true; }
@@ -815,20 +839,19 @@ private:
private:
QString type_;
- FlagValue stored_;
- FlagValue designable_;
- bool isAlias_;
- bool isdefault_;
- bool attached_;
- FlagValue readOnly_;
+ FlagValue stored_;
+ FlagValue designable_;
+ bool isAlias_;
+ bool isdefault_;
+ bool attached_;
+ FlagValue readOnly_;
};
class EnumItem
{
public:
- EnumItem() { }
- EnumItem(const QString &name, const QString &value)
- : name_(name), value_(value) { }
+ EnumItem() {}
+ EnumItem(const QString &name, const QString &value) : name_(name), value_(value) {}
const QString &name() const { return name_; }
const QString &value() const { return value_; }
@@ -841,7 +864,9 @@ private:
class EnumNode : public Node
{
public:
- EnumNode(Aggregate *parent, const QString &name) : Node(Enum, parent, name), flagsType_(nullptr) { }
+ EnumNode(Aggregate *parent, const QString &name) : Node(Enum, parent, name), flagsType_(nullptr)
+ {
+ }
void addItem(const EnumItem &item);
void setFlagsType(TypedefNode *typedeff);
@@ -862,8 +887,10 @@ private:
class TypedefNode : public Node
{
public:
- TypedefNode(Aggregate *parent, const QString &name) : Node(Typedef, parent, name),
- associatedEnum_(nullptr) { }
+ TypedefNode(Aggregate *parent, const QString &name)
+ : Node(Typedef, parent, name), associatedEnum_(nullptr)
+ {
+ }
bool hasAssociatedEnum() const { return associatedEnum_ != nullptr; }
const EnumNode *associatedEnum() const { return associatedEnum_; }
@@ -881,7 +908,9 @@ class TypeAliasNode : public TypedefNode
{
public:
TypeAliasNode(Aggregate *parent, const QString &name, const QString &aliasedType)
- : TypedefNode(parent, name), aliasedType_(aliasedType) { }
+ : TypedefNode(parent, name), aliasedType_(aliasedType)
+ {
+ }
QString aliasedType() { return aliasedType_; }
Node *clone(Aggregate *parent) override;
@@ -899,24 +928,30 @@ inline void EnumNode::setFlagsType(TypedefNode *t)
class SharedCommentNode : public Node
{
public:
- SharedCommentNode(Node *n)
- : Node(Node::SharedComment, n->parent(), QString()) {
+ SharedCommentNode(Node *n) : Node(Node::SharedComment, n->parent(), QString())
+ {
collective_.reserve(1);
append(n);
}
- SharedCommentNode(QmlTypeNode *parent, int count, QString &group)
- : Node(Node::SharedComment, parent, group) {
+ SharedCommentNode(QmlTypeNode *parent, int count, QString &group)
+ : Node(Node::SharedComment, parent, group)
+ {
collective_.reserve(count);
}
~SharedCommentNode() override { collective_.clear(); }
- bool isPropertyGroup() const override {
- return !name().isEmpty() &&
- !collective_.isEmpty() &&
- (collective_.at(0)->isQmlProperty() || collective_.at(0)->isJsProperty());
+ bool isPropertyGroup() const override
+ {
+ return !name().isEmpty() && !collective_.isEmpty()
+ && (collective_.at(0)->isQmlProperty() || collective_.at(0)->isJsProperty());
}
int count() const { return collective_.size(); }
- void append(Node *n) { collective_.append(n); n->setSharedCommentNode(this); setGenus(n->genus()); }
+ void append(Node *n)
+ {
+ collective_.append(n);
+ n->setSharedCommentNode(this);
+ setGenus(n->genus());
+ }
const QVector<Node *> &collective() const { return collective_; }
void setOverloadFlags();
void setRelatedNonmember(bool b) override;
@@ -937,13 +972,13 @@ public:
Slot,
Ctor,
Dtor,
- CCtor, // copy constructor
- MCtor, // move-copy constructor
+ CCtor, // copy constructor
+ MCtor, // move-copy constructor
MacroWithParams,
MacroWithoutParams,
Native,
- CAssign, // copy-assignment operator
- MAssign, // move-assignment operator
+ CAssign, // copy-assignment operator
+ MAssign, // move-assignment operator
QmlSignal,
QmlSignalHandler,
QmlMethod,
@@ -1005,7 +1040,8 @@ public:
bool isQmlSignal() const { return (metaness_ == QmlSignal); }
bool isQmlSignalHandler() const { return (metaness_ == QmlSignalHandler); }
- bool isSpecialMemberFunction() const {
+ bool isSpecialMemberFunction() const
+ {
return (isDtor() || isCCtor() || isMCtor() || isCAssign() || isMAssign());
}
bool isNonvirtual() const { return (virtualness_ == NonVirtual); }
@@ -1075,8 +1111,8 @@ private:
bool const_ : 1;
bool static_ : 1;
- bool reimpFlag_: 1;
- bool attached_: 1;
+ bool reimpFlag_ : 1;
+ bool attached_ : 1;
bool overloadFlag_ : 1;
bool isFinal_ : 1;
bool isOverride_ : 1;
@@ -1212,7 +1248,9 @@ class CollectionNode : public PageNode
{
public:
CollectionNode(NodeType type, Aggregate *parent, const QString &name)
- : PageNode(type, parent, name), seen_(false) { }
+ : PageNode(type, parent, name), seen_(false)
+ {
+ }
bool isCollectionNode() const override { return true; }
QString qtVariable() const override { return qtVariable_; }
@@ -1227,10 +1265,12 @@ public:
QString fullTitle() const override { return title(); }
QString logicalModuleName() const override { return logicalModuleName_; }
- QString logicalModuleVersion() const override {
+ QString logicalModuleVersion() const override
+ {
return logicalModuleVersionMajor_ + QLatin1Char('.') + logicalModuleVersionMinor_;
}
- QString logicalModuleIdentifier() const override {
+ QString logicalModuleIdentifier() const override
+ {
return logicalModuleName_ + logicalModuleVersionMajor_;
}
void setLogicalModuleInfo(const QString &arg) override;
diff --git a/src/qdoc/openedlist.cpp b/src/qdoc/openedlist.cpp
index a36e3b545..eed679e80 100644
--- a/src/qdoc/openedlist.cpp
+++ b/src/qdoc/openedlist.cpp
@@ -40,13 +40,9 @@ QT_BEGIN_NAMESPACE
static const char roman[] = "m\2d\5c\2l\5x\2v\5i";
-OpenedList::OpenedList(ListStyle style)
- : sty(style), ini(1), nex(0)
-{
-}
+OpenedList::OpenedList(ListStyle style) : sty(style), ini(1), nex(0) {}
-OpenedList::OpenedList(const Location &location, const QString &hint)
- : sty(Bullet), ini(1)
+OpenedList::OpenedList(const Location &location, const QString &hint) : sty(Bullet), ini(1)
{
QRegExp hintSyntax("(\\W*)([0-9]+|[A-Z]+|[a-z]+)(\\W*)");
diff --git a/src/qdoc/openedlist.h b/src/qdoc/openedlist.h
index 6c4cea6c0..604eabb6f 100644
--- a/src/qdoc/openedlist.h
+++ b/src/qdoc/openedlist.h
@@ -44,11 +44,9 @@ class OpenedList
Q_DECLARE_TR_FUNCTIONS(QDoc::OpenedList)
public:
- enum ListStyle { Bullet, Tag, Value, Numeric, UpperAlpha, LowerAlpha,
- UpperRoman, LowerRoman };
+ enum ListStyle { Bullet, Tag, Value, Numeric, UpperAlpha, LowerAlpha, UpperRoman, LowerRoman };
- OpenedList()
- : sty(Bullet), ini(1), nex(0) { }
+ OpenedList() : sty(Bullet), ini(1), nex(0) {}
OpenedList(ListStyle style);
OpenedList(const Location &location, const QString &hint);
diff --git a/src/qdoc/parameters.cpp b/src/qdoc/parameters.cpp
index 96a591a2a..7dfe018f6 100644
--- a/src/qdoc/parameters.cpp
+++ b/src/qdoc/parameters.cpp
@@ -83,8 +83,7 @@ QString Parameter::signature(bool includeValue) const
of its parameters.
*/
-Parameters::Parameters()
- : valid_(true), privateSignal_(false), tok_(0), tokenizer_(nullptr)
+Parameters::Parameters() : valid_(true), privateSignal_(false), tok_(0), tokenizer_(nullptr)
{
// nothing.
}
@@ -152,14 +151,11 @@ void Parameters::matchTemplateAngles(CodeChunk &type)
do {
if (tok_ == Tok_LeftAngle) {
leftAngleDepth++;
- }
- else if (tok_ == Tok_RightAngle) {
+ } else if (tok_ == Tok_RightAngle) {
leftAngleDepth--;
- }
- else if (tok_ == Tok_LeftParen || tok_ == Tok_LeftBrace) {
+ } else if (tok_ == Tok_LeftParen || tok_ == Tok_LeftBrace) {
++parenAndBraceDepth;
- }
- else if (tok_ == Tok_RightParen || tok_ == Tok_RightBrace) {
+ } else if (tok_ == Tok_RightParen || tok_ == Tok_RightBrace) {
if (--parenAndBraceDepth < 0)
return;
}
@@ -198,8 +194,8 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name, bool qProp)
while (match(Tok_const) || match(Tok_volatile))
type.append(previousLexeme());
QString pending;
- while (tok_ == Tok_signed || tok_ == Tok_int || tok_ == Tok_unsigned ||
- tok_ == Tok_short || tok_ == Tok_long || tok_ == Tok_int64) {
+ while (tok_ == Tok_signed || tok_ == Tok_int || tok_ == Tok_unsigned
+ || tok_ == Tok_short || tok_ == Tok_long || tok_ == Tok_int64) {
if (tok_ == Tok_signed)
pending = lexeme();
else {
@@ -229,25 +225,22 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name, bool qProp)
with the real one used in Qt Creator.
Is it still needed? mws 11/12/2018
*/
- if (lexeme() == "(" &&
- ((previousLexeme() == "QT_PREPEND_NAMESPACE") || (previousLexeme() == "NS"))) {
+ if (lexeme() == "("
+ && ((previousLexeme() == "QT_PREPEND_NAMESPACE")
+ || (previousLexeme() == "NS"))) {
readToken();
readToken();
type.append(previousLexeme());
readToken();
- }
- else
+ } else
type.append(previousLexeme());
- }
- else if (match(Tok_void) || match(Tok_int) || match(Tok_char) ||
- match(Tok_double) || match(Tok_Ellipsis)) {
+ } else if (match(Tok_void) || match(Tok_int) || match(Tok_char) || match(Tok_double)
+ || match(Tok_Ellipsis)) {
type.append(previousLexeme());
- }
- else {
+ } else {
return false;
}
- }
- else if (match(Tok_int) || match(Tok_char) || match(Tok_double)) {
+ } else if (match(Tok_int) || match(Tok_char) || match(Tok_double)) {
type.append(previousLexeme());
}
@@ -262,8 +255,8 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name, bool qProp)
break;
}
- while (match(Tok_Ampersand) || match(Tok_Aster) || match(Tok_const) ||
- match(Tok_Caret) || match(Tok_Ellipsis))
+ while (match(Tok_Ampersand) || match(Tok_Aster) || match(Tok_const) || match(Tok_Caret)
+ || match(Tok_Ellipsis))
type.append(previousLexeme());
if (match(Tok_LeftParenAster)) {
@@ -296,8 +289,7 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name, bool qProp)
if (!match(Tok_RightParen))
return false;
type.append(previousLexeme());
- }
- else {
+ } else {
/*
The common case: Look for an optional identifier, then for
some array brackets.
@@ -306,8 +298,7 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name, bool qProp)
if (match(Tok_Ident)) {
name = previousLexeme();
- }
- else if (match(Tok_Comment)) {
+ } else if (match(Tok_Comment)) {
/*
A neat hack: Commented-out parameter names are
recognized by qdoc. It's impossible to illustrate
@@ -318,8 +309,7 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name, bool qProp)
*/
if (varComment_.exactMatch(previousLexeme()))
name = varComment_.cap(1);
- }
- else if (match(Tok_LeftParen)) {
+ } else if (match(Tok_LeftParen)) {
name = "(";
while (tok_ != Tok_RightParen && tok_ != Tok_Eoi) {
name.append(lexeme());
@@ -336,17 +326,15 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name, bool qProp)
name.append("]");
readToken();
}
- }
- else if (qProp && (match(Tok_default) || match(Tok_final) || match(Tok_override))) {
+ } else if (qProp && (match(Tok_default) || match(Tok_final) || match(Tok_override))) {
// Hack to make 'default', 'final' and 'override' work again in Q_PROPERTY
name = previousLexeme();
}
if (tok_ == Tok_LeftBracket) {
int bracketDepth0 = tokenizer_->bracketDepth();
- while ((tokenizer_->bracketDepth() >= bracketDepth0 &&
- tok_ != Tok_Eoi) ||
- tok_ == Tok_RightBracket) {
+ while ((tokenizer_->bracketDepth() >= bracketDepth0 && tok_ != Tok_Eoi)
+ || tok_ == Tok_RightBracket) {
type.append(lexeme());
readToken();
}
@@ -377,9 +365,8 @@ bool Parameters::matchParameter()
if (match(Tok_Equal)) {
chunk.clear();
int pdepth = tokenizer_->parenDepth();
- while (tokenizer_->parenDepth() >= pdepth &&
- (tok_ != Tok_Comma || (tokenizer_->parenDepth() > pdepth)) &&
- tok_ != Tok_Eoi) {
+ while (tokenizer_->parenDepth() >= pdepth
+ && (tok_ != Tok_Comma || (tokenizer_->parenDepth() > pdepth)) && tok_ != Tok_Eoi) {
chunk.append(lexeme());
readToken();
}
diff --git a/src/qdoc/parameters.h b/src/qdoc/parameters.h
index 7e72d1689..e049fed51 100644
--- a/src/qdoc/parameters.h
+++ b/src/qdoc/parameters.h
@@ -43,10 +43,11 @@ class Parameter
{
public:
Parameter() {}
- Parameter(const QString &type,
- const QString &name = QString(),
+ Parameter(const QString &type, const QString &name = QString(),
const QString &defaultValue = QString())
- : type_(type), name_(name), defaultValue_(defaultValue) { }
+ : type_(type), name_(name), defaultValue_(defaultValue)
+ {
+ }
void setName(const QString &name) { name_ = name; }
bool hasType() const { return !type_.isEmpty(); }
@@ -55,12 +56,18 @@ public:
const QString &defaultValue() const { return defaultValue_; }
void setDefaultValue(const QString &t) { defaultValue_ = t; }
- void set(const QString &type, const QString &name) {
- type_ = type; name_ = name; defaultValue_.clear();
+ void set(const QString &type, const QString &name)
+ {
+ type_ = type;
+ name_ = name;
+ defaultValue_.clear();
}
- void set(const QString &type, const QString &name, const QString &defaultValue) {
- type_ = type; name_ = name; defaultValue_ = defaultValue;
+ void set(const QString &type, const QString &name, const QString &defaultValue)
+ {
+ type_ = type;
+ name_ = name;
+ defaultValue_ = defaultValue;
}
QString signature(bool includeValue = false) const;
@@ -79,7 +86,12 @@ public:
Parameters();
Parameters(const QString &signature);
- void clear() { parameters_.clear(); privateSignal_ = false; valid_ = true; }
+ void clear()
+ {
+ parameters_.clear();
+ privateSignal_ = false;
+ valid_ = true;
+ }
const ParameterVector &parameters() const { return parameters_; }
bool isPrivateSignal() const { return privateSignal_; }
bool isEmpty() const { return parameters_.isEmpty(); }
diff --git a/src/qdoc/puredocparser.cpp b/src/qdoc/puredocparser.cpp
index 6ba46a20e..ea3757747 100644
--- a/src/qdoc/puredocparser.cpp
+++ b/src/qdoc/puredocparser.cpp
@@ -44,7 +44,10 @@ PureDocParser *PureDocParser::pureParser_ = nullptr;
*/
QStringList PureDocParser::sourceFileNameFilter()
{
- return QStringList() << "*.qdoc" << "*.qtx" << "*.qtt" << "*.js";
+ return QStringList() << "*.qdoc"
+ << "*.qtx"
+ << "*.qtt"
+ << "*.js";
}
/*!
@@ -102,7 +105,8 @@ bool PureDocParser::processQdocComments()
if (topics.isEmpty()) {
doc.location().warning(tr("This qdoc comment contains no topic command "
"(e.g., '\\%1', '\\%2').")
- .arg(COMMAND_MODULE).arg(COMMAND_PAGE));
+ .arg(COMMAND_MODULE)
+ .arg(COMMAND_PAGE));
continue;
}
if (hasTooManyTopics(doc))
@@ -114,8 +118,7 @@ bool PureDocParser::processQdocComments()
processTopicArgs(doc, topic, nodes, docs);
processMetaCommands(nodes, docs);
- }
- else {
+ } else {
tok_ = tokenizer_->getToken();
}
}
diff --git a/src/qdoc/qdoccommandlineparser.cpp b/src/qdoc/qdoccommandlineparser.cpp
index 33009c512..3bd01fae5 100644
--- a/src/qdoc/qdoccommandlineparser.cpp
+++ b/src/qdoc/qdoccommandlineparser.cpp
@@ -41,7 +41,8 @@ QDocCommandLineParser::QDocCommandLineParser()
dependsOption(QStringList() << QStringLiteral("depends")),
highlightingOption(QStringList() << QStringLiteral("highlighting")),
showInternalOption(QStringList() << QStringLiteral("showinternal")),
- redirectDocumentationToDevNullOption(QStringList() << QStringLiteral("redirect-documentation-to-dev-null")),
+ redirectDocumentationToDevNullOption(QStringList()
+ << QStringLiteral("redirect-documentation-to-dev-null")),
noExamplesOption(QStringList() << QStringLiteral("no-examples")),
indexDirOption(QStringList() << QStringLiteral("indexdir")),
installDirOption(QStringList() << QStringLiteral("installdir")),
@@ -57,8 +58,10 @@ QDocCommandLineParser::QDocCommandLineParser()
singleExecOption(QStringList() << QStringLiteral("single-exec")),
writeQaPagesOption(QStringList() << QStringLiteral("write-qa-pages")),
includePathOption("I", "Add dir to the include path for header files.", "path"),
- includePathSystemOption("isystem", "Add dir to the system include path for header files.", "path"),
- frameworkOption("F", "Add macOS framework to the include path for header files.", "framework"),
+ includePathSystemOption("isystem", "Add dir to the system include path for header files.",
+ "path"),
+ frameworkOption("F", "Add macOS framework to the include path for header files.",
+ "framework"),
timestampsOption(QStringList() << QStringLiteral("timestamps"))
{
setApplicationDescription(QCoreApplication::translate("qdoc", "Qt documentation generator"));
@@ -69,7 +72,8 @@ QDocCommandLineParser::QDocCommandLineParser()
addPositionalArgument("file1.qdocconf ...", QCoreApplication::translate("qdoc", "Input files"));
- defineOption.setDescription(QCoreApplication::translate("qdoc", "Define the argument as a macro while parsing sources"));
+ defineOption.setDescription(QCoreApplication::translate(
+ "qdoc", "Define the argument as a macro while parsing sources"));
defineOption.setValueName(QStringLiteral("macro[=def]"));
addOption(defineOption);
@@ -77,56 +81,74 @@ QDocCommandLineParser::QDocCommandLineParser()
dependsOption.setValueName(QStringLiteral("module"));
addOption(dependsOption);
- highlightingOption.setDescription(QCoreApplication::translate("qdoc", "Turn on syntax highlighting (makes qdoc run slower)"));
+ highlightingOption.setDescription(QCoreApplication::translate(
+ "qdoc", "Turn on syntax highlighting (makes qdoc run slower)"));
addOption(highlightingOption);
- showInternalOption.setDescription(QCoreApplication::translate("qdoc", "Include content marked internal"));
+ showInternalOption.setDescription(
+ QCoreApplication::translate("qdoc", "Include content marked internal"));
addOption(showInternalOption);
- redirectDocumentationToDevNullOption.setDescription(QCoreApplication::translate("qdoc", "Save all documentation content to /dev/null. Useful if someone is interested in qdoc errors only."));
+ redirectDocumentationToDevNullOption.setDescription(
+ QCoreApplication::translate("qdoc",
+ "Save all documentation content to /dev/null. Useful if "
+ "someone is interested in qdoc errors only."));
addOption(redirectDocumentationToDevNullOption);
- noExamplesOption.setDescription(QCoreApplication::translate("qdoc", "Do not generate documentation for examples"));
+ noExamplesOption.setDescription(
+ QCoreApplication::translate("qdoc", "Do not generate documentation for examples"));
addOption(noExamplesOption);
- indexDirOption.setDescription(QCoreApplication::translate("qdoc", "Specify a directory where QDoc should search for index files to load"));
+ indexDirOption.setDescription(QCoreApplication::translate(
+ "qdoc", "Specify a directory where QDoc should search for index files to load"));
indexDirOption.setValueName(QStringLiteral("dir"));
addOption(indexDirOption);
- installDirOption.setDescription(QCoreApplication::translate("qdoc", "Specify the directory where the output will be after running \"make install\""));
+ installDirOption.setDescription(QCoreApplication::translate(
+ "qdoc",
+ "Specify the directory where the output will be after running \"make install\""));
installDirOption.setValueName(QStringLiteral("dir"));
addOption(installDirOption);
- obsoleteLinksOption.setDescription(QCoreApplication::translate("qdoc", "Report links from obsolete items to non-obsolete items"));
+ obsoleteLinksOption.setDescription(QCoreApplication::translate(
+ "qdoc", "Report links from obsolete items to non-obsolete items"));
addOption(obsoleteLinksOption);
- outputDirOption.setDescription(QCoreApplication::translate("qdoc", "Specify output directory, overrides setting in qdocconf file"));
+ outputDirOption.setDescription(QCoreApplication::translate(
+ "qdoc", "Specify output directory, overrides setting in qdocconf file"));
outputDirOption.setValueName(QStringLiteral("dir"));
addOption(outputDirOption);
- outputFormatOption.setDescription(QCoreApplication::translate("qdoc", "Specify output format, overrides setting in qdocconf file"));
+ outputFormatOption.setDescription(QCoreApplication::translate(
+ "qdoc", "Specify output format, overrides setting in qdocconf file"));
outputFormatOption.setValueName(QStringLiteral("format"));
addOption(outputFormatOption);
- noLinkErrorsOption.setDescription(QCoreApplication::translate("qdoc", "Do not print link errors (i.e. missing targets)"));
+ noLinkErrorsOption.setDescription(
+ QCoreApplication::translate("qdoc", "Do not print link errors (i.e. missing targets)"));
addOption(noLinkErrorsOption);
- autoLinkErrorsOption.setDescription(QCoreApplication::translate("qdoc", "Show errors when automatic linking fails"));
+ autoLinkErrorsOption.setDescription(
+ QCoreApplication::translate("qdoc", "Show errors when automatic linking fails"));
addOption(autoLinkErrorsOption);
debugOption.setDescription(QCoreApplication::translate("qdoc", "Enable debug output"));
addOption(debugOption);
- prepareOption.setDescription(QCoreApplication::translate("qdoc", "Run qdoc only to generate an index file, not the docs"));
+ prepareOption.setDescription(QCoreApplication::translate(
+ "qdoc", "Run qdoc only to generate an index file, not the docs"));
addOption(prepareOption);
- generateOption.setDescription(QCoreApplication::translate("qdoc", "Run qdoc to read the index files and generate the docs"));
+ generateOption.setDescription(QCoreApplication::translate(
+ "qdoc", "Run qdoc to read the index files and generate the docs"));
addOption(generateOption);
- logProgressOption.setDescription(QCoreApplication::translate("qdoc", "Log progress on stderr."));
+ logProgressOption.setDescription(
+ QCoreApplication::translate("qdoc", "Log progress on stderr."));
addOption(logProgressOption);
- singleExecOption.setDescription(QCoreApplication::translate("qdoc", "Run qdoc once over all the qdoc conf files."));
+ singleExecOption.setDescription(
+ QCoreApplication::translate("qdoc", "Run qdoc once over all the qdoc conf files."));
addOption(singleExecOption);
writeQaPagesOption.setDescription(QCoreApplication::translate("qdoc", "Write QA pages."));
@@ -140,7 +162,8 @@ QDocCommandLineParser::QDocCommandLineParser()
frameworkOption.setFlags(QCommandLineOption::ShortOptionStyle);
addOption(frameworkOption);
- timestampsOption.setDescription(QCoreApplication::translate("qdoc", "Timestamp each qdoc log line."));
+ timestampsOption.setDescription(
+ QCoreApplication::translate("qdoc", "Timestamp each qdoc log line."));
addOption(timestampsOption);
}
diff --git a/src/qdoc/qdocdatabase.cpp b/src/qdoc/qdocdatabase.cpp
index 5c4acdbf1..be257b4b8 100644
--- a/src/qdoc/qdocdatabase.cpp
+++ b/src/qdoc/qdocdatabase.cpp
@@ -88,7 +88,7 @@ bool QDocDatabase::debug = false;
*/
QDocForest::~QDocForest()
{
- for (int i=0; i<searchOrder_.size(); ++i)
+ for (int i = 0; i < searchOrder_.size(); ++i)
delete searchOrder_.at(i);
forest_.clear();
searchOrder_.clear();
@@ -217,7 +217,7 @@ void QDocForest::setSearchOrder(const QStringList &t)
Note that this loop also inserts the primary tree into the
forrest. That is a requirement.
*/
- for (int i=0; i<searchOrder_.size(); ++i) {
+ for (int i = 0; i < searchOrder_.size(); ++i) {
if (!forest_.contains(moduleNames_.at(i))) {
forest_.insert(moduleNames_.at(i), searchOrder_.at(i));
}
@@ -309,10 +309,8 @@ void QDocForest::newPrimaryTree(const QString &module)
to 0, the starting point for each index tree is the root
of the index tree.
*/
-const Node *QDocForest::findNodeForTarget(QStringList &targetPath,
- const Node *relative,
- Node::Genus genus,
- QString &ref)
+const Node *QDocForest::findNodeForTarget(QStringList &targetPath, const Node *relative,
+ Node::Genus genus, QString &ref)
{
int flags = SearchBaseClasses | SearchEnumValues;
@@ -351,7 +349,7 @@ void QDocForest::printLinkCounts(const QString &project)
if (it.value() != module)
depends += QLatin1Char(' ') + it.value();
int pad = 30 - line.length();
- for (int k=0; k<pad; ++k)
+ for (int k = 0; k < pad; ++k)
line += QLatin1Char(' ');
line += "%1";
Location::null.report(line.arg(-(it.key())));
@@ -394,8 +392,7 @@ QString QDocForest::getLinkCounts(QStringList &strings, QVector<int> &counts)
C++ function or a QML function.
*/
const FunctionNode *QDocForest::findFunctionNode(const QStringList &path,
- const Parameters &parameters,
- const Node *relative,
+ const Parameters &parameters, const Node *relative,
Node::Genus genus)
{
for (const auto *tree : searchOrder()) {
@@ -443,8 +440,7 @@ NodeMultiMapMap QDocDatabase::newSinceMaps_;
modules sequentially in a loop. Each source file for each module
is read exactly once.
*/
-QDocDatabase::QDocDatabase()
- : showInternal_(false), singleExec_(false), forest_(this)
+QDocDatabase::QDocDatabase() : showInternal_(false), singleExec_(false), forest_(this)
{
// nothing
}
@@ -466,10 +462,10 @@ QDocDatabase::~QDocDatabase()
QDocDatabase *QDocDatabase::qdocDB()
{
if (qdocDB_ == nullptr) {
- qdocDB_ = new QDocDatabase;
- initializeDB();
+ qdocDB_ = new QDocDatabase;
+ initializeDB();
}
- return qdocDB_;
+ return qdocDB_;
}
/*!
@@ -833,7 +829,7 @@ QmlTypeNode *QDocDatabase::findQmlType(const ImportRec &import, const QString &n
qmName = import.name_;
else
qmName = import.importUri_;
- for (int i=0; i<dotSplit.size(); ++i) {
+ for (int i = 0; i < dotSplit.size(); ++i) {
QString qualifiedName = qmName + "::" + dotSplit[i];
QmlTypeNode *qcn = forest_.lookupQmlType(qualifiedName);
if (qcn)
@@ -873,7 +869,7 @@ void QDocDatabase::processForest()
mode, each tree is analyzed in turn, and its classes and
types are added to the appropriate node maps.
*/
-void QDocDatabase::processForest(void (QDocDatabase::*func) (Aggregate*))
+void QDocDatabase::processForest(void (QDocDatabase::*func)(Aggregate *))
{
Tree *t = forest_.firstTree();
while (t) {
@@ -1104,7 +1100,8 @@ const NodeMap &QDocDatabase::getSinceMap(const QString &key)
documentation. These tasks create required data structures
and resolve links.
*/
-void QDocDatabase::resolveStuff() {
+void QDocDatabase::resolveStuff()
+{
if (Generator::dualExec() || Generator::preparing()) {
primaryTree()->resolveBaseClasses(primaryTreeRoot());
primaryTree()->resolvePropertyOverriddenFromPtrs(primaryTreeRoot());
@@ -1122,7 +1119,7 @@ void QDocDatabase::resolveStuff() {
primaryTree()->resolveBaseClasses(primaryTreeRoot());
primaryTree()->resolvePropertyOverriddenFromPtrs(primaryTreeRoot());
primaryTreeRoot()->resolveQmlInheritance();
- //primaryTree()->resolveTargets(primaryTreeRoot());
+ // primaryTree()->resolveTargets(primaryTreeRoot());
primaryTree()->resolveCppToQmlLinks();
primaryTree()->resolveUsingClauses();
}
@@ -1191,8 +1188,8 @@ void QDocDatabase::resolveNamespaces()
for (auto *node : namespaces) {
NamespaceNode *NS = static_cast<NamespaceNode *>(node);
if (NS->hadDoc() && NS != ns) {
- ns->doc().location().warning(tr("Namespace %1 documented more than once")
- .arg(NS->name()));
+ ns->doc().location().warning(
+ tr("Namespace %1 documented more than once").arg(NS->name()));
NS->doc().location().warning(tr("...also seen here"));
}
}
@@ -1223,8 +1220,8 @@ void QDocDatabase::resolveNamespaces()
for (auto *node : namespaces) {
auto *nameSpaceNode = static_cast<NamespaceNode *>(node);
if (nameSpaceNode != ns) {
- for (auto it = nameSpaceNode->constBegin();
- it != nameSpaceNode->constEnd(); ++it) {
+ for (auto it = nameSpaceNode->constBegin(); it != nameSpaceNode->constEnd();
+ ++it) {
Node *N = *it;
if (N && N->isPublic() && !N->isInternal())
ns->includeChild(N);
@@ -1270,7 +1267,6 @@ void QDocDatabase::resolveProxies()
}
}
-
/*!
Finds the function node for the qualified function path in
\a target and returns a pointer to it. The \a target is a
@@ -1284,8 +1280,7 @@ void QDocDatabase::resolveProxies()
The entire forest is searched, but the first match is accepted.
*/
-const FunctionNode *QDocDatabase::findFunctionNode(const QString &target,
- const Node *relative,
+const FunctionNode *QDocDatabase::findFunctionNode(const QString &target, const Node *relative,
Node::Genus genus)
{
QString signature;
@@ -1368,7 +1363,7 @@ void QDocDatabase::readIndexes(const QStringList &indexFiles)
{
QStringList filesToRead;
for (const QString &file : indexFiles) {
- QString fn = file.mid(file.lastIndexOf(QChar('/'))+1);
+ QString fn = file.mid(file.lastIndexOf(QChar('/')) + 1);
if (!isLoaded(fn))
filesToRead << file;
else
@@ -1382,9 +1377,10 @@ void QDocDatabase::readIndexes(const QStringList &indexFiles)
index file is generated with the parameters \a url and \a title,
using the generator \a g.
*/
-void QDocDatabase::generateIndex(const QString &fileName, const QString &url, const QString &title, Generator *g)
+void QDocDatabase::generateIndex(const QString &fileName, const QString &url, const QString &title,
+ Generator *g)
{
- QString t = fileName.mid(fileName.lastIndexOf(QChar('/'))+1);
+ QString t = fileName.mid(fileName.lastIndexOf(QChar('/')) + 1);
primaryTree()->setIndexFileName(t);
QDocIndexFiles::qdocIndexFiles()->generateIndex(fileName, url, title, g);
QDocIndexFiles::destroyQDocIndexFiles();
@@ -1400,7 +1396,7 @@ void QDocDatabase::generateIndex(const QString &fileName, const QString &url, co
This function only searches in the current primary tree.
*/
-Node *QDocDatabase::findNodeInOpenNamespace(QStringList &path, bool (Node::*isMatch) () const)
+Node *QDocDatabase::findNodeInOpenNamespace(QStringList &path, bool (Node::*isMatch)() const)
{
if (path.isEmpty())
return nullptr;
@@ -1459,9 +1455,10 @@ void QDocDatabase::mergeCollections(Node::NodeType type, CNMap &cnm, const Node
for (CollectionNode *value : values) {
if (value != n) {
// Allow multiple (major) versions of QML/JS modules
- if ((n->isQmlModule() || n->isJsModule()) &&
- n->logicalModuleIdentifier() != value->logicalModuleIdentifier()) {
- if (value->wasSeen() && value != relative && !value->members().isEmpty())
+ if ((n->isQmlModule() || n->isJsModule())
+ && n->logicalModuleIdentifier() != value->logicalModuleIdentifier()) {
+ if (value->wasSeen() && value != relative
+ && !value->members().isEmpty())
cnm.insert(value->fullTitle().toLower(), value);
continue;
}
@@ -1495,8 +1492,8 @@ void QDocDatabase::mergeCollections(CollectionNode *c)
for (auto *tree : searchOrder()) {
CollectionNode *cn = tree->getCollection(c->name(), c->nodeType());
if (cn && cn != c) {
- if ((cn->isQmlModule() || cn->isJsModule()) &&
- cn->logicalModuleIdentifier() != c->logicalModuleIdentifier())
+ if ((cn->isQmlModule() || cn->isJsModule())
+ && cn->logicalModuleIdentifier() != c->logicalModuleIdentifier())
continue;
for (auto *node : cn->members())
c->addMember(node);
@@ -1524,13 +1521,13 @@ const Node *QDocDatabase::findNodeForAtom(const Atom *a, const Node *relative, Q
Tree *domain = nullptr;
Node::Genus genus = Node::DontCare;
// Reserved for future use
- //Node::NodeType goal = Node::NoType;
+ // Node::NodeType goal = Node::NoType;
if (atom->isLinkAtom()) {
domain = atom->domain();
genus = atom->genus();
// Reserved for future use
- //goal = atom->goal();
+ // goal = atom->goal();
}
if (first.isEmpty())
@@ -1563,8 +1560,7 @@ const Node *QDocDatabase::findNodeForAtom(const Atom *a, const Node *relative, Q
relative = nullptr;
return domain->findNodeForTarget(nodePath, target, relative, flags, genus, ref);
}
- }
- else {
+ } else {
if (first.endsWith(".html"))
node = findNodeByNameAndType(QStringList(first), &Node::isPageNode);
else if (first.endsWith(QChar(')')))
diff --git a/src/qdoc/qdocdatabase.h b/src/qdoc/qdocdatabase.h
index 1ff3aff15..dd5d886e6 100644
--- a/src/qdoc/qdocdatabase.h
+++ b/src/qdoc/qdocdatabase.h
@@ -56,8 +56,7 @@ class QDocForest
{
private:
friend class QDocDatabase;
- QDocForest(QDocDatabase *qdb)
- : qdb_(qdb), primaryTree_(nullptr), currentIndex_(0) { }
+ QDocForest(QDocDatabase *qdb) : qdb_(qdb), primaryTree_(nullptr), currentIndex_(0) {}
~QDocForest();
NamespaceNode *firstRoot();
@@ -66,16 +65,15 @@ private:
Tree *nextTree();
Tree *primaryTree() { return primaryTree_; }
Tree *findTree(const QString &t) { return forest_.value(t); }
- QStringList keys() {
- return forest_.keys();
- }
+ QStringList keys() { return forest_.keys(); }
NamespaceNode *primaryTreeRoot() { return (primaryTree_ ? primaryTree_->root() : nullptr); }
bool isEmpty() { return searchOrder().isEmpty(); }
bool done() { return (currentIndex_ >= searchOrder().size()); }
const QVector<Tree *> &searchOrder();
const QVector<Tree *> &indexSearchOrder();
void setSearchOrder(const QStringList &t);
- bool isLoaded(const QString &fn) {
+ bool isLoaded(const QString &fn)
+ {
for (const auto *tree : searchOrder()) {
if (fn == tree->indexFileName())
return true;
@@ -83,10 +81,9 @@ private:
return false;
}
- const Node *findNode(const QStringList &path,
- const Node *relative,
- int findFlags,
- Node::Genus genus) {
+ const Node *findNode(const QStringList &path, const Node *relative, int findFlags,
+ Node::Genus genus)
+ {
for (const auto *tree : searchOrder()) {
const Node *n = tree->findNode(path, relative, findFlags, genus);
if (n)
@@ -96,7 +93,8 @@ private:
return nullptr;
}
- Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch) () const) {
+ Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch)() const)
+ {
for (const auto *tree : searchOrder()) {
Node *n = tree->findNodeByNameAndType(path, isMatch);
if (n)
@@ -105,7 +103,8 @@ private:
return nullptr;
}
- ClassNode *findClassNode(const QStringList &path) {
+ ClassNode *findClassNode(const QStringList &path)
+ {
for (const auto *tree : searchOrder()) {
ClassNode *n = tree->findClassNode(path);
if (n)
@@ -114,7 +113,8 @@ private:
return nullptr;
}
- Node *findNodeForInclude(const QStringList &path) {
+ Node *findNodeForInclude(const QStringList &path)
+ {
for (const auto *tree : searchOrder()) {
Node *n = tree->findNodeForInclude(path);
if (n)
@@ -123,13 +123,9 @@ private:
return nullptr;
}
- const FunctionNode *findFunctionNode(const QStringList &path,
- const Parameters &parameters,
- const Node *relative,
- Node::Genus genus);
- const Node *findNodeForTarget(QStringList &targetPath,
- const Node *relative,
- Node::Genus genus,
+ const FunctionNode *findFunctionNode(const QStringList &path, const Parameters &parameters,
+ const Node *relative, Node::Genus genus);
+ const Node *findNodeForTarget(QStringList &targetPath, const Node *relative, Node::Genus genus,
QString &ref);
const Node *findTypeNode(const QStringList &path, const Node *relative, Node::Genus genus)
@@ -228,16 +224,20 @@ public:
CollectionNode *addQmlModule(const QString &name) { return primaryTree()->addQmlModule(name); }
CollectionNode *addJsModule(const QString &name) { return primaryTree()->addJsModule(name); }
- CollectionNode *addToGroup(const QString &name, Node *node) {
+ CollectionNode *addToGroup(const QString &name, Node *node)
+ {
return primaryTree()->addToGroup(name, node);
}
- CollectionNode *addToModule(const QString &name, Node *node) {
+ CollectionNode *addToModule(const QString &name, Node *node)
+ {
return primaryTree()->addToModule(name, node);
}
- CollectionNode *addToQmlModule(const QString &name, Node *node) {
+ CollectionNode *addToQmlModule(const QString &name, Node *node)
+ {
return primaryTree()->addToQmlModule(name, node);
}
- CollectionNode *addToJsModule(const QString &name, Node *node) {
+ CollectionNode *addToJsModule(const QString &name, Node *node)
+ {
return primaryTree()->addToJsModule(name, node);
}
@@ -246,7 +246,7 @@ public:
QmlTypeNode *findQmlType(const QString &name);
QmlTypeNode *findQmlType(const QString &qmid, const QString &name);
- QmlTypeNode *findQmlType(const ImportRec& import, const QString &name);
+ QmlTypeNode *findQmlType(const ImportRec &import, const QString &name);
Aggregate *findQmlBasicType(const QString &qmid, const QString &name);
static NodeMultiMap &obsoleteClasses() { return obsoleteClasses_; }
@@ -293,19 +293,20 @@ public:
Many of these will be either eliminated or replaced.
********************************************************************/
void resolveStuff();
- void insertTarget(const QString &name,
- const QString &title,
- TargetRec::TargetType type,
- Node *node,
- int priority) {
+ void insertTarget(const QString &name, const QString &title, TargetRec::TargetType type,
+ Node *node, int priority)
+ {
primaryTree()->insertTarget(name, title, type, node, priority);
}
/*******************************************************************
The functions declared below are called for the current tree only.
********************************************************************/
- Aggregate *findRelatesNode(const QStringList &path) { return primaryTree()->findRelatesNode(path); }
- Node *findNodeInOpenNamespace(QStringList &path, bool (Node::*) () const);
+ Aggregate *findRelatesNode(const QStringList &path)
+ {
+ return primaryTree()->findRelatesNode(path);
+ }
+ Node *findNodeInOpenNamespace(QStringList &path, bool (Node::*)() const);
/*******************************************************************/
/*****************************************************************************
@@ -319,40 +320,45 @@ public:
********************************************************************/
ClassNode *findClassNode(const QStringList &path) { return forest_.findClassNode(path); }
Node *findNodeForInclude(const QStringList &path) { return forest_.findNodeForInclude(path); }
- const FunctionNode *findFunctionNode(const QString &target, const Node *relative, Node::Genus genus);
+ const FunctionNode *findFunctionNode(const QString &target, const Node *relative,
+ Node::Genus genus);
const Node *findTypeNode(const QString &type, const Node *relative, Node::Genus genus);
const Node *findNodeForTarget(const QString &target, const Node *relative);
- const PageNode *findPageNodeByTitle(const QString &title) {
+ const PageNode *findPageNodeByTitle(const QString &title)
+ {
return forest_.findPageNodeByTitle(title);
}
- Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch) () const) {
+ Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch)() const)
+ {
return forest_.findNodeByNameAndType(path, isMatch);
}
- const CollectionNode *getCollectionNode(const QString &name, Node::NodeType type) {
+ const CollectionNode *getCollectionNode(const QString &name, Node::NodeType type)
+ {
return forest_.getCollectionNode(name, type);
}
- FunctionNode *findFunctionNodeForTag(QString tag) { return primaryTree()->findFunctionNodeForTag(tag); }
+ FunctionNode *findFunctionNodeForTag(QString tag)
+ {
+ return primaryTree()->findFunctionNodeForTag(tag);
+ }
FunctionNode *findMacroNode(const QString &t) { return primaryTree()->findMacroNode(t); }
private:
- const Node *findNodeForTarget(QStringList &targetPath,
- const Node *relative,
- Node::Genus genus,
- QString &ref) {
+ const Node *findNodeForTarget(QStringList &targetPath, const Node *relative, Node::Genus genus,
+ QString &ref)
+ {
return forest_.findNodeForTarget(targetPath, relative, genus, ref);
}
- const FunctionNode *findFunctionNode(const QStringList &path,
- const Parameters &parameters,
- const Node *relative,
- Node::Genus genus) {
+ const FunctionNode *findFunctionNode(const QStringList &path, const Parameters &parameters,
+ const Node *relative, Node::Genus genus)
+ {
return forest_.findFunctionNode(path, parameters, relative, genus);
}
/*******************************************************************/
public:
- void addPropertyFunction(PropertyNode *property,
- const QString &funcName,
- PropertyNode::FunctionRole funcRole) {
+ void addPropertyFunction(PropertyNode *property, const QString &funcName,
+ PropertyNode::FunctionRole funcRole)
+ {
primaryTree()->addPropertyFunction(property, funcName, funcRole);
}
@@ -361,7 +367,8 @@ public:
void generateTagFile(const QString &name, Generator *g);
void readIndexes(const QStringList &indexFiles);
- void generateIndex(const QString &fileName, const QString &url, const QString &title, Generator *g);
+ void generateIndex(const QString &fileName, const QString &url, const QString &title,
+ Generator *g);
void clearOpenNamespaces() { openNamespaces_.clear(); }
void insertOpenNamespace(const QString &path) { openNamespaces_.insert(path); }
@@ -370,7 +377,7 @@ public:
void processForest();
// Try to make this function private.
- QDocForest& forest() { return forest_; }
+ QDocForest &forest() { return forest_; }
NamespaceNode *primaryTreeRoot() { return forest_.primaryTreeRoot(); }
void newPrimaryTree(const QString &module) { forest_.newPrimaryTree(module); }
void setPrimaryTree(const QString &t) { forest_.setPrimaryTree(t); }
@@ -385,17 +392,16 @@ public:
void incrementLinkCount(const Node *t) { t->tree()->incrementLinkCount(); }
void clearLinkCounts() { forest_.clearLinkCounts(); }
void printLinkCounts(const QString &t) { forest_.printLinkCounts(t); }
- QString getLinkCounts(QStringList &strings, QVector<int> &counts) {
+ QString getLinkCounts(QStringList &strings, QVector<int> &counts)
+ {
return forest_.getLinkCounts(strings, counts);
}
- QString getNewLinkTarget(const Node *locNode,
- const Node *t,
- const QString &fileName,
- QString &text,
- bool broken = false) {
+ QString getNewLinkTarget(const Node *locNode, const Node *t, const QString &fileName,
+ QString &text, bool broken = false)
+ {
return primaryTree()->getNewLinkTarget(locNode, t, fileName, text, broken);
}
- TargetList* getTargetList(const QString &t) { return primaryTree()->getTargetList(t); }
+ TargetList *getTargetList(const QString &t) { return primaryTree()->getTargetList(t); }
QStringList getTargetListKeys() { return primaryTree()->getTargetListKeys(); }
QStringList keys() { return forest_.keys(); }
void resolveNamespaces();
@@ -405,20 +411,19 @@ public:
private:
friend class Tree;
- const Node *findNode(const QStringList &path,
- const Node *relative,
- int findFlags,
- Node::Genus genus) {
+ const Node *findNode(const QStringList &path, const Node *relative, int findFlags,
+ Node::Genus genus)
+ {
return forest_.findNode(path, relative, findFlags, genus);
}
- void processForest(void (QDocDatabase::*) (Aggregate*));
+ void processForest(void (QDocDatabase::*)(Aggregate *));
bool isLoaded(const QString &t) { return forest_.isLoaded(t); }
static void initializeDB();
private:
QDocDatabase();
- QDocDatabase(QDocDatabase const &) : showInternal_(false), forest_(this) { }
- QDocDatabase& operator=(QDocDatabase const &);
+ QDocDatabase(QDocDatabase const &) : showInternal_(false), forest_(this) {}
+ QDocDatabase &operator=(QDocDatabase const &);
public:
static bool debug;
diff --git a/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdocindexfiles.cpp
index 022d658b1..1b247fe24 100644
--- a/src/qdoc/qdocindexfiles.cpp
+++ b/src/qdoc/qdocindexfiles.cpp
@@ -61,13 +61,12 @@ static IndexSectionWriter *post_ = nullptr;
This class handles qdoc index files.
*/
-QDocIndexFiles* QDocIndexFiles::qdocIndexFiles_ = nullptr;
+QDocIndexFiles *QDocIndexFiles::qdocIndexFiles_ = nullptr;
/*!
Constructs the singleton QDocIndexFiles.
*/
-QDocIndexFiles::QDocIndexFiles()
- : gen_(nullptr)
+QDocIndexFiles::QDocIndexFiles() : gen_(nullptr)
{
qdb_ = QDocDatabase::qdocDB();
}
@@ -85,11 +84,11 @@ QDocIndexFiles::~QDocIndexFiles()
Creates the singleton. Allows only one instance of the class
to be created. Returns a pointer to the singleton.
*/
-QDocIndexFiles* QDocIndexFiles::qdocIndexFiles()
+QDocIndexFiles *QDocIndexFiles::qdocIndexFiles()
{
- if (qdocIndexFiles_ == nullptr)
- qdocIndexFiles_ = new QDocIndexFiles;
- return qdocIndexFiles_;
+ if (qdocIndexFiles_ == nullptr)
+ qdocIndexFiles_ = new QDocIndexFiles;
+ return qdocIndexFiles_;
}
/*!
@@ -144,11 +143,10 @@ void QDocIndexFiles::readIndexFile(const QString &path)
QString indexUrl;
if (Config::installDir.isEmpty()) {
indexUrl = attrs.value(QLatin1String("url")).toString();
- }
- else {
+ } else {
// Use a fake directory, since we will copy the output to a sub directory of
// installDir when using "make install". This is just for a proper relative path.
- //QDir installDir(path.section('/', 0, -3) + "/outputdir");
+ // QDir installDir(path.section('/', 0, -3) + "/outputdir");
QDir installDir(path.section('/', 0, -3) + '/' + Generator::outputSubdir());
indexUrl = installDir.relativeFilePath(path).section('/', 0, -2);
}
@@ -180,8 +178,7 @@ void QDocIndexFiles::readIndexFile(const QString &path)
Read a <section> element from the index file and create the
appropriate node(s).
*/
-void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
- Node *current,
+void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
const QString &indexUrl)
{
QXmlStreamAttributes attributes = reader.attributes();
@@ -211,8 +208,8 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
location = Location(indexUrl + QLatin1Char('/') + name.toLower() + ".html");
else if (!indexUrl.isNull())
location = Location(name.toLower() + ".html");
- } else if (elementName == QLatin1String("class") || elementName == QLatin1String("struct") ||
- elementName == QLatin1String("union")) {
+ } else if (elementName == QLatin1String("class") || elementName == QLatin1String("struct")
+ || elementName == QLatin1String("union")) {
Node::NodeType type = Node::Class;
if (elementName == QLatin1String("class"))
type = Node::Class;
@@ -224,7 +221,8 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
if (attributes.hasAttribute(QLatin1String("bases"))) {
QString bases = attributes.value(QLatin1String("bases")).toString();
if (!bases.isEmpty())
- basesList_.append(QPair<ClassNode *, QString>(static_cast<ClassNode *>(node), bases));
+ basesList_.append(
+ QPair<ClassNode *, QString>(static_cast<ClassNode *>(node), bases));
}
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + name.toLower() + ".html");
@@ -397,8 +395,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
if (subtype == QDocAttrFile) {
en->appendFile(name);
goto done;
- }
- else if (subtype == QDocAttrImage) {
+ } else if (subtype == QDocAttrImage) {
en->appendImage(name);
goto done;
}
@@ -434,7 +431,8 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
QXmlStreamAttributes childAttributes = reader.attributes();
if (reader.name() == QLatin1String("value")) {
- EnumItem item(childAttributes.value(QLatin1String("name")).toString(), childAttributes.value(QLatin1String("value")).toString());
+ EnumItem item(childAttributes.value(QLatin1String("name")).toString(),
+ childAttributes.value(QLatin1String("value")).toString());
enumNode->addItem(item);
} else if (reader.name() == QLatin1String("keyword")) {
insertTarget(TargetRec::Keyword, childAttributes, enumNode);
@@ -520,7 +518,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
node = fn;
if (!indexUrl.isEmpty())
- location = Location(indexUrl + QLatin1Char('/') + parent->name().toLower() + ".html");
+ location = Location(indexUrl + QLatin1Char('/') + parent->name().toLower() + ".html");
else if (!indexUrl.isNull())
location = Location(parent->name().toLower() + ".html");
@@ -561,7 +559,8 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
else
node->setAccess(Node::Public);
if (attributes.hasAttribute(QLatin1String("related")))
- node->setRelatedNonmember(attributes.value(QLatin1String("related")) == QLatin1String("true"));
+ node->setRelatedNonmember(attributes.value(QLatin1String("related"))
+ == QLatin1String("true"));
if (attributes.hasAttribute(QLatin1String("threadsafety"))) {
QString threadSafety = attributes.value(QLatin1String("threadsafety")).toString();
@@ -573,8 +572,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
node->setThreadSafeness(Node::ThreadSafe);
else
node->setThreadSafeness(Node::UnspecifiedSafeness);
- }
- else
+ } else
node->setThreadSafeness(Node::UnspecifiedSafeness);
QString status = attributes.value(QLatin1String("status")).toString();
@@ -647,7 +645,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
}
}
- done:
+done:
while (!reader.isEndElement()) {
if (reader.readNext() == QXmlStreamReader::Invalid) {
break;
@@ -656,8 +654,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
}
void QDocIndexFiles::insertTarget(TargetRec::TargetType type,
- const QXmlStreamAttributes &attributes,
- Node *node)
+ const QXmlStreamAttributes &attributes, Node *node)
{
int priority;
switch (type) {
@@ -768,7 +765,8 @@ static const QString getThreadSafenessString(Node::ThreadSafeness t)
\note Function nodes are processed in generateFunctionSection()
*/
-bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node, IndexSectionWriter *post)
+bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
+ IndexSectionWriter *post)
{
if (gen_ == nullptr)
gen_ = Generator::currentGenerator();
@@ -913,8 +911,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
if (fullName != objName)
writer.writeAttribute("fullname", fullName);
href = gen_->fullDocumentLocation(node);
- }
- else
+ } else
href = node->name();
if (node->isQmlNode() || node->isJsNode()) {
Aggregate *p = node->parent();
@@ -951,274 +948,247 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
switch (node->nodeType()) {
case Node::Class:
case Node::Struct:
- case Node::Union:
- {
- // Classes contain information about their base classes.
- const ClassNode *classNode = static_cast<const ClassNode *>(node);
- const QVector<RelatedClass> bases = classNode->baseClasses();
- QSet<QString> baseStrings;
- for (const auto &related : bases) {
- ClassNode *n = related.node_;
- if (n)
- baseStrings.insert(n->fullName());
- else if (!related.path_.isEmpty())
- baseStrings.insert(related.path_.join(QLatin1String("::")));
- }
- if (!baseStrings.isEmpty())
- {
- QStringList baseStringsAsList = baseStrings.values();
- baseStringsAsList.sort();
- writer.writeAttribute("bases", baseStringsAsList.join(QLatin1Char(',')));
- }
- if (!node->physicalModuleName().isEmpty())
- writer.writeAttribute("module", node->physicalModuleName());
- if (!classNode->groupNames().isEmpty())
- writer.writeAttribute("groups", classNode->groupNames().join(QLatin1Char(',')));
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
- }
- break;
- case Node::HeaderFile:
- {
- const HeaderNode *hn = static_cast<const HeaderNode *>(node);
- if (!hn->physicalModuleName().isEmpty())
- writer.writeAttribute("module", hn->physicalModuleName());
- if (!hn->groupNames().isEmpty())
- writer.writeAttribute("groups", hn->groupNames().join(QLatin1Char(',')));
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
- writer.writeAttribute("title", hn->title());
- writer.writeAttribute("fulltitle", hn->fullTitle());
- writer.writeAttribute("subtitle", hn->subtitle());
+ case Node::Union: {
+ // Classes contain information about their base classes.
+ const ClassNode *classNode = static_cast<const ClassNode *>(node);
+ const QVector<RelatedClass> bases = classNode->baseClasses();
+ QSet<QString> baseStrings;
+ for (const auto &related : bases) {
+ ClassNode *n = related.node_;
+ if (n)
+ baseStrings.insert(n->fullName());
+ else if (!related.path_.isEmpty())
+ baseStrings.insert(related.path_.join(QLatin1String("::")));
}
- break;
- case Node::Namespace:
- {
- const NamespaceNode *ns = static_cast<const NamespaceNode *>(node);
- if (!ns->physicalModuleName().isEmpty())
- writer.writeAttribute("module", ns->physicalModuleName());
- if (!ns->groupNames().isEmpty())
- writer.writeAttribute("groups", ns->groupNames().join(QLatin1Char(',')));
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
+ if (!baseStrings.isEmpty()) {
+ QStringList baseStringsAsList = baseStrings.values();
+ baseStringsAsList.sort();
+ writer.writeAttribute("bases", baseStringsAsList.join(QLatin1Char(',')));
}
- break;
+ if (!node->physicalModuleName().isEmpty())
+ writer.writeAttribute("module", node->physicalModuleName());
+ if (!classNode->groupNames().isEmpty())
+ writer.writeAttribute("groups", classNode->groupNames().join(QLatin1Char(',')));
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ } break;
+ case Node::HeaderFile: {
+ const HeaderNode *hn = static_cast<const HeaderNode *>(node);
+ if (!hn->physicalModuleName().isEmpty())
+ writer.writeAttribute("module", hn->physicalModuleName());
+ if (!hn->groupNames().isEmpty())
+ writer.writeAttribute("groups", hn->groupNames().join(QLatin1Char(',')));
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ writer.writeAttribute("title", hn->title());
+ writer.writeAttribute("fulltitle", hn->fullTitle());
+ writer.writeAttribute("subtitle", hn->subtitle());
+ } break;
+ case Node::Namespace: {
+ const NamespaceNode *ns = static_cast<const NamespaceNode *>(node);
+ if (!ns->physicalModuleName().isEmpty())
+ writer.writeAttribute("module", ns->physicalModuleName());
+ if (!ns->groupNames().isEmpty())
+ writer.writeAttribute("groups", ns->groupNames().join(QLatin1Char(',')));
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ } break;
case Node::JsType:
- case Node::QmlType:
- {
- const QmlTypeNode *qcn = static_cast<const QmlTypeNode *>(node);
- writer.writeAttribute("title", qcn->title());
- writer.writeAttribute("fulltitle", qcn->fullTitle());
- writer.writeAttribute("subtitle", qcn->subtitle());
- if (!qcn->groupNames().isEmpty())
- writer.writeAttribute("groups", qcn->groupNames().join(QLatin1Char(',')));
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
- }
- break;
+ case Node::QmlType: {
+ const QmlTypeNode *qcn = static_cast<const QmlTypeNode *>(node);
+ writer.writeAttribute("title", qcn->title());
+ writer.writeAttribute("fulltitle", qcn->fullTitle());
+ writer.writeAttribute("subtitle", qcn->subtitle());
+ if (!qcn->groupNames().isEmpty())
+ writer.writeAttribute("groups", qcn->groupNames().join(QLatin1Char(',')));
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ } break;
case Node::Page:
case Node::Example:
- case Node::ExternalPage:
- {
- /*
- Page nodes (anything that generates a doc page)
- no longer have a subtype. Some of the subtypes
- (Example, External, and Header) have been promoted
- to be node types. They have become subclasses of
- PageNode or, in the case of Header, a subclass of
- Aggregate. The processing for other subtypes that
- have not (yet) been promoted to be node types is
- determined by the PageType enum.
- */
- bool writeModuleName = false;
- if (node->isExample()) {
- writer.writeAttribute("subtype", "example");
- writeModuleName = true;
- } else if (node->isExternalPage()) {
- writer.writeAttribute("subtype", "externalpage");
- } else {
- if (node->pageType() == Node::AttributionPage)
- writer.writeAttribute("subtype", "attribution");
- else
- writer.writeAttribute("subtype", "page");
- writeModuleName = true;
- }
- const PageNode *pn = static_cast<const PageNode *>(node);
- writer.writeAttribute("title", pn->title());
- writer.writeAttribute("fulltitle", pn->fullTitle());
- writer.writeAttribute("subtitle", pn->subtitle());
- if (!node->physicalModuleName().isEmpty() && writeModuleName)
- writer.writeAttribute("module", node->physicalModuleName());
- if (!pn->groupNames().isEmpty())
- writer.writeAttribute("groups", pn->groupNames().join(QLatin1Char(',')));
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
+ case Node::ExternalPage: {
+ /*
+ Page nodes (anything that generates a doc page)
+ no longer have a subtype. Some of the subtypes
+ (Example, External, and Header) have been promoted
+ to be node types. They have become subclasses of
+ PageNode or, in the case of Header, a subclass of
+ Aggregate. The processing for other subtypes that
+ have not (yet) been promoted to be node types is
+ determined by the PageType enum.
+ */
+ bool writeModuleName = false;
+ if (node->isExample()) {
+ writer.writeAttribute("subtype", "example");
+ writeModuleName = true;
+ } else if (node->isExternalPage()) {
+ writer.writeAttribute("subtype", "externalpage");
+ } else {
+ if (node->pageType() == Node::AttributionPage)
+ writer.writeAttribute("subtype", "attribution");
+ else
+ writer.writeAttribute("subtype", "page");
+ writeModuleName = true;
}
- break;
- case Node::Group:
- {
- const CollectionNode *cn = static_cast<const CollectionNode *>(node);
- writer.writeAttribute("seen", cn->wasSeen() ? "true" : "false");
- writer.writeAttribute("title", cn->title());
- if (!cn->subtitle().isEmpty())
- writer.writeAttribute("subtitle", cn->subtitle());
- if (!cn->physicalModuleName().isEmpty())
- writer.writeAttribute("module", cn->physicalModuleName());
- if (!cn->groupNames().isEmpty())
- writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(',')));
- /*
- This is not read back in, so it probably
- shouldn't be written out in the first place.
- */
- if (!cn->members().isEmpty()) {
- QStringList names;
- const auto &members = cn->members();
- for (const Node *member : members)
- names.append(member->name());
- writer.writeAttribute("members", names.join(QLatin1Char(',')));
- }
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
+ const PageNode *pn = static_cast<const PageNode *>(node);
+ writer.writeAttribute("title", pn->title());
+ writer.writeAttribute("fulltitle", pn->fullTitle());
+ writer.writeAttribute("subtitle", pn->subtitle());
+ if (!node->physicalModuleName().isEmpty() && writeModuleName)
+ writer.writeAttribute("module", node->physicalModuleName());
+ if (!pn->groupNames().isEmpty())
+ writer.writeAttribute("groups", pn->groupNames().join(QLatin1Char(',')));
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ } break;
+ case Node::Group: {
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
+ writer.writeAttribute("seen", cn->wasSeen() ? "true" : "false");
+ writer.writeAttribute("title", cn->title());
+ if (!cn->subtitle().isEmpty())
+ writer.writeAttribute("subtitle", cn->subtitle());
+ if (!cn->physicalModuleName().isEmpty())
+ writer.writeAttribute("module", cn->physicalModuleName());
+ if (!cn->groupNames().isEmpty())
+ writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(',')));
+ /*
+ This is not read back in, so it probably
+ shouldn't be written out in the first place.
+ */
+ if (!cn->members().isEmpty()) {
+ QStringList names;
+ const auto &members = cn->members();
+ for (const Node *member : members)
+ names.append(member->name());
+ writer.writeAttribute("members", names.join(QLatin1Char(',')));
}
- break;
- case Node::Module:
- {
- const CollectionNode *cn = static_cast<const CollectionNode *>(node);
- writer.writeAttribute("seen", cn->wasSeen() ? "true" : "false");
- writer.writeAttribute("title", cn->title());
- if (!cn->subtitle().isEmpty())
- writer.writeAttribute("subtitle", cn->subtitle());
- if (!cn->physicalModuleName().isEmpty())
- writer.writeAttribute("module", cn->physicalModuleName());
- if (!cn->groupNames().isEmpty())
- writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(',')));
- /*
- This is not read back in, so it probably
- shouldn't be written out in the first place.
- */
- if (!cn->members().isEmpty()) {
- QStringList names;
- const auto &members = cn->members();
- for (const Node *member : members)
- names.append(member->name());
- writer.writeAttribute("members", names.join(QLatin1Char(',')));
- }
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ } break;
+ case Node::Module: {
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
+ writer.writeAttribute("seen", cn->wasSeen() ? "true" : "false");
+ writer.writeAttribute("title", cn->title());
+ if (!cn->subtitle().isEmpty())
+ writer.writeAttribute("subtitle", cn->subtitle());
+ if (!cn->physicalModuleName().isEmpty())
+ writer.writeAttribute("module", cn->physicalModuleName());
+ if (!cn->groupNames().isEmpty())
+ writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(',')));
+ /*
+ This is not read back in, so it probably
+ shouldn't be written out in the first place.
+ */
+ if (!cn->members().isEmpty()) {
+ QStringList names;
+ const auto &members = cn->members();
+ for (const Node *member : members)
+ names.append(member->name());
+ writer.writeAttribute("members", names.join(QLatin1Char(',')));
}
- break;
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ } break;
case Node::JsModule:
- case Node::QmlModule:
- {
- const CollectionNode *cn = static_cast<const CollectionNode *>(node);
- writer.writeAttribute("seen", cn->wasSeen() ? "true" : "false");
- writer.writeAttribute("title", cn->title());
- if (!cn->subtitle().isEmpty())
- writer.writeAttribute("subtitle", cn->subtitle());
- if (!cn->physicalModuleName().isEmpty())
- writer.writeAttribute("module", cn->physicalModuleName());
- if (!cn->groupNames().isEmpty())
- writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(',')));
- /*
- This is not read back in, so it probably
- shouldn't be written out in the first place.
- */
- if (!cn->members().isEmpty()) {
- QStringList names;
- const auto &members = cn->members();
- for (const Node *member : members)
- names.append(member->name());
- writer.writeAttribute("members", names.join(QLatin1Char(',')));
- }
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
+ case Node::QmlModule: {
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
+ writer.writeAttribute("seen", cn->wasSeen() ? "true" : "false");
+ writer.writeAttribute("title", cn->title());
+ if (!cn->subtitle().isEmpty())
+ writer.writeAttribute("subtitle", cn->subtitle());
+ if (!cn->physicalModuleName().isEmpty())
+ writer.writeAttribute("module", cn->physicalModuleName());
+ if (!cn->groupNames().isEmpty())
+ writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(',')));
+ /*
+ This is not read back in, so it probably
+ shouldn't be written out in the first place.
+ */
+ if (!cn->members().isEmpty()) {
+ QStringList names;
+ const auto &members = cn->members();
+ for (const Node *member : members)
+ names.append(member->name());
+ writer.writeAttribute("members", names.join(QLatin1Char(',')));
}
- break;
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ } break;
case Node::JsProperty:
- case Node::QmlProperty:
- {
- QmlPropertyNode *qpn = static_cast<QmlPropertyNode *>(node);
- writer.writeAttribute("type", qpn->dataType());
- writer.writeAttribute("attached", qpn->isAttached() ? "true" : "false");
- writer.writeAttribute("writable", qpn->isWritable() ? "true" : "false");
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
- }
- break;
- case Node::Property:
- {
- const PropertyNode *propertyNode = static_cast<const PropertyNode *>(node);
- writer.writeAttribute("type", propertyNode->dataType());
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
- const auto &getters = propertyNode->getters();
- for (const auto *fnNode : getters) {
- if (fnNode) {
- const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
- writer.writeStartElement("getter");
- writer.writeAttribute("name", functionNode->name());
- writer.writeEndElement(); // getter
- }
- }
- const auto &setters = propertyNode->setters();
- for (const auto *fnNode : setters) {
- if (fnNode) {
- const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
- writer.writeStartElement("setter");
- writer.writeAttribute("name", functionNode->name());
- writer.writeEndElement(); // setter
- }
- }
- const auto &resetters = propertyNode->resetters();
- for (const auto *fnNode : resetters) {
- if (fnNode) {
- const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
- writer.writeStartElement("resetter");
- writer.writeAttribute("name", functionNode->name());
- writer.writeEndElement(); // resetter
- }
+ case Node::QmlProperty: {
+ QmlPropertyNode *qpn = static_cast<QmlPropertyNode *>(node);
+ writer.writeAttribute("type", qpn->dataType());
+ writer.writeAttribute("attached", qpn->isAttached() ? "true" : "false");
+ writer.writeAttribute("writable", qpn->isWritable() ? "true" : "false");
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ } break;
+ case Node::Property: {
+ const PropertyNode *propertyNode = static_cast<const PropertyNode *>(node);
+ writer.writeAttribute("type", propertyNode->dataType());
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ const auto &getters = propertyNode->getters();
+ for (const auto *fnNode : getters) {
+ if (fnNode) {
+ const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
+ writer.writeStartElement("getter");
+ writer.writeAttribute("name", functionNode->name());
+ writer.writeEndElement(); // getter
}
- const auto &notifiers = propertyNode->notifiers();
- for (const auto *fnNode : notifiers) {
- if (fnNode) {
- const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
- writer.writeStartElement("notifier");
- writer.writeAttribute("name", functionNode->name());
- writer.writeEndElement(); // notifier
- }
+ }
+ const auto &setters = propertyNode->setters();
+ for (const auto *fnNode : setters) {
+ if (fnNode) {
+ const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
+ writer.writeStartElement("setter");
+ writer.writeAttribute("name", functionNode->name());
+ writer.writeEndElement(); // setter
}
}
- break;
- case Node::Variable:
- {
- const VariableNode *variableNode = static_cast<const VariableNode *>(node);
- writer.writeAttribute("type", variableNode->dataType());
- writer.writeAttribute("static", variableNode->isStatic() ? "true" : "false");
- if (!brief.isEmpty())
- writer.writeAttribute("brief", brief);
+ const auto &resetters = propertyNode->resetters();
+ for (const auto *fnNode : resetters) {
+ if (fnNode) {
+ const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
+ writer.writeStartElement("resetter");
+ writer.writeAttribute("name", functionNode->name());
+ writer.writeEndElement(); // resetter
+ }
}
- break;
- case Node::Enum:
- {
- const EnumNode *enumNode = static_cast<const EnumNode *>(node);
- if (enumNode->flagsType())
- writer.writeAttribute("typedef",enumNode->flagsType()->fullDocumentName());
- const auto &items = enumNode->items();
- for (const auto &item : items) {
- writer.writeStartElement("value");
- writer.writeAttribute("name", item.name());
- writer.writeAttribute("value", item.value());
- writer.writeEndElement(); // value
+ const auto &notifiers = propertyNode->notifiers();
+ for (const auto *fnNode : notifiers) {
+ if (fnNode) {
+ const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
+ writer.writeStartElement("notifier");
+ writer.writeAttribute("name", functionNode->name());
+ writer.writeEndElement(); // notifier
}
}
- break;
- case Node::Typedef:
- {
- const TypedefNode *typedefNode = static_cast<const TypedefNode *>(node);
- if (typedefNode->associatedEnum())
- writer.writeAttribute("enum",typedefNode->associatedEnum()->fullDocumentName());
+ } break;
+ case Node::Variable: {
+ const VariableNode *variableNode = static_cast<const VariableNode *>(node);
+ writer.writeAttribute("type", variableNode->dataType());
+ writer.writeAttribute("static", variableNode->isStatic() ? "true" : "false");
+ if (!brief.isEmpty())
+ writer.writeAttribute("brief", brief);
+ } break;
+ case Node::Enum: {
+ const EnumNode *enumNode = static_cast<const EnumNode *>(node);
+ if (enumNode->flagsType())
+ writer.writeAttribute("typedef", enumNode->flagsType()->fullDocumentName());
+ const auto &items = enumNode->items();
+ for (const auto &item : items) {
+ writer.writeStartElement("value");
+ writer.writeAttribute("name", item.name());
+ writer.writeAttribute("value", item.value());
+ writer.writeEndElement(); // value
}
- break;
+ } break;
+ case Node::Typedef: {
+ const TypedefNode *typedefNode = static_cast<const TypedefNode *>(node);
+ if (typedefNode->associatedEnum())
+ writer.writeAttribute("enum", typedefNode->associatedEnum()->fullDocumentName());
+ } break;
case Node::Function: // Now processed in generateFunctionSection()
default:
break;
@@ -1243,7 +1213,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
const auto &targets = node->doc().targets();
for (const Atom *target : targets) {
QString title = target->string();
- QString name = Doc::canonicalTitle(title);
+ QString name = Doc::canonicalTitle(title);
writer.writeStartElement("target");
if (!external)
writer.writeAttribute("name", name);
@@ -1258,7 +1228,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
const auto &keywords = node->doc().keywords();
for (const Atom *keyword : keywords) {
QString title = keyword->string();
- QString name = Doc::canonicalTitle(title);
+ QString name = Doc::canonicalTitle(title);
writer.writeStartElement("keyword");
writer.writeAttribute("name", name);
if (name != title)
@@ -1344,7 +1314,7 @@ void QDocIndexFiles::generateFunctionSection(QXmlStreamWriter &writer, FunctionN
if (!href.isEmpty())
writer.writeAttribute("href", href);
if (fn->threadSafeness() != Node::UnspecifiedSafeness)
- writer.writeAttribute("threadsafety", getThreadSafenessString(fn->threadSafeness()));
+ writer.writeAttribute("threadsafety", getThreadSafenessString(fn->threadSafeness()));
writer.writeAttribute("status", getStatusString(fn->status()));
writer.writeAttribute("access", getAccessString(fn->access()));
@@ -1366,11 +1336,11 @@ void QDocIndexFiles::generateFunctionSection(QXmlStreamWriter &writer, FunctionN
QString brief = fn->doc().trimmedBriefText(fn->name()).toString();
writer.writeAttribute("meta", fn->metanessString());
if (fn->isCppNode()) {
- writer.writeAttribute("virtual", fn->virtualness());
- writer.writeAttribute("const", fn->isConst() ? "true" : "false");
- writer.writeAttribute("static", fn->isStatic() ? "true" : "false");
- writer.writeAttribute("final", fn->isFinal() ? "true" : "false");
- writer.writeAttribute("override", fn->isOverride() ? "true" : "false");
+ writer.writeAttribute("virtual", fn->virtualness());
+ writer.writeAttribute("const", fn->isConst() ? "true" : "false");
+ writer.writeAttribute("static", fn->isStatic() ? "true" : "false");
+ writer.writeAttribute("final", fn->isFinal() ? "true" : "false");
+ writer.writeAttribute("override", fn->isOverride() ? "true" : "false");
/*
This ensures that for functions that have overloads,
the first function written is the one that is not an
@@ -1391,7 +1361,8 @@ void QDocIndexFiles::generateFunctionSection(QXmlStreamWriter &writer, FunctionN
associatedProperties << node->name();
}
associatedProperties.sort();
- writer.writeAttribute("associated-property", associatedProperties.join(QLatin1Char(',')));
+ writer.writeAttribute("associated-property",
+ associatedProperties.join(QLatin1Char(',')));
}
writer.writeAttribute("type", fn->returnType());
if (!brief.isEmpty())
@@ -1464,14 +1435,15 @@ void QDocIndexFiles::generateFunctionSections(QXmlStreamWriter &writer, Aggregat
Generate index sections for the child nodes of the given \a node
using the \a writer specified.
*/
-void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node, IndexSectionWriter *post)
+void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
+ IndexSectionWriter *post)
{
/*
Note that groups, modules, and QML modules are written
after all the other nodes.
*/
- if (node->isCollectionNode() ||
- node->isGroup() || node->isModule() || node->isQmlModule() || node->isJsModule())
+ if (node->isCollectionNode() || node->isGroup() || node->isModule() || node->isQmlModule()
+ || node->isJsModule())
return;
if (generateIndexSection(writer, node, post)) {
@@ -1537,10 +1509,8 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
\a g is used to get the Config object that contains the variables
from the module's .qdocconf file.
*/
-void QDocIndexFiles::generateIndex(const QString &fileName,
- const QString &url,
- const QString &title,
- Generator *g)
+void QDocIndexFiles::generateIndex(const QString &fileName, const QString &url,
+ const QString &title, Generator *g)
{
QFile file(fileName);
if (!file.open(QFile::WriteOnly | QFile::Text))
diff --git a/src/qdoc/qdocindexfiles.h b/src/qdoc/qdocindexfiles.h
index 0e758049a..96e73a9ed 100644
--- a/src/qdoc/qdocindexfiles.h
+++ b/src/qdoc/qdocindexfiles.h
@@ -57,7 +57,7 @@ class QDocIndexFiles
friend class WebXMLGenerator; // for using generateIndexSections()
private:
- static QDocIndexFiles* qdocIndexFiles();
+ static QDocIndexFiles *qdocIndexFiles();
static void destroyQDocIndexFiles();
QDocIndexFiles();
@@ -66,21 +66,25 @@ private:
void readIndexes(const QStringList &indexFiles);
void readIndexFile(const QString &path);
void readIndexSection(QXmlStreamReader &reader, Node *current, const QString &indexUrl);
- void insertTarget(TargetRec::TargetType type, const QXmlStreamAttributes &attributes, Node *node);
+ void insertTarget(TargetRec::TargetType type, const QXmlStreamAttributes &attributes,
+ Node *node);
void resolveIndex();
- void generateIndex(const QString &fileName, const QString &url, const QString &title, Generator *g);
+ void generateIndex(const QString &fileName, const QString &url, const QString &title,
+ Generator *g);
void generateFunctionSection(QXmlStreamWriter &writer, FunctionNode *fn);
void generateFunctionSections(QXmlStreamWriter &writer, Aggregate *aggregate);
- bool generateIndexSection(QXmlStreamWriter &writer, Node *node, IndexSectionWriter *post = nullptr);
- void generateIndexSections(QXmlStreamWriter &writer, Node *node, IndexSectionWriter *post = nullptr);
+ bool generateIndexSection(QXmlStreamWriter &writer, Node *node,
+ IndexSectionWriter *post = nullptr);
+ void generateIndexSections(QXmlStreamWriter &writer, Node *node,
+ IndexSectionWriter *post = nullptr);
private:
- static QDocIndexFiles* qdocIndexFiles_;
+ static QDocIndexFiles *qdocIndexFiles_;
QDocDatabase *qdb_;
Generator *gen_;
QString project_;
- QVector<QPair<ClassNode *, QString> > basesList_;
+ QVector<QPair<ClassNode *, QString>> basesList_;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/qdoctagfiles.cpp b/src/qdoc/qdoctagfiles.cpp
index cd4e9e0e5..8d97ce48a 100644
--- a/src/qdoc/qdoctagfiles.cpp
+++ b/src/qdoc/qdoctagfiles.cpp
@@ -74,9 +74,9 @@ QDocTagFiles::~QDocTagFiles()
*/
QDocTagFiles *QDocTagFiles::qdocTagFiles()
{
- if (qdocTagFiles_ == nullptr)
- qdocTagFiles_ = new QDocTagFiles;
- return qdocTagFiles_;
+ if (qdocTagFiles_ == nullptr)
+ qdocTagFiles_ = new QDocTagFiles;
+ return qdocTagFiles_;
}
/*!
@@ -243,85 +243,80 @@ void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter &writer, const Aggreg
writer.writeCharacters(node->fullDocumentName());
writer.writeEndElement();
break;
- case Node::Function:
- {
- /*
- Function nodes contain information about
- the type of function being described.
- */
-
- const FunctionNode *functionNode = static_cast<const FunctionNode *>(node);
- writer.writeAttribute("protection", access);
- writer.writeAttribute("virtualness", functionNode->virtualness());
- writer.writeAttribute("static", functionNode->isStatic() ? "yes" : "no");
-
- if (functionNode->isNonvirtual())
- writer.writeTextElement("type", functionNode->returnType());
- else
- writer.writeTextElement("type", "virtual " + functionNode->returnType());
-
- writer.writeTextElement("name", objName);
- QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
- writer.writeTextElement("anchorfile", pieces[0]);
- writer.writeTextElement("anchor", pieces[1]);
- QString signature = functionNode->signature(false, false);
- signature = signature.mid(signature.indexOf(QChar('('))).trimmed();
- if (functionNode->isConst())
- signature += " const";
- if (functionNode->isFinal())
- signature += " final";
- if (functionNode->isOverride())
- signature += " override";
- if (functionNode->isPureVirtual())
- signature += " = 0";
- writer.writeTextElement("arglist", signature);
- }
+ case Node::Function: {
+ /*
+ Function nodes contain information about
+ the type of function being described.
+ */
+
+ const FunctionNode *functionNode = static_cast<const FunctionNode *>(node);
+ writer.writeAttribute("protection", access);
+ writer.writeAttribute("virtualness", functionNode->virtualness());
+ writer.writeAttribute("static", functionNode->isStatic() ? "yes" : "no");
+
+ if (functionNode->isNonvirtual())
+ writer.writeTextElement("type", functionNode->returnType());
+ else
+ writer.writeTextElement("type", "virtual " + functionNode->returnType());
+
+ writer.writeTextElement("name", objName);
+ QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
+ writer.writeTextElement("anchorfile", pieces[0]);
+ writer.writeTextElement("anchor", pieces[1]);
+ QString signature = functionNode->signature(false, false);
+ signature = signature.mid(signature.indexOf(QChar('('))).trimmed();
+ if (functionNode->isConst())
+ signature += " const";
+ if (functionNode->isFinal())
+ signature += " final";
+ if (functionNode->isOverride())
+ signature += " override";
+ if (functionNode->isPureVirtual())
+ signature += " = 0";
+ writer.writeTextElement("arglist", signature);
+ }
writer.writeEndElement(); // member
break;
- case Node::Property:
- {
- const PropertyNode *propertyNode = static_cast<const PropertyNode *>(node);
- writer.writeAttribute("type", propertyNode->dataType());
- writer.writeTextElement("name", objName);
- QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
- writer.writeTextElement("anchorfile", pieces[0]);
- writer.writeTextElement("anchor", pieces[1]);
- writer.writeTextElement("arglist", QString());
- }
+ case Node::Property: {
+ const PropertyNode *propertyNode = static_cast<const PropertyNode *>(node);
+ writer.writeAttribute("type", propertyNode->dataType());
+ writer.writeTextElement("name", objName);
+ QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
+ writer.writeTextElement("anchorfile", pieces[0]);
+ writer.writeTextElement("anchor", pieces[1]);
+ writer.writeTextElement("arglist", QString());
+ }
writer.writeEndElement(); // member
break;
- case Node::Enum:
- {
- const EnumNode *enumNode = static_cast<const EnumNode *>(node);
- writer.writeTextElement("name", objName);
- QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
- writer.writeTextElement("anchor", pieces[1]);
- writer.writeTextElement("arglist", QString());
- writer.writeEndElement(); // member
+ case Node::Enum: {
+ const EnumNode *enumNode = static_cast<const EnumNode *>(node);
+ writer.writeTextElement("name", objName);
+ QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
+ writer.writeTextElement("anchor", pieces[1]);
+ writer.writeTextElement("arglist", QString());
+ writer.writeEndElement(); // member
- for (int i = 0; i < enumNode->items().size(); ++i) {
- EnumItem item = enumNode->items().value(i);
- writer.writeStartElement("member");
- writer.writeAttribute("name", item.name());
- writer.writeTextElement("anchor", pieces[1]);
- writer.writeTextElement("arglist", QString());
- writer.writeEndElement(); // member
- }
- }
- break;
- case Node::Typedef:
- {
- const TypedefNode *typedefNode = static_cast<const TypedefNode *>(node);
- if (typedefNode->associatedEnum())
- writer.writeAttribute("type", typedefNode->associatedEnum()->fullDocumentName());
- else
- writer.writeAttribute("type", QString());
- writer.writeTextElement("name", objName);
- QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
- writer.writeTextElement("anchorfile", pieces[0]);
+ for (int i = 0; i < enumNode->items().size(); ++i) {
+ EnumItem item = enumNode->items().value(i);
+ writer.writeStartElement("member");
+ writer.writeAttribute("name", item.name());
writer.writeTextElement("anchor", pieces[1]);
writer.writeTextElement("arglist", QString());
+ writer.writeEndElement(); // member
}
+ } break;
+ case Node::Typedef: {
+ const TypedefNode *typedefNode = static_cast<const TypedefNode *>(node);
+ if (typedefNode->associatedEnum())
+ writer.writeAttribute("type", typedefNode->associatedEnum()->fullDocumentName());
+ else
+ writer.writeAttribute("type", QString());
+ writer.writeTextElement("name", objName);
+ QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
+ writer.writeTextElement("anchorfile", pieces[0]);
+ writer.writeTextElement("anchor", pieces[1]);
+ writer.writeTextElement("arglist", QString());
+ }
writer.writeEndElement(); // member
break;
@@ -343,12 +338,10 @@ void QDocTagFiles::generateTagFile(const QString &fileName, Generator *g)
// If no path was specified or it doesn't exist,
// default to the output directory
if (fileInfo.fileName() == fileName || !fileInfo.dir().exists())
- file.setFileName(gen_->outputDir() + QLatin1Char('/') +
- fileInfo.fileName());
+ file.setFileName(gen_->outputDir() + QLatin1Char('/') + fileInfo.fileName());
if (!file.open(QFile::WriteOnly | QFile::Text)) {
- Location::null.warning(
- QString("Failed to open %1 for writing.").arg(file.fileName()));
+ Location::null.warning(QString("Failed to open %1 for writing.").arg(file.fileName()));
return;
}
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;
diff --git a/src/qdoc/qmlcodemarker.h b/src/qdoc/qmlcodemarker.h
index 81194cb36..c3435e840 100644
--- a/src/qdoc/qmlcodemarker.h
+++ b/src/qdoc/qmlcodemarker.h
@@ -36,7 +36,7 @@
#include "cppcodemarker.h"
#ifndef QT_NO_DECLARATIVE
-#include <private/qqmljsastfwd_p.h>
+# include <private/qqmljsastfwd_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -53,8 +53,7 @@ public:
bool recognizeExtension(const QString &ext) override;
bool recognizeLanguage(const QString &language) override;
Atom::AtomType atomType() const override;
- virtual QString markedUpCode(const QString &code,
- const Node *relative,
+ virtual QString markedUpCode(const QString &code, const Node *relative,
const Location &location) override;
QString markedUpName(const Node *node) override;
@@ -69,8 +68,7 @@ public:
#endif
private:
- QString addMarkUp(const QString &code, const Node *relative,
- const Location &location);
+ QString addMarkUp(const QString &code, const Node *relative, const Location &location);
};
QT_END_NAMESPACE
diff --git a/src/qdoc/qmlcodeparser.cpp b/src/qdoc/qmlcodeparser.cpp
index 1b8688f00..06ce5e1a5 100644
--- a/src/qdoc/qmlcodeparser.cpp
+++ b/src/qdoc/qmlcodeparser.cpp
@@ -37,8 +37,8 @@
#include "qmlvisitor.h"
#ifndef QT_NO_DECLARATIVE
-#include <private/qqmljsast_p.h>
-#include <private/qqmljsastvisitor_p.h>
+# include <private/qqmljsast_p.h>
+# include <private/qqmljsastvisitor_p.h>
#endif
#include <qdebug.h>
@@ -49,8 +49,7 @@ QT_BEGIN_NAMESPACE
*/
QmlCodeParser::QmlCodeParser()
#ifndef QT_NO_DECLARATIVE
- : lexer(nullptr),
- parser(nullptr)
+ : lexer(nullptr), parser(nullptr)
#endif
{
}
@@ -58,9 +57,7 @@ QmlCodeParser::QmlCodeParser()
/*!
Destroys the QML code parser.
*/
-QmlCodeParser::~QmlCodeParser()
-{
-}
+QmlCodeParser::~QmlCodeParser() {}
/*!
Initializes the code parser base class. The \a config argument
@@ -136,10 +133,7 @@ void QmlCodeParser::parseSourceFile(const Location &location, const QString &fil
if (parser->parse()) {
QQmlJS::AST::UiProgram *ast = parser->ast();
- QmlDocVisitor visitor(filePath,
- newCode,
- &engine,
- topicCommands() + commonMetaCommands(),
+ QmlDocVisitor visitor(filePath, newCode, &engine, topicCommands() + commonMetaCommands(),
topicCommands());
QQmlJS::AST::Node::accept(ast, &visitor);
if (visitor.hasError()) {
@@ -150,12 +144,12 @@ void QmlCodeParser::parseSourceFile(const Location &location, const QString &fil
const auto &messages = parser->diagnosticMessages();
for (const auto &msg : messages) {
qDebug().nospace() << qPrintable(filePath) << ':'
-#if Q_QML_PRIVATE_API_VERSION < 5
+# if Q_QML_PRIVATE_API_VERSION < 5
<< msg.loc.startLine << ": QML syntax error at col "
<< msg.loc.startColumn
-#else
+# else
<< msg.line << ": QML syntax error at col " << msg.column
-#endif
+# endif
<< ": " << qPrintable(msg.message);
}
currentFile_.clear();
@@ -171,26 +165,14 @@ static QSet<QString> topicCommands_;
const QSet<QString> &QmlCodeParser::topicCommands()
{
if (topicCommands_.isEmpty()) {
- topicCommands_ << COMMAND_VARIABLE
- << COMMAND_QMLCLASS
- << COMMAND_QMLTYPE
- << COMMAND_QMLPROPERTY
- << COMMAND_QMLPROPERTYGROUP // mws 13/03/2019
- << COMMAND_QMLATTACHEDPROPERTY
- << COMMAND_QMLSIGNAL
- << COMMAND_QMLATTACHEDSIGNAL
- << COMMAND_QMLMETHOD
- << COMMAND_QMLATTACHEDMETHOD
- << COMMAND_QMLBASICTYPE
- << COMMAND_JSTYPE
- << COMMAND_JSPROPERTY
- << COMMAND_JSPROPERTYGROUP // mws 13/03/2019
- << COMMAND_JSATTACHEDPROPERTY
- << COMMAND_JSSIGNAL
- << COMMAND_JSATTACHEDSIGNAL
- << COMMAND_JSMETHOD
- << COMMAND_JSATTACHEDMETHOD
- << COMMAND_JSBASICTYPE;
+ topicCommands_ << COMMAND_VARIABLE << COMMAND_QMLCLASS << COMMAND_QMLTYPE
+ << COMMAND_QMLPROPERTY << COMMAND_QMLPROPERTYGROUP // mws 13/03/2019
+ << COMMAND_QMLATTACHEDPROPERTY << COMMAND_QMLSIGNAL
+ << COMMAND_QMLATTACHEDSIGNAL << COMMAND_QMLMETHOD
+ << COMMAND_QMLATTACHEDMETHOD << COMMAND_QMLBASICTYPE << COMMAND_JSTYPE
+ << COMMAND_JSPROPERTY << COMMAND_JSPROPERTYGROUP // mws 13/03/2019
+ << COMMAND_JSATTACHEDPROPERTY << COMMAND_JSSIGNAL << COMMAND_JSATTACHEDSIGNAL
+ << COMMAND_JSMETHOD << COMMAND_JSATTACHEDMETHOD << COMMAND_JSBASICTYPE;
}
return topicCommands_;
}
@@ -235,15 +217,13 @@ void QmlCodeParser::extractPragmas(QString &script)
token = l.lex();
- if (token != QQmlJSGrammar::T_IDENTIFIER ||
- l.tokenStartLine() != startLine ||
- script.mid(l.tokenOffset(), l.tokenLength()) != pragma)
+ if (token != QQmlJSGrammar::T_IDENTIFIER || l.tokenStartLine() != startLine
+ || script.mid(l.tokenOffset(), l.tokenLength()) != pragma)
return;
token = l.lex();
- if (token != QQmlJSGrammar::T_IDENTIFIER ||
- l.tokenStartLine() != startLine)
+ if (token != QQmlJSGrammar::T_IDENTIFIER || l.tokenStartLine() != startLine)
return;
QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength());
diff --git a/src/qdoc/qmlcodeparser.h b/src/qdoc/qmlcodeparser.h
index 85923137b..f639f2115 100644
--- a/src/qdoc/qmlcodeparser.h
+++ b/src/qdoc/qmlcodeparser.h
@@ -38,9 +38,9 @@
#include <QtCore/qset.h>
#ifndef QT_NO_DECLARATIVE
-#include <private/qqmljsengine_p.h>
-#include <private/qqmljslexer_p.h>
-#include <private/qqmljsparser_p.h>
+# include <private/qqmljsengine_p.h>
+# include <private/qqmljslexer_p.h>
+# include <private/qqmljsparser_p.h>
#endif
QT_BEGIN_NAMESPACE
diff --git a/src/qdoc/qmlmarkupvisitor.cpp b/src/qdoc/qmlmarkupvisitor.cpp
index dbcdf8aa5..434fe76bc 100644
--- a/src/qdoc/qmlmarkupvisitor.cpp
+++ b/src/qdoc/qmlmarkupvisitor.cpp
@@ -32,9 +32,9 @@
#include <QtCore/qstringlist.h>
#ifndef QT_NO_DECLARATIVE
-#include <private/qqmljsast_p.h>
-#include <private/qqmljsastfwd_p.h>
-#include <private/qqmljsengine_p.h>
+# include <private/qqmljsast_p.h>
+# include <private/qqmljsastfwd_p.h>
+# include <private/qqmljsengine_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -79,15 +79,13 @@ QmlMarkupVisitor::QmlMarkupVisitor(const QString &source,
}
}
-QmlMarkupVisitor::~QmlMarkupVisitor()
-{
-}
+QmlMarkupVisitor::~QmlMarkupVisitor() {}
// The protect() function is a copy of the one from CppCodeMarker.
-static const QString samp = QLatin1String("&amp;");
-static const QString slt = QLatin1String("&lt;");
-static const QString sgt = QLatin1String("&gt;");
+static const QString samp = QLatin1String("&amp;");
+static const QString slt = QLatin1String("&lt;");
+static const QString sgt = QLatin1String("&gt;");
static const QString squot = QLatin1String("&quot;");
QString QmlMarkupVisitor::protect(const QString &str)
@@ -98,11 +96,20 @@ QString QmlMarkupVisitor::protect(const QString &str)
const QChar *data = str.constData();
for (int i = 0; i != n; ++i) {
switch (data[i].unicode()) {
- case '&': marked += samp; break;
- case '<': marked += slt; break;
- case '>': marked += sgt; break;
- case '"': marked += squot; break;
- default : marked += data[i];
+ case '&':
+ marked += samp;
+ break;
+ case '<':
+ marked += slt;
+ break;
+ case '>':
+ marked += sgt;
+ break;
+ case '"':
+ marked += squot;
+ break;
+ default:
+ marked += data[i];
}
}
return marked;
@@ -179,9 +186,9 @@ void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish)
cursor = finish;
}
-void QmlMarkupVisitor::addMarkedUpToken(
- QQmlJS::AST::SourceLocation &location, const QString &tagName,
- const QHash<QString, QString> &attributes)
+void QmlMarkupVisitor::addMarkedUpToken(QQmlJS::AST::SourceLocation &location,
+ const QString &tagName,
+ const QHash<QString, QString> &attributes)
{
if (!location.isValid())
return;
@@ -260,7 +267,7 @@ bool QmlMarkupVisitor::visit(QQmlJS::AST::UiPublicMember *member)
addVerbatim(member->propertyToken);
addVerbatim(member->typeModifierToken);
addMarkedUpToken(member->typeToken, QLatin1String("type"));
- //addVerbatim(member->identifierToken);
+ // addVerbatim(member->identifierToken);
QQmlJS::AST::Node::accept(member->parameters, this);
}
addVerbatim(member->semicolonToken);
@@ -309,7 +316,7 @@ bool QmlMarkupVisitor::visit(QQmlJS::AST::UiArrayMemberList *list)
{
for (QQmlJS::AST::UiArrayMemberList *it = list; it; it = it->next) {
QQmlJS::AST::Node::accept(it->member, this);
- //addVerbatim(it->commaToken);
+ // addVerbatim(it->commaToken);
}
return false;
}
@@ -387,12 +394,11 @@ void QmlMarkupVisitor::endVisit(QQmlJS::AST::ObjectPattern *literal)
addVerbatim(literal->rbraceToken);
}
-
bool QmlMarkupVisitor::visit(QQmlJS::AST::PatternElementList *list)
{
for (QQmlJS::AST::PatternElementList *it = list; it; it = it->next) {
QQmlJS::AST::Node::accept(it->element, this);
- //addVerbatim(it->commaToken);
+ // addVerbatim(it->commaToken);
}
QQmlJS::AST::Node::accept(list->elision, this);
return false;
@@ -409,7 +415,7 @@ bool QmlMarkupVisitor::visit(QQmlJS::AST::PatternProperty *list)
QQmlJS::AST::Node::accept(list->name, this);
addVerbatim(list->colonToken, list->colonToken);
QQmlJS::AST::Node::accept(list->initializer, this);
- //addVerbatim(list->commaToken, list->commaToken);
+ // addVerbatim(list->commaToken, list->commaToken);
return false;
}
@@ -559,7 +565,7 @@ bool QmlMarkupVisitor::visit(QQmlJS::AST::VariableStatement *statement)
{
addVerbatim(statement->declarationKindToken);
QQmlJS::AST::Node::accept(statement->declarations, this);
- //addVerbatim(statement->semicolonToken);
+ // addVerbatim(statement->semicolonToken);
return false;
}
@@ -692,7 +698,6 @@ void QmlMarkupVisitor::endVisit(QQmlJS::AST::CaseBlock *block)
addVerbatim(block->rbraceToken, block->rbraceToken);
}
-
bool QmlMarkupVisitor::visit(QQmlJS::AST::SwitchStatement *statement)
{
addMarkedUpToken(statement->switchToken, QLatin1String("keyword"));
@@ -788,9 +793,9 @@ bool QmlMarkupVisitor::visit(QQmlJS::AST::FunctionDeclaration *declaration)
bool QmlMarkupVisitor::visit(QQmlJS::AST::FormalParameterList *list)
{
-// addVerbatim(list->commaToken);
+ // addVerbatim(list->commaToken);
QQmlJS::AST::Node::accept(list->element, this);
- //addMarkedUpToken(list->identifierToken, QLatin1String("name"));
+ // addMarkedUpToken(list->identifierToken, QLatin1String("name"));
return false;
}
diff --git a/src/qdoc/qmlmarkupvisitor.h b/src/qdoc/qmlmarkupvisitor.h
index a0e3f870b..c9a012ae8 100644
--- a/src/qdoc/qmlmarkupvisitor.h
+++ b/src/qdoc/qmlmarkupvisitor.h
@@ -35,8 +35,8 @@
#include <QtCore/qstring.h>
#ifndef QT_NO_DECLARATIVE
-#include <private/qqmljsastvisitor_p.h>
-#include <private/qqmljsengine_p.h>
+# include <private/qqmljsastvisitor_p.h>
+# include <private/qqmljsengine_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -45,13 +45,9 @@ QT_BEGIN_NAMESPACE
class QmlMarkupVisitor : public QQmlJS::AST::Visitor
{
public:
- enum ExtraType{
- Comment,
- Pragma
- };
+ enum ExtraType { Comment, Pragma };
- QmlMarkupVisitor(const QString &code,
- const QVector<QQmlJS::AST::SourceLocation> &pragmas,
+ QmlMarkupVisitor(const QString &code, const QVector<QQmlJS::AST::SourceLocation> &pragmas,
QQmlJS::Engine *engine);
virtual ~QmlMarkupVisitor();
@@ -148,8 +144,7 @@ protected:
private:
typedef QHash<QString, QString> StringHash;
void addExtra(quint32 start, quint32 finish);
- void addMarkedUpToken(QQmlJS::AST::SourceLocation &location,
- const QString &text,
+ void addMarkedUpToken(QQmlJS::AST::SourceLocation &location, const QString &text,
const StringHash &attributes = StringHash());
void addVerbatim(QQmlJS::AST::SourceLocation first,
QQmlJS::AST::SourceLocation last = QQmlJS::AST::SourceLocation());
diff --git a/src/qdoc/qmlvisitor.cpp b/src/qdoc/qmlvisitor.cpp
index 6eb924570..d2d32b393 100644
--- a/src/qdoc/qmlvisitor.cpp
+++ b/src/qdoc/qmlvisitor.cpp
@@ -40,9 +40,9 @@
#include <QtCore/qstringlist.h>
#ifndef QT_NO_DECLARATIVE
-#include <private/qqmljsast_p.h>
-#include <private/qqmljsastfwd_p.h>
-#include <private/qqmljsengine_p.h>
+# include <private/qqmljsast_p.h>
+# include <private/qqmljsastfwd_p.h>
+# include <private/qqmljsengine_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -51,11 +51,8 @@ QT_BEGIN_NAMESPACE
/*!
The constructor stores all the parameters in local data members.
*/
-QmlDocVisitor::QmlDocVisitor(const QString &filePath,
- const QString &code,
- QQmlJS::Engine *engine,
- const QSet<QString> &commands,
- const QSet<QString> &topics)
+QmlDocVisitor::QmlDocVisitor(const QString &filePath, const QString &code, QQmlJS::Engine *engine,
+ const QSet<QString> &commands, const QSet<QString> &topics)
: nestingLevel(0)
{
lastEndOffset = 0;
@@ -88,12 +85,10 @@ QQmlJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) cons
if (loc.begin() <= lastEndOffset) {
// Return if we reach the end of the preceding structure.
break;
- }
- else if (usedComments.contains(loc.begin())) {
+ } else if (usedComments.contains(loc.begin())) {
// Return if we encounter a previously used comment.
break;
- }
- else if (loc.begin() > lastEndOffset && loc.end() < offset) {
+ } else if (loc.begin() > lastEndOffset && loc.end() < offset) {
// Only examine multiline comments in order to avoid snippet markers.
if (document.at(loc.offset - 1) == QLatin1Char('*')) {
QString comment = document.mid(loc.offset, loc.length);
@@ -109,7 +104,7 @@ QQmlJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) cons
class QmlSignatureParser
{
- public:
+public:
QmlSignatureParser(FunctionNode *func, const QString &signature, const Location &loc);
void readToken() { tok_ = tokenizer_->getToken(); }
QString lexeme() { return tokenizer_->lexeme(); }
@@ -120,7 +115,7 @@ class QmlSignatureParser
bool matchParameter();
bool matchFunctionDecl();
- private:
+private:
QString signature_;
QStringList names_;
QString funcName_;
@@ -160,9 +155,10 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
node->setDoc(doc);
nodes.append(node);
if (topicsUsed.size() > 0) {
- for (int i=0; i<topicsUsed.size(); ++i) {
+ for (int i = 0; i < topicsUsed.size(); ++i) {
QString topic = topicsUsed.at(i).topic;
- if (!topic.startsWith(QLatin1String("qml")) && !topic.startsWith(QLatin1String("js")))
+ if (!topic.startsWith(QLatin1String("qml"))
+ && !topic.startsWith(QLatin1String("js")))
continue; // maybe a qdoc warning here? mws 18/07/18
QString args = topicsUsed.at(i).args;
if (topic == COMMAND_JSTYPE) {
@@ -173,8 +169,7 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
if (qpa.name_ == nodePassedIn->name()) {
if (nodePassedIn->isAlias())
nodePassedIn->setDataType(qpa.type_);
- }
- else {
+ } else {
bool isAttached = topic.contains(QLatin1String("attached"));
QmlPropertyNode *n = parent->hasQmlProperty(qpa.name_, isAttached);
if (n == nullptr)
@@ -186,12 +181,12 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
n->markDefault();
if (isAttached)
n->markReadOnly(0);
- if ((topic == COMMAND_JSPROPERTY) || (topic == COMMAND_JSATTACHEDPROPERTY))
+ if ((topic == COMMAND_JSPROPERTY)
+ || (topic == COMMAND_JSATTACHEDPROPERTY))
n->changeType(Node::QmlProperty, Node::JsProperty);
nodes.append(n);
}
- }
- else
+ } else
qDebug() << " FAILED TO PARSE QML OR JS PROPERTY:" << topic << args;
} else if (topic.endsWith(QLatin1String("method"))) {
if (node->isFunction()) {
@@ -203,7 +198,7 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
}
}
}
- for (int i=0; i<nodes.size(); ++i)
+ for (int i = 0; i < nodes.size(); ++i)
applyMetacommands(loc, nodes.at(i), doc);
usedComments.insert(loc.offset);
if (doc.isEmpty()) {
@@ -217,7 +212,8 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
return false;
}
-QmlSignatureParser::QmlSignatureParser(FunctionNode *func, const QString &signature, const Location &loc)
+QmlSignatureParser::QmlSignatureParser(FunctionNode *func, const QString &signature,
+ const Location &loc)
: signature_(signature), func_(func), location_(loc)
{
QByteArray latin1 = signature.toLatin1();
@@ -256,11 +252,8 @@ bool QmlSignatureParser::matchTypeAndName(CodeChunk *type, QString *var)
bool virgin = true;
if (tok_ != Tok_Ident) {
- while (match(Tok_signed) ||
- match(Tok_unsigned) ||
- match(Tok_short) ||
- match(Tok_long) ||
- match(Tok_int64)) {
+ while (match(Tok_signed) || match(Tok_unsigned) || match(Tok_short) || match(Tok_long)
+ || match(Tok_int64)) {
type->append(previousLexeme());
virgin = false;
}
@@ -269,19 +262,12 @@ bool QmlSignatureParser::matchTypeAndName(CodeChunk *type, QString *var)
if (virgin) {
if (match(Tok_Ident)) {
type->append(previousLexeme());
- }
- else if (match(Tok_void) ||
- match(Tok_int) ||
- match(Tok_char) ||
- match(Tok_double) ||
- match(Tok_Ellipsis))
+ } else if (match(Tok_void) || match(Tok_int) || match(Tok_char) || match(Tok_double)
+ || match(Tok_Ellipsis))
type->append(previousLexeme());
else
return false;
- }
- else if (match(Tok_int) ||
- match(Tok_char) ||
- match(Tok_double)) {
+ } else if (match(Tok_int) || match(Tok_char) || match(Tok_double)) {
type->append(previousLexeme());
}
@@ -291,10 +277,7 @@ bool QmlSignatureParser::matchTypeAndName(CodeChunk *type, QString *var)
break;
}
- while (match(Tok_Ampersand) ||
- match(Tok_Aster) ||
- match(Tok_const) ||
- match(Tok_Caret))
+ while (match(Tok_Ampersand) || match(Tok_Aster) || match(Tok_const) || match(Tok_Caret))
type->append(previousLexeme());
/*
@@ -308,8 +291,8 @@ bool QmlSignatureParser::matchTypeAndName(CodeChunk *type, QString *var)
if (tok_ == Tok_LeftBracket) {
int bracketDepth0 = tokenizer_->bracketDepth();
- while ((tokenizer_->bracketDepth() >= bracketDepth0 && tok_ != Tok_Eoi) ||
- tok_ == Tok_RightBracket) {
+ while ((tokenizer_->bracketDepth() >= bracketDepth0 && tok_ != Tok_Eoi)
+ || tok_ == Tok_RightBracket) {
type->append(lexeme());
readToken();
}
@@ -333,10 +316,9 @@ bool QmlSignatureParser::matchParameter()
return false;
if (match(Tok_Equal)) {
int parenDepth0 = tokenizer_->parenDepth();
- while (tokenizer_->parenDepth() >= parenDepth0 &&
- (tok_ != Tok_Comma ||
- tokenizer_->parenDepth() > parenDepth0) &&
- tok_ != Tok_Eoi) {
+ while (tokenizer_->parenDepth() >= parenDepth0
+ && (tok_ != Tok_Comma || tokenizer_->parenDepth() > parenDepth0)
+ && tok_ != Tok_Eoi) {
defaultValue.append(lexeme());
readToken();
}
@@ -405,9 +387,7 @@ bool QmlSignatureParser::matchFunctionDecl()
are found, a qdoc warning is emitted and false is
returned.
*/
-bool QmlDocVisitor::splitQmlPropertyArg(const Doc &doc,
- const QString &arg,
- QmlPropArgs& qpa)
+bool QmlDocVisitor::splitQmlPropertyArg(const Doc &doc, const QString &arg, QmlPropArgs &qpa)
{
qpa.clear();
QStringList blankSplit = arg.split(QLatin1Char(' '));
@@ -419,20 +399,17 @@ bool QmlDocVisitor::splitQmlPropertyArg(const Doc &doc,
qpa.component_ = colonSplit[1];
qpa.name_ = colonSplit[2];
return true;
- }
- else if (colonSplit.size() == 2) {
+ } else if (colonSplit.size() == 2) {
qpa.component_ = colonSplit[0];
qpa.name_ = colonSplit[1];
return true;
- }
- else if (colonSplit.size() == 1) {
+ } else if (colonSplit.size() == 1) {
qpa.name_ = colonSplit[0];
return true;
}
QString msg = "Unrecognizable QML module/component qualifier for " + arg;
doc.location().warning(tr(msg.toLatin1().data()));
- }
- else {
+ } else {
QString msg = "Missing property type for " + arg;
doc.location().warning(tr(msg.toLatin1().data()));
}
@@ -442,9 +419,7 @@ bool QmlDocVisitor::splitQmlPropertyArg(const Doc &doc,
/*!
Applies the metacommands found in the comment.
*/
-void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation,
- Node *node,
- Doc &doc)
+void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, Node *node, Doc &doc)
{
QDocDatabase *qdb = QDocDatabase::qdocDB();
QSet<QString> metacommands = doc.metaCommandsUsed();
@@ -456,51 +431,38 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation,
if (node->isQmlType() || node->isJsType()) {
node->setAbstract(true);
}
- }
- else if (command == COMMAND_DEPRECATED) {
+ } else if (command == COMMAND_DEPRECATED) {
node->setStatus(Node::Obsolete);
- }
- else if ((command == COMMAND_INQMLMODULE) || (command == COMMAND_INJSMODULE)) {
- qdb->addToQmlModule(args[0].first,node);
- }
- else if (command == COMMAND_QMLINHERITS) {
+ } else if ((command == COMMAND_INQMLMODULE) || (command == COMMAND_INJSMODULE)) {
+ qdb->addToQmlModule(args[0].first, node);
+ } else if (command == COMMAND_QMLINHERITS) {
if (node->name() == args[0].first)
doc.location().warning(tr("%1 tries to inherit itself").arg(args[0].first));
else if (node->isQmlType() || node->isJsType()) {
QmlTypeNode *qmlType = static_cast<QmlTypeNode *>(node);
qmlType->setQmlBaseName(args[0].first);
}
- }
- else if (command == COMMAND_QMLDEFAULT) {
+ } else if (command == COMMAND_QMLDEFAULT) {
node->markDefault();
- }
- else if (command == COMMAND_QMLREADONLY) {
+ } else if (command == COMMAND_QMLREADONLY) {
node->markReadOnly(1);
- }
- else if ((command == COMMAND_INGROUP) && !args.isEmpty()) {
+ } else if ((command == COMMAND_INGROUP) && !args.isEmpty()) {
for (const auto &argument : args)
QDocDatabase::qdocDB()->addToGroup(argument.first, node);
- }
- else if (command == COMMAND_INTERNAL) {
+ } else if (command == COMMAND_INTERNAL) {
node->setStatus(Node::Internal);
- }
- else if (command == COMMAND_OBSOLETE) {
+ } else if (command == COMMAND_OBSOLETE) {
node->setStatus(Node::Obsolete);
- }
- else if (command == COMMAND_PAGEKEYWORDS) {
+ } else if (command == COMMAND_PAGEKEYWORDS) {
// Not done yet. Do we need this?
- }
- else if (command == COMMAND_PRELIMINARY) {
+ } else if (command == COMMAND_PRELIMINARY) {
node->setStatus(Node::Preliminary);
- }
- else if (command == COMMAND_SINCE) {
+ } else if (command == COMMAND_SINCE) {
QString arg = args[0].first; //.join(' ');
node->setSince(arg);
- }
- else if (command == COMMAND_WRAPPER) {
+ } else if (command == COMMAND_WRAPPER) {
node->setWrapper();
- }
- else {
+ } else {
doc.location().warning(tr("The \\%1 command is ignored in QML files").arg(command));
}
}
@@ -543,7 +505,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
if (current->isNamespace()) {
QmlTypeNode *component = nullptr;
- Node *candidate = current ->findChildNode(name, Node::QML);
+ Node *candidate = current->findChildNode(name, Node::QML);
if (candidate != nullptr)
component = static_cast<QmlTypeNode *>(candidate);
else
@@ -577,7 +539,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiImport *import)
{
QString name = document.mid(import->fileNameToken.offset, import->fileNameToken.length);
if (name[0] == '\"')
- name = name.mid(1, name.length()-2);
+ name = name.mid(1, name.length() - 2);
QString version = document.mid(import->versionToken.offset, import->versionToken.length);
QString importId = document.mid(import->importIdToken.offset, import->importIdToken.length);
QString importUri = getFullyQualifiedId(import->importUri);
@@ -608,20 +570,18 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiArrayBinding *)
return true;
}
-void QmlDocVisitor::endVisit(QQmlJS::AST::UiArrayBinding *)
-{
-}
+void QmlDocVisitor::endVisit(QQmlJS::AST::UiArrayBinding *) {}
-template <typename T>
+template<typename T>
QString qualifiedIdToString(T node);
-template <>
+template<>
QString qualifiedIdToString(QStringRef node)
{
return node.toString();
}
-template <>
+template<>
QString qualifiedIdToString(QQmlJS::AST::UiQualifiedId *node)
{
QString s;
@@ -647,8 +607,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member)
return true;
}
switch (member->type) {
- case QQmlJS::AST::UiPublicMember::Signal:
- {
+ case QQmlJS::AST::UiPublicMember::Signal: {
if (current->isQmlType() || current->isJsType()) {
QmlTypeNode *qmlType = static_cast<QmlTypeNode *>(current);
if (qmlType) {
@@ -668,8 +627,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member)
}
break;
}
- case QQmlJS::AST::UiPublicMember::Property:
- {
+ case QQmlJS::AST::UiPublicMember::Property: {
QString type = qualifiedIdToString(member->memberType);
QString name = member->name.toString();
if (current->isQmlType() || current->isJsType()) {
@@ -697,7 +655,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member)
/*!
End the visit of the \a member.
*/
-void QmlDocVisitor::endVisit(QQmlJS::AST::UiPublicMember* member)
+void QmlDocVisitor::endVisit(QQmlJS::AST::UiPublicMember *member)
{
lastEndOffset = member->lastSourceLocation().end();
}
@@ -711,7 +669,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::IdentifierPropertyName *)
Begin the visit of the function declaration \a fd, but only
if the nesting level is 1.
*/
-bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration* fd)
+bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration *fd)
{
if (nestingLevel <= 1) {
FunctionNode::Metaness metaness = FunctionNode::QmlMethod;
@@ -738,7 +696,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration* fd)
/*!
End the visit of the function declaration, \a fd.
*/
-void QmlDocVisitor::endVisit(QQmlJS::AST::FunctionDeclaration* fd)
+void QmlDocVisitor::endVisit(QQmlJS::AST::FunctionDeclaration *fd)
{
lastEndOffset = fd->lastSourceLocation().end();
}
@@ -752,22 +710,22 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::FunctionDeclaration* fd)
documentation, that discussion must take place in the comment
for the signal.
*/
-bool QmlDocVisitor::visit(QQmlJS::AST::UiScriptBinding* )
+bool QmlDocVisitor::visit(QQmlJS::AST::UiScriptBinding *)
{
return true;
}
-void QmlDocVisitor::endVisit(QQmlJS::AST::UiScriptBinding* sb)
+void QmlDocVisitor::endVisit(QQmlJS::AST::UiScriptBinding *sb)
{
lastEndOffset = sb->lastSourceLocation().end();
}
-bool QmlDocVisitor::visit(QQmlJS::AST::UiQualifiedId* )
+bool QmlDocVisitor::visit(QQmlJS::AST::UiQualifiedId *)
{
return true;
}
-void QmlDocVisitor::endVisit(QQmlJS::AST::UiQualifiedId* )
+void QmlDocVisitor::endVisit(QQmlJS::AST::UiQualifiedId *)
{
// nothing.
}
diff --git a/src/qdoc/qmlvisitor.h b/src/qdoc/qmlvisitor.h
index fae02c1e2..6c10c5258 100644
--- a/src/qdoc/qmlvisitor.h
+++ b/src/qdoc/qmlvisitor.h
@@ -34,8 +34,8 @@
#include <QtCore/qstring.h>
#ifndef QT_NO_DECLARATIVE
-#include <private/qqmljsastvisitor_p.h>
-#include <private/qqmljsengine_p.h>
+# include <private/qqmljsastvisitor_p.h>
+# include <private/qqmljsengine_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -47,7 +47,8 @@ struct QmlPropArgs
QString component_;
QString name_;
- void clear() {
+ void clear()
+ {
type_.clear();
module_.clear();
component_.clear();
@@ -61,11 +62,8 @@ class QmlDocVisitor : public QQmlJS::AST::Visitor
Q_DECLARE_TR_FUNCTIONS(QDoc::QmlDocVisitor)
public:
- QmlDocVisitor(const QString &filePath,
- const QString &code,
- QQmlJS::Engine *engine,
- const QSet<QString> &commands,
- const QSet<QString> &topics);
+ QmlDocVisitor(const QString &filePath, const QString &code, QQmlJS::Engine *engine,
+ const QSet<QString> &commands, const QSet<QString> &topics);
~QmlDocVisitor() override;
bool visit(QQmlJS::AST::UiImport *import) override;
@@ -101,9 +99,7 @@ private:
QQmlJS::AST::SourceLocation precedingComment(quint32 offset) const;
bool applyDocumentation(QQmlJS::AST::SourceLocation location, Node *node);
void applyMetacommands(QQmlJS::AST::SourceLocation location, Node *node, Doc &doc);
- bool splitQmlPropertyArg(const Doc &doc,
- const QString &arg,
- QmlPropArgs& qpa);
+ bool splitQmlPropertyArg(const Doc &doc, const QString &arg, QmlPropArgs &qpa);
QQmlJS::Engine *engine;
quint32 lastEndOffset;
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;
}
diff --git a/src/qdoc/quoter.h b/src/qdoc/quoter.h
index 6dec63641..ed21828cf 100644
--- a/src/qdoc/quoter.h
+++ b/src/qdoc/quoter.h
@@ -48,14 +48,11 @@ public:
Quoter();
void reset();
- void quoteFromFile(const QString &userFriendlyFileName,
- const QString &plainCode, const QString &markedCode);
- QString quoteLine(const Location &docLocation, const QString &command,
- const QString &pattern);
- QString quoteTo(const Location &docLocation, const QString &command,
- const QString &pattern);
- QString quoteUntil(const Location &docLocation, const QString &command,
- const QString &pattern);
+ void quoteFromFile(const QString &userFriendlyFileName, const QString &plainCode,
+ const QString &markedCode);
+ QString quoteLine(const Location &docLocation, const QString &command, const QString &pattern);
+ QString quoteTo(const Location &docLocation, const QString &command, const QString &pattern);
+ QString quoteUntil(const Location &docLocation, const QString &command, const QString &pattern);
QString quoteSnippet(const Location &docLocation, const QString &identifier);
static QStringList splitLines(const QString &line);
@@ -63,17 +60,15 @@ public:
private:
QString getLine(int unindent = 0);
void failedAtEnd(const Location &docLocation, const QString &command);
- bool match(const Location &docLocation, const QString &pattern,
- const QString &line);
+ bool match(const Location &docLocation, const QString &pattern, const QString &line);
QString commentForCode() const;
- QString removeSpecialLines(const QString &line, const QString &comment,
- int unindent = 0);
+ QString removeSpecialLines(const QString &line, const QString &comment, int unindent = 0);
bool silent;
QStringList plainLines;
QStringList markedLines;
Location codeLocation;
- static QHash<QString,QString> commentHash;
+ static QHash<QString, QString> commentHash;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/sections.cpp b/src/qdoc/sections.cpp
index 7fd39bc4f..7d5bcf03f 100644
--- a/src/qdoc/sections.cpp
+++ b/src/qdoc/sections.cpp
@@ -38,17 +38,21 @@
QT_BEGIN_NAMESPACE
-//Aggregate *Sections::aggregate_ = nullptr;
+// Aggregate *Sections::aggregate_ = nullptr;
static bool sectionsInitialized = false;
QVector<Section> Sections::stdSummarySections_(7, Section(Section::Summary, Section::Active));
QVector<Section> Sections::stdDetailsSections_(7, Section(Section::Details, Section::Active));
-QVector<Section> Sections::stdCppClassSummarySections_(18, Section(Section::Summary, Section::Active));
-QVector<Section> Sections::stdCppClassDetailsSections_(6, Section(Section::Details, Section::Active));
+QVector<Section> Sections::stdCppClassSummarySections_(18,
+ Section(Section::Summary, Section::Active));
+QVector<Section> Sections::stdCppClassDetailsSections_(6,
+ Section(Section::Details, Section::Active));
QVector<Section> Sections::sinceSections_(15, Section(Section::Details, Section::Active));
QVector<Section> Sections::allMembers_(1, Section(Section::AllMembers, Section::Active));
-QVector<Section> Sections::stdQmlTypeSummarySections_(7, Section(Section::Summary, Section::Active));
-QVector<Section> Sections::stdQmlTypeDetailsSections_(7, Section(Section::Details, Section::Active));
+QVector<Section> Sections::stdQmlTypeSummarySections_(7,
+ Section(Section::Summary, Section::Active));
+QVector<Section> Sections::stdQmlTypeDetailsSections_(7,
+ Section(Section::Details, Section::Active));
/*!
\class Section
@@ -61,9 +65,9 @@ QVector<Section> Sections::stdQmlTypeDetailsSections_(7, Section(Section::Detail
*/
Section::Section(Style style, Status status) : style_(style), status_(status), aggregate_(nullptr)
{
- //members_.reserve(100);
- //obsoleteMembers_.reserve(50);
- //reimplementedMembers_.reserve(50);
+ // members_.reserve(100);
+ // obsoleteMembers_.reserve(50);
+ // reimplementedMembers_.reserve(50);
}
/*!
@@ -88,7 +92,7 @@ void Section::clear()
reimplementedMemberMap_.clear();
if (!classMapList_.isEmpty()) {
for (int i = 0; i < classMapList_.size(); i++) {
- ClassMap* cm = classMapList_[i];
+ ClassMap *cm = classMapList_[i];
classMapList_[i] = nullptr;
delete cm;
}
@@ -102,7 +106,7 @@ void Section::clear()
inheritedMembers_.clear();
if (!classKeysNodesList_.isEmpty()) {
for (int i = 0; i < classKeysNodesList_.size(); i++) {
- ClassKeysNodes* ckn = classKeysNodesList_[i];
+ ClassKeysNodes *ckn = classKeysNodesList_[i];
classKeysNodesList_[i] = nullptr;
delete ckn;
}
@@ -133,7 +137,7 @@ QString Section::sortName(const Node *node, const QString *name)
// we want 'qint8' to appear before 'qint16'
if (numDigits > 0) {
for (int i = 0; i < 4 - numDigits; ++i)
- nodeName.insert(nodeName.size()-numDigits-1, QLatin1Char('0'));
+ nodeName.insert(nodeName.size() - numDigits - 1, QLatin1Char('0'));
}
if (node->isFunction()) {
@@ -144,8 +148,7 @@ QString Section::sortName(const Node *node, const QString *name)
sortNo = QLatin1String("C");
else if (fn->isDtor())
sortNo = QLatin1String("D");
- else if (nodeName.startsWith(QLatin1String("operator"))
- && nodeName.length() > 8
+ else if (nodeName.startsWith(QLatin1String("operator")) && nodeName.length() > 8
&& !nodeName[8].isLetterOrNumber())
sortNo = QLatin1String("F");
else
@@ -185,12 +188,11 @@ void Section::insert(Node *node)
if (node->isPrivate() || node->isInternal()) {
irrelevant = true;
- }
- else if (node->isFunction()) {
+ } else if (node->isFunction()) {
FunctionNode *func = static_cast<FunctionNode *>(node);
irrelevant = (inherited && (func->isSomeCtor() || func->isDtor()));
- }
- else if (node->isClassNode() || node->isEnumType() || node->isTypedef() || node->isVariable()) {
+ } else if (node->isClassNode() || node->isEnumType() || node->isTypedef()
+ || node->isVariable()) {
irrelevant = (inherited && style_ != AllMembers);
if (!irrelevant && style_ == Details && node->isTypedef()) {
const TypedefNode *tdn = static_cast<const TypedefNode *>(node);
@@ -211,7 +213,8 @@ void Section::insert(Node *node)
memberMap_.insertMulti(key, node);
}
if (inherited && (node->parent()->isClassNode() || node->parent()->isNamespace())) {
- if (inheritedMembers_.isEmpty() || inheritedMembers_.last().first != node->parent()) {
+ if (inheritedMembers_.isEmpty()
+ || inheritedMembers_.last().first != node->parent()) {
QPair<Aggregate *, int> p(node->parent(), 0);
inheritedMembers_.append(p);
}
@@ -284,8 +287,8 @@ void Section::reduce()
obsoleteMembers_ = obsoleteMemberMap_.values().toVector();
reimplementedMembers_ = reimplementedMemberMap_.values().toVector();
for (int i = 0; i < classMapList_.size(); i++) {
- ClassMap* cm = classMapList_[i];
- ClassKeysNodes* ckn = new ClassKeysNodes;
+ ClassMap *cm = classMapList_[i];
+ ClassKeysNodes *ckn = new ClassKeysNodes;
ckn->first = cm->first;
ckn->second.second = cm->second.values().toVector();
ckn->second.first = cm->second.keys();
@@ -397,11 +400,9 @@ Sections::Sections(const NodeMultiMap &nsmap) : aggregate_(nullptr)
sections[SinceGlobalFunctions].appendMember(node);
else
sections[SinceNamespaceFunctions].appendMember(node);
- }
- else
+ } else
sections[SinceGlobalFunctions].appendMember(node);
- }
- else
+ } else
sections[SinceGlobalFunctions].appendMember(node);
}
break;
@@ -456,8 +457,7 @@ Sections::~Sections()
break;
}
aggregate_ = nullptr;
- }
- else {
+ } else {
clear(sinceSections());
}
}
@@ -467,7 +467,7 @@ Sections::~Sections()
*/
void Sections::initAggregate(SectionVector &v, Aggregate *aggregate)
{
- for (int i = 0; i< v.size(); ++i)
+ for (int i = 0; i < v.size(); ++i)
v[i].setAggregate(aggregate);
}
@@ -499,7 +499,8 @@ void Sections::initSections()
v[8].init("Protected Functions", "protected function", "protected functions");
v[9].init("Protected Slots", "protected slot", "protected slots");
v[10].init("Protected Variables", "protected type", "protected variables");
- v[11].init("Static Protected Members", "static protected member", "static protected members");
+ v[11].init("Static Protected Members", "static protected member",
+ "static protected members");
v[12].init("Private Types", "private type", "private types");
v[13].init("Private Functions", "private function", "private functions");
v[14].init("Private Slots", "private slot", "private slots");
@@ -572,13 +573,13 @@ void Sections::initSections()
{
QVector<Section> &v = stdQmlTypeDetailsSections_;
- v[0].init("Property Documentation","qmlprop","member","members");
- v[1].init("Attached Property Documentation","qmlattprop", "member","members");
- v[2].init("Signal Documentation","qmlsig","signal","signals");
- v[3].init("Signal Handler Documentation","qmlsighan","signal handler","signal handlers");
- v[4].init("Attached Signal Documentation","qmlattsig", "signal","signals");
- v[5].init("Method Documentation","qmlmeth","member","members");
- v[6].init("Attached Method Documentation","qmlattmeth", "member","members");
+ v[0].init("Property Documentation", "qmlprop", "member", "members");
+ v[1].init("Attached Property Documentation", "qmlattprop", "member", "members");
+ v[2].init("Signal Documentation", "qmlsig", "signal", "signals");
+ v[3].init("Signal Handler Documentation", "qmlsighan", "signal handler", "signal handlers");
+ v[4].init("Attached Signal Documentation", "qmlattsig", "signal", "signals");
+ v[5].init("Method Documentation", "qmlmeth", "member", "members");
+ v[6].init("Attached Method Documentation", "qmlattmeth", "member", "members");
}
}
@@ -623,32 +624,31 @@ void Sections::stdRefPageSwitch(SectionVector &v, Node *n, Node *t)
case Node::Typedef:
v[StdTypes].insert(n);
return;
- case Node::Function:
- {
- FunctionNode *func = static_cast<FunctionNode *>(t);
- if (func->isMacro())
- v[StdMacros].insert(n);
- else
- v[StdFunctions].insert(n);
- }
+ case Node::Function: {
+ FunctionNode *func = static_cast<FunctionNode *>(t);
+ if (func->isMacro())
+ v[StdMacros].insert(n);
+ else
+ v[StdFunctions].insert(n);
+ }
return;
- case Node::Variable:
- {
- const VariableNode *var = static_cast<const VariableNode *>(t);
- if (!var->doc().isEmpty()) {
- if (var->isStatic())
- v[StdStaticVariables].insert(n);
- else
- v[StdVariables].insert(n);
- }
+ case Node::Variable: {
+ const VariableNode *var = static_cast<const VariableNode *>(t);
+ if (!var->doc().isEmpty()) {
+ if (var->isStatic())
+ v[StdStaticVariables].insert(n);
+ else
+ v[StdVariables].insert(n);
}
+ }
return;
- case Node::SharedComment:
- {
- SharedCommentNode *scn = static_cast<SharedCommentNode *>(t);
- if (!scn->doc().isEmpty() && scn->collective().count())
- stdRefPageSwitch(v, scn, scn->collective().first()); // TODO: warn about mixed node types in collective?
- }
+ case Node::SharedComment: {
+ SharedCommentNode *scn = static_cast<SharedCommentNode *>(t);
+ if (!scn->doc().isEmpty() && scn->collective().count())
+ stdRefPageSwitch(
+ v, scn,
+ scn->collective().first()); // TODO: warn about mixed node types in collective?
+ }
return;
default:
return;
@@ -738,24 +738,20 @@ void Sections::distributeNodeInSummaryVector(SectionVector &sv, Node *n)
sv[PrivateSlots].insert(fn);
else
sv[ProtectedSlots].insert(fn);
- }
- else if (fn->isSignal()) {
+ } else if (fn->isSignal()) {
if (fn->isPublic())
sv[Signals].insert(fn);
- }
- else if (fn->isPublic()) {
+ } else if (fn->isPublic()) {
if (fn->isStatic())
sv[StaticPublicMembers].insert(fn);
else if (!sv[PublicFunctions].insertReimplementedMember(fn))
sv[PublicFunctions].insert(fn);
- }
- else if (fn->isPrivate()) {
+ } else if (fn->isPrivate()) {
if (fn->isStatic())
sv[StaticPrivateMembers].insert(fn);
else if (!sv[PrivateFunctions].insertReimplementedMember(fn))
sv[PrivateFunctions].insert(fn);
- }
- else { // protected
+ } else { // protected
if (fn->isStatic())
sv[StaticProtectedMembers].insert(fn);
else if (!sv[ProtectedFunctions].insertReimplementedMember(fn))
@@ -775,8 +771,7 @@ void Sections::distributeNodeInSummaryVector(SectionVector &sv, Node *n)
sv[StaticPrivateMembers].insert(n);
else
sv[StaticProtectedMembers].insert(n);
- }
- else {
+ } else {
if (n->isPublic())
sv[PublicVariables].insert(n);
else if (!n->isPrivate())
@@ -810,7 +805,7 @@ void Sections::distributeNodeInDetailsVector(SectionVector &dv, Node *n)
if (n->isSharingComment())
return;
- // t is the reference node to be tested - typically it's this node (n), but for
+ // t is the reference node to be tested - typically it's this node (n), but for
// shared comment nodes we need to distribute based on the nodes in its collective.
Node *t = n;
@@ -926,7 +921,7 @@ void Sections::distributeQmlNodeInSummaryVector(SectionVector &sv, Node *n, bool
sv[QmlMethods].insert(fn);
}
} else if (n->isSharedCommentNode()) {
- SharedCommentNode *scn = static_cast<SharedCommentNode*>(n);
+ SharedCommentNode *scn = static_cast<SharedCommentNode *>(n);
if (scn->isPropertyGroup()) {
sv[QmlProperties].insert(scn);
} else {
@@ -957,11 +952,9 @@ void Sections::buildStdCppClassRefPageSections()
bool documentAll = true;
if (aggregate_->parent() && !aggregate_->name().isEmpty() && !aggregate_->hasDoc())
documentAll = false;
- for (auto it = aggregate_->constBegin(); it != aggregate_->constEnd();++it) {
+ for (auto it = aggregate_->constBegin(); it != aggregate_->constEnd(); ++it) {
Node *n = *it;
- if (!n->isPrivate()
- && !n->isProperty()
- && !n->isRelatedNonmember()
+ if (!n->isPrivate() && !n->isProperty() && !n->isRelatedNonmember()
&& !n->isSharedCommentNode())
allMembers.insert(n);
if (!documentAll && !n->hasDoc())
@@ -983,14 +976,12 @@ void Sections::buildStdCppClassRefPageSections()
ClassNode *cn = stack.pop();
for (auto it = cn->constBegin(); it != cn->constEnd(); ++it) {
Node *n = *it;
- if (!n->isPrivate()
- && !n->isProperty()
- && !n->isRelatedNonmember()
+ if (!n->isPrivate() && !n->isProperty() && !n->isRelatedNonmember()
&& !n->isSharedCommentNode())
allMembers.insert(n);
if (!documentAll && !n->hasDoc())
continue;
- //distributeNodeInSummaryVector(sv, n); Why was this here? mws 03/07/2019
+ // distributeNodeInSummaryVector(sv, n); Why was this here? mws 03/07/2019
}
pushBaseClasses(stack, cn);
}
@@ -999,14 +990,13 @@ void Sections::buildStdCppClassRefPageSections()
allMembers.reduce();
}
-
/*!
Build the section vectors for a standard reference page,
when the aggregate node is a QML type.
*/
void Sections::buildStdQmlTypeRefPageSections()
{
- ClassMap* classMap = nullptr;
+ ClassMap *classMap = nullptr;
SectionVector &summarySections = stdQmlTypeSummarySections();
SectionVector &detailsSections = stdQmlTypeDetailsSections();
Section &allMembers = allMembersSection();
@@ -1015,7 +1005,7 @@ void Sections::buildStdQmlTypeRefPageSections()
while (true) {
if (!qtn->isAbstract() || !classMap)
classMap = allMembers.newClassMap(qtn);
- for (auto it = qtn->constBegin(); it !=qtn->constEnd(); ++it) {
+ for (auto it = qtn->constBegin(); it != qtn->constEnd(); ++it) {
Node *n = *it;
if (n->isInternal())
continue;
@@ -1028,8 +1018,7 @@ void Sections::buildStdQmlTypeRefPageSections()
}
if (qtn->qmlBaseNode() == qtn) {
qDebug() << "qdoc internal error: circular type definition."
- << "QML type" << qtn->name()
- << "can't be its own base type";
+ << "QML type" << qtn->name() << "can't be its own base type";
qtn = nullptr;
break;
}
@@ -1052,8 +1041,7 @@ void Sections::buildStdQmlTypeRefPageSections()
}
if (qtn->qmlBaseNode() == qtn) {
qDebug() << "qdoc internal error: circular type definition."
- << "QML type" << qtn->name()
- << "can't be its own base type";
+ << "QML type" << qtn->name() << "can't be its own base type";
qtn = nullptr;
break;
}
@@ -1070,7 +1058,8 @@ void Sections::buildStdQmlTypeRefPageSections()
have not been modified. Otherwise, both vectors will contain pointers
to the sections that contain obsolete members.
*/
-bool Sections::hasObsoleteMembers(SectionPtrVector *summary_spv, SectionPtrVector *details_spv) const
+bool Sections::hasObsoleteMembers(SectionPtrVector *summary_spv,
+ SectionPtrVector *details_spv) const
{
const SectionVector *sections = nullptr;
if (aggregate_->isClassNode())
@@ -1096,5 +1085,4 @@ bool Sections::hasObsoleteMembers(SectionPtrVector *summary_spv, SectionPtrVecto
return !summary_spv->isEmpty();
}
-
QT_END_NAMESPACE
diff --git a/src/qdoc/sections.h b/src/qdoc/sections.h
index 9c1514c2d..90596b394 100644
--- a/src/qdoc/sections.h
+++ b/src/qdoc/sections.h
@@ -36,7 +36,7 @@
QT_BEGIN_NAMESPACE
typedef QMultiMap<QString, Node *> MemberMap; // the string is the member signature
-typedef QPair<const QmlTypeNode *, MemberMap> ClassMap; // the node is the QML type
+typedef QPair<const QmlTypeNode *, MemberMap> ClassMap; // the node is the QML type
typedef QVector<ClassMap *> ClassMapList;
typedef QPair<QStringList, NodeVector> KeysAndNodes;
@@ -50,27 +50,30 @@ public:
enum Status { Obsolete, Active };
public:
- Section() : style_(Details), status_(Active), aggregate_(nullptr) { }
+ Section() : style_(Details), status_(Active), aggregate_(nullptr) {}
Section(Style style, Status status);
~Section();
- void init(const QString &title) {
- title_ = title;
- }
- void init(const QString &singular,
- const QString &plural) {
- singular_ = singular; plural_ = plural;
+ void init(const QString &title) { title_ = title; }
+ void init(const QString &singular, const QString &plural)
+ {
+ singular_ = singular;
+ plural_ = plural;
}
- void init(const QString &title,
- const QString &singular,
- const QString &plural) {
- title_ = title; divClass_.clear(); singular_= singular; plural_ = plural;
+ void init(const QString &title, const QString &singular, const QString &plural)
+ {
+ title_ = title;
+ divClass_.clear();
+ singular_ = singular;
+ plural_ = plural;
}
- void init(const QString &title,
- const QString &divClass,
- const QString &singular,
- const QString &plural) {
- title_ = title; divClass_ = divClass; singular_= singular; plural_ = plural;
+ void init(const QString &title, const QString &divClass, const QString &singular,
+ const QString &plural)
+ {
+ title_ = title;
+ divClass_ = divClass;
+ singular_ = singular;
+ plural_ = plural;
}
void insert(Node *node);
@@ -84,11 +87,10 @@ public:
void clear();
void reduce();
- bool isEmpty() const {
- return (memberMap_.isEmpty() &&
- inheritedMembers_.isEmpty() &&
- reimplementedMemberMap_.isEmpty() &&
- classMapList_.isEmpty());
+ bool isEmpty() const
+ {
+ return (memberMap_.isEmpty() && inheritedMembers_.isEmpty()
+ && reimplementedMemberMap_.isEmpty() && classMapList_.isEmpty());
}
Style style() const { return style_; }
@@ -101,7 +103,7 @@ public:
const QStringList &keys(Status t) const { return (t == Obsolete ? obsoleteKeys_ : keys_); }
const NodeVector &members() const { return members_; }
const NodeVector &reimplementedMembers() const { return reimplementedMembers_; }
- const QVector<QPair<Aggregate*, int> > &inheritedMembers() const { return inheritedMembers_; }
+ const QVector<QPair<Aggregate *, int>> &inheritedMembers() const { return inheritedMembers_; }
ClassKeysNodesList &classKeysNodesList() { return classKeysNodesList_; }
const NodeVector &obsoleteMembers() const { return obsoleteMembers_; }
void appendMembers(const NodeVector &nv) { members_.append(nv); }
@@ -112,8 +114,8 @@ private:
QString sortName(const Node *node, const QString *name = nullptr);
private:
- Style style_;
- Status status_;
+ Style style_;
+ Status status_;
QString title_;
QString divClass_;
QString singular_;
@@ -125,7 +127,7 @@ private:
NodeVector members_;
NodeVector obsoleteMembers_;
NodeVector reimplementedMembers_;
- QVector<QPair<Aggregate *, int> > inheritedMembers_;
+ QVector<QPair<Aggregate *, int>> inheritedMembers_;
ClassKeysNodesList classKeysNodesList_;
QMultiMap<QString, Node *> memberMap_;
@@ -247,7 +249,6 @@ private:
static SectionVector stdQmlTypeDetailsSections_;
static SectionVector sinceSections_;
static SectionVector allMembers_;
-
};
QT_END_NAMESPACE
diff --git a/src/qdoc/text.cpp b/src/qdoc/text.cpp
index c80ef00e3..b3e3b4106 100644
--- a/src/qdoc/text.cpp
+++ b/src/qdoc/text.cpp
@@ -38,19 +38,14 @@
QT_BEGIN_NAMESPACE
-Text::Text()
- : first(nullptr), last(nullptr)
-{
-}
+Text::Text() : first(nullptr), last(nullptr) {}
-Text::Text(const QString &str)
- : first(nullptr), last(nullptr)
+Text::Text(const QString &str) : first(nullptr), last(nullptr)
{
operator<<(str);
}
-Text::Text(const Text &text)
- : first(nullptr), last(nullptr)
+Text::Text(const Text &text) : first(nullptr), last(nullptr)
{
operator=(text);
}
@@ -79,22 +74,19 @@ Text &Text::operator<<(const QString &string)
return operator<<(Atom(Atom::String, string));
}
-Text &Text::operator<<(const Atom& atom)
+Text &Text::operator<<(const Atom &atom)
{
if (atom.count() < 2) {
if (first == nullptr) {
first = new Atom(atom.type(), atom.string());
last = first;
- }
- else
+ } else
last = new Atom(last, atom.type(), atom.string());
- }
- else {
+ } else {
if (first == nullptr) {
first = new Atom(atom.type(), atom.string(), atom.string(1));
last = first;
- }
- else
+ } else
last = new Atom(last, atom.type(), atom.string(), atom.string(1));
}
return *this;
@@ -110,8 +102,7 @@ Text &Text::operator<<(const LinkAtom &atom)
if (first == nullptr) {
first = new LinkAtom(atom);
last = first;
- }
- else
+ } else
last = new LinkAtom(last, atom);
return *this;
}
@@ -164,9 +155,8 @@ QString Text::toString() const
QString str;
const Atom *atom = firstAtom();
while (atom != nullptr) {
- if (atom->type() == Atom::String ||
- atom->type() == Atom::AutoLink ||
- atom->type() == Atom::C)
+ if (atom->type() == Atom::String || atom->type() == Atom::AutoLink
+ || atom->type() == Atom::C)
str += atom->string();
atom = atom->next();
}
@@ -180,9 +170,8 @@ bool Text::contains(const QString &str) const
{
const Atom *atom = firstAtom();
while (atom != nullptr) {
- if (atom->type() == Atom::String ||
- atom->type() == Atom::AutoLink ||
- atom->type() == Atom::C)
+ if (atom->type() == Atom::String || atom->type() == Atom::AutoLink
+ || atom->type() == Atom::C)
if (atom->string().contains(str, Qt::CaseInsensitive))
return true;
atom = atom->next();
@@ -190,7 +179,8 @@ bool Text::contains(const QString &str) const
return false;
}
-Text Text::subText(Atom::AtomType left, Atom::AtomType right, const Atom *from, bool inclusive) const
+Text Text::subText(Atom::AtomType left, Atom::AtomType right, const Atom *from,
+ bool inclusive) const
{
const Atom *begin = from ? from : firstAtom();
const Atom *end;
@@ -256,7 +246,8 @@ void Text::dump() const
str.replace(QRegExp("[^\x20-\x7e]"), "?");
if (!str.isEmpty())
str = " \"" + str + QLatin1Char('"');
- fprintf(stderr, " %-15s%s\n", atom->typeString().toLatin1().data(), str.toLatin1().data());
+ fprintf(stderr, " %-15s%s\n", atom->typeString().toLatin1().data(),
+ str.toLatin1().data());
atom = atom->next();
}
}
diff --git a/src/qdoc/text.h b/src/qdoc/text.h
index 7c31fcde0..704a44968 100644
--- a/src/qdoc/text.h
+++ b/src/qdoc/text.h
@@ -51,7 +51,7 @@ public:
Atom *lastAtom() { return last; }
Text &operator<<(Atom::AtomType atomType);
Text &operator<<(const QString &string);
- Text &operator<<(const Atom& atom);
+ Text &operator<<(const Atom &atom);
Text &operator<<(const LinkAtom &atom);
Text &operator<<(const Text &text);
void stripFirstAtom();
@@ -62,7 +62,8 @@ public:
QString toString() const;
const Atom *firstAtom() const { return first; }
const Atom *lastAtom() const { return last; }
- Text subText(Atom::AtomType left, Atom::AtomType right, const Atom *from = nullptr, bool inclusive = false) const;
+ Text subText(Atom::AtomType left, Atom::AtomType right, const Atom *from = nullptr,
+ bool inclusive = false) const;
void dump() const;
void clear();
@@ -72,23 +73,34 @@ public:
static int compare(const Text &text1, const Text &text2);
private:
-
Atom *first;
Atom *last;
};
inline bool operator==(const Text &text1, const Text &text2)
-{ return Text::compare(text1, text2) == 0; }
+{
+ return Text::compare(text1, text2) == 0;
+}
inline bool operator!=(const Text &text1, const Text &text2)
-{ return Text::compare(text1, text2) != 0; }
+{
+ return Text::compare(text1, text2) != 0;
+}
inline bool operator<(const Text &text1, const Text &text2)
-{ return Text::compare(text1, text2) < 0; }
+{
+ return Text::compare(text1, text2) < 0;
+}
inline bool operator<=(const Text &text1, const Text &text2)
-{ return Text::compare(text1, text2) <= 0; }
+{
+ return Text::compare(text1, text2) <= 0;
+}
inline bool operator>(const Text &text1, const Text &text2)
-{ return Text::compare(text1, text2) > 0; }
+{
+ return Text::compare(text1, text2) > 0;
+}
inline bool operator>=(const Text &text1, const Text &text2)
-{ return Text::compare(text1, text2) >= 0; }
+{
+ return Text::compare(text1, text2) >= 0;
+}
QT_END_NAMESPACE
diff --git a/src/qdoc/tokenizer.cpp b/src/qdoc/tokenizer.cpp
index af3837c3a..d15b6d318 100644
--- a/src/qdoc/tokenizer.cpp
+++ b/src/qdoc/tokenizer.cpp
@@ -42,42 +42,69 @@
QT_BEGIN_NAMESPACE
-#define LANGUAGE_CPP "Cpp"
+#define LANGUAGE_CPP "Cpp"
/* qmake ignore Q_OBJECT */
/*
Keep in sync with tokenizer.h.
*/
-static const char *kwords[] = {
- "char", "class", "const", "double", "enum", "explicit",
- "friend", "inline", "int", "long", "namespace", "operator",
- "private", "protected", "public", "short", "signals", "signed",
- "slots", "static", "struct", "template", "typedef", "typename",
- "union", "unsigned", "using", "virtual", "void", "volatile",
- "__int64", "default", "delete", "final", "override",
- "Q_OBJECT",
- "Q_OVERRIDE",
- "Q_PROPERTY",
- "Q_PRIVATE_PROPERTY",
- "Q_DECLARE_SEQUENTIAL_ITERATOR",
- "Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR",
- "Q_DECLARE_ASSOCIATIVE_ITERATOR",
- "Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR",
- "Q_DECLARE_FLAGS",
- "Q_SIGNALS",
- "Q_SLOTS",
- "QT_COMPAT",
- "QT_COMPAT_CONSTRUCTOR",
- "QT_DEPRECATED",
- "QT_MOC_COMPAT",
- "QT_MODULE",
- "QT3_SUPPORT",
- "QT3_SUPPORT_CONSTRUCTOR",
- "QT3_MOC_SUPPORT",
- "QDOC_PROPERTY",
- "QPrivateSignal"
-};
+static const char *kwords[] = { "char",
+ "class",
+ "const",
+ "double",
+ "enum",
+ "explicit",
+ "friend",
+ "inline",
+ "int",
+ "long",
+ "namespace",
+ "operator",
+ "private",
+ "protected",
+ "public",
+ "short",
+ "signals",
+ "signed",
+ "slots",
+ "static",
+ "struct",
+ "template",
+ "typedef",
+ "typename",
+ "union",
+ "unsigned",
+ "using",
+ "virtual",
+ "void",
+ "volatile",
+ "__int64",
+ "default",
+ "delete",
+ "final",
+ "override",
+ "Q_OBJECT",
+ "Q_OVERRIDE",
+ "Q_PROPERTY",
+ "Q_PRIVATE_PROPERTY",
+ "Q_DECLARE_SEQUENTIAL_ITERATOR",
+ "Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR",
+ "Q_DECLARE_ASSOCIATIVE_ITERATOR",
+ "Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR",
+ "Q_DECLARE_FLAGS",
+ "Q_SIGNALS",
+ "Q_SLOTS",
+ "QT_COMPAT",
+ "QT_COMPAT_CONSTRUCTOR",
+ "QT_DEPRECATED",
+ "QT_MOC_COMPAT",
+ "QT_MODULE",
+ "QT3_SUPPORT",
+ "QT3_SUPPORT_CONSTRUCTOR",
+ "QT3_MOC_SUPPORT",
+ "QDOC_PROPERTY",
+ "QPrivateSignal" };
static const int KwordHashTableSize = 4096;
static int kwordHashTable[KwordHashTableSize];
@@ -102,8 +129,7 @@ static QTextCodec *sourceCodec = nullptr;
*/
static int hashKword(const char *s, int len)
{
- return (((uchar) s[0]) + (((uchar) s[2]) << 5) +
- (((uchar) s[len - 1]) << 3)) % KwordHashTableSize;
+ return (((uchar)s[0]) + (((uchar)s[2]) << 5) + (((uchar)s[len - 1]) << 3)) % KwordHashTableSize;
}
static void insertKwordIntoHash(const char *s, int number)
@@ -124,8 +150,7 @@ Tokenizer::Tokenizer(const Location &loc, QFile &in)
start(loc);
}
-Tokenizer::Tokenizer(const Location &loc, const QByteArray &in)
- : yyIn(in)
+Tokenizer::Tokenizer(const Location &loc, const QByteArray &in) : yyIn(in)
{
init();
yyPos = 0;
@@ -152,8 +177,7 @@ int Tokenizer::getToken()
do {
yyCh = getChar();
} while (isspace(yyCh));
- }
- else if (isalpha(yyCh) || yyCh == '_') {
+ } else if (isalpha(yyCh) || yyCh == '_') {
do {
yyCh = getChar();
} while (isalnum(yyCh) || yyCh == '_');
@@ -163,8 +187,7 @@ int Tokenizer::getToken()
int i = kwordHashTable[k];
if (i == 0) {
return Tok_Ident;
- }
- else if (i == -1) {
+ } else if (i == -1) {
if (!parsingMacro && ignoredTokensAndDirectives->contains(yyLex)) {
if (ignoredTokensAndDirectives->value(yyLex)) { // it's a directive
int parenDepth = 0;
@@ -180,9 +203,8 @@ int Tokenizer::getToken()
}
break;
}
- }
- else if (strcmp(yyLex, kwords[i - 1]) == 0) {
- int ret = (int) Tok_FirstKeyword + i - 1;
+ } else if (strcmp(yyLex, kwords[i - 1]) == 0) {
+ int ret = (int)Tok_FirstKeyword + i - 1;
if (ret != Tok_typename)
return ret;
break;
@@ -191,15 +213,12 @@ int Tokenizer::getToken()
if (++k == KwordHashTableSize)
k = 0;
}
- }
- else if (isdigit(yyCh)) {
+ } else if (isdigit(yyCh)) {
do {
yyCh = getChar();
- } while (isalnum(yyCh) || yyCh == '.' || yyCh == '+' ||
- yyCh == '-');
+ } while (isalnum(yyCh) || yyCh == '.' || yyCh == '+' || yyCh == '-');
return Tok_Number;
- }
- else {
+ } else {
switch (yyCh) {
case '!':
case '%':
@@ -234,8 +253,7 @@ int Tokenizer::getToken()
if (yyCh == '=') {
yyCh = getChar();
return Tok_SomeOperator;
- }
- else {
+ } else {
return Tok_Ampersand;
}
case '\'':
@@ -255,8 +273,7 @@ int Tokenizer::getToken()
if (yyCh == EOF) {
yyTokLoc.warning(tr("Unterminated C++ character literal"));
- }
- else {
+ } else {
yyCh = getChar();
return Tok_Number;
}
@@ -328,8 +345,7 @@ int Tokenizer::getToken()
} else if (isdigit(yyCh)) {
do {
yyCh = getChar();
- } while (isalnum(yyCh) || yyCh == '.' || yyCh == '+' ||
- yyCh == '-');
+ } while (isalnum(yyCh) || yyCh == '.' || yyCh == '+' || yyCh == '-');
return Tok_Number;
}
return Tok_SomeOperator;
@@ -462,10 +478,11 @@ int Tokenizer::getToken()
default:
// ### We should really prevent qdoc from looking at snippet files rather than
// ### suppress warnings when reading them.
- if (yyNumPreprocessorSkipping == 0 && !(yyTokLoc.fileName().endsWith(".qdoc") ||
- yyTokLoc.fileName().endsWith(".js"))) {
- yyTokLoc.warning(tr("Hostile character 0x%1 in C++ source")
- .arg((uchar)yyCh, 1, 16));
+ if (yyNumPreprocessorSkipping == 0
+ && !(yyTokLoc.fileName().endsWith(".qdoc")
+ || yyTokLoc.fileName().endsWith(".js"))) {
+ yyTokLoc.warning(
+ tr("Hostile character 0x%1 in C++ source").arg((uchar)yyCh, 1, 16));
}
yyCh = getChar();
}
@@ -526,8 +543,8 @@ void Tokenizer::initialize(const Config &config)
insertKwordIntoHash(tb.data(), -1);
}
- const QStringList directives = config.getStringList(LANGUAGE_CPP + Config::dot
- + CONFIG_IGNOREDIRECTIVES);
+ const QStringList directives =
+ config.getStringList(LANGUAGE_CPP + Config::dot + CONFIG_IGNOREDIRECTIVES);
for (const auto &directive : directives) {
const QByteArray db = directive.toLatin1();
ignoredTokensAndDirectives->insert(db, true);
@@ -558,8 +575,8 @@ void Tokenizer::terminate()
void Tokenizer::init()
{
- yyLexBuf1 = new char[(int) yyLexBufSize];
- yyLexBuf2 = new char[(int) yyLexBufSize];
+ yyLexBuf1 = new char[(int)yyLexBufSize];
+ yyLexBuf2 = new char[(int)yyLexBufSize];
yyPrevLex = yyLexBuf1;
yyPrevLex[0] = '\0';
yyLex = yyLexBuf2;
@@ -754,11 +771,9 @@ bool Tokenizer::isTrue(const QString &condition)
}
}
if (firstOr != -1)
- return isTrue(condition.left(firstOr)) ||
- isTrue(condition.mid(firstOr + 2));
+ return isTrue(condition.left(firstOr)) || isTrue(condition.mid(firstOr + 2));
if (firstAnd != -1)
- return isTrue(condition.left(firstAnd)) &&
- isTrue(condition.mid(firstAnd + 2));
+ return isTrue(condition.left(firstAnd)) && isTrue(condition.mid(firstAnd + 2));
QString t = condition.simplified();
if (t.isEmpty())
diff --git a/src/qdoc/tokenizer.h b/src/qdoc/tokenizer.h
index 2f0c1937c..4f35090fe 100644
--- a/src/qdoc/tokenizer.h
+++ b/src/qdoc/tokenizer.h
@@ -49,30 +49,93 @@ QT_BEGIN_NAMESPACE
tokenizer.cpp as well, and possibly adjust Tok_FirstKeyword and
Tok_LastKeyword.
*/
-enum { Tok_Eoi, Tok_Ampersand, Tok_Aster, Tok_Caret, Tok_LeftParen,
- Tok_RightParen, Tok_LeftParenAster, Tok_Equal, Tok_LeftBrace,
- Tok_RightBrace, Tok_Semicolon, Tok_Colon, Tok_LeftAngle,
- Tok_RightAngle, Tok_Comma, Tok_Ellipsis, Tok_Gulbrandsen,
- Tok_LeftBracket, Tok_RightBracket, Tok_Tilde, Tok_SomeOperator,
- Tok_Number, Tok_String, Tok_Doc, Tok_Comment, Tok_Ident, Tok_At,
- Tok_char, Tok_class, Tok_const, Tok_double, Tok_enum,
- Tok_explicit, Tok_friend, Tok_inline, Tok_int, Tok_long,
- Tok_namespace, Tok_operator, Tok_private, Tok_protected,
- Tok_public, Tok_short, Tok_signals, Tok_signed, Tok_slots,
- Tok_static, Tok_struct, Tok_template, Tok_typedef,
- Tok_typename, Tok_union, Tok_unsigned, Tok_using, Tok_virtual,
- Tok_void, Tok_volatile, Tok_int64, Tok_default, Tok_delete, Tok_final,
- Tok_override,
- Tok_Q_OBJECT, Tok_Q_OVERRIDE,
- Tok_Q_PROPERTY, Tok_Q_PRIVATE_PROPERTY, Tok_Q_DECLARE_SEQUENTIAL_ITERATOR,
- Tok_Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR,
- Tok_Q_DECLARE_ASSOCIATIVE_ITERATOR,
- Tok_Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR,
- Tok_Q_DECLARE_FLAGS, Tok_Q_SIGNALS, Tok_Q_SLOTS, Tok_QT_COMPAT,
- Tok_QT_COMPAT_CONSTRUCTOR, Tok_QT_DEPRECATED, Tok_QT_MOC_COMPAT,
- Tok_QT_MODULE, Tok_QT3_SUPPORT, Tok_QT3_SUPPORT_CONSTRUCTOR,
- Tok_QT3_MOC_SUPPORT, Tok_QDOC_PROPERTY, Tok_QPrivateSignal,
- Tok_FirstKeyword = Tok_char, Tok_LastKeyword = Tok_QPrivateSignal };
+enum {
+ Tok_Eoi,
+ Tok_Ampersand,
+ Tok_Aster,
+ Tok_Caret,
+ Tok_LeftParen,
+ Tok_RightParen,
+ Tok_LeftParenAster,
+ Tok_Equal,
+ Tok_LeftBrace,
+ Tok_RightBrace,
+ Tok_Semicolon,
+ Tok_Colon,
+ Tok_LeftAngle,
+ Tok_RightAngle,
+ Tok_Comma,
+ Tok_Ellipsis,
+ Tok_Gulbrandsen,
+ Tok_LeftBracket,
+ Tok_RightBracket,
+ Tok_Tilde,
+ Tok_SomeOperator,
+ Tok_Number,
+ Tok_String,
+ Tok_Doc,
+ Tok_Comment,
+ Tok_Ident,
+ Tok_At,
+ Tok_char,
+ Tok_class,
+ Tok_const,
+ Tok_double,
+ Tok_enum,
+ Tok_explicit,
+ Tok_friend,
+ Tok_inline,
+ Tok_int,
+ Tok_long,
+ Tok_namespace,
+ Tok_operator,
+ Tok_private,
+ Tok_protected,
+ Tok_public,
+ Tok_short,
+ Tok_signals,
+ Tok_signed,
+ Tok_slots,
+ Tok_static,
+ Tok_struct,
+ Tok_template,
+ Tok_typedef,
+ Tok_typename,
+ Tok_union,
+ Tok_unsigned,
+ Tok_using,
+ Tok_virtual,
+ Tok_void,
+ Tok_volatile,
+ Tok_int64,
+ Tok_default,
+ Tok_delete,
+ Tok_final,
+ Tok_override,
+ Tok_Q_OBJECT,
+ Tok_Q_OVERRIDE,
+ Tok_Q_PROPERTY,
+ Tok_Q_PRIVATE_PROPERTY,
+ Tok_Q_DECLARE_SEQUENTIAL_ITERATOR,
+ Tok_Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR,
+ Tok_Q_DECLARE_ASSOCIATIVE_ITERATOR,
+ Tok_Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR,
+ Tok_Q_DECLARE_FLAGS,
+ Tok_Q_SIGNALS,
+ Tok_Q_SLOTS,
+ Tok_QT_COMPAT,
+ Tok_QT_COMPAT_CONSTRUCTOR,
+ Tok_QT_DEPRECATED,
+ Tok_QT_MOC_COMPAT,
+ Tok_QT_MODULE,
+ Tok_QT3_SUPPORT,
+ Tok_QT3_SUPPORT_CONSTRUCTOR,
+ Tok_QT3_MOC_SUPPORT,
+ Tok_QDOC_PROPERTY,
+ Tok_QPrivateSignal,
+ Tok_FirstKeyword = Tok_char,
+ Tok_LastKeyword = Tok_QPrivateSignal
+};
/*
The Tokenizer class implements lexical analysis of C++ source
@@ -120,17 +183,14 @@ private:
*/
enum { yyLexBufSize = 524288 };
- int getch()
- {
- return yyPos == yyIn.size() ? EOF : yyIn[yyPos++];
- }
+ int getch() { return yyPos == yyIn.size() ? EOF : yyIn[yyPos++]; }
inline int getChar()
{
if (yyCh == EOF)
return EOF;
if (yyLexLen < yyLexBufSize - 1) {
- yyLex[yyLexLen++] = (char) yyCh;
+ yyLex[yyLexLen++] = (char)yyCh;
yyLex[yyLexLen] = '\0';
}
yyCurLoc.advance(yyCh);
diff --git a/src/qdoc/tree.cpp b/src/qdoc/tree.cpp
index 6ff473bdc..718b16fc5 100644
--- a/src/qdoc/tree.cpp
+++ b/src/qdoc/tree.cpp
@@ -144,7 +144,8 @@ Node *Tree::findNodeForInclude(const QStringList &path) const
Aggregate *Tree::findAggregate(const QString &name)
{
QStringList path = name.split(QLatin1String("::"));
- return static_cast<Aggregate *>(findNodeRecursive(path, 0, const_cast<NamespaceNode *>(root()), &Node::isFirstClassAggregate));
+ return static_cast<Aggregate *>(findNodeRecursive(path, 0, const_cast<NamespaceNode *>(root()),
+ &Node::isFirstClassAggregate));
}
/*!
@@ -217,8 +218,7 @@ Aggregate *Tree::findRelatesNode(const QStringList &path)
Inserts function name \a funcName and function role \a funcRole into
the property function map for the specified \a property.
*/
-void Tree::addPropertyFunction(PropertyNode *property,
- const QString &funcName,
+void Tree::addPropertyFunction(PropertyNode *property, const QString &funcName,
PropertyNode::FunctionRole funcRole)
{
unresolvedPropertyMap[property].insert(funcRole, funcName);
@@ -295,7 +295,7 @@ void Tree::resolvePropertyOverriddenFromPtrs(Aggregate *n)
void Tree::resolveProperties()
{
for (auto propEntry = unresolvedPropertyMap.constBegin();
- propEntry != unresolvedPropertyMap.constEnd(); ++propEntry) {
+ propEntry != unresolvedPropertyMap.constEnd(); ++propEntry) {
PropertyNode *property = propEntry.key();
Aggregate *parent = property->parent();
QString getterName = (*propEntry)[PropertyNode::Getter];
@@ -306,19 +306,15 @@ void Tree::resolveProperties()
for (auto it = parent->constBegin(); it != parent->constEnd(); ++it) {
if ((*it)->isFunction()) {
FunctionNode *function = static_cast<FunctionNode *>(*it);
- if (function->access() == property->access() &&
- (function->status() == property->status() ||
- function->doc().isEmpty())) {
+ if (function->access() == property->access()
+ && (function->status() == property->status() || function->doc().isEmpty())) {
if (function->name() == getterName) {
property->addFunction(function, PropertyNode::Getter);
- }
- else if (function->name() == setterName) {
+ } else if (function->name() == setterName) {
property->addFunction(function, PropertyNode::Setter);
- }
- else if (function->name() == resetterName) {
+ } else if (function->name() == resetterName) {
property->addFunction(function, PropertyNode::Resetter);
- }
- else if (function->name() == notifierName) {
+ } else if (function->name() == notifierName) {
property->addSignal(function, PropertyNode::Notifier);
}
}
@@ -327,7 +323,7 @@ void Tree::resolveProperties()
}
for (auto propEntry = unresolvedPropertyMap.constBegin();
- propEntry != unresolvedPropertyMap.constEnd(); ++propEntry) {
+ propEntry != unresolvedPropertyMap.constEnd(); ++propEntry) {
PropertyNode *property = propEntry.key();
// redo it to set the property functions
if (property->overriddenFrom())
@@ -422,7 +418,7 @@ ClassList Tree::allBaseClasses(const ClassNode *classNode) const
search at the tree root. \a subtype is not used unless
\a type is \c{Page}.
*/
-Node *Tree::findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch) () const) const
+Node *Tree::findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch)() const) const
{
return findNodeRecursive(path, 0, root(), isMatch);
}
@@ -443,10 +439,8 @@ Node *Tree::findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch)
If the algorithm is successful, the pointer to the final
node is returned. Otherwise 0 is returned.
*/
-Node *Tree::findNodeRecursive(const QStringList &path,
- int pathIndex,
- const Node *start,
- bool (Node::*isMatch) () const) const
+Node *Tree::findNodeRecursive(const QStringList &path, int pathIndex, const Node *start,
+ bool (Node::*isMatch)() const) const
{
if (start == nullptr || path.isEmpty())
return nullptr;
@@ -460,13 +454,12 @@ Node *Tree::findNodeRecursive(const QStringList &path,
if (node == nullptr)
continue;
if (node->name() == name) {
- if (pathIndex+1 >= path.size()) {
+ if (pathIndex + 1 >= path.size()) {
if ((node->*(isMatch))())
return node;
continue;
- }
- else { // Search the children of n for the next name in the path.
- node = findNodeRecursive(path, pathIndex+1, node, isMatch);
+ } else { // Search the children of n for the next name in the path.
+ node = findNodeRecursive(path, pathIndex + 1, node, isMatch);
if (node != nullptr)
return node;
}
@@ -488,11 +481,8 @@ Node *Tree::findNodeRecursive(const QStringList &path,
If a matching node is found, \a ref is an output parameter that
is set to the HTML reference to use for the link.
*/
-const Node *Tree::findNodeForTarget(const QStringList &path,
- const QString &target,
- const Node *start,
- int flags,
- Node::Genus genus,
+const Node *Tree::findNodeForTarget(const QStringList &path, const QString &target,
+ const Node *start, int flags, Node::Genus genus,
QString &ref) const
{
const Node *node = nullptr;
@@ -533,8 +523,8 @@ const Node *Tree::findNodeForTarget(const QStringList &path,
type node.
*/
int path_idx = 0;
- if (((genus == Node::QML) || (genus == Node::DontCare)) &&
- (path.size() >= 2) && !path[0].isEmpty()) {
+ if (((genus == Node::QML) || (genus == Node::DontCare)) && (path.size() >= 2)
+ && !path[0].isEmpty()) {
QmlTypeNode *qcn = lookupQmlType(QString(path[0] + "::" + path[1]));
if (qcn) {
current = qcn;
@@ -544,8 +534,7 @@ const Node *Tree::findNodeForTarget(const QStringList &path,
if (!ref.isEmpty())
return current;
return nullptr;
- }
- else
+ } else
return current;
}
path_idx = 2;
@@ -554,7 +543,8 @@ const Node *Tree::findNodeForTarget(const QStringList &path,
while (current != nullptr) {
if (current->isAggregate()) { // Should this be isPageNode() ???
- const Node *node = matchPathAndTarget(path, path_idx, target, current, flags, genus, ref);
+ const Node *node =
+ matchPathAndTarget(path, path_idx, target, current, flags, genus, ref);
if (node)
return node;
}
@@ -584,12 +574,8 @@ const Node *Tree::findNodeForTarget(const QStringList &path,
\a path is a not a fully-qualified name. \a node is
most often the root of this Tree.
*/
-const Node *Tree::matchPathAndTarget(const QStringList &path,
- int idx,
- const QString &target,
- const Node *node,
- int flags,
- Node::Genus genus,
+const Node *Tree::matchPathAndTarget(const QStringList &path, int idx, const QString &target,
+ const Node *node, int flags, Node::Genus genus,
QString &ref) const
{
/*
@@ -621,21 +607,22 @@ const Node *Tree::matchPathAndTarget(const QStringList &path,
}
}
if (target.isEmpty()) {
- if ((idx) == (path.size()-1) && node->isAggregate() && (flags & SearchEnumValues)) {
- const Node *t = static_cast<const Aggregate *>(node)->findEnumNodeForValue(path.at(idx));
+ if ((idx) == (path.size() - 1) && node->isAggregate() && (flags & SearchEnumValues)) {
+ const Node *t =
+ static_cast<const Aggregate *>(node)->findEnumNodeForValue(path.at(idx));
if (t)
return t;
}
}
- if (((genus == Node::CPP) || (genus == Node::DontCare)) &&
- node->isClassNode() && (flags & SearchBaseClasses)) {
+ if (((genus == Node::CPP) || (genus == Node::DontCare)) && node->isClassNode()
+ && (flags & SearchBaseClasses)) {
const ClassList bases = allBaseClasses(static_cast<const ClassNode *>(node));
for (const auto *base : bases) {
const Node *t = matchPathAndTarget(path, idx, target, base, flags, genus, ref);
- if (t && ! t->isPrivate())
+ if (t && !t->isPrivate())
return t;
if (target.isEmpty()) {
- if ((idx) == (path.size()-1) && (flags & SearchEnumValues)) {
+ if ((idx) == (path.size() - 1) && (flags & SearchEnumValues)) {
t = base->findEnumNodeForValue(path.at(idx));
if (t)
return t;
@@ -652,9 +639,7 @@ const Node *Tree::matchPathAndTarget(const QStringList &path,
recursively if no match is found. The \a flags are used to
restrict the search.
*/
-const Node *Tree::findNode(const QStringList &path,
- const Node *start,
- int flags,
+const Node *Tree::findNode(const QStringList &path, const Node *start, int flags,
Node::Genus genus) const
{
const Node *current = start;
@@ -674,8 +659,8 @@ const Node *Tree::findNode(const QStringList &path,
If the answer is yes, the reference identifies a QML
type node.
*/
- if (((genus == Node::QML) || (genus == Node::DontCare)) &&
- (path.size() >= 2) && !path[0].isEmpty()) {
+ if (((genus == Node::QML) || (genus == Node::DontCare)) && (path.size() >= 2)
+ && !path[0].isEmpty()) {
QmlTypeNode *qcn = lookupQmlType(QString(path[0] + "::" + path[1]));
if (qcn != nullptr) {
node = qcn;
@@ -689,16 +674,18 @@ const Node *Tree::findNode(const QStringList &path,
if (node == nullptr || !node->isAggregate())
break;
- // Clear the TypesOnly flag until the last path segment, as e.g. namespaces are not types.
- // We also ignore module nodes as they are not aggregates and thus have no children.
+ // Clear the TypesOnly flag until the last path segment, as e.g. namespaces are not
+ // types. We also ignore module nodes as they are not aggregates and thus have no
+ // children.
int tmpFlags = (i < path.size() - 1) ? (flags & ~TypesOnly) | IgnoreModules : flags;
- const Node *next = static_cast<const Aggregate *>(node)->findChildNode(path.at(i), genus, tmpFlags);
- if ((next == nullptr) && (flags & SearchEnumValues) && i == path.size()-1) {
+ const Node *next = static_cast<const Aggregate *>(node)->findChildNode(path.at(i),
+ genus, tmpFlags);
+ if ((next == nullptr) && (flags & SearchEnumValues) && i == path.size() - 1) {
next = static_cast<const Aggregate *>(node)->findEnumNodeForValue(path.at(i));
}
- if ((next == nullptr) && ((genus == Node::CPP) || (genus == Node::DontCare)) &&
- node->isClassNode() && (flags & SearchBaseClasses)) {
+ if ((next == nullptr) && ((genus == Node::CPP) || (genus == Node::DontCare))
+ && node->isClassNode() && (flags & SearchBaseClasses)) {
const ClassList bases = allBaseClasses(static_cast<const ClassNode *>(node));
for (const auto *base : bases) {
next = base->findChildNode(path.at(i), genus, tmpFlags);
@@ -752,11 +739,8 @@ QString Tree::getRef(const QString &target, const Node *node) const
the \a node, the \a priority. and a canonicalized form of
the \a name, which is later used.
*/
-void Tree::insertTarget(const QString &name,
- const QString &title,
- TargetRec::TargetType type,
- Node *node,
- int priority)
+void Tree::insertTarget(const QString &name, const QString &title, TargetRec::TargetType type,
+ Node *node, int priority)
{
TargetRec *target = new TargetRec(name, title, type, node, priority);
nodesByTargetRef_.insert(name, target);
@@ -838,8 +822,8 @@ void Tree::resolveTargets(Aggregate *root)
This function searches for a \a target anchor node. If it
finds one, it sets \a ref and returns the found node.
*/
-const Node*
-Tree::findUnambiguousTarget(const QString &target, Node::Genus genus, QString &ref) const
+const Node *Tree::findUnambiguousTarget(const QString &target, Node::Genus genus,
+ QString &ref) const
{
int numBestTargets = 0;
TargetRec *bestTarget = nullptr;
@@ -856,8 +840,7 @@ Tree::findUnambiguousTarget(const QString &target, Node::Genus genus, QString &r
bestTargetList.clear();
bestTargetList.append(candidate);
numBestTargets = 1;
- }
- else if (candidate->priority_ == bestTarget->priority_) {
+ } else if (candidate->priority_ == bestTarget->priority_) {
bestTargetList.append(candidate);
++numBestTargets;
}
@@ -881,8 +864,7 @@ Tree::findUnambiguousTarget(const QString &target, Node::Genus genus, QString &r
bestTargetList.clear();
bestTargetList.append(candidate);
numBestTargets = 1;
- }
- else if (candidate->priority_ == bestTarget->priority_) {
+ } else if (candidate->priority_ == bestTarget->priority_) {
bestTargetList.append(candidate);
++numBestTargets;
}
@@ -923,7 +905,8 @@ const PageNode *Tree::findPageNodeByTitle(const QString &title) const
++j;
}
if (j != pageNodesByTitle_.cend()) {
- it.value()->location().warning("This page title exists in more than one file: " + title);
+ it.value()->location().warning("This page title exists in more than one file: "
+ + title);
j.value()->location().warning("[It also exists here]");
}
}
@@ -1157,7 +1140,7 @@ CollectionNode *Tree::addToQmlModule(const QString &name, Node *node)
node->setQmlModule(cn);
if (node->isQmlType()) {
QmlTypeNode *n = static_cast<QmlTypeNode *>(node);
- for (int i=0; i<qmid.size(); ++i) {
+ for (int i = 0; i < qmid.size(); ++i) {
QString key = qmid[i] + "::" + node->name();
insertQmlType(key, n);
}
@@ -1188,7 +1171,7 @@ CollectionNode *Tree::addToJsModule(const QString &name, Node *node)
node->setQmlModule(cn);
if (node->isJsType()) {
QmlTypeNode *n = static_cast<QmlTypeNode *>(node);
- for (int i=0; i<qmid.size(); ++i) {
+ for (int i = 0; i < qmid.size(); ++i) {
QString key = qmid[i] + "::" + node->name();
insertQmlType(key, n);
}
@@ -1203,7 +1186,7 @@ CollectionNode *Tree::addToJsModule(const QString &name, Node *node)
void Tree::insertQmlType(const QString &key, QmlTypeNode *n)
{
if (!qmlTypeMap_.contains(key))
- qmlTypeMap_.insert(key,n);
+ qmlTypeMap_.insert(key, n);
}
/*!
@@ -1218,13 +1201,11 @@ void Tree::insertQmlType(const QString &key, QmlTypeNode *n)
pointer to it is returned. Otherwise, nullis returned. If
\a relative is ull, the search begins at the tree root.
*/
-const FunctionNode *Tree::findFunctionNode(const QStringList &path,
- const Parameters &parameters,
- const Node *relative,
- Node::Genus genus) const
+const FunctionNode *Tree::findFunctionNode(const QStringList &path, const Parameters &parameters,
+ const Node *relative, Node::Genus genus) const
{
- if (path.size() == 3 && !path[0].isEmpty() &&
- ((genus == Node::QML) || (genus == Node::DontCare))) {
+ if (path.size() == 3 && !path[0].isEmpty()
+ && ((genus == Node::QML) || (genus == Node::DontCare))) {
QmlTypeNode *qcn = lookupQmlType(QString(path[0] + "::" + path[1]));
if (qcn == nullptr) {
QStringList p(path[1]);
@@ -1307,11 +1288,8 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path,
The node \a t
*/
-QString Tree::getNewLinkTarget(const Node *locNode,
- const Node *t,
- const QString &fileName,
- QString &text,
- bool broken)
+QString Tree::getNewLinkTarget(const Node *locNode, const Node *t, const QString &fileName,
+ QString &text, bool broken)
{
QString physicalModuleName;
if (t != nullptr && !broken) {
@@ -1319,8 +1297,7 @@ QString Tree::getNewLinkTarget(const Node *locNode,
if (tree != this)
tree->incrementLinkCount();
physicalModuleName = tree->physicalModuleName();
- }
- else
+ } else
physicalModuleName = "broken";
incrementLinkCount();
QString target = QString("qa-target-%1").arg(-(linkCount()));
@@ -1330,8 +1307,7 @@ QString Tree::getNewLinkTarget(const Node *locNode,
if (it == targetListMap_->end()) {
tList = new TargetList;
it = targetListMap_->insert(physicalModuleName, tList);
- }
- else
+ } else
tList = it.value();
tList->append(tloc);
return target;
diff --git a/src/qdoc/tree.h b/src/qdoc/tree.h
index 0d56425dc..b7e4dce75 100644
--- a/src/qdoc/tree.h
+++ b/src/qdoc/tree.h
@@ -47,12 +47,10 @@ struct TargetRec
public:
enum TargetType { Unknown, Target, Keyword, Contents, Class, Function, Page, Subtitle };
- TargetRec(const QString &name,
- const QString &title,
- TargetRec::TargetType type,
- Node *node,
+ TargetRec(const QString &name, const QString &title, TargetRec::TargetType type, Node *node,
int priority)
- : node_(node), ref_(name), title_(title), priority_(priority), type_(type) {
+ : node_(node), ref_(name), title_(title), priority_(priority), type_(type)
+ {
// Discard the dedicated ref for keywords - they always
// link to the top of the QDoc comment they appear in
if (type == Keyword)
@@ -72,8 +70,11 @@ public:
struct TargetLoc
{
public:
- TargetLoc(const Node *loc, const QString &t, const QString &fileName, const QString &text, bool broken)
- : loc_(loc), target_(t), fileName_(fileName), text_(text), broken_(broken) { }
+ TargetLoc(const Node *loc, const QString &t, const QString &fileName, const QString &text,
+ bool broken)
+ : loc_(loc), target_(t), fileName_(fileName), text_(text), broken_(broken)
+ {
+ }
const Node *loc_;
QString target_;
QString fileName_;
@@ -119,52 +120,34 @@ private: // The rest of the class is private.
Node *findNodeForInclude(const QStringList &path) const;
ClassNode *findClassNode(const QStringList &path, const Node *start = nullptr) const;
NamespaceNode *findNamespaceNode(const QStringList &path) const;
- const FunctionNode *findFunctionNode(const QStringList &path,
- const Parameters &parameters,
- const Node *relative,
- Node::Genus genus) const;
- Node *findNodeRecursive(const QStringList &path,
- int pathIndex,
- const Node *start,
- bool (Node::*) () const) const;
- const Node *findNodeForTarget(const QStringList &path,
- const QString &target,
- const Node *node,
- int flags,
- Node::Genus genus,
- QString &ref) const;
- const Node *matchPathAndTarget(const QStringList &path,
- int idx,
- const QString &target,
- const Node *node,
- int flags,
- Node::Genus genus,
+ const FunctionNode *findFunctionNode(const QStringList &path, const Parameters &parameters,
+ const Node *relative, Node::Genus genus) const;
+ Node *findNodeRecursive(const QStringList &path, int pathIndex, const Node *start,
+ bool (Node::*)() const) const;
+ const Node *findNodeForTarget(const QStringList &path, const QString &target, const Node *node,
+ int flags, Node::Genus genus, QString &ref) const;
+ const Node *matchPathAndTarget(const QStringList &path, int idx, const QString &target,
+ const Node *node, int flags, Node::Genus genus,
QString &ref) const;
- const Node *findNode(const QStringList &path,
- const Node *relative,
- int flags,
+ const Node *findNode(const QStringList &path, const Node *relative, int flags,
Node::Genus genus) const;
QmlTypeNode *findQmlTypeNode(const QStringList &path);
- Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch) () const) const;
+ Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch)() const) const;
Aggregate *findRelatesNode(const QStringList &path);
QString getRef(const QString &target, const Node *node) const;
- void insertTarget(const QString &name,
- const QString &title,
- TargetRec::TargetType type,
- Node *node,
- int priority);
+ void insertTarget(const QString &name, const QString &title, TargetRec::TargetType type,
+ Node *node, int priority);
void resolveTargets(Aggregate *root);
const Node *findUnambiguousTarget(const QString &target, Node::Genus genus, QString &ref) const;
const PageNode *findPageNodeByTitle(const QString &title) const;
- void addPropertyFunction(PropertyNode *property,
- const QString &funcName,
+ void addPropertyFunction(PropertyNode *property, const QString &funcName,
PropertyNode::FunctionRole funcRole);
void resolveBaseClasses(Aggregate *n);
- void resolveBaseClassesHelper(int pass, ClassNode* cn);
+ void resolveBaseClassesHelper(int pass, ClassNode *cn);
void resolvePropertyOverriddenFromPtrs(Aggregate *n);
void resolveProperties();
void resolveCppToQmlLinks();
@@ -187,8 +170,14 @@ private: // The rest of the class is private.
CollectionNode *findGroup(const QString &name) { return findCollection(name, Node::Group); }
CollectionNode *findModule(const QString &name) { return findCollection(name, Node::Module); }
- CollectionNode *findQmlModule(const QString &name) { return findCollection(name, Node::QmlModule); }
- CollectionNode *findJsModule(const QString &name) { return findCollection(name, Node::JsModule); }
+ CollectionNode *findQmlModule(const QString &name)
+ {
+ return findCollection(name, Node::QmlModule);
+ }
+ CollectionNode *findJsModule(const QString &name)
+ {
+ return findCollection(name, Node::JsModule);
+ }
CollectionNode *addGroup(const QString &name) { return findGroup(name); }
CollectionNode *addModule(const QString &name) { return findModule(name); }
@@ -211,12 +200,9 @@ private: // The rest of the class is private.
bool docsHaveBeenGenerated() const { return docsHaveBeenGenerated_; }
void setTreeHasBeenAnalyzed() { treeHasBeenAnalyzed_ = true; }
void setdocsHaveBeenGenerated() { docsHaveBeenGenerated_ = true; }
- QString getNewLinkTarget(const Node *locNode,
- const Node *t,
- const QString &fileName,
- QString &text,
- bool broken);
- TargetList* getTargetList(const QString &module);
+ QString getNewLinkTarget(const Node *locNode, const Node *t, const QString &fileName,
+ QString &text, bool broken);
+ TargetList *getTargetList(const QString &module);
QStringList getTargetListKeys() { return targetListMap_->keys(); }
FunctionNode *findFunctionNodeForTag(const QString &tag, Aggregate *parent = nullptr);
FunctionNode *findMacroNode(const QString &t, const Aggregate *parent = nullptr);
diff --git a/src/qdoc/utilities.cpp b/src/qdoc/utilities.cpp
index 308bb2c66..5bcafe0a7 100644
--- a/src/qdoc/utilities.cpp
+++ b/src/qdoc/utilities.cpp
@@ -35,25 +35,25 @@
\brief This namespace holds QDoc-internal utility methods.
*/
namespace Utilities {
- static inline void setDebugEnabled(bool value)
- {
- const_cast<QLoggingCategory &>(lcQdoc()).setEnabled(QtDebugMsg, value);
- }
+static inline void setDebugEnabled(bool value)
+{
+ const_cast<QLoggingCategory &>(lcQdoc()).setEnabled(QtDebugMsg, value);
+}
- void startDebugging(const QString &message)
- {
- setDebugEnabled(true);
- qCDebug(lcQdoc, "START DEBUGGING: %ls", qUtf16Printable(message));
- }
+void startDebugging(const QString &message)
+{
+ setDebugEnabled(true);
+ qCDebug(lcQdoc, "START DEBUGGING: %ls", qUtf16Printable(message));
+}
- void stopDebugging(const QString &message)
- {
- qCDebug(lcQdoc, "STOP DEBUGGING: %ls", qUtf16Printable(message));
- setDebugEnabled(false);
- }
+void stopDebugging(const QString &message)
+{
+ qCDebug(lcQdoc, "STOP DEBUGGING: %ls", qUtf16Printable(message));
+ setDebugEnabled(false);
+}
- bool debugging()
- {
- return lcQdoc().isEnabled(QtDebugMsg);
- }
+bool debugging()
+{
+ return lcQdoc().isEnabled(QtDebugMsg);
+}
}
diff --git a/src/qdoc/utilities.h b/src/qdoc/utilities.h
index da848795e..841099aea 100644
--- a/src/qdoc/utilities.h
+++ b/src/qdoc/utilities.h
@@ -31,11 +31,10 @@
#include <QtCore/qstring.h>
-namespace Utilities
-{
- void startDebugging(const QString &message);
- void stopDebugging(const QString &message);
- bool debugging();
+namespace Utilities {
+void startDebugging(const QString &message);
+void stopDebugging(const QString &message);
+bool debugging();
};
#endif // UTILITIES_H
diff --git a/src/qdoc/webxmlgenerator.cpp b/src/qdoc/webxmlgenerator.cpp
index 330f3d474..c7312d418 100644
--- a/src/qdoc/webxmlgenerator.cpp
+++ b/src/qdoc/webxmlgenerator.cpp
@@ -41,7 +41,6 @@ QT_BEGIN_NAMESPACE
static CodeMarker *marker_ = nullptr;
-
void WebXMLGenerator::initializeGenerator(const Config &config)
{
HtmlGenerator::initializeGenerator(config);
@@ -71,9 +70,7 @@ QString WebXMLGenerator::fileExtension() const
Some pages produce supplementary output while being generated, and that's
handled here.
*/
-int WebXMLGenerator::generateAtom(const Atom *atom,
- const Node *relative,
- CodeMarker *marker)
+int WebXMLGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker)
{
if (supplement && currentWriter)
addAtomElements(*currentWriter.data(), atom, relative, marker);
@@ -120,9 +117,8 @@ void WebXMLGenerator::generatePageNode(PageNode *pn, CodeMarker * /* marker */)
endSubPage();
}
-void WebXMLGenerator::generateExampleFilePage(const Node *en,
- const QString &file,
- CodeMarker * /* marker */)
+void WebXMLGenerator::generateExampleFilePage(const Node *en, const QString &file,
+ CodeMarker * /* marker */)
{
QByteArray data;
QXmlStreamWriter writer(&data);
@@ -140,9 +136,8 @@ void WebXMLGenerator::generateExampleFilePage(const Node *en,
writer.writeAttribute("subtitle", file);
writer.writeStartElement("description");
QString userFriendlyFilePath; // unused
- writer.writeAttribute("path", Doc::resolveFile(en->doc().location(),
- file,
- &userFriendlyFilePath));
+ writer.writeAttribute("path",
+ Doc::resolveFile(en->doc().location(), file, &userFriendlyFilePath));
writer.writeAttribute("line", "0");
writer.writeAttribute("column", "0");
@@ -151,14 +146,12 @@ void WebXMLGenerator::generateExampleFilePage(const Node *en,
QString code = quoter.quoteTo(en->location(), QString(), QString());
writer.writeTextElement("code", trimmedTrailing(code, QString(), QString()));
-
writer.writeEndElement(); // description
writer.writeEndElement(); // page
writer.writeEndElement(); // document
writer.writeEndElement(); // WebXML
writer.writeEndDocument();
-
out() << data;
endFilePage();
}
@@ -267,8 +260,7 @@ void WebXMLGenerator::generateDocumentation(Node *node)
qdb_->mergeCollections(static_cast<CollectionNode *>(node));
generatePageNode(static_cast<PageNode *>(node), nullptr);
}
- }
- else if (node->isTextPageNode())
+ } else if (node->isTextPageNode())
generatePageNode(static_cast<PageNode *>(node), nullptr);
// else if TODO: anything else?
}
@@ -276,16 +268,15 @@ void WebXMLGenerator::generateDocumentation(Node *node)
if (node->isAggregate()) {
Aggregate *aggregate = static_cast<Aggregate *>(node);
for (auto c : aggregate->childNodes()) {
- if ((c->isAggregate() ||
- c->isTextPageNode() ||
- c->isCollectionNode()) && !c->isPrivate())
+ if ((c->isAggregate() || c->isTextPageNode() || c->isCollectionNode())
+ && !c->isPrivate())
generateDocumentation(c);
}
}
}
-const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
- const Atom *atom, const Node *relative, CodeMarker *marker)
+const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer, const Atom *atom,
+ const Node *relative, CodeMarker *marker)
{
bool keepQuoting = false;
@@ -293,13 +284,11 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
return nullptr;
switch (atom->type()) {
- case Atom::AnnotatedList:
- {
- const CollectionNode* cn = qdb_->getCollectionNode(atom->string(), Node::Group);
+ case Atom::AnnotatedList: {
+ const CollectionNode *cn = qdb_->getCollectionNode(atom->string(), Node::Group);
if (cn)
generateAnnotatedList(writer, relative, cn->members());
- }
- break;
+ } break;
case Atom::AutoLink:
if (!inLink && !inSectionHeading) {
const Node *node = nullptr;
@@ -348,9 +337,8 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
const QVector<QStringRef> words = str.splitRef(' ');
if (!words.isEmpty()) {
const QStringRef &first(words.at(0));
- if (!(first == "contains" || first == "specifies"
- || first == "describes" || first == "defines"
- || first == "holds" || first == "determines"))
+ if (!(first == "contains" || first == "specifies" || first == "describes"
+ || first == "defines" || first == "holds" || first == "determines"))
writer.writeCharacters(" holds ");
else
writer.writeCharacters(" ");
@@ -378,7 +366,8 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
case Atom::Code:
if (!hasQuotingInformation)
- writer.writeTextElement("code", trimmedTrailing(plainCode(atom->string()), QString(), QString()));
+ writer.writeTextElement(
+ "code", trimmedTrailing(plainCode(atom->string()), QString(), QString()));
else
keepQuoting = true;
break;
@@ -386,22 +375,26 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
#ifdef QDOC_QML
case Atom::Qml:
if (!hasQuotingInformation)
- writer.writeTextElement("qml", trimmedTrailing(plainCode(atom->string()), QString(), QString()));
+ writer.writeTextElement(
+ "qml", trimmedTrailing(plainCode(atom->string()), QString(), QString()));
else
keepQuoting = true;
#endif
case Atom::CodeBad:
- writer.writeTextElement("badcode", trimmedTrailing(plainCode(atom->string()), QString(), QString()));
+ writer.writeTextElement("badcode",
+ trimmedTrailing(plainCode(atom->string()), QString(), QString()));
break;
case Atom::CodeNew:
writer.writeTextElement("para", "you can rewrite it as");
- writer.writeTextElement("newcode", trimmedTrailing(plainCode(atom->string()), QString(), QString()));
+ writer.writeTextElement("newcode",
+ trimmedTrailing(plainCode(atom->string()), QString(), QString()));
break;
case Atom::CodeOld:
writer.writeTextElement("para", "For example, if you have code like");
- writer.writeTextElement("oldcode", trimmedTrailing(plainCode(atom->string()), QString(), QString()));
+ writer.writeTextElement("oldcode",
+ trimmedTrailing(plainCode(atom->string()), QString(), QString()));
break;
case Atom::CodeQuoteArgument:
@@ -424,25 +417,21 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
}
break;
- case Atom::ExampleFileLink:
- {
+ case Atom::ExampleFileLink: {
if (!inLink) {
QString link = linkForExampleFile(atom->string(), relative);
if (!link.isEmpty())
startLink(writer, atom, relative, link);
}
- }
- break;
+ } break;
- case Atom::ExampleImageLink:
- {
+ case Atom::ExampleImageLink: {
if (!inLink) {
QString link = atom->string();
if (!link.isEmpty())
startLink(writer, atom, nullptr, "images/used-in-examples/" + link);
}
- }
- break;
+ } break;
case Atom::FootnoteLeft:
writer.writeStartElement("footnote");
@@ -459,8 +448,7 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
writer.writeStartElement("raw");
writer.writeAttribute("format", atom->string());
break;
- case Atom::FormattingLeft:
- {
+ case Atom::FormattingLeft: {
if (atom->string() == ATOM_FORMATTING_BOLD)
writer.writeStartElement("bold");
else if (atom->string() == ATOM_FORMATTING_ITALIC)
@@ -477,11 +465,9 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
writer.writeStartElement("argument");
else if (atom->string() == ATOM_FORMATTING_INDEX)
writer.writeStartElement("index");
- }
- break;
+ } break;
- case Atom::FormattingRight:
- {
+ case Atom::FormattingRight: {
if (atom->string() == ATOM_FORMATTING_BOLD)
writer.writeEndElement();
else if (atom->string() == ATOM_FORMATTING_ITALIC)
@@ -565,8 +551,7 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
writer.writeAttribute("type", "enum");
else
writer.writeAttribute("type", "definition");
- }
- else {
+ } else {
writer.writeAttribute("type", "ordered");
if (atom->string() == ATOM_LIST_UPPERALPHA)
writer.writeAttribute("start", "A");
@@ -583,14 +568,12 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
case Atom::ListItemNumber:
break;
- case Atom::ListTagLeft:
- {
+ case Atom::ListTagLeft: {
writer.writeStartElement("definition");
- writer.writeTextElement("term", plainCode(
- marker->markedUpEnumValue(atom->next()->string(), relative)));
- }
- break;
+ writer.writeTextElement(
+ "term", plainCode(marker->markedUpEnumValue(atom->next()->string(), relative)));
+ } break;
case Atom::ListTagRight:
writer.writeEndElement(); // definition
@@ -650,14 +633,12 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
writer.writeEndElement(); // section
break;
- case Atom::SectionHeadingLeft:
- {
+ case Atom::SectionHeadingLeft: {
writer.writeStartElement("heading");
int unit = atom->string().toInt(); // + hOffset(relative)
writer.writeAttribute("level", QString::number(unit));
inSectionHeading = true;
- }
- break;
+ } break;
case Atom::SectionHeadingRight:
writer.writeEndElement(); // heading
@@ -671,7 +652,6 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
case Atom::SnippetCommand:
if (quoting_) {
writer.writeStartElement(atom->string());
-
}
break;
@@ -722,8 +702,7 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
writer.writeEndElement(); // row
break;
- case Atom::TableItemLeft:
- {
+ case Atom::TableItemLeft: {
writer.writeStartElement("item");
QStringList spans = atom->string().split(",");
if (spans.size() == 2) {
@@ -732,8 +711,7 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
if (spans.at(1) != "1")
writer.writeAttribute("rowspan", spans.at(1).trimmed());
}
- }
- break;
+ } break;
case Atom::TableItemRight:
writer.writeEndElement(); // item
break;
@@ -754,11 +732,10 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
hasQuotingInformation = keepQuoting;
return atom->next();
-
}
-void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom,
- const Node *node, const QString &link)
+void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom, const Node *node,
+ const QString &link)
{
QString fullName = link;
if (node)
@@ -776,8 +753,7 @@ void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom,
case Node::Enum:
writer.writeAttribute("enum", fullName);
break;
- case Node::Example:
- {
+ case Node::Example: {
const ExampleNode *en = static_cast<const ExampleNode *>(node);
QString fileTitle = exampleFileTitle(en, atom->string());
if (!fileTitle.isEmpty()) {
@@ -785,17 +761,15 @@ void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom,
break;
}
}
- Q_FALLTHROUGH();
+ Q_FALLTHROUGH();
case Node::Page:
writer.writeAttribute("page", fullName);
break;
- case Node::Property:
- {
+ case Node::Property: {
const PropertyNode *propertyNode = static_cast<const PropertyNode *>(node);
if (propertyNode->getters().size() > 0)
writer.writeAttribute("getter", propertyNode->getters().at(0)->fullName());
- }
- break;
+ } break;
default:
break;
}
@@ -804,7 +778,8 @@ void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom,
}
}
-void WebXMLGenerator::endLink(QXmlStreamWriter &writer) {
+void WebXMLGenerator::endLink(QXmlStreamWriter &writer)
+{
if (inLink) {
writer.writeEndElement(); // link
inLink = false;
@@ -855,14 +830,14 @@ void WebXMLGenerator::generateRelations(QXmlStreamWriter &writer, const Node *no
}
}
-void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer,
- const Node *relative, const NodeMap &nodeMap)
+void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative,
+ const NodeMap &nodeMap)
{
generateAnnotatedList(writer, relative, nodeMap.values());
}
-void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer,
- const Node *relative, const NodeList &nodeList)
+void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative,
+ const NodeList &nodeList)
{
writer.writeStartElement("table");
writer.writeAttribute("width", "100%");
diff --git a/src/qdoc/webxmlgenerator.h b/src/qdoc/webxmlgenerator.h
index 565be82c9..71fd9df24 100644
--- a/src/qdoc/webxmlgenerator.h
+++ b/src/qdoc/webxmlgenerator.h
@@ -59,13 +59,14 @@ protected:
QString fileExtension() const override;
virtual const Atom *addAtomElements(QXmlStreamWriter &writer, const Atom *atom,
- const Node *relative, CodeMarker *marker);
+ const Node *relative, CodeMarker *marker);
virtual void generateIndexSections(QXmlStreamWriter &writer, Node *node);
-
private:
- void generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative, const NodeMap &nodeMap);
- void generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative, const NodeList &nodeList);
+ void generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative,
+ const NodeMap &nodeMap);
+ void generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative,
+ const NodeList &nodeList);
void generateRelations(QXmlStreamWriter &writer, const Node *node);
void startLink(QXmlStreamWriter &writer, const Atom *atom, const Node *node,
const QString &link);
diff --git a/src/qdoc/xmlgenerator.cpp b/src/qdoc/xmlgenerator.cpp
index 05cd1b963..8b266ca18 100644
--- a/src/qdoc/xmlgenerator.cpp
+++ b/src/qdoc/xmlgenerator.cpp
@@ -40,10 +40,8 @@ QT_BEGIN_NAMESPACE
*/
bool XmlGenerator::hasBrief(const Node *node)
{
- return !(node->isQmlType()
- || node->isPageNode()
- || node->isCollectionNode()
- || node->isJsType());
+ return !(node->isQmlType() || node->isPageNode() || node->isCollectionNode()
+ || node->isJsType());
}
/*!
@@ -92,23 +90,19 @@ int XmlGenerator::hOffset(const Node *node)
*/
void XmlGenerator::rewritePropertyBrief(const Atom *atom, const Node *relative)
{
- if (relative->nodeType() == Node::Property ||
- relative->nodeType() == Node::Variable) {
+ if (relative->nodeType() == Node::Property || relative->nodeType() == Node::Variable) {
atom = atom->next();
if (atom && atom->type() == Atom::String) {
QString firstWord =
- atom->string().toLower().section(' ', 0, 0, QString::SectionSkipEmpty);
- if (firstWord == QLatin1String("the")
- || firstWord == QLatin1String("a")
- || firstWord == QLatin1String("an")
- || firstWord == QLatin1String("whether")
+ atom->string().toLower().section(' ', 0, 0, QString::SectionSkipEmpty);
+ if (firstWord == QLatin1String("the") || firstWord == QLatin1String("a")
+ || firstWord == QLatin1String("an") || firstWord == QLatin1String("whether")
|| firstWord == QLatin1String("which")) {
QString str = QLatin1String("This ")
- + QLatin1String(relative->nodeType() == Node::Property ?
- "property" : "variable")
- + QLatin1String(" holds ")
- + atom->string().left(1).toLower()
- + atom->string().mid(1);
+ + QLatin1String(relative->nodeType() == Node::Property ? "property"
+ : "variable")
+ + QLatin1String(" holds ") + atom->string().left(1).toLower()
+ + atom->string().mid(1);
const_cast<Atom *>(atom)->setString(str);
}
}
@@ -140,7 +134,7 @@ void XmlGenerator::setImageFileName(const Node *relative, const QString &fileNam
if (relative->isExample()) {
const auto cen = static_cast<const ExampleNode *>(relative);
if (cen->imageFileName().isEmpty()) {
- auto *en = const_cast<ExampleNode*>(cen);
+ auto *en = const_cast<ExampleNode *>(cen);
en->setImageFileName(fileName);
}
}
@@ -250,8 +244,7 @@ QString XmlGenerator::refForNode(const Node *node)
if (tdn->associatedEnum())
return refForNode(tdn->associatedEnum());
ref = node->name() + "-typedef";
- }
- break;
+ } break;
case Node::Function: {
const auto fn = static_cast<const FunctionNode *>(node);
switch (fn->metaness()) {
@@ -279,8 +272,7 @@ QString XmlGenerator::refForNode(const Node *node)
}
break;
}
- }
- break;
+ } break;
case Node::JsProperty:
case Node::QmlProperty:
if (node->isAttached())
@@ -324,15 +316,14 @@ QString XmlGenerator::linkForNode(const Node *node, const Node *relative)
return QString();
QString fn = fileName(node);
- if (node && node->parent()
- && (node->parent()->isQmlType() || node->parent()->isJsType())
+ if (node && node->parent() && (node->parent()->isQmlType() || node->parent()->isJsType())
&& node->parent()->isAbstract()) {
if (Generator::qmlTypeContext()) {
if (Generator::qmlTypeContext()->inherits(node->parent())) {
fn = fileName(Generator::qmlTypeContext());
} else if (node->parent()->isInternal()) {
- node->doc().location().warning(
- tr("Cannot link to property in internal type '%1'").arg(node->parent()->name()));
+ node->doc().location().warning(tr("Cannot link to property in internal type '%1'")
+ .arg(node->parent()->name()));
return QString();
}
}
@@ -356,8 +347,8 @@ QString XmlGenerator::linkForNode(const Node *node, const Node *relative)
back down into the other subdirectory.
*/
if (node && relative && (node != relative)) {
- if (useOutputSubdirs() && !node->isExternalPage() &&
- node->outputSubdirectory() != relative->outputSubdirectory()) {
+ if (useOutputSubdirs() && !node->isExternalPage()
+ && node->outputSubdirectory() != relative->outputSubdirectory()) {
if (link.startsWith(QString(node->outputSubdirectory() + QLatin1Char('/')))) {
link.prepend(QString("../"));
} else {
diff --git a/src/qdoc/xmlgenerator.h b/src/qdoc/xmlgenerator.h
index 4bf1ca938..41744ff21 100644
--- a/src/qdoc/xmlgenerator.h
+++ b/src/qdoc/xmlgenerator.h
@@ -59,7 +59,7 @@ protected:
QString refForNode(const Node *node);
QString linkForNode(const Node *node, const Node *relative);
QString getLink(const Atom *atom, const Node *relative, const Node **node);
- QString getAutoLink(const Atom *atom, const Node *relative, const Node** node);
+ QString getAutoLink(const Atom *atom, const Node *relative, const Node **node);
const QPair<QString, QString> anchorForNode(const Node *node);
@@ -68,4 +68,4 @@ protected:
QT_END_NAMESPACE
-#endif //XMLGENERATOR_H
+#endif // XMLGENERATOR_H
diff --git a/src/qdoc/yyindent.cpp b/src/qdoc/yyindent.cpp
index c78e132b6..581a97a3e 100644
--- a/src/qdoc/yyindent.cpp
+++ b/src/qdoc/yyindent.cpp
@@ -247,7 +247,7 @@ static QString trimmedCodeLine(const QString &t)
/*
Remove C++-style comments.
*/
- k = trimmed.indexOf( "//" );
+ k = trimmed.indexOf("//");
if (k != -1)
trimmed.truncate(k);
@@ -309,10 +309,8 @@ static const bool *yyLeftBraceFollows = nullptr;
Saves and restores the state of the global linizer. This enables
backtracking.
*/
-#define YY_SAVE() \
- LinizerState savedState = *yyLinizerState
-#define YY_RESTORE() \
- *yyLinizerState = savedState
+#define YY_SAVE() LinizerState savedState = *yyLinizerState
+#define YY_RESTORE() *yyLinizerState = savedState
/*
Advances to the previous line in yyProgram and update yyLine
@@ -323,8 +321,7 @@ static bool readLine()
{
int k;
- yyLinizerState->leftBraceFollows =
- (firstNonWhiteSpace(yyLinizerState->line) == QChar('{'));
+ yyLinizerState->leftBraceFollows = (firstNonWhiteSpace(yyLinizerState->line) == QChar('{'));
do {
if (yyLinizerState->iter == yyProgram->constBegin()) {
@@ -374,7 +371,7 @@ static bool readLine()
Remove preprocessor directives.
*/
k = 0;
- while (k < (int) yyLinizerState->line.length()) {
+ while (k < (int)yyLinizerState->line.length()) {
QChar ch = yyLinizerState->line[k];
if (ch == QChar('#')) {
yyLinizerState->line.clear();
@@ -397,8 +394,7 @@ static bool readLine()
the other way around, as we are parsing backwards.
*/
yyLinizerState->braceDepth +=
- yyLinizerState->line.count('}') -
- yyLinizerState->line.count('{');
+ yyLinizerState->line.count('}') - yyLinizerState->line.count('{');
/*
We use a dirty trick for
@@ -413,8 +409,7 @@ static bool readLine()
*/
if (yyLinizerState->pendingRightBrace)
yyLinizerState->braceDepth++;
- yyLinizerState->pendingRightBrace =
- (yyLinizerState->line.indexOf(*braceX) == 0);
+ yyLinizerState->pendingRightBrace = (yyLinizerState->line.indexOf(*braceX) == 0);
if (yyLinizerState->pendingRightBrace)
yyLinizerState->braceDepth--;
} while (yyLinizerState->line.isEmpty());
@@ -502,7 +497,7 @@ static int indentWhenBottomLineStartsInCComment()
*/
int indent = columnForIndex(*yyLine, k);
k += 2;
- while (k < (int) yyLine->length()) {
+ while (k < (int)yyLine->length()) {
if (!(*yyLine)[k].isSpace())
return columnForIndex(*yyLine, k);
k++;
@@ -623,14 +618,13 @@ static bool isUnfinishedLine()
if (yyLine->isEmpty())
return false;
- QChar lastCh = (*yyLine)[(int) yyLine->length() - 1];
+ QChar lastCh = (*yyLine)[(int)yyLine->length() - 1];
if (QString("{};").indexOf(lastCh) == -1 && !yyLine->endsWith("...")) {
/*
It doesn't end with ';' or similar. If it's neither
"Q_OBJECT" nor "if ( x )", it must be an unfinished line.
*/
- unf = (yyLine->indexOf("Q_OBJECT") == -1 &&
- !matchBracelessControlStatement());
+ unf = (yyLine->indexOf("Q_OBJECT") == -1 && !matchBracelessControlStatement());
} else if (lastCh == QChar(';')) {
if (lastParen(*yyLine) == QChar('(')) {
/*
@@ -639,8 +633,8 @@ static bool isUnfinishedLine()
for ( int i = 1; i < 10;
*/
unf = true;
- } else if (readLine() && yyLine->endsWith(QLatin1Char(';')) &&
- lastParen(*yyLine) == QChar('(')) {
+ } else if (readLine() && yyLine->endsWith(QLatin1Char(';'))
+ && lastParen(*yyLine) == QChar('(')) {
/*
Exception:
@@ -719,8 +713,8 @@ static int indentForContinuationLine()
Such a brace must be treated just like the other
delimiters.
*/
- if ( braceDepth == -1 ) {
- if (j < (int) yyLine->length() - 1) {
+ if (braceDepth == -1) {
+ if (j < (int)yyLine->length() - 1) {
hook = j;
} else {
return 0; // shouldn't happen
@@ -753,12 +747,10 @@ static int indentForContinuationLine()
end of the unfinished lines or by unbalanced
parentheses.
*/
- if (QString("!=<>").indexOf((*yyLine)[j - 1]) == -1 &&
- (*yyLine)[j + 1] != '=') {
- if (braceDepth == 0 && delimDepth == 0 &&
- j < (int) yyLine->length() - 1 &&
- !yyLine->endsWith(QLatin1Char(',')) &&
- (yyLine->contains('(') == yyLine->contains(')')))
+ if (QString("!=<>").indexOf((*yyLine)[j - 1]) == -1 && (*yyLine)[j + 1] != '=') {
+ if (braceDepth == 0 && delimDepth == 0 && j < (int)yyLine->length() - 1
+ && !yyLine->endsWith(QLatin1Char(','))
+ && (yyLine->contains('(') == yyLine->contains(')')))
hook = j;
}
}
@@ -780,7 +772,7 @@ static int indentForContinuationLine()
"foo foo foo foo foo foo foo foo foo") );
*/
hook++;
- while (hook < (int) yyLine->length()) {
+ while (hook < (int)yyLine->length()) {
if (!(*yyLine)[hook].isSpace())
return columnForIndex(*yyLine, hook);
hook++;
@@ -991,8 +983,7 @@ static void initializeIndenter()
{
literal = new QRegExp("([\"'])(?:\\\\.|[^\\\\])*\\1");
literal->setMinimal(true);
- label = new QRegExp(
- "^\\s*((?:case\\b([^:]|::)+|[a-zA-Z_0-9]+)(?:\\s+slots)?:)(?!:)");
+ label = new QRegExp("^\\s*((?:case\\b([^:]|::)+|[a-zA-Z_0-9]+)(?:\\s+slots)?:)(?!:)");
inlineCComment = new QRegExp("/\\*.*\\*/");
inlineCComment->setMinimal(true);
braceX = new QRegExp("^\\s*\\}\\s*(?:else|catch)\\b");
@@ -1068,10 +1059,9 @@ int indentForBottomLine(const QStringList &program, QChar typedIn)
*/
indent -= ppIndentSize;
} else if (okay(typedIn, ':')) {
- QRegExp caseLabel(
- "\\s*(?:case\\b(?:[^:]|::)+"
- "|(?:public|protected|private|signals|default)(?:\\s+slots)?\\s*"
- ")?:.*" );
+ QRegExp caseLabel("\\s*(?:case\\b(?:[^:]|::)+"
+ "|(?:public|protected|private|signals|default)(?:\\s+slots)?\\s*"
+ ")?:.*");
if (caseLabel.exactMatch(bottomLine)) {
/*
@@ -1106,60 +1096,60 @@ QT_END_NAMESPACE
Test driver.
*/
-#include <qfile.h>
-#include <qtextstream.h>
+# include <qfile.h>
+# include <qtextstream.h>
-#include <errno.h>
+# include <errno.h>
QT_BEGIN_NAMESPACE
-static QString fileContents( const QString &fileName )
+static QString fileContents(const QString &fileName)
{
- QFile f( fileName );
- if ( !f.open(QFile::ReadOnly) ) {
- qWarning( "yyindent error: Cannot open file '%s' for reading: %s",
- fileName.toLatin1().data(), strerror(errno) );
+ QFile f(fileName);
+ if (!f.open(QFile::ReadOnly)) {
+ qWarning("yyindent error: Cannot open file '%s' for reading: %s",
+ fileName.toLatin1().data(), strerror(errno));
return QString();
}
- QTextStream t( &f );
+ QTextStream t(&f);
QString contents = t.read();
f.close();
- if ( contents.isEmpty() )
- qWarning( "yyindent error: File '%s' is empty", fileName.toLatin1().data() );
+ if (contents.isEmpty())
+ qWarning("yyindent error: File '%s' is empty", fileName.toLatin1().data());
return contents;
}
QT_END_NAMESPACE
-int main( int argc, char **argv )
+int main(int argc, char **argv)
{
QT_USE_NAMESPACE
- if ( argc != 2 ) {
- qWarning( "usage: yyindent file.cpp" );
+ if (argc != 2) {
+ qWarning("usage: yyindent file.cpp");
return 1;
}
- QString code = fileContents( argv[1] );
- QStringList program = QStringList::split( '\n', code, true );
+ QString code = fileContents(argv[1]);
+ QStringList program = QStringList::split('\n', code, true);
QStringList p;
QString out;
- while ( !program.isEmpty() && program.last().trimmed().isEmpty() )
- program.remove( program.fromLast() );
+ while (!program.isEmpty() && program.last().trimmed().isEmpty())
+ program.remove(program.fromLast());
QStringList::ConstIterator line = program.constBegin();
- while ( line != program.constEnd() ) {
- p.push_back( *line );
- QChar typedIn = firstNonWhiteSpace( *line );
- if ( p.last().endsWith(QLatin1Char(':')) )
+ while (line != program.constEnd()) {
+ p.push_back(*line);
+ QChar typedIn = firstNonWhiteSpace(*line);
+ if (p.last().endsWith(QLatin1Char(':')))
typedIn = ':';
- int indent = indentForBottomLine( p, typedIn );
+ int indent = indentForBottomLine(p, typedIn);
- if ( !(*line).trimmed().isEmpty() ) {
- for ( int j = 0; j < indent; j++ )
+ if (!(*line).trimmed().isEmpty()) {
+ for (int j = 0; j < indent; j++)
out += QLatin1Char(' ');
out += (*line).trimmed();
}
@@ -1167,10 +1157,10 @@ int main( int argc, char **argv )
++line;
}
- while ( out.endsWith(QLatin1Char('\n')) )
- out.truncate( out.length() - 1 );
+ while (out.endsWith(QLatin1Char('\n')))
+ out.truncate(out.length() - 1);
- printf( "%s\n", out.toLatin1().data() );
+ printf("%s\n", out.toLatin1().data());
return 0;
}