summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2021-05-12 13:58:47 +0200
committerPaul Wicking <paul.wicking@qt.io>2021-05-19 14:28:26 +0200
commit4c3108e5c2975e8ab07d4cb2c722bb100625656d (patch)
tree9624bc3e6d7d8fe66098a1982335f389a696d0ae
parente2c226f3d1181c4f98a2bf8dc6d2eafcdeafd18e (diff)
QDoc: Code cleanup
* Unify members; use s_ or m_ prefix instead of _ suffix. * Remove unnecessary member that duplicates content in base class. * Add [[nodiscard]] annotations where applicable. * Add overloads to virtual methods that have been extended with parameters with default values. * Make single argument ctors explicit. * Remove semi-colon from namespace declaration. Change-Id: Ie1ff39079722b81ba6754f945a898dc9b335bbae Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
-rw-r--r--src/qdoc/aggregate.h25
-rw-r--r--src/qdoc/atom.cpp72
-rw-r--r--src/qdoc/atom.h82
-rw-r--r--src/qdoc/clangcodeparser.cpp16
-rw-r--r--src/qdoc/classnode.h16
-rw-r--r--src/qdoc/codechunk.cpp8
-rw-r--r--src/qdoc/codechunk.h26
-rw-r--r--src/qdoc/codemarker.cpp24
-rw-r--r--src/qdoc/codemarker.h6
-rw-r--r--src/qdoc/codeparser.cpp26
-rw-r--r--src/qdoc/codeparser.h18
-rw-r--r--src/qdoc/collectionnode.h22
-rw-r--r--src/qdoc/config.h61
-rw-r--r--src/qdoc/cppcodemarker.h2
-rw-r--r--src/qdoc/cppcodeparser.cpp74
-rw-r--r--src/qdoc/cppcodeparser.h2
-rw-r--r--src/qdoc/doc.cpp113
-rw-r--r--src/qdoc/doc.h56
-rw-r--r--src/qdoc/docbookgenerator.cpp1372
-rw-r--r--src/qdoc/docbookgenerator.h19
-rw-r--r--src/qdoc/docparser.cpp249
-rw-r--r--src/qdoc/docparser.h34
-rw-r--r--src/qdoc/docprivate.cpp2
-rw-r--r--src/qdoc/docprivate.h38
-rw-r--r--src/qdoc/enumitem.h4
-rw-r--r--src/qdoc/examplenode.h8
-rw-r--r--src/qdoc/functionnode.h148
-rw-r--r--src/qdoc/generator.cpp172
-rw-r--r--src/qdoc/generator.h72
-rw-r--r--src/qdoc/headernode.h20
-rw-r--r--src/qdoc/helpprojectwriter.cpp245
-rw-r--r--src/qdoc/helpprojectwriter.h75
-rw-r--r--src/qdoc/htmlgenerator.cpp2
-rw-r--r--src/qdoc/htmlgenerator.h3
-rw-r--r--src/qdoc/importrec.h8
-rw-r--r--src/qdoc/jscodemarker.h2
-rw-r--r--src/qdoc/location.cpp118
-rw-r--r--src/qdoc/location.h64
-rw-r--r--src/qdoc/macro.h6
-rw-r--r--src/qdoc/manifestwriter.cpp33
-rw-r--r--src/qdoc/manifestwriter.h6
-rw-r--r--src/qdoc/namespacenode.h18
-rw-r--r--src/qdoc/node.h247
-rw-r--r--src/qdoc/openedlist.h16
-rw-r--r--src/qdoc/pagenode.h23
-rw-r--r--src/qdoc/parameters.cpp119
-rw-r--r--src/qdoc/parameters.h95
-rw-r--r--src/qdoc/propertynode.h41
-rw-r--r--src/qdoc/proxynode.h4
-rw-r--r--src/qdoc/puredocparser.cpp10
-rw-r--r--src/qdoc/puredocparser.h4
-rw-r--r--src/qdoc/qdocdatabase.cpp512
-rw-r--r--src/qdoc/qdocdatabase.h155
-rw-r--r--src/qdoc/qdocindexfiles.cpp112
-rw-r--r--src/qdoc/qdocindexfiles.h16
-rw-r--r--src/qdoc/qmlcodemarker.h2
-rw-r--r--src/qdoc/qmlcodeparser.cpp26
-rw-r--r--src/qdoc/qmlcodeparser.h6
-rw-r--r--src/qdoc/qmlmarkupvisitor.cpp112
-rw-r--r--src/qdoc/qmlmarkupvisitor.h18
-rw-r--r--src/qdoc/qmlpropertynode.h37
-rw-r--r--src/qdoc/qmltypenode.cpp12
-rw-r--r--src/qdoc/qmltypenode.h32
-rw-r--r--src/qdoc/qmlvisitor.cpp134
-rw-r--r--src/qdoc/qmlvisitor.h44
-rw-r--r--src/qdoc/quoter.cpp98
-rw-r--r--src/qdoc/quoter.h12
-rw-r--r--src/qdoc/relatedclass.h2
-rw-r--r--src/qdoc/sections.cpp183
-rw-r--r--src/qdoc/sections.h170
-rw-r--r--src/qdoc/sharedcommentnode.h6
-rw-r--r--src/qdoc/singleton.h4
-rw-r--r--src/qdoc/text.cpp68
-rw-r--r--src/qdoc/text.h18
-rw-r--r--src/qdoc/tokenizer.cpp424
-rw-r--r--src/qdoc/tokenizer.h62
-rw-r--r--src/qdoc/topic.h12
-rw-r--r--src/qdoc/tree.cpp132
-rw-r--r--src/qdoc/tree.h107
-rw-r--r--src/qdoc/usingclause.h6
-rw-r--r--src/qdoc/utilities.h2
-rw-r--r--src/qdoc/variablenode.h8
-rw-r--r--src/qdoc/webxmlgenerator.h2
83 files changed, 3271 insertions, 3189 deletions
diff --git a/src/qdoc/aggregate.h b/src/qdoc/aggregate.h
index 3668f64e5..d50250f41 100644
--- a/src/qdoc/aggregate.h
+++ b/src/qdoc/aggregate.h
@@ -43,7 +43,8 @@ class QmlPropertyNode;
class Aggregate : public PageNode
{
public:
- Node *findChildNode(const QString &name, Node::Genus genus, int findFlags = 0) const;
+ [[nodiscard]] Node *findChildNode(const QString &name, Node::Genus genus,
+ int findFlags = 0) 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);
@@ -52,21 +53,21 @@ public:
void normalizeOverloads();
void markUndocumentedChildrenInternal();
- bool isAggregate() const override { return true; }
- const EnumNode *findEnumNodeForValue(const QString &enumValue) const;
+ [[nodiscard]] bool isAggregate() const override { return true; }
+ [[nodiscard]] const EnumNode *findEnumNodeForValue(const QString &enumValue) const;
- qsizetype count() const { return m_children.size(); }
- const NodeList &childNodes() const { return m_children; }
+ [[nodiscard]] qsizetype count() const { return m_children.size(); }
+ [[nodiscard]] const NodeList &childNodes() const { return m_children; }
const NodeList &nonfunctionList();
- NodeList::ConstIterator constBegin() const { return m_children.constBegin(); }
- NodeList::ConstIterator constEnd() const { return m_children.constEnd(); }
+ [[nodiscard]] NodeList::ConstIterator constBegin() const { return m_children.constBegin(); }
+ [[nodiscard]] NodeList::ConstIterator constEnd() const { return m_children.constEnd(); }
void addIncludeFile(const QString &includeFile);
void setIncludeFiles(const QStringList &includeFiles);
- const QStringList &includeFiles() const { return m_includeFiles; }
+ [[nodiscard]] const QStringList &includeFiles() const { return m_includeFiles; }
- QmlPropertyNode *hasQmlProperty(const QString &) const;
- QmlPropertyNode *hasQmlProperty(const QString &, bool attached) const;
+ [[nodiscard]] QmlPropertyNode *hasQmlProperty(const QString &) const;
+ [[nodiscard]] QmlPropertyNode *hasQmlProperty(const QString &, bool attached) const;
virtual QmlTypeNode *qmlBaseNode() const { return nullptr; }
void addChildByTitle(Node *child, const QString &title);
void addChild(Node *child);
@@ -77,7 +78,7 @@ public:
void findAllFunctions(NodeMapMap &functionIndex);
void findAllNamespaces(NodeMultiMap &namespaces);
void findAllAttributions(NodeMultiMap &attributions);
- bool hasObsoleteMembers() const;
+ [[nodiscard]] bool hasObsoleteMembers() const;
void findAllObsoleteThings();
void findAllClasses();
void findAllSince();
@@ -85,7 +86,7 @@ public:
bool hasOverloads(const FunctionNode *fn) const;
void appendToRelatedByProxy(const NodeList &t) { m_relatedByProxy.append(t); }
NodeList &relatedByProxy() { return m_relatedByProxy; }
- QString typeWord(bool cap) const;
+ [[nodiscard]] QString typeWord(bool cap) const;
protected:
Aggregate(NodeType type, Aggregate *parent, const QString &name)
diff --git a/src/qdoc/atom.cpp b/src/qdoc/atom.cpp
index 3aa5324f7..2844e8b33 100644
--- a/src/qdoc/atom.cpp
+++ b/src/qdoc/atom.cpp
@@ -142,7 +142,7 @@ QT_BEGIN_NAMESPACE
\value UnknownCommand
*/
-QString Atom::noError_ = QString();
+QString Atom::s_noError = QString();
static const struct
{
@@ -293,7 +293,7 @@ static const struct
*/
const Atom *Atom::next(AtomType t) const
{
- return (next_ && (next_->type() == t)) ? next_ : nullptr;
+ return (m_next && (m_next->type() == t)) ? m_next : nullptr;
}
/*!
@@ -302,7 +302,7 @@ const Atom *Atom::next(AtomType t) const
*/
const Atom *Atom::next(AtomType t, const QString &s) const
{
- return (next_ && (next_->type() == t) && (next_->string() == s)) ? next_ : nullptr;
+ return (m_next && (m_next->type() == t) && (m_next->string() == s)) ? m_next : nullptr;
}
/*! \fn const Atom *Atom::next() const
@@ -373,7 +373,7 @@ void Atom::dump() const
*/
QString Atom::linkText() const
{
- Q_ASSERT(type_ == Atom::Link);
+ Q_ASSERT(m_type == Atom::Link);
QString result;
if (next() && next()->string() == ATOM_FORMATTING_LINK) {
@@ -398,11 +398,11 @@ QString Atom::linkText() const
*/
LinkAtom::LinkAtom(const QString &p1, const QString &p2)
: Atom(Atom::Link, p1),
- resolved_(false),
- genus_(Node::DontCare),
- goal_(Node::NoType),
- domain_(nullptr),
- squareBracketParams_(p2)
+ m_resolved(false),
+ m_genus(Node::DontCare),
+ m_goal(Node::NoType),
+ m_domain(nullptr),
+ m_squareBracketParams(p2)
{
// nada.
}
@@ -414,41 +414,41 @@ LinkAtom::LinkAtom(const QString &p1, const QString &p2)
*/
void LinkAtom::resolveSquareBracketParams()
{
- if (resolved_)
+ if (m_resolved)
return;
- const QStringList params = squareBracketParams_.toLower().split(QLatin1Char(' '));
+ const QStringList params = m_squareBracketParams.toLower().split(QLatin1Char(' '));
for (const auto &param : params) {
- if (!domain_) {
- domain_ = QDocDatabase::qdocDB()->findTree(param);
- if (domain_) {
+ if (!m_domain) {
+ m_domain = QDocDatabase::qdocDB()->findTree(param);
+ if (m_domain) {
continue;
}
}
- if (goal_ == Node::NoType) {
- goal_ = Node::goal(param);
- if (goal_ != Node::NoType)
+ if (m_goal == Node::NoType) {
+ m_goal = Node::goal(param);
+ if (m_goal != Node::NoType)
continue;
}
if (param == "qml") {
- genus_ = Node::QML;
+ m_genus = Node::QML;
continue;
}
if (param == "cpp") {
- genus_ = Node::CPP;
+ m_genus = Node::CPP;
continue;
}
if (param == "doc") {
- genus_ = Node::DOC;
+ m_genus = Node::DOC;
continue;
}
if (param == "api") {
- genus_ = Node::API;
+ m_genus = Node::API;
continue;
}
- error_ = squareBracketParams_;
+ m_error = m_squareBracketParams;
break;
}
- resolved_ = true;
+ m_resolved = true;
}
/*!
@@ -456,12 +456,12 @@ void LinkAtom::resolveSquareBracketParams()
*/
LinkAtom::LinkAtom(const LinkAtom &t)
: Atom(Link, t.string()),
- resolved_(t.resolved_),
- genus_(t.genus_),
- goal_(t.goal_),
- domain_(t.domain_),
- error_(t.error_),
- squareBracketParams_(t.squareBracketParams_)
+ m_resolved(t.m_resolved),
+ m_genus(t.m_genus),
+ m_goal(t.m_goal),
+ m_domain(t.m_domain),
+ m_error(t.m_error),
+ m_squareBracketParams(t.m_squareBracketParams)
{
// nothing
}
@@ -473,14 +473,14 @@ LinkAtom::LinkAtom(const LinkAtom &t)
*/
LinkAtom::LinkAtom(Atom *previous, const LinkAtom &t)
: Atom(previous, Link, t.string()),
- resolved_(t.resolved_),
- genus_(t.genus_),
- goal_(t.goal_),
- domain_(t.domain_),
- error_(t.error_),
- squareBracketParams_(t.squareBracketParams_)
+ m_resolved(t.m_resolved),
+ m_genus(t.m_genus),
+ m_goal(t.m_goal),
+ m_domain(t.m_domain),
+ m_error(t.m_error),
+ m_squareBracketParams(t.m_squareBracketParams)
{
- previous->next_ = this;
+ previous->m_next = this;
}
QT_END_NAMESPACE
diff --git a/src/qdoc/atom.h b/src/qdoc/atom.h
index f030b774a..77a058a70 100644
--- a/src/qdoc/atom.h
+++ b/src/qdoc/atom.h
@@ -134,60 +134,60 @@ public:
friend class LinkAtom;
- explicit Atom(AtomType type, const QString &string = "") : type_(type), strs(string) {}
+ explicit Atom(AtomType type, const QString &string = "") : m_type(type), m_strs(string) { }
- Atom(AtomType type, const QString &p1, const QString &p2) : type_(type), strs(p1)
+ Atom(AtomType type, const QString &p1, const QString &p2) : m_type(type), m_strs(p1)
{
if (!p2.isEmpty())
- strs << p2;
+ m_strs << p2;
}
Atom(Atom *previous, AtomType type, const QString &string)
- : next_(previous->next_), type_(type), strs(string)
+ : m_next(previous->m_next), m_type(type), m_strs(string)
{
- previous->next_ = this;
+ previous->m_next = this;
}
Atom(Atom *previous, AtomType type, const QString &p1, const QString &p2)
- : next_(previous->next_), type_(type), strs(p1)
+ : m_next(previous->m_next), m_type(type), m_strs(p1)
{
if (!p2.isEmpty())
- strs << p2;
- previous->next_ = this;
+ m_strs << p2;
+ previous->m_next = this;
}
virtual ~Atom() = default;
- void appendChar(QChar ch) { strs[0] += ch; }
- void appendString(const QString &string) { strs[0] += string; }
- void chopString() { strs[0].chop(1); }
- void setString(const QString &string) { strs[0] = string; }
- Atom *next() { return next_; }
- void setNext(Atom *newNext) { next_ = newNext; }
-
- const Atom *next() const { return next_; }
- const Atom *next(AtomType t) const;
- const Atom *next(AtomType t, const QString &s) const;
- AtomType type() const { return type_; }
- QString typeString() const;
- const QString &string() const { return strs[0]; }
- const QString &string(int i) const { return strs[i]; }
- qsizetype count() const { return strs.size(); }
+ void appendChar(QChar ch) { m_strs[0] += ch; }
+ void appendString(const QString &string) { m_strs[0] += string; }
+ void chopString() { m_strs[0].chop(1); }
+ void setString(const QString &string) { m_strs[0] = string; }
+ Atom *next() { return m_next; }
+ void setNext(Atom *newNext) { m_next = newNext; }
+
+ [[nodiscard]] const Atom *next() const { return m_next; }
+ [[nodiscard]] const Atom *next(AtomType t) const;
+ [[nodiscard]] const Atom *next(AtomType t, const QString &s) const;
+ [[nodiscard]] AtomType type() const { return m_type; }
+ [[nodiscard]] QString typeString() const;
+ [[nodiscard]] const QString &string() const { return m_strs[0]; }
+ [[nodiscard]] const QString &string(int i) const { return m_strs[i]; }
+ [[nodiscard]] qsizetype count() const { return m_strs.size(); }
void dump() const;
- QString linkText() const;
- const QStringList &strings() const { return strs; }
+ [[nodiscard]] QString linkText() const;
+ [[nodiscard]] const QStringList &strings() const { return m_strs; }
- virtual bool isLinkAtom() const { return false; }
+ [[nodiscard]] virtual bool isLinkAtom() const { return false; }
virtual Node::Genus genus() { return Node::DontCare; }
virtual Tree *domain() { return nullptr; }
- virtual const QString &error() { return noError_; }
+ virtual const QString &error() { return s_noError; }
virtual void resolveSquareBracketParams() {}
protected:
- static QString noError_;
- Atom *next_ = nullptr;
- AtomType type_;
- QStringList strs;
+ static QString s_noError;
+ Atom *m_next = nullptr;
+ AtomType m_type {};
+ QStringList m_strs {};
};
class LinkAtom : public Atom
@@ -198,27 +198,27 @@ public:
LinkAtom(Atom *previous, const LinkAtom &t);
~LinkAtom() override = default;
- bool isLinkAtom() const override { return true; }
+ [[nodiscard]] bool isLinkAtom() const override { return true; }
Node::Genus genus() override
{
resolveSquareBracketParams();
- return genus_;
+ return m_genus;
}
Tree *domain() override
{
resolveSquareBracketParams();
- return domain_;
+ return m_domain;
}
- const QString &error() override { return error_; }
+ const QString &error() override { return m_error; }
void resolveSquareBracketParams() override;
protected:
- bool resolved_;
- Node::Genus genus_;
- Node::NodeType goal_;
- Tree *domain_;
- QString error_;
- QString squareBracketParams_;
+ bool m_resolved {};
+ Node::Genus m_genus {};
+ Node::NodeType m_goal {};
+ Tree *m_domain {};
+ QString m_error {};
+ QString m_squareBracketParams {};
};
#define ATOM_FORMATTING_BOLD "bold"
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index a34d730e2..2c71c235d 100644
--- a/src/qdoc/clangcodeparser.cpp
+++ b/src/qdoc/clangcodeparser.cpp
@@ -1394,7 +1394,7 @@ void ClangCodeParser::buildPCH()
// Visit the header now, as token from pre-compiled header won't be visited
// later
CXCursor cur = clang_getTranslationUnitCursor(tu);
- ClangVisitor visitor(qdb_, m_allHeaders);
+ ClangVisitor visitor(m_qdb, m_allHeaders);
visitor.visitChildren(cur);
qCDebug(lcQdoc) << "PCH built and visited for" << moduleHeader();
}
@@ -1448,8 +1448,8 @@ void ClangCodeParser::parseSourceFile(const Location & /*location*/, const QStri
The set of open namespaces is cleared before parsing
each source file. The word "source" here means cpp file.
*/
- qdb_->clearOpenNamespaces();
- currentFile_ = filePath;
+ m_qdb->clearOpenNamespaces();
+ m_currentFile = filePath;
flags_ = static_cast<CXTranslationUnit_Flags>(CXTranslationUnit_Incomplete
| CXTranslationUnit_SkipFunctionBodies
| CXTranslationUnit_KeepGoing);
@@ -1481,7 +1481,7 @@ void ClangCodeParser::parseSourceFile(const Location & /*location*/, const QStri
}
CXCursor tuCur = clang_getTranslationUnitCursor(tu);
- ClangVisitor visitor(qdb_, m_allHeaders);
+ ClangVisitor visitor(m_qdb, m_allHeaders);
visitor.visitChildren(tuCur);
CXToken *tokens;
@@ -1511,7 +1511,7 @@ void ClangCodeParser::parseSourceFile(const Location & /*location*/, const QStri
NodeList nodes;
const TopicList &topics = doc.topicsUsed();
if (!topics.isEmpty())
- topic = topics[0].topic;
+ topic = topics[0].m_topic;
if (topic.isEmpty()) {
Node *n = nullptr;
@@ -1583,7 +1583,7 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnSig
not be found. Return 0 in that case.
*/
if (!idTag.isEmpty()) {
- fnNode = qdb_->findFunctionNodeForTag(idTag);
+ fnNode = m_qdb->findFunctionNodeForTag(idTag);
if (!fnNode) {
location.error(
QStringLiteral("tag \\fn [%1] not used in any include file in current module").arg(idTag));
@@ -1666,7 +1666,7 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnSig
the diagnostics if they stop us finding the node.
*/
CXCursor cur = clang_getTranslationUnitCursor(tu);
- ClangVisitor visitor(qdb_, m_allHeaders);
+ ClangVisitor visitor(m_qdb, m_allHeaders);
bool ignoreSignature = false;
visitor.visitFnArg(cur, &fnNode, ignoreSignature);
/*
@@ -1690,7 +1690,7 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnSig
qualifier[i++] = QChar(' ');
if (i > 0)
qualifier = qualifier.simplified();
- ClassNode *cn = qdb_->findClassNode(QStringList(qualifier));
+ ClassNode *cn = m_qdb->findClassNode(QStringList(qualifier));
if (cn && cn->isInternal())
report = false;
}
diff --git a/src/qdoc/classnode.h b/src/qdoc/classnode.h
index d0b2e881a..404ca1bfc 100644
--- a/src/qdoc/classnode.h
+++ b/src/qdoc/classnode.h
@@ -49,11 +49,11 @@ public:
ClassNode(NodeType type, Aggregate *parent, const QString &name) : Aggregate(type, parent, name)
{
}
- bool isFirstClassAggregate() const override { return true; }
- bool isClassNode() const override { return true; }
- bool isRelatableType() const override { return true; }
- bool isWrapper() const override { return m_wrapper; }
- QString obsoleteLink() const override { return m_obsoleteLink; }
+ [[nodiscard]] bool isFirstClassAggregate() const override { return true; }
+ [[nodiscard]] bool isClassNode() const override { return true; }
+ [[nodiscard]] bool isRelatableType() const override { return true; }
+ [[nodiscard]] bool isWrapper() const override { return m_wrapper; }
+ [[nodiscard]] QString obsoleteLink() const override { return m_obsoleteLink; }
void setObsoleteLink(const QString &t) override { m_obsoleteLink = t; }
void setWrapper() override { m_wrapper = true; }
@@ -68,17 +68,17 @@ public:
QList<RelatedClass> &ignoredBaseClasses() { return m_ignoredBases; }
QList<UsingClause> &usingClauses() { return m_usingClauses; }
- const QList<RelatedClass> &baseClasses() const { return m_bases; }
+ [[nodiscard]] const QList<RelatedClass> &baseClasses() const { return m_bases; }
QmlTypeNode *qmlElement() { return m_qmlElement; }
void setQmlElement(QmlTypeNode *qcn) { m_qmlElement = qcn; }
- bool isAbstract() const override { return m_abstract; }
+ [[nodiscard]] bool isAbstract() const override { return m_abstract; }
void setAbstract(bool b) override { m_abstract = b; }
PropertyNode *findPropertyNode(const QString &name);
QmlTypeNode *findQmlBaseNode();
FunctionNode *findOverriddenFunction(const FunctionNode *fn);
PropertyNode *findOverriddenProperty(const FunctionNode *fn);
- bool docMustBeGenerated() const override;
+ [[nodiscard]] bool docMustBeGenerated() const override;
private:
void promotePublicBases(const QList<RelatedClass> &bases);
diff --git a/src/qdoc/codechunk.cpp b/src/qdoc/codechunk.cpp
index 7944d9791..ed27d5f2a 100644
--- a/src/qdoc/codechunk.cpp
+++ b/src/qdoc/codechunk.cpp
@@ -113,17 +113,17 @@ static int category(QChar ch)
*/
void CodeChunk::append(const QString &lexeme)
{
- if (!s.isEmpty() && !lexeme.isEmpty()) {
+ if (!m_str.isEmpty() && !lexeme.isEmpty()) {
/*
Should there be a space or not between the code chunk so far and the
new lexeme?
*/
- int cat1 = category(s.at(s.size() - 1));
+ int cat1 = category(m_str.at(m_str.size() - 1));
int cat2 = category(lexeme[0]);
if (needSpace[cat1][cat2])
- s += QLatin1Char(' ');
+ m_str += QLatin1Char(' ');
}
- s += lexeme;
+ m_str += lexeme;
}
QT_END_NAMESPACE
diff --git a/src/qdoc/codechunk.h b/src/qdoc/codechunk.h
index 0a7b0022e..4a54cfdc9 100644
--- a/src/qdoc/codechunk.h
+++ b/src/qdoc/codechunk.h
@@ -38,24 +38,30 @@ QT_BEGIN_NAMESPACE
class CodeChunk
{
public:
- CodeChunk() : hotspot(-1) {}
+ CodeChunk() : m_hotspot(-1) { }
void append(const QString &lexeme);
void appendHotspot()
{
- if (hotspot == -1)
- hotspot = s.length();
+ if (m_hotspot == -1)
+ m_hotspot = m_str.length();
}
- bool isEmpty() const { return s.isEmpty(); }
- void clear() { s.clear(); }
- QString toString() const { return s; }
- QString left() const { return s.left(hotspot == -1 ? s.length() : hotspot); }
- QString right() const { return s.mid(hotspot == -1 ? s.length() : hotspot); }
+ [[nodiscard]] bool isEmpty() const { return m_str.isEmpty(); }
+ void clear() { m_str.clear(); }
+ [[nodiscard]] QString toString() const { return m_str; }
+ [[nodiscard]] QString left() const
+ {
+ return m_str.left(m_hotspot == -1 ? m_str.length() : m_hotspot);
+ }
+ [[nodiscard]] QString right() const
+ {
+ return m_str.mid(m_hotspot == -1 ? m_str.length() : m_hotspot);
+ }
private:
- QString s;
- int hotspot;
+ QString m_str {};
+ qsizetype m_hotspot {};
};
inline bool operator==(const CodeChunk &c, const CodeChunk &d)
diff --git a/src/qdoc/codemarker.cpp b/src/qdoc/codemarker.cpp
index 6759dbed5..f42f50d62 100644
--- a/src/qdoc/codemarker.cpp
+++ b/src/qdoc/codemarker.cpp
@@ -38,8 +38,8 @@
QT_BEGIN_NAMESPACE
-QString CodeMarker::defaultLang;
-QList<CodeMarker *> CodeMarker::markers;
+QString CodeMarker::s_defaultLang;
+QList<CodeMarker *> CodeMarker::s_markers;
/*!
When a code marker constructs itself, it puts itself into
@@ -50,7 +50,7 @@ QList<CodeMarker *> CodeMarker::markers;
*/
CodeMarker::CodeMarker()
{
- markers.prepend(this);
+ s_markers.prepend(this);
}
/*!
@@ -59,7 +59,7 @@ CodeMarker::CodeMarker()
*/
CodeMarker::~CodeMarker()
{
- markers.removeAll(this);
+ s_markers.removeAll(this);
}
/*!
@@ -82,8 +82,8 @@ void CodeMarker::terminateMarker()
*/
void CodeMarker::initialize()
{
- defaultLang = Config::instance().getString(CONFIG_LANGUAGE);
- for (const auto &marker : qAsConst(markers))
+ s_defaultLang = Config::instance().getString(CONFIG_LANGUAGE);
+ for (const auto &marker : qAsConst(s_markers))
marker->initializeMarker();
}
@@ -92,17 +92,17 @@ void CodeMarker::initialize()
*/
void CodeMarker::terminate()
{
- for (const auto &marker : qAsConst(markers))
+ for (const auto &marker : qAsConst(s_markers))
marker->terminateMarker();
}
CodeMarker *CodeMarker::markerForCode(const QString &code)
{
- CodeMarker *defaultMarker = markerForLanguage(defaultLang);
+ CodeMarker *defaultMarker = markerForLanguage(s_defaultLang);
if (defaultMarker != nullptr && defaultMarker->recognizeCode(code))
return defaultMarker;
- for (const auto &marker : qAsConst(markers)) {
+ for (const auto &marker : qAsConst(s_markers)) {
if (marker->recognizeCode(code))
return marker;
}
@@ -112,13 +112,13 @@ CodeMarker *CodeMarker::markerForCode(const QString &code)
CodeMarker *CodeMarker::markerForFileName(const QString &fileName)
{
- CodeMarker *defaultMarker = markerForLanguage(defaultLang);
+ CodeMarker *defaultMarker = markerForLanguage(s_defaultLang);
qsizetype dot = -1;
while ((dot = fileName.lastIndexOf(QLatin1Char('.'), dot)) != -1) {
QString ext = fileName.mid(dot + 1);
if (defaultMarker != nullptr && defaultMarker->recognizeExtension(ext))
return defaultMarker;
- for (const auto &marker : qAsConst(markers)) {
+ for (const auto &marker : qAsConst(s_markers)) {
if (marker->recognizeExtension(ext))
return marker;
}
@@ -129,7 +129,7 @@ CodeMarker *CodeMarker::markerForFileName(const QString &fileName)
CodeMarker *CodeMarker::markerForLanguage(const QString &lang)
{
- for (const auto &marker : qAsConst(markers)) {
+ for (const auto &marker : qAsConst(s_markers)) {
if (marker->recognizeLanguage(lang))
return marker;
}
diff --git a/src/qdoc/codemarker.h b/src/qdoc/codemarker.h
index a4662ed56..3a1d8813e 100644
--- a/src/qdoc/codemarker.h
+++ b/src/qdoc/codemarker.h
@@ -45,7 +45,7 @@ public:
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; }
+ [[nodiscard]] virtual Atom::AtomType atomType() const { return Atom::Code; }
virtual QString markedUpCode(const QString &code, const Node * /*relative*/,
const Location & /*location*/)
{
@@ -85,8 +85,8 @@ protected:
QString linkTag(const Node *node, const QString &body);
private:
- static QString defaultLang;
- static QList<CodeMarker *> markers;
+ static QString s_defaultLang;
+ static QList<CodeMarker *> s_markers;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/codeparser.cpp b/src/qdoc/codeparser.cpp
index 8443f86dd..b28da748c 100644
--- a/src/qdoc/codeparser.cpp
+++ b/src/qdoc/codeparser.cpp
@@ -37,8 +37,8 @@
QT_BEGIN_NAMESPACE
-QList<CodeParser *> CodeParser::parsers;
-bool CodeParser::showInternal_ = false;
+QList<CodeParser *> CodeParser::s_parsers;
+bool CodeParser::s_showInternal = false;
/*!
The constructor adds this code parser to the static
@@ -46,8 +46,8 @@ bool CodeParser::showInternal_ = false;
*/
CodeParser::CodeParser()
{
- qdb_ = QDocDatabase::qdocDB();
- parsers.prepend(this);
+ m_qdb = QDocDatabase::qdocDB();
+ s_parsers.prepend(this);
}
/*!
@@ -56,7 +56,7 @@ CodeParser::CodeParser()
*/
CodeParser::~CodeParser()
{
- parsers.removeAll(this);
+ s_parsers.removeAll(this);
}
/*!
@@ -64,7 +64,7 @@ CodeParser::~CodeParser()
*/
void CodeParser::initializeParser()
{
- showInternal_ = Config::instance().showInternal();
+ s_showInternal = Config::instance().showInternal();
}
/*!
@@ -91,7 +91,7 @@ void CodeParser::parseHeaderFile(const Location &location, const QString &filePa
*/
void CodeParser::initialize()
{
- for (const auto &parser : qAsConst(parsers))
+ for (const auto &parser : qAsConst(s_parsers))
parser->initializeParser();
}
@@ -100,13 +100,13 @@ void CodeParser::initialize()
*/
void CodeParser::terminate()
{
- for (const auto parser : parsers)
+ for (const auto parser : s_parsers)
parser->terminateParser();
}
CodeParser *CodeParser::parserForLanguage(const QString &language)
{
- for (const auto parser : qAsConst(parsers)) {
+ for (const auto parser : qAsConst(s_parsers)) {
if (parser->language() == language)
return parser;
}
@@ -117,7 +117,7 @@ CodeParser *CodeParser::parserForHeaderFile(const QString &filePath)
{
QString fileName = QFileInfo(filePath).fileName();
- for (const auto &parser : qAsConst(parsers)) {
+ for (const auto &parser : qAsConst(s_parsers)) {
const QStringList headerPatterns = parser->headerFileNameFilter();
for (const auto &pattern : headerPatterns) {
auto re = QRegularExpression::fromWildcard(pattern, Qt::CaseInsensitive);
@@ -132,7 +132,7 @@ CodeParser *CodeParser::parserForSourceFile(const QString &filePath)
{
QString fileName = QFileInfo(filePath).fileName();
- for (const auto &parser : parsers) {
+ for (const auto &parser : s_parsers) {
const QStringList sourcePatterns = parser->sourceFileNameFilter();
for (const QString &pattern : sourcePatterns) {
auto re = QRegularExpression::fromWildcard(pattern, Qt::CaseInsensitive);
@@ -211,7 +211,7 @@ void CodeParser::setLink(Node *node, Node::LinkType linkType, const QString &arg
*/
bool CodeParser::isWorthWarningAbout(const Doc &doc)
{
- return (showInternal_ || !doc.metaCommandsUsed().contains(QStringLiteral("internal")));
+ return (s_showInternal || !doc.metaCommandsUsed().contains(QStringLiteral("internal")));
}
/*!
@@ -260,7 +260,7 @@ void CodeParser::checkModuleInclusion(Node *n)
return;
}
- qdb_->addToModule(Generator::defaultModuleName(), n);
+ m_qdb->addToModule(Generator::defaultModuleName(), n);
n->doc().location().warning(
QStringLiteral("%1 %2 has no \\inmodule command; "
"using project name by default: %3")
diff --git a/src/qdoc/codeparser.h b/src/qdoc/codeparser.h
index 934d33d3d..dd484db99 100644
--- a/src/qdoc/codeparser.h
+++ b/src/qdoc/codeparser.h
@@ -58,9 +58,9 @@ public:
return nullptr;
}
- const QString &currentFile() const { return currentFile_; }
- const QString &moduleHeader() const { return moduleHeader_; }
- void setModuleHeader(const QString &t) { moduleHeader_ = t; }
+ [[nodiscard]] const QString &currentFile() const { return m_currentFile; }
+ [[nodiscard]] const QString &moduleHeader() const { return m_moduleHeader; }
+ void setModuleHeader(const QString &t) { m_moduleHeader = t; }
void checkModuleInclusion(Node *n);
static void initialize();
@@ -74,14 +74,14 @@ public:
protected:
const QSet<QString> &commonMetaCommands();
static void extractPageLinkAndDesc(QStringView arg, QString *link, QString *desc);
- static bool showInternal() { return showInternal_; }
- QString moduleHeader_;
- QString currentFile_;
- QDocDatabase *qdb_;
+ static bool showInternal() { return s_showInternal; }
+ QString m_moduleHeader {};
+ QString m_currentFile {};
+ QDocDatabase *m_qdb {};
private:
- static QList<CodeParser *> parsers;
- static bool showInternal_;
+ static QList<CodeParser *> s_parsers;
+ static bool s_showInternal;
};
#define COMMAND_ABSTRACT Doc::alias(QLatin1String("abstract"))
diff --git a/src/qdoc/collectionnode.h b/src/qdoc/collectionnode.h
index 19f7d8d8e..2d8dcf008 100644
--- a/src/qdoc/collectionnode.h
+++ b/src/qdoc/collectionnode.h
@@ -44,29 +44,29 @@ public:
{
}
- bool isCollectionNode() const override { return true; }
- QString qtVariable() const override { return m_qtVariable; }
+ [[nodiscard]] bool isCollectionNode() const override { return true; }
+ [[nodiscard]] QString qtVariable() const override { return m_qtVariable; }
void setQtVariable(const QString &v) override { m_qtVariable = v; }
- QString qtCMakeComponent() const override { return m_qtCMakeComponent; }
+ [[nodiscard]] QString qtCMakeComponent() const override { return m_qtCMakeComponent; }
void setQtCMakeComponent(const QString &target) override { m_qtCMakeComponent = target; }
void addMember(Node *node) override;
- bool hasNamespaces() const override;
- bool hasClasses() const override;
+ [[nodiscard]] bool hasNamespaces() const override;
+ [[nodiscard]] bool hasClasses() const override;
void getMemberNamespaces(NodeMap &out) override;
void getMemberClasses(NodeMap &out) const override;
- bool wasSeen() const override { return m_seen; }
+ [[nodiscard]] bool wasSeen() const override { return m_seen; }
- QString fullTitle() const override { return title(); }
- QString logicalModuleName() const override { return m_logicalModuleName; }
- QString logicalModuleVersion() const override;
- QString logicalModuleIdentifier() const override
+ [[nodiscard]] QString fullTitle() const override { return title(); }
+ [[nodiscard]] QString logicalModuleName() const override { return m_logicalModuleName; }
+ [[nodiscard]] QString logicalModuleVersion() const override;
+ [[nodiscard]] QString logicalModuleIdentifier() const override
{
return m_logicalModuleName + m_logicalModuleVersionMajor;
}
void setLogicalModuleInfo(const QString &arg) override;
void setLogicalModuleInfo(const QStringList &info) override;
- const NodeList &members() const { return m_members; }
+ [[nodiscard]] const NodeList &members() const { return m_members; }
void markSeen() { m_seen = true; }
void markNotSeen() { m_seen = false; }
diff --git a/src/qdoc/config.h b/src/qdoc/config.h
index a7042e6b9..00c741d9e 100644
--- a/src/qdoc/config.h
+++ b/src/qdoc/config.h
@@ -39,6 +39,8 @@
#include <QtCore/qstack.h>
#include <QtCore/qstringlist.h>
+#include <utility>
+
QT_BEGIN_NAMESPACE
/*
@@ -53,8 +55,8 @@ struct ExpandVar
QString m_var {};
QChar m_delim {};
- ExpandVar(int valueIndex, int index, const QString &var, const QChar &delim)
- : m_valueIndex(valueIndex), m_index(index), m_var(var), m_delim(delim)
+ ExpandVar(int valueIndex, int index, QString var, const QChar &delim)
+ : m_valueIndex(valueIndex), m_index(index), m_var(std::move(var)), m_delim(delim)
{
}
};
@@ -78,10 +80,10 @@ struct ConfigVar
ConfigVar() = default;
- ConfigVar(const QString &name, const QStringList &values, const QString &dir,
+ ConfigVar(QString name, const QStringList &values, const QString &dir,
const Location &loc = Location(),
const QList<ExpandVar> &expandVars = QList<ExpandVar>())
- : m_name(name), m_location(loc), m_expandVars(expandVars)
+ : m_name(std::move(name)), m_location(loc), m_expandVars(expandVars)
{
for (const auto &v : values)
m_values << ConfigValue {v, dir};
@@ -117,8 +119,8 @@ public:
enum QDocPass { Neither, Prepare, Generate };
void init(const QString &programName, const QStringList &args);
- bool getDebug() const { return m_debug; }
- bool showInternal() const { return m_showInternal; }
+ [[nodiscard]] bool getDebug() const { return m_debug; }
+ [[nodiscard]] bool showInternal() const { return m_showInternal; }
void clear();
void reset();
@@ -127,26 +129,27 @@ public:
void insertStringList(const QString &var, const QStringList &values);
void showHelp(int exitCode = 0) { m_parser.showHelp(exitCode); }
- QStringList qdocFiles() const { return m_parser.positionalArguments(); }
- const QString &programName() const { return m_prog; }
- const Location &location() const { return m_location; }
- const Location &lastLocation() const { return m_lastLocation; }
- bool getBool(const QString &var) const;
- int getInt(const QString &var) const;
-
- QString getOutputDir(const QString &format = QString("HTML")) const;
- QSet<QString> getOutputFormats() const;
- QString getString(const QString &var, const QString &defaultString = QString()) const;
- QSet<QString> getStringSet(const QString &var) const;
- QStringList getStringList(const QString &var) const;
- QStringList getCanonicalPathList(const QString &var, bool validate = false) const;
- QRegularExpression getRegExp(const QString &var) const;
- QList<QRegularExpression> getRegExpList(const QString &var) const;
- QSet<QString> subVars(const QString &var) const;
+ [[nodiscard]] QStringList qdocFiles() const { return m_parser.positionalArguments(); }
+ [[nodiscard]] const QString &programName() const { return m_prog; }
+ [[nodiscard]] const Location &location() const { return m_location; }
+ [[nodiscard]] const Location &lastLocation() const { return m_lastLocation; }
+ [[nodiscard]] bool getBool(const QString &var) const;
+ [[nodiscard]] int getInt(const QString &var) const;
+
+ [[nodiscard]] QString getOutputDir(const QString &format = QString("HTML")) const;
+ [[nodiscard]] QSet<QString> getOutputFormats() const;
+ [[nodiscard]] QString getString(const QString &var,
+ const QString &defaultString = QString()) const;
+ [[nodiscard]] QSet<QString> getStringSet(const QString &var) const;
+ [[nodiscard]] QStringList getStringList(const QString &var) const;
+ [[nodiscard]] QStringList getCanonicalPathList(const QString &var, bool validate = false) const;
+ [[nodiscard]] QRegularExpression getRegExp(const QString &var) const;
+ [[nodiscard]] QList<QRegularExpression> getRegExpList(const QString &var) const;
+ [[nodiscard]] QSet<QString> subVars(const QString &var) const;
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;
+ [[nodiscard]] QString getIncludeFilePath(const QString &fileName) const;
QStringList getExampleQdocFiles(const QSet<QString> &excludedDirs,
const QSet<QString> &excludedFiles);
QStringList getExampleImageFiles(const QSet<QString> &excludedDirs,
@@ -180,20 +183,20 @@ public:
static QString overrideOutputDir;
static QSet<QString> overrideOutputFormats;
- inline bool singleExec() const;
- inline bool dualExec() const;
+ [[nodiscard]] inline bool singleExec() const;
+ [[nodiscard]] inline bool dualExec() const;
QStringList &defines() { return m_defines; }
QStringList &dependModules() { return m_dependModules; }
QStringList &includePaths() { return m_includePaths; }
QStringList &indexDirs() { return m_indexDirs; }
- QString currentDir() const { return m_currentDir; }
+ [[nodiscard]] QString currentDir() const { return m_currentDir; }
void setCurrentDir(const QString &path) { m_currentDir = path; }
- QString previousCurrentDir() const { return m_previousCurrentDir; }
+ [[nodiscard]] QString previousCurrentDir() const { return m_previousCurrentDir; }
void setPreviousCurrentDir(const QString &path) { m_previousCurrentDir = path; }
void setQDocPass(const QDocPass &pass) { m_qdocPass = pass; };
- bool preparing() const { return (m_qdocPass == Prepare); }
- bool generating() const { return (m_qdocPass == Generate); }
+ [[nodiscard]] bool preparing() const { return (m_qdocPass == Prepare); }
+ [[nodiscard]] bool generating() const { return (m_qdocPass == Generate); }
private:
void processCommandLineOptions(const QStringList &args);
diff --git a/src/qdoc/cppcodemarker.h b/src/qdoc/cppcodemarker.h
index a645d1a36..4b8986608 100644
--- a/src/qdoc/cppcodemarker.h
+++ b/src/qdoc/cppcodemarker.h
@@ -42,7 +42,7 @@ public:
bool recognizeCode(const QString &code) override;
bool recognizeExtension(const QString &ext) override;
bool recognizeLanguage(const QString &lang) override;
- Atom::AtomType atomType() const override;
+ [[nodiscard]] Atom::AtomType atomType() const 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;
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index 3cf7dc406..26309194e 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -212,12 +212,12 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc, const QString &command,
idx = words.size() - 1;
path = words[idx].split("::");
- node = qdb_->findNodeInOpenNamespace(path, m_nodeTypeTestFuncMap[command]);
+ node = m_qdb->findNodeInOpenNamespace(path, m_nodeTypeTestFuncMap[command]);
if (node == nullptr)
- node = qdb_->findNodeByNameAndType(path, m_nodeTypeTestFuncMap[command]);
+ node = m_qdb->findNodeByNameAndType(path, m_nodeTypeTestFuncMap[command]);
// Allow representing a type alias as a class
if (node == nullptr && command == COMMAND_CLASS) {
- node = qdb_->findNodeByNameAndType(path, &Node::isTypeAlias);
+ node = m_qdb->findNodeByNameAndType(path, &Node::isTypeAlias);
if (node) {
auto access = node->access();
auto loc = node->location();
@@ -248,46 +248,46 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc, const QString &command,
if (path.size() > 1) {
path.pop_back();
QString ns = path.join(QLatin1String("::"));
- qdb_->insertOpenNamespace(ns);
+ m_qdb->insertOpenNamespace(ns);
}
}
}
return node;
} else if (command == COMMAND_EXAMPLE) {
if (Config::generateExamples) {
- auto *en = new ExampleNode(qdb_->primaryTreeRoot(), arg.first);
+ auto *en = new ExampleNode(m_qdb->primaryTreeRoot(), arg.first);
en->setLocation(doc.startLocation());
setExampleFileLists(en);
return en;
}
} else if (command == COMMAND_EXTERNALPAGE) {
- auto *epn = new ExternalPageNode(qdb_->primaryTreeRoot(), arg.first);
+ auto *epn = new ExternalPageNode(m_qdb->primaryTreeRoot(), arg.first);
epn->setLocation(doc.startLocation());
return epn;
} else if (command == COMMAND_HEADERFILE) {
- auto *hn = new HeaderNode(qdb_->primaryTreeRoot(), arg.first);
+ auto *hn = new HeaderNode(m_qdb->primaryTreeRoot(), arg.first);
hn->setLocation(doc.startLocation());
return hn;
} else if (command == COMMAND_GROUP) {
- CollectionNode *cn = qdb_->addGroup(arg.first);
+ CollectionNode *cn = m_qdb->addGroup(arg.first);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
} else if (command == COMMAND_MODULE) {
- CollectionNode *cn = qdb_->addModule(arg.first);
+ CollectionNode *cn = m_qdb->addModule(arg.first);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
} else if (command == COMMAND_QMLMODULE) {
QStringList blankSplit = arg.first.split(QLatin1Char(' '));
- CollectionNode *cn = qdb_->addQmlModule(blankSplit[0]);
+ CollectionNode *cn = m_qdb->addQmlModule(blankSplit[0]);
cn->setLogicalModuleInfo(blankSplit);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
} else if (command == COMMAND_JSMODULE) {
QStringList blankSplit = arg.first.split(QLatin1Char(' '));
- CollectionNode *cn = qdb_->addJsModule(blankSplit[0]);
+ CollectionNode *cn = m_qdb->addJsModule(blankSplit[0]);
cn->setLogicalModuleInfo(blankSplit);
cn->setLocation(doc.startLocation());
cn->markSeen();
@@ -312,33 +312,33 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc, const QString &command,
else if (t == "attribution")
ptype = Node::AttributionPage;
}
- auto *pn = new PageNode(qdb_->primaryTreeRoot(), args[0], ptype);
+ auto *pn = new PageNode(m_qdb->primaryTreeRoot(), args[0], ptype);
pn->setLocation(doc.startLocation());
return pn;
} else if (command == COMMAND_QMLTYPE) {
QmlTypeNode *qcn = nullptr;
- Node *candidate = qdb_->primaryTreeRoot()->findChildNode(arg.first, Node::QML);
+ Node *candidate = m_qdb->primaryTreeRoot()->findChildNode(arg.first, Node::QML);
if (candidate != nullptr && candidate->isQmlType())
qcn = static_cast<QmlTypeNode *>(candidate);
else
- qcn = new QmlTypeNode(qdb_->primaryTreeRoot(), arg.first);
+ qcn = new QmlTypeNode(m_qdb->primaryTreeRoot(), arg.first);
qcn->setLocation(doc.startLocation());
return qcn;
} else if (command == COMMAND_JSTYPE) {
QmlTypeNode *qcn = nullptr;
- Node *candidate = qdb_->primaryTreeRoot()->findChildNode(arg.first, Node::JS);
+ Node *candidate = m_qdb->primaryTreeRoot()->findChildNode(arg.first, Node::JS);
if (candidate != nullptr && candidate->isJsType())
qcn = static_cast<QmlTypeNode *>(candidate);
else
- qcn = new QmlTypeNode(qdb_->primaryTreeRoot(), arg.first, Node::JsType);
+ qcn = new QmlTypeNode(m_qdb->primaryTreeRoot(), arg.first, Node::JsType);
qcn->setLocation(doc.startLocation());
return qcn;
} else if (command == COMMAND_QMLBASICTYPE) {
- auto *node = new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first);
+ auto *node = new QmlBasicTypeNode(m_qdb->primaryTreeRoot(), arg.first);
node->setLocation(doc.startLocation());
return node;
} else if (command == COMMAND_JSBASICTYPE) {
- auto *node = new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first, Node::JsBasicType);
+ auto *node = new QmlBasicTypeNode(m_qdb->primaryTreeRoot(), arg.first, Node::JsBasicType);
node->setLocation(doc.startLocation());
return node;
} else if ((command == COMMAND_QMLSIGNAL) || (command == COMMAND_QMLMETHOD)
@@ -413,8 +413,8 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
QString qmlTypeName;
Topic topic = topics.at(0);
- bool jsProps = isJSPropertyTopic(topic.topic);
- arg = topic.args;
+ bool jsProps = isJSPropertyTopic(topic.m_topic);
+ arg = topic.m_args;
if (splitQmlPropertyArg(arg, type, module, qmlTypeName, property, doc.location())) {
qsizetype i = property.indexOf('.');
if (i != -1)
@@ -422,18 +422,18 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
}
NodeList sharedNodes;
- QmlTypeNode *qmlType = qdb_->findQmlType(module, qmlTypeName);
+ QmlTypeNode *qmlType = m_qdb->findQmlType(module, qmlTypeName);
if (qmlType == nullptr)
- qmlType = new QmlTypeNode(qdb_->primaryTreeRoot(), qmlTypeName);
+ qmlType = new QmlTypeNode(m_qdb->primaryTreeRoot(), qmlTypeName);
for (const auto &topicCommand : topics) {
- QString cmd = topicCommand.topic;
- arg = topicCommand.args;
+ QString cmd = topicCommand.m_topic;
+ arg = topicCommand.m_args;
if ((cmd == COMMAND_QMLPROPERTY) || (cmd == COMMAND_QMLATTACHEDPROPERTY)
|| (cmd == COMMAND_JSPROPERTY) || (cmd == COMMAND_JSATTACHEDPROPERTY)) {
bool attached = cmd.contains(QLatin1String("attached"));
if (splitQmlPropertyArg(arg, type, module, qmlTypeName, property, doc.location())) {
- if (qmlType != qdb_->findQmlType(module, qmlTypeName)) {
+ if (qmlType != m_qdb->findQmlType(module, qmlTypeName)) {
doc.startLocation().warning(
QStringLiteral(
"All properties in a group must belong to the same type: '%1'")
@@ -541,7 +541,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
}
} else if (command == COMMAND_RELATES) {
QStringList path = arg.split("::");
- Aggregate *aggregate = qdb_->findRelatesNode(path);
+ Aggregate *aggregate = m_qdb->findRelatesNode(path);
if (aggregate == nullptr)
aggregate = new ProxyNode(node->root(), arg);
@@ -592,7 +592,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
}
} else if (command == COMMAND_QMLINSTANTIATES) {
if (node->isQmlType() || node->isJsType()) {
- ClassNode *classNode = qdb_->findClassNode(arg.split("::"));
+ ClassNode *classNode = m_qdb->findClassNode(arg.split("::"));
if (classNode)
node->setClassNode(classNode);
else
@@ -628,13 +628,13 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
node->setDeprecatedSince(version);
} else if (command == COMMAND_INGROUP || command == COMMAND_INPUBLICGROUP) {
// Note: \ingroup and \inpublicgroup are the same (and now recognized as such).
- qdb_->addToGroup(arg, node);
+ m_qdb->addToGroup(arg, node);
} else if (command == COMMAND_INMODULE) {
- qdb_->addToModule(arg, node);
+ m_qdb->addToModule(arg, node);
} else if (command == COMMAND_INQMLMODULE) {
- qdb_->addToQmlModule(arg, node);
+ m_qdb->addToQmlModule(arg, node);
} else if (command == COMMAND_INJSMODULE) {
- qdb_->addToJsModule(arg, node);
+ m_qdb->addToJsModule(arg, node);
} else if (command == COMMAND_OBSOLETE) {
node->setStatus(Node::Deprecated);
} else if (command == COMMAND_NONREENTRANT) {
@@ -658,7 +658,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
if (!node->setTitle(arg))
doc.location().warning(QStringLiteral("Ignored '\\%1'").arg(COMMAND_TITLE));
else if (node->isExample())
- qdb_->addExampleNode(static_cast<ExampleNode *>(node));
+ m_qdb->addExampleNode(static_cast<ExampleNode *>(node));
} else if (command == COMMAND_SUBTITLE) {
if (!node->setSubtitle(arg))
doc.location().warning(QStringLiteral("Ignored '\\%1'").arg(COMMAND_SUBTITLE));
@@ -732,9 +732,9 @@ FunctionNode *CppCodeParser::parseOtherFuncArg(const QString &topic, const Locat
}
funcName = colonSplit.last();
- Aggregate *aggregate = qdb_->findQmlType(moduleName, elementName);
+ Aggregate *aggregate = m_qdb->findQmlType(moduleName, elementName);
if (aggregate == nullptr)
- aggregate = qdb_->findQmlBasicType(moduleName, elementName);
+ aggregate = m_qdb->findQmlBasicType(moduleName, elementName);
if (aggregate == nullptr)
return nullptr;
@@ -772,7 +772,7 @@ FunctionNode *CppCodeParser::parseMacroArg(const Location &location, const QStri
QStringList blankSplit = leftParenSplit[0].split(' ');
if (!blankSplit.empty()) {
macroName = blankSplit.last();
- oldMacroNode = qdb_->findMacroNode(macroName);
+ oldMacroNode = m_qdb->findMacroNode(macroName);
}
QString returnType;
if (blankSplit.size() > 1) {
@@ -796,7 +796,7 @@ FunctionNode *CppCodeParser::parseMacroArg(const Location &location, const QStri
FunctionNode::Metaness metaness = FunctionNode::MacroWithParams;
if (params.isEmpty())
metaness = FunctionNode::MacroWithoutParams;
- auto *macro = new FunctionNode(metaness, qdb_->primaryTreeRoot(), macroName);
+ auto *macro = new FunctionNode(metaness, m_qdb->primaryTreeRoot(), macroName);
macro->setAccess(Access::Public);
macro->setLocation(location);
macro->setReturnType(returnType);
@@ -921,7 +921,7 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL
} else if (isQMLMethodTopic(topic) || isJSMethodTopic(topic)) {
node = parseOtherFuncArg(topic, doc.location(), args[0].first);
} else if (topic == COMMAND_DONTDOCUMENT) {
- qdb_->primaryTree()->addToDontDocumentMap(args[0].first);
+ m_qdb->primaryTree()->addToDontDocumentMap(args[0].first);
} else {
node = processTopicCommand(doc, topic, args[0]);
}
diff --git a/src/qdoc/cppcodeparser.h b/src/qdoc/cppcodeparser.h
index 897912d6e..62ace0b91 100644
--- a/src/qdoc/cppcodeparser.h
+++ b/src/qdoc/cppcodeparser.h
@@ -78,7 +78,7 @@ protected:
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);
- bool hasTooManyTopics(const Doc &doc) const;
+ [[nodiscard]] bool hasTooManyTopics(const Doc &doc) const;
private:
void setExampleFileLists(ExampleNode *en);
diff --git a/src/qdoc/doc.cpp b/src/qdoc/doc.cpp
index b6c4f0ba9..cff32b4e3 100644
--- a/src/qdoc/doc.cpp
+++ b/src/qdoc/doc.cpp
@@ -53,29 +53,29 @@ DocUtilities &Doc::m_utilities = DocUtilities::instance();
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);
+ m_priv = new DocPrivate(start_loc, end_loc, source);
DocParser parser;
- parser.parse(source, priv, metaCommandSet, topics);
+ parser.parse(source, m_priv, metaCommandSet, topics);
}
-Doc::Doc(const Doc &doc) : priv(nullptr)
+Doc::Doc(const Doc &doc) : m_priv(nullptr)
{
operator=(doc);
}
Doc::~Doc()
{
- if (priv && priv->deref())
- delete priv;
+ if (m_priv && m_priv->deref())
+ delete m_priv;
}
Doc &Doc::operator=(const Doc &doc)
{
- if (doc.priv)
- doc.priv->ref();
- if (priv && priv->deref())
- delete priv;
- priv = doc.priv;
+ if (doc.m_priv)
+ doc.m_priv->ref();
+ if (m_priv && m_priv->deref())
+ delete m_priv;
+ m_priv = doc.m_priv;
return *this;
}
@@ -85,7 +85,7 @@ Doc &Doc::operator=(const Doc &doc)
const Location &Doc::location() const
{
static const Location dummy;
- return priv == nullptr ? dummy : priv->start_loc;
+ return m_priv == nullptr ? dummy : m_priv->m_start_loc;
}
/*!
@@ -99,18 +99,18 @@ const Location &Doc::startLocation() const
const QString &Doc::source() const
{
static QString null;
- return priv == nullptr ? null : priv->src;
+ return m_priv == nullptr ? null : m_priv->m_src;
}
bool Doc::isEmpty() const
{
- return priv == nullptr || priv->src.isEmpty();
+ return m_priv == nullptr || m_priv->m_src.isEmpty();
}
const Text &Doc::body() const
{
static const Text dummy;
- return priv == nullptr ? dummy : priv->text;
+ return m_priv == nullptr ? dummy : m_priv->m_text;
}
Text Doc::briefText(bool inclusive) const
@@ -181,7 +181,7 @@ Text Doc::trimmedBriefText(const QString &className) const
Text Doc::legaleseText() const
{
- if (priv == nullptr || !priv->hasLegalese)
+ if (m_priv == nullptr || !m_priv->m_hasLegalese)
return Text();
else
return body().subText(Atom::LegaleseLeft, Atom::LegaleseRight);
@@ -189,22 +189,22 @@ Text Doc::legaleseText() const
QSet<QString> Doc::parameterNames() const
{
- return priv == nullptr ? QSet<QString>() : priv->params;
+ return m_priv == nullptr ? QSet<QString>() : m_priv->m_params;
}
QStringList Doc::enumItemNames() const
{
- return priv == nullptr ? QStringList() : priv->enumItemList;
+ return m_priv == nullptr ? QStringList() : m_priv->m_enumItemList;
}
QStringList Doc::omitEnumItemNames() const
{
- return priv == nullptr ? QStringList() : priv->omitEnumItemList;
+ return m_priv == nullptr ? QStringList() : m_priv->m_omitEnumItemList;
}
QSet<QString> Doc::metaCommandsUsed() const
{
- return priv == nullptr ? QSet<QString>() : priv->metacommandsUsed;
+ return m_priv == nullptr ? QSet<QString>() : m_priv->m_metacommandsUsed;
}
/*!
@@ -232,61 +232,61 @@ bool Doc::isMarkedReimp() const
*/
TopicList Doc::topicsUsed() const
{
- return priv == nullptr ? TopicList() : priv->topics_;
+ return m_priv == nullptr ? TopicList() : m_priv->m_topics;
}
ArgList Doc::metaCommandArgs(const QString &metacommand) const
{
- return priv == nullptr ? ArgList() : priv->metaCommandMap.value(metacommand);
+ return m_priv == nullptr ? ArgList() : m_priv->m_metaCommandMap.value(metacommand);
}
QList<Text> Doc::alsoList() const
{
- return priv == nullptr ? QList<Text>() : priv->alsoList;
+ return m_priv == nullptr ? QList<Text>() : m_priv->m_alsoList;
}
bool Doc::hasTableOfContents() const
{
- return priv && priv->extra && !priv->extra->tableOfContents_.isEmpty();
+ return m_priv && m_priv->extra && !m_priv->extra->m_tableOfContents.isEmpty();
}
bool Doc::hasKeywords() const
{
- return priv && priv->extra && !priv->extra->keywords_.isEmpty();
+ return m_priv && m_priv->extra && !m_priv->extra->m_keywords.isEmpty();
}
bool Doc::hasTargets() const
{
- return priv && priv->extra && !priv->extra->targets_.isEmpty();
+ return m_priv && m_priv->extra && !m_priv->extra->m_targets.isEmpty();
}
const QList<Atom *> &Doc::tableOfContents() const
{
- priv->constructExtra();
- return priv->extra->tableOfContents_;
+ m_priv->constructExtra();
+ return m_priv->extra->m_tableOfContents;
}
const QList<int> &Doc::tableOfContentsLevels() const
{
- priv->constructExtra();
- return priv->extra->tableOfContentsLevels_;
+ m_priv->constructExtra();
+ return m_priv->extra->m_tableOfContentsLevels;
}
const QList<Atom *> &Doc::keywords() const
{
- priv->constructExtra();
- return priv->extra->keywords_;
+ m_priv->constructExtra();
+ return m_priv->extra->m_keywords;
}
const QList<Atom *> &Doc::targets() const
{
- priv->constructExtra();
- return priv->extra->targets_;
+ m_priv->constructExtra();
+ return m_priv->extra->m_targets;
}
QStringMultiMap *Doc::metaTagMap() const
{
- return priv && priv->extra ? &priv->extra->metaMap_ : nullptr;
+ return m_priv && m_priv->extra ? &m_priv->extra->m_metaMap : nullptr;
}
void Doc::initialize()
@@ -312,25 +312,25 @@ void Doc::initialize()
QString macroDotName = CONFIG_MACRO + Config::dot + macroName;
Macro macro;
macro.numParams = -1;
- macro.defaultDef = config.getString(macroDotName);
- if (!macro.defaultDef.isEmpty()) {
- macro.defaultDefLocation = config.lastLocation();
- macro.numParams = Config::numParams(macro.defaultDef);
+ macro.m_defaultDef = config.getString(macroDotName);
+ if (!macro.m_defaultDef.isEmpty()) {
+ macro.m_defaultDefLocation = config.lastLocation();
+ macro.numParams = Config::numParams(macro.m_defaultDef);
}
bool silent = false;
for (const auto &f : config.subVars(macroDotName)) {
QString def = config.getString(macroDotName + Config::dot + f);
if (!def.isEmpty()) {
- macro.otherDefs.insert(f, def);
+ macro.m_otherDefs.insert(f, def);
int m = Config::numParams(def);
if (macro.numParams == -1)
macro.numParams = m;
else if (macro.numParams != m) {
if (!silent) {
QString other = QStringLiteral("default");
- if (macro.defaultDef.isEmpty())
- other = macro.otherDefs.constBegin().key();
+ if (macro.m_defaultDef.isEmpty())
+ other = macro.m_otherDefs.constBegin().key();
config.lastLocation().warning(
QStringLiteral("Macro '\\%1' takes inconsistent number of "
"arguments (%2 %3, %4 %5)")
@@ -403,8 +403,9 @@ void Doc::trimCStyleComment(Location &location, QString &str)
QString Doc::resolveFile(const Location &location, const QString &fileName,
QString *userFriendlyFilePath)
{
- const QString result = Config::findFile(location, DocParser::exampleFiles,
- DocParser::exampleDirs, fileName, userFriendlyFilePath);
+ const QString result =
+ Config::findFile(location, DocParser::s_exampleFiles, DocParser::s_exampleDirs,
+ fileName, userFriendlyFilePath);
qCDebug(lcQdoc).noquote().nospace()
<< __FUNCTION__ << "(location=" << location.fileName() << ':' << location.lineNo()
<< ", fileName=\"" << fileName << "\"), resolved to \"" << result;
@@ -421,10 +422,10 @@ CodeMarker *Doc::quoteFromFile(const Location &location, Quoter &quoter, const Q
const QString filePath = resolveFile(location, fileName, &userFriendlyFilePath);
if (filePath.isEmpty()) {
QString details = QLatin1String("Example directories: ")
- + DocParser::exampleDirs.join(QLatin1Char(' '));
- if (!DocParser::exampleFiles.isEmpty())
+ + DocParser::s_exampleDirs.join(QLatin1Char(' '));
+ if (!DocParser::s_exampleFiles.isEmpty())
details += QLatin1String(", example files: ")
- + DocParser::exampleFiles.join(QLatin1Char(' '));
+ + DocParser::s_exampleFiles.join(QLatin1Char(' '));
location.warning(QStringLiteral("Cannot find file to quote from: '%1'").arg(fileName),
details);
} else {
@@ -482,21 +483,21 @@ QString Doc::canonicalTitle(const QString &title)
void Doc::detach()
{
- if (priv == nullptr) {
- priv = new DocPrivate;
+ if (m_priv == nullptr) {
+ m_priv = new DocPrivate;
return;
}
- if (priv->count == 1)
+ if (m_priv->count == 1)
return;
- --priv->count;
+ --m_priv->count;
- auto *newPriv = new DocPrivate(*priv);
+ auto *newPriv = new DocPrivate(*m_priv);
newPriv->count = 1;
- if (priv->extra)
- newPriv->extra = new DocPrivateExtra(*priv->extra);
+ if (m_priv->extra)
+ newPriv->extra = new DocPrivateExtra(*m_priv->extra);
- priv = newPriv;
+ m_priv = newPriv;
}
/*!
@@ -505,8 +506,8 @@ void Doc::detach()
*/
QString Doc::bracketedArgs(const QString &command) const
{
- if (priv && priv->extra && !priv->extra->bracketedArgs_.isEmpty())
- return priv->extra->bracketedArgs_[command];
+ if (m_priv && m_priv->extra && !m_priv->extra->m_bracketedArgs.isEmpty())
+ return m_priv->extra->m_bracketedArgs[command];
return QString();
}
diff --git a/src/qdoc/doc.h b/src/qdoc/doc.h
index 1fcf42d31..3862bdcc8 100644
--- a/src/qdoc/doc.h
+++ b/src/qdoc/doc.h
@@ -26,10 +26,6 @@
**
****************************************************************************/
-/*
- doc.h
-*/
-
#ifndef DOC_H
#define DOC_H
@@ -74,31 +70,31 @@ public:
Doc &operator=(const Doc &doc);
- const Location &location() const;
- const Location &startLocation() const;
- bool isEmpty() const;
- const QString &source() const;
- const Text &body() const;
- Text briefText(bool inclusive = false) const;
- Text trimmedBriefText(const QString &className) const;
- Text legaleseText() const;
- QSet<QString> parameterNames() const;
- QStringList enumItemNames() const;
- QStringList omitEnumItemNames() const;
- QSet<QString> metaCommandsUsed() const;
- TopicList topicsUsed() const;
- ArgList metaCommandArgs(const QString &metaCommand) const;
- QList<Text> alsoList() const;
- bool hasTableOfContents() const;
- bool hasKeywords() const;
- bool hasTargets() const;
- bool isInternal() const;
- bool isMarkedReimp() const;
- const QList<Atom *> &tableOfContents() const;
- const QList<int> &tableOfContentsLevels() const;
- const QList<Atom *> &keywords() const;
- const QList<Atom *> &targets() const;
- QStringMultiMap *metaTagMap() const;
+ [[nodiscard]] const Location &location() const;
+ [[nodiscard]] const Location &startLocation() const;
+ [[nodiscard]] bool isEmpty() const;
+ [[nodiscard]] const QString &source() const;
+ [[nodiscard]] const Text &body() const;
+ [[nodiscard]] Text briefText(bool inclusive = false) const;
+ [[nodiscard]] Text trimmedBriefText(const QString &className) const;
+ [[nodiscard]] Text legaleseText() const;
+ [[nodiscard]] QSet<QString> parameterNames() const;
+ [[nodiscard]] QStringList enumItemNames() const;
+ [[nodiscard]] QStringList omitEnumItemNames() const;
+ [[nodiscard]] QSet<QString> metaCommandsUsed() const;
+ [[nodiscard]] TopicList topicsUsed() const;
+ [[nodiscard]] ArgList metaCommandArgs(const QString &metaCommand) const;
+ [[nodiscard]] QList<Text> alsoList() const;
+ [[nodiscard]] bool hasTableOfContents() const;
+ [[nodiscard]] bool hasKeywords() const;
+ [[nodiscard]] bool hasTargets() const;
+ [[nodiscard]] bool isInternal() const;
+ [[nodiscard]] bool isMarkedReimp() const;
+ [[nodiscard]] const QList<Atom *> &tableOfContents() const;
+ [[nodiscard]] const QList<int> &tableOfContentsLevels() const;
+ [[nodiscard]] const QList<Atom *> &keywords() const;
+ [[nodiscard]] const QList<Atom *> &targets() const;
+ [[nodiscard]] QStringMultiMap *metaTagMap() const;
[[nodiscard]] QString bracketedArgs(const QString &command) const;
static void initialize();
@@ -113,7 +109,7 @@ public:
private:
void detach();
- DocPrivate *priv { nullptr };
+ DocPrivate *m_priv { nullptr };
static DocUtilities &m_utilities;
};
Q_DECLARE_TYPEINFO(Doc, Q_RELOCATABLE_TYPE);
diff --git a/src/qdoc/docbookgenerator.cpp b/src/qdoc/docbookgenerator.cpp
index 9fd545db5..b4d1ab403 100644
--- a/src/qdoc/docbookgenerator.cpp
+++ b/src/qdoc/docbookgenerator.cpp
@@ -64,47 +64,47 @@ static const char xlinkNamespace[] = "http://www.w3.org/1999/xlink";
inline void DocBookGenerator::newLine()
{
- writer->writeCharacters("\n");
+ m_writer->writeCharacters("\n");
}
void DocBookGenerator::startSectionBegin()
{
- writer->writeStartElement(dbNamespace, "section");
+ m_writer->writeStartElement(dbNamespace, "section");
newLine();
- writer->writeStartElement(dbNamespace, "title");
+ m_writer->writeStartElement(dbNamespace, "title");
}
void DocBookGenerator::startSectionBegin(const QString &id)
{
- writer->writeStartElement(dbNamespace, "section");
- writer->writeAttribute("xml:id", id);
+ m_writer->writeStartElement(dbNamespace, "section");
+ m_writer->writeAttribute("xml:id", id);
newLine();
- writer->writeStartElement(dbNamespace, "title");
+ m_writer->writeStartElement(dbNamespace, "title");
}
void DocBookGenerator::startSectionEnd()
{
- writer->writeEndElement(); // title
+ m_writer->writeEndElement(); // title
newLine();
}
void DocBookGenerator::startSection(const QString &id, const QString &title)
{
startSectionBegin(id);
- writer->writeCharacters(title);
+ m_writer->writeCharacters(title);
startSectionEnd();
}
void DocBookGenerator::endSection()
{
- writer->writeEndElement(); // section
+ m_writer->writeEndElement(); // section
newLine();
}
void DocBookGenerator::writeAnchor(const QString &id)
{
- writer->writeEmptyElement(dbNamespace, "anchor");
- writer->writeAttribute("xml:id", id);
+ m_writer->writeEmptyElement(dbNamespace, "anchor");
+ m_writer->writeAttribute("xml:id", id);
newLine();
}
@@ -116,19 +116,19 @@ void DocBookGenerator::initializeGenerator()
{
// Excerpts from HtmlGenerator::initializeGenerator.
Generator::initializeGenerator();
- config = &Config::instance();
+ m_config = &Config::instance();
- project = config->getString(CONFIG_PROJECT);
+ m_project = m_config->getString(CONFIG_PROJECT);
- projectDescription = config->getString(CONFIG_DESCRIPTION);
- if (projectDescription.isEmpty() && !project.isEmpty())
- projectDescription = project + QLatin1String(" Reference Documentation");
+ m_projectDescription = m_config->getString(CONFIG_DESCRIPTION);
+ if (m_projectDescription.isEmpty() && !m_project.isEmpty())
+ m_projectDescription = m_project + QLatin1String(" Reference Documentation");
- naturalLanguage = config->getString(CONFIG_NATURALLANGUAGE);
- if (naturalLanguage.isEmpty())
- naturalLanguage = QLatin1String("en");
+ m_naturalLanguage = m_config->getString(CONFIG_NATURALLANGUAGE);
+ if (m_naturalLanguage.isEmpty())
+ m_naturalLanguage = QLatin1String("en");
- buildversion = config->getString(CONFIG_BUILDVERSION);
+ m_buildVersion = m_config->getString(CONFIG_BUILDVERSION);
}
QString DocBookGenerator::format()
@@ -173,7 +173,7 @@ bool DocBookGenerator::generateText(const Text &text, const Node *relative, Code
const Atom *DocBookGenerator::generateAtomList(const Atom *atom, const Node *relative,
bool generate, int &numAtoms)
{
- Q_ASSERT(writer);
+ Q_ASSERT(m_writer);
// From Generator::generateAtomList.
while (atom) {
switch (atom->type()) {
@@ -221,7 +221,7 @@ const Atom *DocBookGenerator::generateAtomList(const Atom *atom, const Node *rel
*/
qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker)
{
- Q_ASSERT(writer);
+ Q_ASSERT(m_writer);
Q_UNUSED(marker);
// From HtmlGenerator::generateAtom, without warning generation.
int idx = 0;
@@ -235,7 +235,7 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
genus = Node::API;
Q_FALLTHROUGH();
case Atom::NavAutoLink:
- if (!inLink && !m_inContents && !m_inSectionHeading) {
+ if (!m_inLink && !m_inContents && !m_inSectionHeading) {
const Node *node = nullptr;
QString link = getAutoLink(atom, relative, &node, genus);
if (!link.isEmpty() && node && node->isDeprecated()
@@ -243,14 +243,14 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
link.clear();
}
if (link.isEmpty()) {
- writer->writeCharacters(atom->string());
+ m_writer->writeCharacters(atom->string());
} else {
beginLink(link, node, relative);
generateLink(atom);
endLink();
}
} else {
- writer->writeCharacters(atom->string());
+ m_writer->writeCharacters(atom->string());
}
break;
case Atom::BaseName:
@@ -260,12 +260,12 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
skipAhead = skipAtoms(atom, Atom::BriefRight);
break;
}
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
rewritePropertyBrief(atom, relative);
break;
case Atom::BriefRight:
if (hasBrief(relative)) {
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
}
break;
@@ -273,71 +273,71 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
// This may at one time have been used to mark up C++ code but it is
// now widely used to write teletype text. As a result, text marked
// with the \c command is not passed to a code marker.
- writer->writeTextElement(dbNamespace, "code", plainCode(atom->string()));
+ m_writer->writeTextElement(dbNamespace, "code", plainCode(atom->string()));
break;
case Atom::CaptionLeft:
- writer->writeStartElement(dbNamespace, "title");
+ m_writer->writeStartElement(dbNamespace, "title");
break;
case Atom::CaptionRight:
endLink();
- writer->writeEndElement(); // title
+ m_writer->writeEndElement(); // title
newLine();
break;
case Atom::Qml:
- writer->writeStartElement(dbNamespace, "programlisting");
- writer->writeAttribute("language", "qml");
- writer->writeCharacters(atom->string());
- writer->writeEndElement(); // programlisting
+ m_writer->writeStartElement(dbNamespace, "programlisting");
+ m_writer->writeAttribute("language", "qml");
+ m_writer->writeCharacters(atom->string());
+ m_writer->writeEndElement(); // programlisting
newLine();
break;
case Atom::JavaScript:
- writer->writeStartElement(dbNamespace, "programlisting");
- writer->writeAttribute("language", "js");
- writer->writeCharacters(atom->string());
- writer->writeEndElement(); // programlisting
+ m_writer->writeStartElement(dbNamespace, "programlisting");
+ m_writer->writeAttribute("language", "js");
+ m_writer->writeCharacters(atom->string());
+ m_writer->writeEndElement(); // programlisting
newLine();
break;
case Atom::CodeNew:
- writer->writeTextElement(dbNamespace, "para", "you can rewrite it as");
+ m_writer->writeTextElement(dbNamespace, "para", "you can rewrite it as");
newLine();
- writer->writeStartElement(dbNamespace, "programlisting");
- writer->writeAttribute("language", "cpp");
- writer->writeAttribute("role", "new");
- writer->writeCharacters(atom->string());
- writer->writeEndElement(); // programlisting
+ m_writer->writeStartElement(dbNamespace, "programlisting");
+ m_writer->writeAttribute("language", "cpp");
+ m_writer->writeAttribute("role", "new");
+ m_writer->writeCharacters(atom->string());
+ m_writer->writeEndElement(); // programlisting
newLine();
break;
case Atom::Code:
- writer->writeStartElement(dbNamespace, "programlisting");
- writer->writeAttribute("language", "cpp");
- writer->writeCharacters(atom->string());
- writer->writeEndElement(); // programlisting
+ m_writer->writeStartElement(dbNamespace, "programlisting");
+ m_writer->writeAttribute("language", "cpp");
+ m_writer->writeCharacters(atom->string());
+ m_writer->writeEndElement(); // programlisting
newLine();
break;
case Atom::CodeOld:
- writer->writeTextElement(dbNamespace, "para", "For example, if you have code like");
+ m_writer->writeTextElement(dbNamespace, "para", "For example, if you have code like");
newLine();
Q_FALLTHROUGH();
case Atom::CodeBad:
- writer->writeStartElement(dbNamespace, "programlisting");
- writer->writeAttribute("language", "cpp");
- writer->writeAttribute("role", "bad");
- writer->writeCharacters(atom->string());
- writer->writeEndElement(); // programlisting
+ m_writer->writeStartElement(dbNamespace, "programlisting");
+ m_writer->writeAttribute("language", "cpp");
+ m_writer->writeAttribute("role", "bad");
+ m_writer->writeCharacters(atom->string());
+ m_writer->writeEndElement(); // programlisting
newLine();
break;
case Atom::DivLeft:
case Atom::DivRight:
break;
case Atom::FootnoteLeft:
- writer->writeStartElement(dbNamespace, "footnote");
+ m_writer->writeStartElement(dbNamespace, "footnote");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
break;
case Atom::FootnoteRight:
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // footnote
+ m_writer->writeEndElement(); // footnote
break;
case Atom::FormatElse:
case Atom::FormatEndif:
@@ -345,23 +345,23 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
break;
case Atom::FormattingLeft:
if (atom->string() == ATOM_FORMATTING_BOLD) {
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
} else if (atom->string() == ATOM_FORMATTING_ITALIC) {
- writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
} else if (atom->string() == ATOM_FORMATTING_UNDERLINE) {
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "underline");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "underline");
} else if (atom->string() == ATOM_FORMATTING_SUBSCRIPT) {
- writer->writeStartElement(dbNamespace, "sub");
+ m_writer->writeStartElement(dbNamespace, "sub");
} else if (atom->string() == ATOM_FORMATTING_SUPERSCRIPT) {
- writer->writeStartElement(dbNamespace, "sup");
+ m_writer->writeStartElement(dbNamespace, "sup");
} else if (atom->string() == ATOM_FORMATTING_TELETYPE
|| atom->string() == ATOM_FORMATTING_PARAMETER) {
- writer->writeStartElement(dbNamespace, "code");
+ m_writer->writeStartElement(dbNamespace, "code");
if (atom->string() == ATOM_FORMATTING_PARAMETER)
- writer->writeAttribute("role", "parameter");
+ m_writer->writeAttribute("role", "parameter");
}
break;
case Atom::FormattingRight:
@@ -371,7 +371,7 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
|| atom->string() == ATOM_FORMATTING_SUPERSCRIPT
|| atom->string() == ATOM_FORMATTING_TELETYPE
|| atom->string() == ATOM_FORMATTING_PARAMETER) {
- writer->writeEndElement();
+ m_writer->writeEndElement();
}
if (atom->string() == ATOM_FORMATTING_LINK)
endLink();
@@ -460,36 +460,36 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
case Atom::Image: // mediaobject
case Atom::InlineImage: { // inlinemediaobject
QString tag = atom->type() == Atom::Image ? "mediaobject" : "inlinemediaobject";
- writer->writeStartElement(dbNamespace, tag);
+ m_writer->writeStartElement(dbNamespace, tag);
newLine();
QString fileName = imageFileName(relative, atom->string());
if (fileName.isEmpty()) {
- writer->writeStartElement(dbNamespace, "textobject");
+ m_writer->writeStartElement(dbNamespace, "textobject");
newLine();
- writer->writeStartElement(dbNamespace, "para");
- writer->writeTextElement(dbNamespace, "emphasis",
- "[Missing image " + atom->string() + "]");
- writer->writeEndElement(); // para
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeTextElement(dbNamespace, "emphasis",
+ "[Missing image " + atom->string() + "]");
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // textobject
+ m_writer->writeEndElement(); // textobject
newLine();
} else {
if (atom->next() && !atom->next()->string().isEmpty())
- writer->writeTextElement(dbNamespace, "alt", atom->next()->string());
+ m_writer->writeTextElement(dbNamespace, "alt", atom->next()->string());
- writer->writeStartElement(dbNamespace, "imageobject");
+ m_writer->writeStartElement(dbNamespace, "imageobject");
newLine();
- writer->writeEmptyElement(dbNamespace, "imagedata");
- writer->writeAttribute("fileref", fileName);
+ m_writer->writeEmptyElement(dbNamespace, "imagedata");
+ m_writer->writeAttribute("fileref", fileName);
newLine();
- writer->writeEndElement(); // imageobject
+ m_writer->writeEndElement(); // imageobject
newLine();
setImageFileName(relative, fileName);
}
- writer->writeEndElement(); // [inline]mediaobject
+ m_writer->writeEndElement(); // [inline]mediaobject
if (atom->type() == Atom::Image)
newLine();
} break;
@@ -498,15 +498,15 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
case Atom::ImportantLeft:
case Atom::NoteLeft: {
QString tag = atom->type() == Atom::ImportantLeft ? "important" : "note";
- writer->writeStartElement(dbNamespace, tag);
+ m_writer->writeStartElement(dbNamespace, tag);
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
} break;
case Atom::ImportantRight:
case Atom::NoteRight:
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // note/important
+ m_writer->writeEndElement(); // note/important
newLine();
break;
case Atom::LegaleseLeft:
@@ -526,56 +526,56 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
} break;
case Atom::ListLeft:
if (inPara) {
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
inPara = false;
}
if (atom->string() == ATOM_LIST_BULLET) {
- writer->writeStartElement(dbNamespace, "itemizedlist");
+ m_writer->writeStartElement(dbNamespace, "itemizedlist");
newLine();
} else if (atom->string() == ATOM_LIST_TAG) {
- writer->writeStartElement(dbNamespace, "variablelist");
+ m_writer->writeStartElement(dbNamespace, "variablelist");
newLine();
} else if (atom->string() == ATOM_LIST_VALUE) {
- writer->writeStartElement(dbNamespace, "informaltable");
+ m_writer->writeStartElement(dbNamespace, "informaltable");
newLine();
- writer->writeStartElement(dbNamespace, "thead");
+ m_writer->writeStartElement(dbNamespace, "thead");
newLine();
- writer->writeStartElement(dbNamespace, "tr");
+ m_writer->writeStartElement(dbNamespace, "tr");
newLine();
- writer->writeTextElement(dbNamespace, "th", "Constant");
+ m_writer->writeTextElement(dbNamespace, "th", "Constant");
newLine();
m_threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom);
if (m_threeColumnEnumValueTable && relative->nodeType() == Node::Enum) {
// If not in \enum topic, skip the value column
- writer->writeTextElement(dbNamespace, "th", "Value");
+ m_writer->writeTextElement(dbNamespace, "th", "Value");
newLine();
}
- writer->writeTextElement(dbNamespace, "th", "Description");
+ m_writer->writeTextElement(dbNamespace, "th", "Description");
newLine();
- writer->writeEndElement(); // tr
+ m_writer->writeEndElement(); // tr
newLine();
- writer->writeEndElement(); // thead
+ m_writer->writeEndElement(); // thead
newLine();
} else {
- writer->writeStartElement(dbNamespace, "orderedlist");
+ m_writer->writeStartElement(dbNamespace, "orderedlist");
if (atom->next() != nullptr && atom->next()->string().toInt() > 1)
- writer->writeAttribute("startingnumber", atom->next()->string());
+ m_writer->writeAttribute("startingnumber", atom->next()->string());
if (atom->string() == ATOM_LIST_UPPERALPHA)
- writer->writeAttribute("numeration", "upperalpha");
+ m_writer->writeAttribute("numeration", "upperalpha");
else if (atom->string() == ATOM_LIST_LOWERALPHA)
- writer->writeAttribute("numeration", "loweralpha");
+ m_writer->writeAttribute("numeration", "loweralpha");
else if (atom->string() == ATOM_LIST_UPPERROMAN)
- writer->writeAttribute("numeration", "upperroman");
+ m_writer->writeAttribute("numeration", "upperroman");
else if (atom->string() == ATOM_LIST_LOWERROMAN)
- writer->writeAttribute("numeration", "lowerroman");
+ m_writer->writeAttribute("numeration", "lowerroman");
else // (atom->string() == ATOM_LIST_NUMERIC)
- writer->writeAttribute("numeration", "arabic");
+ m_writer->writeAttribute("numeration", "arabic");
newLine();
}
@@ -584,34 +584,34 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
break;
case Atom::ListTagLeft:
if (atom->string() == ATOM_LIST_TAG) {
- writer->writeStartElement(dbNamespace, "varlistentry");
+ m_writer->writeStartElement(dbNamespace, "varlistentry");
newLine();
- writer->writeStartElement(dbNamespace, "item");
+ m_writer->writeStartElement(dbNamespace, "item");
} else { // (atom->string() == ATOM_LIST_VALUE)
QPair<QString, int> pair = getAtomListValue(atom);
skipAhead = pair.second;
- writer->writeStartElement(dbNamespace, "tr");
+ m_writer->writeStartElement(dbNamespace, "tr");
newLine();
- writer->writeStartElement(dbNamespace, "td");
+ m_writer->writeStartElement(dbNamespace, "td");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
generateEnumValue(pair.first, relative);
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // td
+ m_writer->writeEndElement(); // td
newLine();
if (relative->nodeType() == Node::Enum) {
const auto enume = static_cast<const EnumNode *>(relative);
QString itemValue = enume->itemValue(atom->next()->string());
- writer->writeStartElement(dbNamespace, "td");
+ m_writer->writeStartElement(dbNamespace, "td");
if (itemValue.isEmpty())
- writer->writeCharacters("?");
+ m_writer->writeCharacters("?");
else
- writer->writeTextElement(dbNamespace, "code", itemValue);
- writer->writeEndElement(); // td
+ m_writer->writeTextElement(dbNamespace, "code", itemValue);
+ m_writer->writeEndElement(); // td
newLine();
}
}
@@ -619,52 +619,52 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
case Atom::SinceTagRight:
case Atom::ListTagRight:
if (atom->string() == ATOM_LIST_TAG) {
- writer->writeEndElement(); // item
+ m_writer->writeEndElement(); // item
newLine();
}
break;
case Atom::ListItemLeft:
- inListItemLineOpen = false;
+ m_inListItemLineOpen = false;
if (atom->string() == ATOM_LIST_TAG) {
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
} else if (atom->string() == ATOM_LIST_VALUE) {
if (m_threeColumnEnumValueTable) {
if (matchAhead(atom, Atom::ListItemRight)) {
- writer->writeEmptyElement(dbNamespace, "td");
+ m_writer->writeEmptyElement(dbNamespace, "td");
newLine();
- inListItemLineOpen = false;
+ m_inListItemLineOpen = false;
} else {
- writer->writeStartElement(dbNamespace, "td");
+ m_writer->writeStartElement(dbNamespace, "td");
newLine();
- inListItemLineOpen = true;
+ m_inListItemLineOpen = true;
}
}
} else {
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
}
// Don't skip a paragraph, DocBook requires them within list items.
break;
case Atom::ListItemRight:
if (atom->string() == ATOM_LIST_TAG) {
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // listitem
+ m_writer->writeEndElement(); // listitem
newLine();
- writer->writeEndElement(); // varlistentry
+ m_writer->writeEndElement(); // varlistentry
newLine();
} else if (atom->string() == ATOM_LIST_VALUE) {
- if (inListItemLineOpen) {
- writer->writeEndElement(); // td
+ if (m_inListItemLineOpen) {
+ m_writer->writeEndElement(); // td
newLine();
- inListItemLineOpen = false;
+ m_inListItemLineOpen = false;
}
- writer->writeEndElement(); // tr
+ m_writer->writeEndElement(); // tr
newLine();
} else {
- writer->writeEndElement(); // listitem
+ m_writer->writeEndElement(); // listitem
newLine();
}
break;
@@ -674,33 +674,33 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
// - ATOM_LIST_TAG: variablelist
// - ATOM_LIST_VALUE: informaltable
// - ATOM_LIST_NUMERIC: orderedlist
- writer->writeEndElement();
+ m_writer->writeEndElement();
newLine();
break;
case Atom::Nop:
break;
case Atom::ParaLeft:
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
inPara = true;
break;
case Atom::ParaRight:
endLink();
if (inPara) {
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
inPara = false;
}
break;
case Atom::QuotationLeft:
- writer->writeStartElement(dbNamespace, "blockquote");
+ m_writer->writeStartElement(dbNamespace, "blockquote");
inPara = true;
break;
case Atom::QuotationRight:
- writer->writeEndElement(); // blockquote
+ m_writer->writeEndElement(); // blockquote
newLine();
break;
case Atom::RawString:
- writer->writeCharacters(atom->string());
+ m_writer->writeCharacters(atom->string());
break;
case Atom::SectionLeft:
currentSectionLevel = atom->string().toInt() + hOffset(relative);
@@ -710,15 +710,15 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
// i.e. going to a new section, even deeper.
while (!sectionLevels.empty() && sectionLevels.top() >= currentSectionLevel) {
sectionLevels.pop();
- writer->writeEndElement(); // section
+ m_writer->writeEndElement(); // section
newLine();
}
sectionLevels.push(currentSectionLevel);
- writer->writeStartElement(dbNamespace, "section");
- writer->writeAttribute("xml:id",
- Doc::canonicalTitle(Text::sectionHeading(atom).toString()));
+ m_writer->writeStartElement(dbNamespace, "section");
+ m_writer->writeAttribute("xml:id",
+ Doc::canonicalTitle(Text::sectionHeading(atom).toString()));
newLine();
// Unlike startSectionBegin, don't start a title here.
}
@@ -730,30 +730,30 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
case Atom::SectionHeadingLeft:
// Level 1 is dealt with at the header level (info tag).
if (currentSectionLevel > 1) {
- writer->writeStartElement(dbNamespace, "title");
+ m_writer->writeStartElement(dbNamespace, "title");
m_inSectionHeading = true;
}
break;
case Atom::SectionHeadingRight:
// Level 1 is dealt with at the header level (info tag).
if (currentSectionLevel > 1) {
- writer->writeEndElement(); // title
+ m_writer->writeEndElement(); // title
newLine();
m_inSectionHeading = false;
}
break;
case Atom::SidebarLeft:
- writer->writeStartElement(dbNamespace, "sidebar");
+ m_writer->writeStartElement(dbNamespace, "sidebar");
break;
case Atom::SidebarRight:
- writer->writeEndElement(); // sidebar
+ m_writer->writeEndElement(); // sidebar
newLine();
break;
case Atom::String:
- if (inLink && !m_inContents && !m_inSectionHeading)
+ if (m_inLink && !m_inContents && !m_inSectionHeading)
generateLink(atom);
else
- writer->writeCharacters(atom->string());
+ m_writer->writeCharacters(atom->string());
break;
case Atom::TableLeft: {
QPair<QString, QString> pair = getTableWidthAttr(atom);
@@ -761,46 +761,46 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
QString width = pair.first;
if (inPara) {
- writer->writeEndElement(); // para or blockquote
+ m_writer->writeEndElement(); // para or blockquote
newLine();
inPara = false;
}
- writer->writeStartElement(dbNamespace, "informaltable");
- writer->writeAttribute("style", attr);
+ m_writer->writeStartElement(dbNamespace, "informaltable");
+ m_writer->writeAttribute("style", attr);
if (!width.isEmpty())
- writer->writeAttribute("width", width);
+ m_writer->writeAttribute("width", width);
newLine();
m_numTableRows = 0;
} break;
case Atom::TableRight:
- writer->writeEndElement(); // table
+ m_writer->writeEndElement(); // table
newLine();
break;
case Atom::TableHeaderLeft:
- writer->writeStartElement(dbNamespace, "thead");
+ m_writer->writeStartElement(dbNamespace, "thead");
newLine();
- writer->writeStartElement(dbNamespace, "tr");
+ m_writer->writeStartElement(dbNamespace, "tr");
newLine();
m_inTableHeader = true;
break;
case Atom::TableHeaderRight:
- writer->writeEndElement(); // tr
+ m_writer->writeEndElement(); // tr
newLine();
if (matchAhead(atom, Atom::TableHeaderLeft)) {
skipAhead = 1;
- writer->writeStartElement(dbNamespace, "tr");
+ m_writer->writeStartElement(dbNamespace, "tr");
newLine();
} else {
- writer->writeEndElement(); // thead
+ m_writer->writeEndElement(); // thead
newLine();
m_inTableHeader = false;
}
break;
case Atom::TableRowLeft:
- writer->writeStartElement(dbNamespace, "tr");
+ m_writer->writeStartElement(dbNamespace, "tr");
if (atom->string().isEmpty()) {
- writer->writeAttribute("valign", "top");
+ m_writer->writeAttribute("valign", "top");
} else {
// Basic parsing of attributes, should be enough. The input string (atom->string())
// looks like:
@@ -815,29 +815,29 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
.arg(atom->string()));
}
for (int i = 0; i + 1 < args.size(); i += 2)
- writer->writeAttribute(args.at(i).chopped(1), args.at(i + 1));
+ m_writer->writeAttribute(args.at(i).chopped(1), args.at(i + 1));
}
newLine();
break;
case Atom::TableRowRight:
- writer->writeEndElement(); // tr
+ m_writer->writeEndElement(); // tr
newLine();
break;
case Atom::TableItemLeft:
- writer->writeStartElement(dbNamespace, m_inTableHeader ? "th" : "td");
+ m_writer->writeStartElement(dbNamespace, m_inTableHeader ? "th" : "td");
for (int i = 0; i < atom->count(); ++i) {
const QString &p = atom->string(i);
if (p.contains('=')) {
QStringList lp = p.split(QLatin1Char('='));
- writer->writeAttribute(lp.at(0), lp.at(1));
+ m_writer->writeAttribute(lp.at(0), lp.at(1));
} else {
QStringList spans = p.split(QLatin1Char(','));
if (spans.size() == 2) {
if (spans.at(0) != "1")
- writer->writeAttribute("colspan", spans.at(0));
+ m_writer->writeAttribute("colspan", spans.at(0));
if (spans.at(1) != "1")
- writer->writeAttribute("rowspan", spans.at(1));
+ m_writer->writeAttribute("rowspan", spans.at(1));
}
}
}
@@ -845,7 +845,7 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
// No skipahead, as opposed to HTML: in DocBook, the text must be wrapped in paragraphs.
break;
case Atom::TableItemRight:
- writer->writeEndElement(); // th if m_inTableHeader, otherwise td
+ m_writer->writeEndElement(); // th if m_inTableHeader, otherwise td
newLine();
break;
case Atom::TableOfContents:
@@ -856,19 +856,19 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative,
writeAnchor(Doc::canonicalTitle(atom->string()));
break;
case Atom::UnhandledFormat:
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
- writer->writeCharacters("&lt;Missing DocBook&gt;");
- writer->writeEndElement(); // emphasis
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
+ m_writer->writeCharacters("&lt;Missing DocBook&gt;");
+ m_writer->writeEndElement(); // emphasis
break;
case Atom::UnknownCommand:
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
- writer->writeCharacters("&lt;Unknown command&gt;");
- writer->writeStartElement(dbNamespace, "code");
- writer->writeCharacters(atom->string());
- writer->writeEndElement(); // code
- writer->writeEndElement(); // emphasis
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
+ m_writer->writeCharacters("&lt;Unknown command&gt;");
+ m_writer->writeStartElement(dbNamespace, "code");
+ m_writer->writeCharacters(atom->string());
+ m_writer->writeEndElement(); // code
+ m_writer->writeEndElement(); // emphasis
break;
case Atom::QmlText:
case Atom::EndQmlText:
@@ -903,22 +903,22 @@ void DocBookGenerator::generateClassHierarchy(const Node *relative, NodeMultiMap
QStack<NodeMap> stack;
stack.push(topLevel);
- writer->writeStartElement(dbNamespace, "itemizedlist");
+ m_writer->writeStartElement(dbNamespace, "itemizedlist");
newLine();
while (!stack.isEmpty()) {
if (stack.top().isEmpty()) {
stack.pop();
- writer->writeEndElement(); // listitem
+ m_writer->writeEndElement(); // listitem
newLine();
- writer->writeEndElement(); // itemizedlist
+ m_writer->writeEndElement(); // itemizedlist
newLine();
} else {
auto *child = static_cast<ClassNode *>(*stack.top().begin());
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
generateFullName(child, relative);
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
// Don't close the listitem now, as DocBook requires sublists to reside in items.
stack.top().erase(stack.top().begin());
@@ -930,7 +930,7 @@ void DocBookGenerator::generateClassHierarchy(const Node *relative, NodeMultiMap
}
if (!newTop.isEmpty()) {
stack.push(newTop);
- writer->writeStartElement(dbNamespace, "itemizedlist");
+ m_writer->writeStartElement(dbNamespace, "itemizedlist");
newLine();
}
}
@@ -945,12 +945,12 @@ void DocBookGenerator::generateLink(const Atom *atom)
if (match.hasMatch()) {
// hack for C++: move () outside of link
qsizetype k = match.capturedStart(1);
- writer->writeCharacters(atom->string().left(k));
- writer->writeEndElement(); // link
- inLink = false;
- writer->writeCharacters(atom->string().mid(k));
+ m_writer->writeCharacters(atom->string().left(k));
+ m_writer->writeEndElement(); // link
+ m_inLink = false;
+ m_writer->writeCharacters(atom->string().mid(k));
} else {
- writer->writeCharacters(atom->string());
+ m_writer->writeCharacters(atom->string());
}
}
@@ -961,20 +961,20 @@ void DocBookGenerator::generateLink(const Atom *atom)
void DocBookGenerator::beginLink(const QString &link, const Node *node, const Node *relative)
{
// From HtmlGenerator::beginLink.
- writer->writeStartElement(dbNamespace, "link");
- writer->writeAttribute(xlinkNamespace, "href", link);
+ m_writer->writeStartElement(dbNamespace, "link");
+ m_writer->writeAttribute(xlinkNamespace, "href", link);
if (node && !(relative && node->status() == relative->status())
&& node->isDeprecated())
- writer->writeAttribute("role", "deprecated");
- inLink = true;
+ m_writer->writeAttribute("role", "deprecated");
+ m_inLink = true;
}
void DocBookGenerator::endLink()
{
// From HtmlGenerator::endLink.
- if (inLink)
- writer->writeEndElement(); // link
- inLink = false;
+ if (m_inLink)
+ m_writer->writeEndElement(); // link
+ m_inLink = false;
}
void DocBookGenerator::generateList(const Node *relative, const QString &selector)
@@ -1029,32 +1029,32 @@ void DocBookGenerator::generateAnnotatedList(const Node *relative, const NodeLis
}
// From WebXMLGenerator::generateAnnotatedList.
- writer->writeStartElement(dbNamespace, "variablelist");
- writer->writeAttribute("role", selector);
+ m_writer->writeStartElement(dbNamespace, "variablelist");
+ m_writer->writeAttribute("role", selector);
newLine();
for (const auto node : nodeList) {
if (node->isInternal() || node->isDeprecated())
continue;
- writer->writeStartElement(dbNamespace, "varlistentry");
+ m_writer->writeStartElement(dbNamespace, "varlistentry");
newLine();
- writer->writeStartElement(dbNamespace, "term");
+ m_writer->writeStartElement(dbNamespace, "term");
generateFullName(node, relative);
- writer->writeEndElement(); // term
+ m_writer->writeEndElement(); // term
newLine();
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters(node->doc().briefText().toString());
- writer->writeEndElement(); // para
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters(node->doc().briefText().toString());
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // listitem
+ m_writer->writeEndElement(); // listitem
newLine();
- writer->writeEndElement(); // varlistentry
+ m_writer->writeEndElement(); // varlistentry
newLine();
}
- writer->writeEndElement(); // variablelist
+ m_writer->writeEndElement(); // variablelist
newLine();
}
@@ -1165,31 +1165,31 @@ void DocBookGenerator::generateCompactList(ListType listType, const Node *relati
*/
if (curParOffset == 0) {
if (i > 0) {
- writer->writeEndElement(); // variablelist
+ m_writer->writeEndElement(); // variablelist
newLine();
}
- writer->writeStartElement(dbNamespace, "variablelist");
- writer->writeAttribute("role", selector);
+ m_writer->writeStartElement(dbNamespace, "variablelist");
+ m_writer->writeAttribute("role", selector);
newLine();
- writer->writeStartElement(dbNamespace, "varlistentry");
+ m_writer->writeStartElement(dbNamespace, "varlistentry");
newLine();
- writer->writeStartElement(dbNamespace, "term");
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
- writer->writeCharacters(paragraphName[curParNr]);
- writer->writeEndElement(); // emphasis
- writer->writeEndElement(); // term
+ m_writer->writeStartElement(dbNamespace, "term");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
+ m_writer->writeCharacters(paragraphName[curParNr]);
+ m_writer->writeEndElement(); // emphasis
+ m_writer->writeEndElement(); // term
newLine();
}
/*
Output a listitem for the current offset in the current paragraph.
*/
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
if ((curParNr < NumParagraphs) && !paragraphName[curParNr].isEmpty()) {
NodeMultiMap::Iterator it;
NodeMultiMap::Iterator next;
@@ -1199,9 +1199,9 @@ void DocBookGenerator::generateCompactList(ListType listType, const Node *relati
if (listType == Generic) {
generateFullName(it.value(), relative);
- writer->writeStartElement(dbNamespace, "link");
- writer->writeAttribute(xlinkNamespace, "href", fullDocumentLocation(*it));
- writer->writeAttribute("type", targetType(it.value()));
+ m_writer->writeStartElement(dbNamespace, "link");
+ m_writer->writeAttribute(xlinkNamespace, "href", fullDocumentLocation(*it));
+ m_writer->writeAttribute("type", targetType(it.value()));
} else if (listType == Obsolete) {
QString fn = fileName(it.value(), fileExtension());
QString link;
@@ -1209,9 +1209,9 @@ void DocBookGenerator::generateCompactList(ListType listType, const Node *relati
link = QString("../" + it.value()->outputSubdirectory() + QLatin1Char('/'));
link += fn;
- writer->writeStartElement(dbNamespace, "link");
- writer->writeAttribute(xlinkNamespace, "href", link);
- writer->writeAttribute("type", targetType(it.value()));
+ m_writer->writeStartElement(dbNamespace, "link");
+ m_writer->writeAttribute(xlinkNamespace, "href", link);
+ m_writer->writeAttribute("type", targetType(it.value()));
}
QStringList pieces;
@@ -1231,58 +1231,58 @@ void DocBookGenerator::generateCompactList(ListType listType, const Node *relati
} else
pieces = it.value()->fullName(relative).split("::");
- writer->writeCharacters(pieces.last());
- writer->writeEndElement(); // link
+ m_writer->writeCharacters(pieces.last());
+ m_writer->writeEndElement(); // link
if (pieces.size() > 1) {
- writer->writeCharacters(" (");
+ m_writer->writeCharacters(" (");
generateFullName(it.value()->parent(), relative);
- writer->writeCharacters(")");
+ m_writer->writeCharacters(")");
}
}
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // listitem
+ m_writer->writeEndElement(); // listitem
newLine();
- writer->writeEndElement(); // varlistentry
+ m_writer->writeEndElement(); // varlistentry
newLine();
curParOffset++;
}
if (nmm.count() > 0) {
- writer->writeEndElement(); // variablelist
+ m_writer->writeEndElement(); // variablelist
}
}
void DocBookGenerator::generateFunctionIndex(const Node *relative)
{
// From HtmlGenerator::generateFunctionIndex.
- writer->writeStartElement(dbNamespace, "simplelist");
- writer->writeAttribute("role", "functionIndex");
+ m_writer->writeStartElement(dbNamespace, "simplelist");
+ m_writer->writeAttribute("role", "functionIndex");
newLine();
for (int i = 0; i < 26; i++) {
QChar ch('a' + i);
- writer->writeStartElement(dbNamespace, "member");
- writer->writeAttribute(xlinkNamespace, "href", QString("#") + ch);
- writer->writeCharacters(ch.toUpper());
- writer->writeEndElement(); // member
+ m_writer->writeStartElement(dbNamespace, "member");
+ m_writer->writeAttribute(xlinkNamespace, "href", QString("#") + ch);
+ m_writer->writeCharacters(ch.toUpper());
+ m_writer->writeEndElement(); // member
newLine();
}
- writer->writeEndElement(); // simplelist
+ m_writer->writeEndElement(); // simplelist
newLine();
char nextLetter = 'a';
char currentLetter;
- writer->writeStartElement(dbNamespace, "itemizedlist");
+ m_writer->writeStartElement(dbNamespace, "itemizedlist");
newLine();
NodeMapMap &funcIndex = m_qdb->getFunctionIndex();
QMap<QString, NodeMap>::ConstIterator f = funcIndex.constBegin();
while (f != funcIndex.constEnd()) {
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters(f.key() + ": ");
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters(f.key() + ": ");
currentLetter = f.key()[0].unicode();
while (islower(currentLetter) && currentLetter >= nextLetter) {
@@ -1292,18 +1292,18 @@ void DocBookGenerator::generateFunctionIndex(const Node *relative)
NodeMap::ConstIterator s = (*f).constBegin();
while (s != (*f).constEnd()) {
- writer->writeCharacters(" ");
+ m_writer->writeCharacters(" ");
generateFullName((*s)->parent(), relative);
++s;
}
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // listitem
+ m_writer->writeEndElement(); // listitem
newLine();
++f;
}
- writer->writeEndElement(); // itemizedlist
+ m_writer->writeEndElement(); // itemizedlist
newLine();
}
@@ -1314,20 +1314,20 @@ void DocBookGenerator::generateLegaleseList(const Node *relative)
for (auto it = legaleseTexts.cbegin(), end = legaleseTexts.cend(); it != end; ++it) {
Text text = it.key();
generateText(text, relative);
- writer->writeStartElement(dbNamespace, "itemizedlist");
+ m_writer->writeStartElement(dbNamespace, "itemizedlist");
newLine();
do {
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
generateFullName(it.value(), relative);
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // listitem
+ m_writer->writeEndElement(); // listitem
newLine();
++it;
} while (it != legaleseTexts.constEnd() && it.key() == text);
- writer->writeEndElement(); // itemizedlist
+ m_writer->writeEndElement(); // itemizedlist
newLine();
}
}
@@ -1342,9 +1342,9 @@ void DocBookGenerator::generateBrief(const Node *node)
if (!brief.lastAtom()->string().endsWith('.'))
brief << Atom(Atom::String, ".");
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
generateText(brief, node);
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
}
}
@@ -1353,12 +1353,12 @@ bool DocBookGenerator::generateSince(const Node *node)
{
// From Generator::generateSince.
if (!node->since().isEmpty()) {
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters("This " + typeString(node) + " was introduced");
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters("This " + typeString(node) + " was introduced");
if (node->nodeType() == Node::Enum)
- writer->writeCharacters(" or modified");
- writer->writeCharacters(" in " + formatSince(node) + ".");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(" or modified");
+ m_writer->writeCharacters(" in " + formatSince(node) + ".");
+ m_writer->writeEndElement(); // para
newLine();
return true;
@@ -1374,28 +1374,28 @@ void DocBookGenerator::generateHeader(const QString &title, const QString &subTi
refMap.clear();
// Output the DocBook header.
- writer->writeStartElement(dbNamespace, "info");
+ m_writer->writeStartElement(dbNamespace, "info");
newLine();
- writer->writeTextElement(dbNamespace, "title", title);
+ m_writer->writeTextElement(dbNamespace, "title", title);
newLine();
if (!subTitle.isEmpty()) {
- writer->writeTextElement(dbNamespace, "subtitle", subTitle);
+ m_writer->writeTextElement(dbNamespace, "subtitle", subTitle);
newLine();
}
- if (!project.isEmpty()) {
- writer->writeTextElement(dbNamespace, "productname", project);
+ if (!m_project.isEmpty()) {
+ m_writer->writeTextElement(dbNamespace, "productname", m_project);
newLine();
}
- if (!buildversion.isEmpty()) {
- writer->writeTextElement(dbNamespace, "edition", buildversion);
+ if (!m_buildVersion.isEmpty()) {
+ m_writer->writeTextElement(dbNamespace, "edition", m_buildVersion);
newLine();
}
- if (!projectDescription.isEmpty()) {
- writer->writeTextElement(dbNamespace, "titleabbrev", projectDescription);
+ if (!m_projectDescription.isEmpty()) {
+ m_writer->writeTextElement(dbNamespace, "titleabbrev", m_projectDescription);
newLine();
}
@@ -1416,15 +1416,15 @@ void DocBookGenerator::generateHeader(const QString &title, const QString &subTi
else
anchorPair = anchorForNode(linkNode);
- writer->writeStartElement(dbNamespace, "extendedlink");
- writer->writeEmptyElement(dbNamespace, "link");
- writer->writeAttribute(xlinkNamespace, "to", anchorPair.first);
- writer->writeAttribute(xlinkNamespace, "title", "prev");
+ m_writer->writeStartElement(dbNamespace, "extendedlink");
+ m_writer->writeEmptyElement(dbNamespace, "link");
+ m_writer->writeAttribute(xlinkNamespace, "to", anchorPair.first);
+ m_writer->writeAttribute(xlinkNamespace, "title", "prev");
if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty())
- writer->writeAttribute(xlinkNamespace, "label", anchorPair.second);
+ m_writer->writeAttribute(xlinkNamespace, "label", anchorPair.second);
else
- writer->writeAttribute(xlinkNamespace, "label", linkPair.second);
- writer->writeEndElement(); // extendedlink
+ m_writer->writeAttribute(xlinkNamespace, "label", linkPair.second);
+ m_writer->writeEndElement(); // extendedlink
}
if (node->links().contains(Node::NextLink)) {
linkPair = node->links()[Node::NextLink];
@@ -1434,15 +1434,15 @@ void DocBookGenerator::generateHeader(const QString &title, const QString &subTi
else
anchorPair = anchorForNode(linkNode);
- writer->writeStartElement(dbNamespace, "extendedlink");
- writer->writeEmptyElement(dbNamespace, "link");
- writer->writeAttribute(xlinkNamespace, "to", anchorPair.first);
- writer->writeAttribute(xlinkNamespace, "title", "prev");
+ m_writer->writeStartElement(dbNamespace, "extendedlink");
+ m_writer->writeEmptyElement(dbNamespace, "link");
+ m_writer->writeAttribute(xlinkNamespace, "to", anchorPair.first);
+ m_writer->writeAttribute(xlinkNamespace, "title", "prev");
if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty())
- writer->writeAttribute(xlinkNamespace, "label", anchorPair.second);
+ m_writer->writeAttribute(xlinkNamespace, "label", anchorPair.second);
else
- writer->writeAttribute(xlinkNamespace, "label", linkPair.second);
- writer->writeEndElement(); // extendedlink
+ m_writer->writeAttribute(xlinkNamespace, "label", linkPair.second);
+ m_writer->writeEndElement(); // extendedlink
}
if (node->links().contains(Node::StartLink)) {
linkPair = node->links()[Node::StartLink];
@@ -1452,15 +1452,15 @@ void DocBookGenerator::generateHeader(const QString &title, const QString &subTi
else
anchorPair = anchorForNode(linkNode);
- writer->writeStartElement(dbNamespace, "extendedlink");
- writer->writeEmptyElement(dbNamespace, "link");
- writer->writeAttribute(xlinkNamespace, "to", anchorPair.first);
- writer->writeAttribute(xlinkNamespace, "title", "start");
+ m_writer->writeStartElement(dbNamespace, "extendedlink");
+ m_writer->writeEmptyElement(dbNamespace, "link");
+ m_writer->writeAttribute(xlinkNamespace, "to", anchorPair.first);
+ m_writer->writeAttribute(xlinkNamespace, "title", "start");
if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty())
- writer->writeAttribute(xlinkNamespace, "label", anchorPair.second);
+ m_writer->writeAttribute(xlinkNamespace, "label", anchorPair.second);
else
- writer->writeAttribute(xlinkNamespace, "label", linkPair.second);
- writer->writeEndElement(); // extendedlink
+ m_writer->writeAttribute(xlinkNamespace, "label", linkPair.second);
+ m_writer->writeEndElement(); // extendedlink
}
}
@@ -1471,7 +1471,7 @@ void DocBookGenerator::generateHeader(const QString &title, const QString &subTi
// abstracts only happen in the header (info tag), slightly different tags must be used at
// other places. Also includes code from HtmlGenerator::generateCppReferencePage to handle
// the name spaces.
- writer->writeStartElement(dbNamespace, "abstract");
+ m_writer->writeStartElement(dbNamespace, "abstract");
newLine();
bool generatedSomething = false;
@@ -1498,9 +1498,9 @@ void DocBookGenerator::generateHeader(const QString &title, const QString &subTi
if (!brief.lastAtom()->string().endsWith('.'))
brief << Atom(Atom::String, ".");
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
generateText(brief, node);
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
generatedSomething = true;
@@ -1513,14 +1513,14 @@ void DocBookGenerator::generateHeader(const QString &title, const QString &subTi
// An abstract cannot be empty, hence use the project description.
if (!generatedSomething)
- writer->writeTextElement(dbNamespace, "para", projectDescription + ".");
+ m_writer->writeTextElement(dbNamespace, "para", m_projectDescription + ".");
- writer->writeEndElement(); // abstract
+ m_writer->writeEndElement(); // abstract
newLine();
}
// End of the DocBook header.
- writer->writeEndElement(); // info
+ m_writer->writeEndElement(); // info
newLine();
}
@@ -1535,15 +1535,15 @@ void DocBookGenerator::closeTextSections()
void DocBookGenerator::generateFooter()
{
closeTextSections();
- writer->writeEndElement(); // article
+ m_writer->writeEndElement(); // article
}
void DocBookGenerator::generateSimpleLink(const QString &href, const QString &text)
{
- writer->writeStartElement(dbNamespace, "link");
- writer->writeAttribute(xlinkNamespace, "href", href);
- writer->writeCharacters(text);
- writer->writeEndElement(); // link
+ m_writer->writeStartElement(dbNamespace, "link");
+ m_writer->writeAttribute(xlinkNamespace, "href", href);
+ m_writer->writeCharacters(text);
+ m_writer->writeEndElement(); // link
}
void DocBookGenerator::generateObsoleteMembers(const Sections &sections)
@@ -1563,15 +1563,15 @@ void DocBookGenerator::generateObsoleteMembers(const Sections &sections)
startSection("obsolete", "Obsolete Members for " + aggregate->name());
- writer->writeStartElement(dbNamespace, "para");
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
- writer->writeCharacters("The following members of class ");
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
+ m_writer->writeCharacters("The following members of class ");
generateSimpleLink(linkForNode(aggregate, nullptr), aggregate->name());
- writer->writeCharacters(" are deprecated.");
- writer->writeEndElement(); // emphasis bold
- writer->writeCharacters(" We strongly advise against using them in new code.");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(" are deprecated.");
+ m_writer->writeEndElement(); // emphasis bold
+ m_writer->writeCharacters(" We strongly advise against using them in new code.");
+ m_writer->writeEndElement(); // para
newLine();
for (const Section *section : details_spv) {
@@ -1619,15 +1619,15 @@ void DocBookGenerator::generateObsoleteQmlMembers(const Sections &sections)
startSection("obsolete", "Obsolete Members for " + aggregate->name());
- writer->writeStartElement(dbNamespace, "para");
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
- writer->writeCharacters("The following members of QML type ");
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
+ m_writer->writeCharacters("The following members of QML type ");
generateSimpleLink(linkForNode(aggregate, nullptr), aggregate->name());
- writer->writeCharacters(" are deprecated.");
- writer->writeEndElement(); // emphasis bold
- writer->writeCharacters(" We strongly advise against using them in new code.");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(" are deprecated.");
+ m_writer->writeEndElement(); // emphasis bold
+ m_writer->writeCharacters(" We strongly advise against using them in new code.");
+ m_writer->writeEndElement(); // para
newLine();
for (const auto *section : details_spv) {
@@ -1682,29 +1682,29 @@ static QString nodeToSynopsisTag(const Node *node)
void DocBookGenerator::generateStartRequisite(const QString &description)
{
- writer->writeStartElement(dbNamespace, "varlistentry");
+ m_writer->writeStartElement(dbNamespace, "varlistentry");
newLine();
- writer->writeTextElement(dbNamespace, "term", description);
+ m_writer->writeTextElement(dbNamespace, "term", description);
newLine();
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
}
void DocBookGenerator::generateEndRequisite()
{
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // listitem
+ m_writer->writeEndElement(); // listitem
newLine();
- writer->writeEndElement(); // varlistentry
+ m_writer->writeEndElement(); // varlistentry
newLine();
}
void DocBookGenerator::generateRequisite(const QString &description, const QString &value)
{
generateStartRequisite(description);
- writer->writeCharacters(value);
+ m_writer->writeCharacters(value);
generateEndRequisite();
}
@@ -1716,11 +1716,11 @@ void DocBookGenerator::generateCMakeRequisite(const QStringList &values)
{
const QString description("CMake");
generateStartRequisite(description);
- writer->writeCharacters(values.first());
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(values.first());
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters(values.last());
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters(values.last());
generateEndRequisite();
}
@@ -1744,7 +1744,7 @@ void DocBookGenerator::generateSortedNames(const ClassNode *cn, const QList<Rela
int index = 0;
for (const QString &className : classNames) {
generateFullName(classMap.value(className), cn);
- writer->writeCharacters(Utilities::comma(index++, classNames.count()));
+ m_writer->writeCharacters(Utilities::comma(index++, classNames.count()));
}
}
@@ -1764,7 +1764,7 @@ void DocBookGenerator::generateSortedQmlNames(const Node *base, const NodeList &
for (const QString &name : names) {
generateFullName(classMap.value(name), base);
- writer->writeCharacters(Utilities::comma(index++, names.count()));
+ m_writer->writeCharacters(Utilities::comma(index++, names.count()));
}
}
@@ -1775,7 +1775,7 @@ void DocBookGenerator::generateRequisites(const Aggregate *aggregate)
{
// Adapted from HtmlGenerator::generateRequisites, but simplified: no need to store all the
// elements, they can be produced one by one.
- writer->writeStartElement(dbNamespace, "variablelist");
+ m_writer->writeStartElement(dbNamespace, "variablelist");
newLine();
// Includes.
@@ -1829,10 +1829,10 @@ void DocBookGenerator::generateRequisites(const Aggregate *aggregate)
generateFullName((*r).m_node, classe);
if ((*r).m_access == Access::Protected)
- writer->writeCharacters(" (protected)");
+ m_writer->writeCharacters(" (protected)");
else if ((*r).m_access == Access::Private)
- writer->writeCharacters(" (private)");
- writer->writeCharacters(
+ m_writer->writeCharacters(" (private)");
+ m_writer->writeCharacters(
Utilities::comma(index++, classe->baseClasses().count()));
}
++r;
@@ -1849,7 +1849,7 @@ void DocBookGenerator::generateRequisites(const Aggregate *aggregate)
}
}
- writer->writeEndElement(); // variablelist
+ m_writer->writeEndElement(); // variablelist
newLine();
}
@@ -1863,7 +1863,7 @@ void DocBookGenerator::generateQmlRequisites(const QmlTypeNode *qcn)
if (!qcn)
return;
- writer->writeStartElement(dbNamespace, "variablelist");
+ m_writer->writeStartElement(dbNamespace, "variablelist");
newLine();
// Module name and version (i.e. import).
@@ -1920,7 +1920,7 @@ void DocBookGenerator::generateQmlRequisites(const QmlTypeNode *qcn)
generateEndRequisite();
}
- writer->writeEndElement(); // variablelist
+ m_writer->writeEndElement(); // variablelist
newLine();
}
@@ -1932,28 +1932,28 @@ bool DocBookGenerator::generateStatus(const Node *node)
// Do nothing.
return false;
case Node::Preliminary:
- writer->writeStartElement(dbNamespace, "para");
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
- writer->writeCharacters("This " + typeString(node)
- + " is under development and is subject to change.");
- writer->writeEndElement(); // emphasis
- writer->writeEndElement(); // para
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
+ m_writer->writeCharacters("This " + typeString(node)
+ + " is under development and is subject to change.");
+ m_writer->writeEndElement(); // emphasis
+ m_writer->writeEndElement(); // para
newLine();
return true;
case Node::Deprecated:
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
if (node->isAggregate()) {
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
}
- writer->writeCharacters("This " + typeString(node) + " is deprecated");
+ m_writer->writeCharacters("This " + typeString(node) + " is deprecated");
if (const QString &version = node->deprecatedSince(); !version.isEmpty())
- writer->writeCharacters(" since " + version);
- writer->writeCharacters(". We strongly advise against using it in new code.");
+ m_writer->writeCharacters(" since " + version);
+ m_writer->writeCharacters(". We strongly advise against using it in new code.");
if (node->isAggregate())
- writer->writeEndElement(); // emphasis
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // emphasis
+ m_writer->writeEndElement(); // para
newLine();
return true;
case Node::Internal:
@@ -1969,26 +1969,26 @@ bool DocBookGenerator::generateStatus(const Node *node)
void DocBookGenerator::generateSignatureList(const NodeList &nodes)
{
// From Generator::signatureList and Generator::appendSignature.
- writer->writeStartElement(dbNamespace, "itemizedlist");
+ m_writer->writeStartElement(dbNamespace, "itemizedlist");
newLine();
NodeList::ConstIterator n = nodes.constBegin();
while (n != nodes.constEnd()) {
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
generateSimpleLink(currentGenerator()->fullDocumentLocation(*n),
(*n)->signature(false, true));
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // itemizedlist
+ m_writer->writeEndElement(); // itemizedlist
newLine();
++n;
}
- writer->writeEndElement(); // itemizedlist
+ m_writer->writeEndElement(); // itemizedlist
newLine();
}
@@ -2009,25 +2009,25 @@ bool DocBookGenerator::generateThreadSafeness(const Node *node)
QString linkThreadSafe = getAutoLink(&threadSafeAtom, node, &threadSafeNode);
if (ts == Node::NonReentrant) {
- writer->writeStartElement(dbNamespace, "warning");
+ m_writer->writeStartElement(dbNamespace, "warning");
newLine();
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters("This " + typeString(node) + " is not ");
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters("This " + typeString(node) + " is not ");
generateSimpleLink(linkReentrant, "reentrant");
- writer->writeCharacters(".");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(".");
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // warning
+ m_writer->writeEndElement(); // warning
return true;
}
if (ts == Node::Reentrant || ts == Node::ThreadSafe) {
- writer->writeStartElement(dbNamespace, "note");
+ m_writer->writeStartElement(dbNamespace, "note");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
if (node->isAggregate()) {
- writer->writeCharacters("All functions in this " + typeString(node) + " are ");
+ m_writer->writeCharacters("All functions in this " + typeString(node) + " are ");
if (ts == Node::ThreadSafe)
generateSimpleLink(linkThreadSafe, "thread-safe");
else
@@ -2038,62 +2038,62 @@ bool DocBookGenerator::generateThreadSafeness(const Node *node)
NodeList nonreentrant;
bool exceptions = hasExceptions(node, reentrant, threadsafe, nonreentrant);
if (!exceptions || (ts == Node::Reentrant && !threadsafe.isEmpty())) {
- writer->writeCharacters(".");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(".");
+ m_writer->writeEndElement(); // para
newLine();
} else {
- writer->writeCharacters(" with the following exceptions:");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(" with the following exceptions:");
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
if (ts == Node::Reentrant) {
if (!nonreentrant.isEmpty()) {
- writer->writeCharacters("These functions are not ");
+ m_writer->writeCharacters("These functions are not ");
generateSimpleLink(linkReentrant, "reentrant");
- writer->writeCharacters(":");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(":");
+ m_writer->writeEndElement(); // para
newLine();
generateSignatureList(nonreentrant);
}
if (!threadsafe.isEmpty()) {
- writer->writeCharacters("These functions are also ");
+ m_writer->writeCharacters("These functions are also ");
generateSimpleLink(linkThreadSafe, "thread-safe");
- writer->writeCharacters(":");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(":");
+ m_writer->writeEndElement(); // para
newLine();
generateSignatureList(threadsafe);
}
} else { // thread-safe
if (!reentrant.isEmpty()) {
- writer->writeCharacters("These functions are only ");
+ m_writer->writeCharacters("These functions are only ");
generateSimpleLink(linkReentrant, "reentrant");
- writer->writeCharacters(":");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(":");
+ m_writer->writeEndElement(); // para
newLine();
generateSignatureList(reentrant);
}
if (!nonreentrant.isEmpty()) {
- writer->writeCharacters("These functions are not ");
+ m_writer->writeCharacters("These functions are not ");
generateSimpleLink(linkReentrant, "reentrant");
- writer->writeCharacters(":");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(":");
+ m_writer->writeEndElement(); // para
newLine();
generateSignatureList(nonreentrant);
}
}
}
} else {
- writer->writeCharacters("This " + typeString(node) + " is ");
+ m_writer->writeCharacters("This " + typeString(node) + " is ");
if (ts == Node::ThreadSafe)
generateSimpleLink(linkThreadSafe, "thread-safe");
else
generateSimpleLink(linkReentrant, "reentrant");
- writer->writeCharacters(".");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(".");
+ m_writer->writeEndElement(); // para
newLine();
}
- writer->writeEndElement(); // note
+ m_writer->writeEndElement(); // note
return true;
}
@@ -2134,7 +2134,7 @@ void DocBookGenerator::generateBody(const Node *node)
}
if (!t.isEmpty())
- writer->writeTextElement(dbNamespace, "para", t);
+ m_writer->writeTextElement(dbNamespace, "para", t);
}
} else if (!node->isSharingComment()) {
// Reimplements clause and type alias info precede body text
@@ -2222,13 +2222,13 @@ void DocBookGenerator::generateLinkToExample(const ExampleNode *en, const QStrin
<< Config::instance().getString(CONFIG_EXAMPLESINSTALLPATH) << en->name();
path.removeAll(QString());
- writer->writeStartElement(dbNamespace, "para");
- writer->writeStartElement(dbNamespace, "link");
- writer->writeAttribute(xlinkNamespace, "href",
- exampleUrl.replace(placeholder, path.join(separator)));
- writer->writeCharacters(link);
- writer->writeEndElement(); // link
- writer->writeEndElement(); // para
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "link");
+ m_writer->writeAttribute(xlinkNamespace, "href",
+ exampleUrl.replace(placeholder, path.join(separator)));
+ m_writer->writeCharacters(link);
+ m_writer->writeEndElement(); // link
+ m_writer->writeEndElement(); // para
newLine();
}
@@ -2256,12 +2256,12 @@ void DocBookGenerator::generateFileList(const ExampleNode *en, bool images)
if (paths.isEmpty())
return;
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters(tag);
- writer->writeEndElement(); // para
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters(tag);
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeStartElement(dbNamespace, "itemizedlist");
+ m_writer->writeStartElement(dbNamespace, "itemizedlist");
for (const auto &file : qAsConst(paths)) {
if (images) {
@@ -2271,16 +2271,16 @@ void DocBookGenerator::generateFileList(const ExampleNode *en, bool images)
generateExampleFilePage(en, file);
}
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
generateSimpleLink(file, file);
- writer->writeEndElement(); // para
- writer->writeEndElement(); // listitem
+ m_writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // listitem
newLine();
}
- writer->writeEndElement(); // itemizedlist
+ m_writer->writeEndElement(); // itemizedlist
newLine();
}
@@ -2298,8 +2298,8 @@ void DocBookGenerator::generateExampleFilePage(const Node *node, const QString &
const auto en = static_cast<const ExampleNode *>(node);
// Store current (active) writer
- QXmlStreamWriter *currentWriter = writer;
- writer = startDocument(en, file);
+ QXmlStreamWriter *currentWriter = m_writer;
+ m_writer = startDocument(en, file);
generateHeader(en->fullTitle(), en->subtitle(), en);
Text text;
@@ -2313,7 +2313,7 @@ void DocBookGenerator::generateExampleFilePage(const Node *node, const QString &
endDocument();
// Restore writer
- writer = currentWriter;
+ m_writer = currentWriter;
}
void DocBookGenerator::generateReimplementsClause(const FunctionNode *fn)
@@ -2325,22 +2325,22 @@ void DocBookGenerator::generateReimplementsClause(const FunctionNode *fn)
const FunctionNode *overrides = cn->findOverriddenFunction(fn);
if (overrides && !overrides->isPrivate() && !overrides->parent()->isPrivate()) {
if (overrides->hasDoc()) {
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters("Reimplements: ");
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters("Reimplements: ");
QString fullName =
overrides->parent()->name() + "::" + overrides->signature(false, true);
generateFullName(overrides->parent(), fullName, overrides);
- writer->writeCharacters(".");
+ m_writer->writeCharacters(".");
return;
}
}
const PropertyNode *sameName = cn->findOverriddenProperty(fn);
if (sameName && sameName->hasDoc()) {
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters("Reimplements an access function for property: ");
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters("Reimplements an access function for property: ");
QString fullName = sameName->parent()->name() + "::" + sameName->name();
generateFullName(sameName->parent(), fullName, overrides);
- writer->writeCharacters(".");
+ m_writer->writeCharacters(".");
return;
}
}
@@ -2355,25 +2355,25 @@ void DocBookGenerator::generateAlsoList(const Node *node, CodeMarker *marker)
supplementAlsoList(node, alsoList);
if (!alsoList.isEmpty()) {
- writer->writeStartElement(dbNamespace, "para");
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeCharacters("See also ");
- writer->writeEndElement(); // emphasis
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeCharacters("See also ");
+ m_writer->writeEndElement(); // emphasis
newLine();
- writer->writeStartElement(dbNamespace, "simplelist");
- writer->writeAttribute("type", "vert");
- writer->writeAttribute("role", "see-also");
+ m_writer->writeStartElement(dbNamespace, "simplelist");
+ m_writer->writeAttribute("type", "vert");
+ m_writer->writeAttribute("role", "see-also");
for (const Text &text : alsoList) {
- writer->writeStartElement(dbNamespace, "member");
+ m_writer->writeStartElement(dbNamespace, "member");
generateText(text, node);
- writer->writeEndElement(); // member
+ m_writer->writeEndElement(); // member
newLine();
}
- writer->writeEndElement(); // simplelist
+ m_writer->writeEndElement(); // simplelist
newLine();
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
}
}
@@ -2387,25 +2387,25 @@ void DocBookGenerator::generateMaintainerList(const Aggregate *node, CodeMarker
const QStringList sl = getMetadataElements(node, "maintainer");
if (!sl.isEmpty()) {
- writer->writeStartElement(dbNamespace, "para");
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeCharacters("Maintained by: ");
- writer->writeEndElement(); // emphasis
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeCharacters("Maintained by: ");
+ m_writer->writeEndElement(); // emphasis
newLine();
- writer->writeStartElement(dbNamespace, "simplelist");
- writer->writeAttribute("type", "vert");
- writer->writeAttribute("role", "maintainer");
+ m_writer->writeStartElement(dbNamespace, "simplelist");
+ m_writer->writeAttribute("type", "vert");
+ m_writer->writeAttribute("role", "maintainer");
for (const QString &maintainer : sl) {
- writer->writeStartElement(dbNamespace, "member");
- writer->writeCharacters(maintainer);
- writer->writeEndElement(); // member
+ m_writer->writeStartElement(dbNamespace, "member");
+ m_writer->writeCharacters(maintainer);
+ m_writer->writeEndElement(); // member
newLine();
}
- writer->writeEndElement(); // simplelist
+ m_writer->writeEndElement(); // simplelist
newLine();
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
}
}
@@ -2416,23 +2416,23 @@ void DocBookGenerator::generateMaintainerList(const Aggregate *node, CodeMarker
QXmlStreamWriter *DocBookGenerator::startGenericDocument(const Node *node, const QString &fileName)
{
QFile *outFile = openSubPageFile(node, fileName);
- writer = new QXmlStreamWriter(outFile);
- writer->setAutoFormatting(false); // We need a precise handling of line feeds.
+ m_writer = new QXmlStreamWriter(outFile);
+ m_writer->setAutoFormatting(false); // We need a precise handling of line feeds.
- writer->writeStartDocument();
+ m_writer->writeStartDocument();
newLine();
- writer->writeNamespace(dbNamespace, "db");
- writer->writeNamespace(xlinkNamespace, "xlink");
- writer->writeStartElement(dbNamespace, "article");
- writer->writeAttribute("version", "5.2");
- if (!naturalLanguage.isEmpty())
- writer->writeAttribute("xml:lang", naturalLanguage);
+ m_writer->writeNamespace(dbNamespace, "db");
+ m_writer->writeNamespace(xlinkNamespace, "xlink");
+ m_writer->writeStartElement(dbNamespace, "article");
+ m_writer->writeAttribute("version", "5.2");
+ if (!m_naturalLanguage.isEmpty())
+ m_writer->writeAttribute("xml:lang", m_naturalLanguage);
newLine();
// Empty the section stack for the new document.
sectionLevels.resize(0);
- return writer;
+ return m_writer;
}
QXmlStreamWriter *DocBookGenerator::startDocument(const Node *node)
@@ -2449,11 +2449,11 @@ QXmlStreamWriter *DocBookGenerator::startDocument(const ExampleNode *en, const Q
void DocBookGenerator::endDocument()
{
- writer->writeEndElement(); // article
- writer->writeEndDocument();
- writer->device()->close();
- delete writer;
- writer = nullptr;
+ m_writer->writeEndElement(); // article
+ m_writer->writeEndDocument();
+ m_writer->device()->close();
+ delete m_writer;
+ m_writer = nullptr;
}
/*!
@@ -2489,7 +2489,7 @@ void DocBookGenerator::generateCppReferencePage(Node *node)
subtitleText = fullTitle;
// Start producing the DocBook file.
- writer = startDocument(node);
+ m_writer = startDocument(node);
// Info container.
generateHeader(title, subtitleText, aggregate);
@@ -2537,7 +2537,7 @@ void DocBookGenerator::generateCppReferencePage(Node *node)
generateDetailedMember(*member, aggregate);
} else {
startSectionBegin();
- writer->writeCharacters("class ");
+ m_writer->writeCharacters("class ");
generateFullName(*member, aggregate);
startSectionEnd();
generateBrief(*member);
@@ -2559,16 +2559,16 @@ void DocBookGenerator::generateCppReferencePage(Node *node)
void DocBookGenerator::generateSynopsisInfo(const QString &key, const QString &value)
{
- writer->writeStartElement(dbNamespace, "synopsisinfo");
- writer->writeAttribute(dbNamespace, "role", key);
- writer->writeCharacters(value);
- writer->writeEndElement(); // synopsisinfo
+ m_writer->writeStartElement(dbNamespace, "synopsisinfo");
+ m_writer->writeAttribute(dbNamespace, "role", key);
+ m_writer->writeCharacters(value);
+ m_writer->writeEndElement(); // synopsisinfo
newLine();
}
void DocBookGenerator::generateModifier(const QString &value)
{
- writer->writeTextElement(dbNamespace, "modifier", value);
+ m_writer->writeTextElement(dbNamespace, "modifier", value);
newLine();
}
@@ -2584,7 +2584,7 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
// Generator::generateThreadSafeness, QDocIndexFiles::generateIndexSection.
// This function is the only place where DocBook extensions are used.
- if (config->getBool(CONFIG_DOCBOOKEXTENSIONS))
+ if (m_config->getBool(CONFIG_DOCBOOKEXTENSIONS))
return;
// Nothing to export in some cases. Note that isSharedCommentNode() returns
@@ -2613,64 +2613,64 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
// Start the synopsis tag.
QString synopsisTag = nodeToSynopsisTag(node);
- writer->writeStartElement(dbNamespace, synopsisTag);
+ m_writer->writeStartElement(dbNamespace, synopsisTag);
newLine();
// Name and basic properties of each tag (like types and parameters).
if (node->isClass()) {
- writer->writeStartElement(dbNamespace, "ooclass");
- writer->writeTextElement(dbNamespace, "classname", node->plainName());
- writer->writeEndElement(); // ooclass
+ m_writer->writeStartElement(dbNamespace, "ooclass");
+ m_writer->writeTextElement(dbNamespace, "classname", node->plainName());
+ m_writer->writeEndElement(); // ooclass
newLine();
} else if (node->isNamespace()) {
- writer->writeTextElement(dbNamespace, "namespacename", node->plainName());
+ m_writer->writeTextElement(dbNamespace, "namespacename", node->plainName());
newLine();
} else if (node->isQmlType()) {
- writer->writeStartElement(dbNamespace, "ooclass");
- writer->writeTextElement(dbNamespace, "classname", node->plainName());
- writer->writeEndElement(); // ooclass
+ m_writer->writeStartElement(dbNamespace, "ooclass");
+ m_writer->writeTextElement(dbNamespace, "classname", node->plainName());
+ m_writer->writeEndElement(); // ooclass
newLine();
if (!qcn->groupNames().isEmpty())
- writer->writeAttribute("groups", qcn->groupNames().join(QLatin1Char(',')));
+ m_writer->writeAttribute("groups", qcn->groupNames().join(QLatin1Char(',')));
} else if (node->isProperty()) {
- writer->writeTextElement(dbNamespace, "modifier", "(Qt property)");
+ m_writer->writeTextElement(dbNamespace, "modifier", "(Qt property)");
newLine();
- writer->writeTextElement(dbNamespace, "type", propertyNode->dataType());
+ m_writer->writeTextElement(dbNamespace, "type", propertyNode->dataType());
newLine();
- writer->writeTextElement(dbNamespace, "varname", node->plainName());
+ m_writer->writeTextElement(dbNamespace, "varname", node->plainName());
newLine();
} else if (node->isVariable()) {
if (variableNode->isStatic()) {
- writer->writeTextElement(dbNamespace, "modifier", "static");
+ m_writer->writeTextElement(dbNamespace, "modifier", "static");
newLine();
}
- writer->writeTextElement(dbNamespace, "type", variableNode->dataType());
+ m_writer->writeTextElement(dbNamespace, "type", variableNode->dataType());
newLine();
- writer->writeTextElement(dbNamespace, "varname", node->plainName());
+ m_writer->writeTextElement(dbNamespace, "varname", node->plainName());
newLine();
} else if (node->isEnumType()) {
- writer->writeTextElement(dbNamespace, "enumname", node->plainName());
+ m_writer->writeTextElement(dbNamespace, "enumname", node->plainName());
newLine();
} else if (node->isQmlProperty()) {
QString name = node->name();
if (qpn->isAttached())
name.prepend(qpn->element() + QLatin1Char('.'));
- writer->writeTextElement(dbNamespace, "type", qpn->dataType());
+ m_writer->writeTextElement(dbNamespace, "type", qpn->dataType());
newLine();
- writer->writeTextElement(dbNamespace, "varname", name);
+ m_writer->writeTextElement(dbNamespace, "varname", name);
newLine();
if (qpn->isAttached()) {
- writer->writeTextElement(dbNamespace, "modifier", "attached");
+ m_writer->writeTextElement(dbNamespace, "modifier", "attached");
newLine();
}
if ((const_cast<QmlPropertyNode *>(qpn))->isWritable()) {
- writer->writeTextElement(dbNamespace, "modifier", "writable");
+ m_writer->writeTextElement(dbNamespace, "modifier", "writable");
newLine();
}
if ((const_cast<QmlPropertyNode *>(qpn))->isRequired()) {
- writer->writeTextElement(dbNamespace, "modifier", "required");
+ m_writer->writeTextElement(dbNamespace, "modifier", "required");
newLine();
}
if (qpn->isReadOnly()) {
@@ -2691,14 +2691,14 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
if (!functionNode->isMacro()) {
if (functionNode->returnType() == "void")
- writer->writeEmptyElement(dbNamespace, "void");
+ m_writer->writeEmptyElement(dbNamespace, "void");
else
- writer->writeTextElement(dbNamespace, "type", functionNode->returnType());
+ m_writer->writeTextElement(dbNamespace, "type", functionNode->returnType());
newLine();
}
// Remove two characters from the plain name to only get the name
// of the method without parentheses.
- writer->writeTextElement(dbNamespace, "methodname", node->plainName().chopped(2));
+ m_writer->writeTextElement(dbNamespace, "methodname", node->plainName().chopped(2));
newLine();
if (functionNode->isOverload())
@@ -2711,24 +2711,24 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
generateModifier("override");
if (!functionNode->isMacro() && functionNode->parameters().isEmpty()) {
- writer->writeEmptyElement(dbNamespace, "void");
+ m_writer->writeEmptyElement(dbNamespace, "void");
newLine();
}
const Parameters &lp = functionNode->parameters();
for (int i = 0; i < lp.count(); ++i) {
const Parameter &parameter = lp.at(i);
- writer->writeStartElement(dbNamespace, "methodparam");
+ m_writer->writeStartElement(dbNamespace, "methodparam");
newLine();
- writer->writeTextElement(dbNamespace, "type", parameter.type());
+ m_writer->writeTextElement(dbNamespace, "type", parameter.type());
newLine();
- writer->writeTextElement(dbNamespace, "parameter", parameter.name());
+ m_writer->writeTextElement(dbNamespace, "parameter", parameter.name());
newLine();
if (!parameter.defaultValue().isEmpty()) {
- writer->writeTextElement(dbNamespace, "initializer", parameter.defaultValue());
+ m_writer->writeTextElement(dbNamespace, "initializer", parameter.defaultValue());
newLine();
}
- writer->writeEndElement(); // methodparam
+ m_writer->writeEndElement(); // methodparam
newLine();
}
@@ -2767,7 +2767,7 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
signature += " = default";
generateSynopsisInfo("signature", signature);
} else if (node->isTypedef()) {
- writer->writeTextElement(dbNamespace, "type", node->plainName());
+ m_writer->writeTextElement(dbNamespace, "type", node->plainName());
} else {
node->doc().location().warning(
QStringLiteral("Unexpected node type in generateDocBookSynopsis: %1")
@@ -2853,18 +2853,18 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
Atom a = Atom(Atom::LinkNode, CodeMarker::stringForNode(classe->qmlElement()));
QString link = getAutoLink(&a, aggregate, &otherNode);
- writer->writeStartElement(dbNamespace, "synopsisinfo");
- writer->writeAttribute(dbNamespace, "role", "instantiatedBy");
+ m_writer->writeStartElement(dbNamespace, "synopsisinfo");
+ m_writer->writeAttribute(dbNamespace, "role", "instantiatedBy");
generateSimpleLink(link, classe->qmlElement()->name());
- writer->writeEndElement(); // synopsisinfo
+ m_writer->writeEndElement(); // synopsisinfo
newLine();
}
// Inherits.
QList<RelatedClass>::ConstIterator r;
if (!classe->baseClasses().isEmpty()) {
- writer->writeStartElement(dbNamespace, "synopsisinfo");
- writer->writeAttribute(dbNamespace, "role", "inherits");
+ m_writer->writeStartElement(dbNamespace, "synopsisinfo");
+ m_writer->writeAttribute(dbNamespace, "role", "inherits");
r = classe->baseClasses().constBegin();
int index = 0;
@@ -2873,26 +2873,26 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
generateFullName((*r).m_node, classe);
if ((*r).m_access == Access::Protected) {
- writer->writeCharacters(" (protected)");
+ m_writer->writeCharacters(" (protected)");
} else if ((*r).m_access == Access::Private) {
- writer->writeCharacters(" (private)");
+ m_writer->writeCharacters(" (private)");
}
- writer->writeCharacters(
+ m_writer->writeCharacters(
Utilities::comma(index++, classe->baseClasses().count()));
}
++r;
}
- writer->writeEndElement(); // synopsisinfo
+ m_writer->writeEndElement(); // synopsisinfo
newLine();
}
// Inherited by.
if (!classe->derivedClasses().isEmpty()) {
- writer->writeStartElement(dbNamespace, "synopsisinfo");
- writer->writeAttribute(dbNamespace, "role", "inheritedBy");
+ m_writer->writeStartElement(dbNamespace, "synopsisinfo");
+ m_writer->writeAttribute(dbNamespace, "role", "inheritedBy");
generateSortedNames(classe, classe->derivedClasses());
- writer->writeEndElement(); // synopsisinfo
+ m_writer->writeEndElement(); // synopsisinfo
newLine();
}
}
@@ -2923,10 +2923,10 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
NodeList subs;
QmlTypeNode::subclasses(qcn, subs);
if (!subs.isEmpty()) {
- writer->writeTextElement(dbNamespace, "synopsisinfo");
- writer->writeAttribute(dbNamespace, "role", "inheritedBy");
+ m_writer->writeTextElement(dbNamespace, "synopsisinfo");
+ m_writer->writeAttribute(dbNamespace, "role", "inheritedBy");
generateSortedQmlNames(qcn, subs);
- writer->writeEndElement(); // synopsisinfo
+ m_writer->writeEndElement(); // synopsisinfo
newLine();
}
@@ -2939,10 +2939,10 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
Atom a = Atom(Atom::LinkNode, CodeMarker::stringForNode(base));
QString link = getAutoLink(&a, base, &otherNode);
- writer->writeTextElement(dbNamespace, "synopsisinfo");
- writer->writeAttribute(dbNamespace, "role", "inherits");
+ m_writer->writeTextElement(dbNamespace, "synopsisinfo");
+ m_writer->writeAttribute(dbNamespace, "role", "inherits");
generateSimpleLink(link, base->name());
- writer->writeEndElement(); // synopsisinfo
+ m_writer->writeEndElement(); // synopsisinfo
newLine();
}
@@ -2953,10 +2953,10 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
Atom a = Atom(Atom::LinkNode, CodeMarker::stringForNode(qcn));
QString link = getAutoLink(&a, cn, &otherNode);
- writer->writeTextElement(dbNamespace, "synopsisinfo");
- writer->writeAttribute(dbNamespace, "role", "instantiates");
+ m_writer->writeTextElement(dbNamespace, "synopsisinfo");
+ m_writer->writeAttribute(dbNamespace, "role", "instantiates");
generateSimpleLink(link, cn->name());
- writer->writeEndElement(); // synopsisinfo
+ m_writer->writeEndElement(); // synopsisinfo
newLine();
}
}
@@ -3022,26 +3022,26 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
// Enums and typedefs.
if (enumNode) {
for (const EnumItem &item : enumNode->items()) {
- writer->writeStartElement(dbNamespace, "enumitem");
- writer->writeAttribute(dbNamespace, "enumidentifier", item.name());
- writer->writeAttribute(dbNamespace, "enumvalue", item.value());
- writer->writeEndElement(); // enumitem
+ m_writer->writeStartElement(dbNamespace, "enumitem");
+ m_writer->writeAttribute(dbNamespace, "enumidentifier", item.name());
+ m_writer->writeAttribute(dbNamespace, "enumvalue", item.value());
+ m_writer->writeEndElement(); // enumitem
newLine();
}
}
- writer->writeEndElement(); // nodeToSynopsisTag (like classsynopsis)
+ m_writer->writeEndElement(); // nodeToSynopsisTag (like classsynopsis)
newLine();
// The typedef associated to this enum.
if (enumNode && enumNode->flagsType()) {
- writer->writeStartElement(dbNamespace, "typedefsynopsis");
+ m_writer->writeStartElement(dbNamespace, "typedefsynopsis");
newLine();
- writer->writeTextElement(dbNamespace, "typedefname",
- enumNode->flagsType()->fullDocumentName());
+ m_writer->writeTextElement(dbNamespace, "typedefname",
+ enumNode->flagsType()->fullDocumentName());
- writer->writeEndElement(); // typedefsynopsis
+ m_writer->writeEndElement(); // typedefsynopsis
newLine();
}
}
@@ -3084,7 +3084,7 @@ void DocBookGenerator::typified(const QString &string, const Node *relative, boo
bool isProbablyType = (pendingWord != QLatin1String("const"));
if (generateType && isProbablyType) {
// Flush the current buffer.
- writer->writeCharacters(result);
+ m_writer->writeCharacters(result);
result.truncate(0);
// Add the link, logic from HtmlGenerator::highlightedCode.
@@ -3096,12 +3096,12 @@ void DocBookGenerator::typified(const QString &string, const Node *relative, boo
href = linkForNode(n, relative);
}
- writer->writeStartElement(dbNamespace, "type");
+ m_writer->writeStartElement(dbNamespace, "type");
if (href.isEmpty())
- writer->writeCharacters(pendingWord);
+ m_writer->writeCharacters(pendingWord);
else
generateSimpleLink(href, pendingWord);
- writer->writeEndElement(); // type
+ m_writer->writeEndElement(); // type
} else {
result += pendingWord;
}
@@ -3118,7 +3118,7 @@ void DocBookGenerator::typified(const QString &string, const Node *relative, boo
result += QLatin1Char(' ');
}
- writer->writeCharacters(result);
+ m_writer->writeCharacters(result);
}
void DocBookGenerator::generateSynopsisName(const Node *node, const Node *relative,
@@ -3129,14 +3129,14 @@ void DocBookGenerator::generateSynopsisName(const Node *node, const Node *relati
QString name = taggedNode(node);
if (!generateNameLink) {
- writer->writeCharacters(name);
+ m_writer->writeCharacters(name);
return;
}
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
generateSimpleLink(linkForNode(node, relative), name);
- writer->writeEndElement(); // emphasis
+ m_writer->writeEndElement(); // emphasis
}
void DocBookGenerator::generateParameter(const Parameter &parameter, const Node *relative,
@@ -3156,22 +3156,22 @@ void DocBookGenerator::generateParameter(const Parameter &parameter, const Node
// this is intended to be rendered as a subscript.
QRegularExpression sub("([a-z]+)_([0-9]+|n)");
- writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
auto match = sub.match(paramName);
if (match.hasMatch()) {
- writer->writeCharacters(match.captured(0));
- writer->writeStartElement(dbNamespace, "sub");
- writer->writeCharacters(match.captured(1));
- writer->writeEndElement(); // sub
+ m_writer->writeCharacters(match.captured(0));
+ m_writer->writeStartElement(dbNamespace, "sub");
+ m_writer->writeCharacters(match.captured(1));
+ m_writer->writeEndElement(); // sub
} else {
- writer->writeCharacters(paramName);
+ m_writer->writeCharacters(paramName);
}
- writer->writeEndElement(); // emphasis
+ m_writer->writeEndElement(); // emphasis
}
const QString &pvalue = parameter.defaultValue();
if (generateExtra && !pvalue.isEmpty())
- writer->writeCharacters(" = " + pvalue);
+ m_writer->writeCharacters(" = " + pvalue);
}
void DocBookGenerator::generateSynopsis(const Node *node, const Node *relative,
@@ -3186,24 +3186,24 @@ void DocBookGenerator::generateSynopsis(const Node *node, const Node *relative,
const int MaxEnumValues = 6;
if (generateExtra)
- writer->writeCharacters(CodeMarker::extraSynopsis(node, style));
+ m_writer->writeCharacters(CodeMarker::extraSynopsis(node, style));
// Then generate the synopsis.
if (style == Section::Details) {
if (!node->isRelatedNonmember() && !node->isProxyNode() && !node->parent()->name().isEmpty()
&& !node->parent()->isHeader() && !node->isProperty() && !node->isQmlNode()
&& !node->isJsNode()) {
- writer->writeCharacters(taggedNode(node->parent()) + "::");
+ m_writer->writeCharacters(taggedNode(node->parent()) + "::");
}
}
switch (node->nodeType()) {
case Node::Namespace:
- writer->writeCharacters("namespace ");
+ m_writer->writeCharacters("namespace ");
generateSynopsisName(node, relative, generateNameLink);
break;
case Node::Class:
- writer->writeCharacters("class ");
+ m_writer->writeCharacters("class ");
generateSynopsisName(node, relative, generateNameLink);
break;
case Node::Function: {
@@ -3212,7 +3212,7 @@ void DocBookGenerator::generateSynopsis(const Node *node, const Node *relative,
// First, the part coming before the name.
if (style == Section::Summary || style == Section::Accessors) {
if (!func->isNonvirtual())
- writer->writeCharacters(QStringLiteral("virtual "));
+ m_writer->writeCharacters(QStringLiteral("virtual "));
}
// Name and parameters.
@@ -3221,19 +3221,19 @@ void DocBookGenerator::generateSynopsis(const Node *node, const Node *relative,
generateSynopsisName(node, relative, generateNameLink);
if (!func->isMacroWithoutParams()) {
- writer->writeCharacters(QStringLiteral("("));
+ m_writer->writeCharacters(QStringLiteral("("));
if (!func->parameters().isEmpty()) {
const Parameters &parameters = func->parameters();
for (int i = 0; i < parameters.count(); i++) {
if (i > 0)
- writer->writeCharacters(QStringLiteral(", "));
+ m_writer->writeCharacters(QStringLiteral(", "));
generateParameter(parameters.at(i), relative, generateExtra, generateType);
}
}
- writer->writeCharacters(QStringLiteral(")"));
+ m_writer->writeCharacters(QStringLiteral(")"));
}
if (func->isConst())
- writer->writeCharacters(QStringLiteral(" const"));
+ m_writer->writeCharacters(QStringLiteral(" const"));
if (style == Section::Summary || style == Section::Accessors) {
// virtual is prepended, if needed.
@@ -3248,10 +3248,10 @@ void DocBookGenerator::generateSynopsis(const Node *node, const Node *relative,
synopsis += QStringLiteral(" &");
else if (func->isRefRef())
synopsis += QStringLiteral(" &&");
- writer->writeCharacters(synopsis);
+ m_writer->writeCharacters(synopsis);
} else if (style == Section::AllMembers) {
if (!func->returnType().isEmpty() && func->returnType() != "void") {
- writer->writeCharacters(QStringLiteral(" : "));
+ m_writer->writeCharacters(QStringLiteral(" : "));
typified(func->returnType(), relative, false, generateType);
}
} else {
@@ -3260,12 +3260,12 @@ void DocBookGenerator::generateSynopsis(const Node *node, const Node *relative,
synopsis += QStringLiteral(" &");
else if (func->isRefRef())
synopsis += QStringLiteral(" &&");
- writer->writeCharacters(synopsis);
+ m_writer->writeCharacters(synopsis);
}
} break;
case Node::Enum: {
const auto enume = static_cast<const EnumNode *>(node);
- writer->writeCharacters(QStringLiteral("enum "));
+ m_writer->writeCharacters(QStringLiteral("enum "));
generateSynopsisName(node, relative, generateNameLink);
QString synopsis;
@@ -3295,38 +3295,38 @@ void DocBookGenerator::generateSynopsis(const Node *node, const Node *relative,
synopsis += QLatin1Char(' ');
synopsis += QLatin1Char('}');
}
- writer->writeCharacters(synopsis);
+ m_writer->writeCharacters(synopsis);
} break;
case Node::TypeAlias: {
if (style == Section::Details) {
QString templateDecl = node->templateDecl();
if (!templateDecl.isEmpty())
- writer->writeCharacters(templateDecl + QLatin1Char(' '));
+ m_writer->writeCharacters(templateDecl + QLatin1Char(' '));
}
generateSynopsisName(node, relative, generateNameLink);
} break;
case Node::Typedef: {
if (static_cast<const TypedefNode *>(node)->associatedEnum())
- writer->writeCharacters("flags ");
+ m_writer->writeCharacters("flags ");
generateSynopsisName(node, relative, generateNameLink);
} break;
case Node::Property: {
const auto property = static_cast<const PropertyNode *>(node);
generateSynopsisName(node, relative, generateNameLink);
- writer->writeCharacters(" : ");
+ m_writer->writeCharacters(" : ");
typified(property->qualifiedDataType(), relative, false, generateType);
} break;
case Node::Variable: {
const auto variable = static_cast<const VariableNode *>(node);
if (style == Section::AllMembers) {
generateSynopsisName(node, relative, generateNameLink);
- writer->writeCharacters(" : ");
+ m_writer->writeCharacters(" : ");
typified(variable->dataType(), relative, false, generateType);
} else {
typified(variable->leftType(), relative, false, generateType);
- writer->writeCharacters(" ");
+ m_writer->writeCharacters(" ");
generateSynopsisName(node, relative, generateNameLink);
- writer->writeCharacters(variable->rightType());
+ m_writer->writeCharacters(variable->rightType());
}
} break;
default:
@@ -3340,7 +3340,7 @@ void DocBookGenerator::generateEnumValue(const QString &enumValue, const Node *r
// <@op>). With respect to CppCodeMarker::markedUpEnumValue, the order of generation of parents
// must be reversed so that they are processed in the order
if (!relative->isEnumType()) {
- writer->writeCharacters(enumValue);
+ m_writer->writeCharacters(enumValue);
return;
}
@@ -3355,14 +3355,14 @@ void DocBookGenerator::generateEnumValue(const QString &enumValue, const Node *r
if (static_cast<const EnumNode *>(relative)->isScoped())
parents << relative;
- writer->writeStartElement(dbNamespace, "code");
+ m_writer->writeStartElement(dbNamespace, "code");
for (auto parent : parents) {
generateSynopsisName(parent, relative, true);
- writer->writeCharacters("::");
+ m_writer->writeCharacters("::");
}
- writer->writeCharacters(enumValue);
- writer->writeEndElement(); // code
+ m_writer->writeCharacters(enumValue);
+ m_writer->writeEndElement(); // code
}
/*!
@@ -3380,19 +3380,19 @@ void DocBookGenerator::generateOverloadedSignal(const Node *node)
if (code.isEmpty())
return;
- writer->writeStartElement(dbNamespace, "note");
+ m_writer->writeStartElement(dbNamespace, "note");
newLine();
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters("Signal ");
- writer->writeTextElement(dbNamespace, "emphasis", node->name());
- writer->writeCharacters(" 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:");
- writer->writeTextElement(dbNamespace, "code", code);
- writer->writeEndElement(); // para
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters("Signal ");
+ m_writer->writeTextElement(dbNamespace, "emphasis", node->name());
+ m_writer->writeCharacters(" 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:");
+ m_writer->writeTextElement(dbNamespace, "code", code);
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // note
+ m_writer->writeEndElement(); // note
newLine();
}
@@ -3406,23 +3406,24 @@ void DocBookGenerator::generateAddendum(const Node *node, Addendum type, CodeMar
Q_UNUSED(marker);
Q_ASSERT(node && !node->name().isEmpty());
if (generateNote) {
- writer->writeStartElement(dbNamespace, "note");
+ m_writer->writeStartElement(dbNamespace, "note");
newLine();
}
switch (type) {
case Invokable:
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters(
- "This function can be invoked via the meta-object system and from QML. See ");
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters(
+ "This function can be invoked via the meta-object system and from QML. See ");
generateSimpleLink(node->url(), "Q_INVOKABLE");
- writer->writeCharacters(".");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(".");
+ m_writer->writeEndElement(); // para
newLine();
break;
case PrivateSignal:
- writer->writeTextElement(dbNamespace, "para",
- "This is a private signal. It can be used in signal connections but "
- "cannot be emitted by the user.");
+ m_writer->writeTextElement(
+ dbNamespace, "para",
+ "This is a private signal. It can be used in signal connections but "
+ "cannot be emitted by the user.");
break;
case QmlSignalHandler:
{
@@ -3430,11 +3431,11 @@ void DocBookGenerator::generateAddendum(const Node *node, Addendum type, CodeMar
int prefixLocation = handler.lastIndexOf('.', -2) + 1;
handler[prefixLocation] = handler[prefixLocation].toTitleCase();
handler.insert(prefixLocation, QLatin1String("on"));
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters("The corresponding handler is ");
- writer->writeTextElement(dbNamespace, "code", handler);
- writer->writeCharacters(".");
- writer->writeEndElement(); // para
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters("The corresponding handler is ");
+ m_writer->writeTextElement(dbNamespace, "code", handler);
+ m_writer->writeCharacters(".");
+ m_writer->writeEndElement(); // para
newLine();
break;
}
@@ -3466,9 +3467,9 @@ void DocBookGenerator::generateAddendum(const Node *node, Addendum type, CodeMar
default:
continue;
}
- writer->writeCharacters(msg + " for property ");
+ m_writer->writeCharacters(msg + " for property ");
generateSimpleLink(linkForNode(pn, nullptr), pn->name());
- writer->writeCharacters(". ");
+ m_writer->writeCharacters(". ");
}
break;
}
@@ -3477,11 +3478,11 @@ void DocBookGenerator::generateAddendum(const Node *node, Addendum type, CodeMar
const Node *linkNode;
Atom linkAtom = Atom(Atom::Link, "QProperty");
QString link = getAutoLink(&linkAtom, node, &linkNode);
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters("This property supports ");
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters("This property supports ");
generateSimpleLink(link, "QProperty");
- writer->writeCharacters(" bindings.");
- writer->writeEndElement(); // para
+ m_writer->writeCharacters(" bindings.");
+ m_writer->writeEndElement(); // para
newLine();
break;
}
@@ -3490,7 +3491,7 @@ void DocBookGenerator::generateAddendum(const Node *node, Addendum type, CodeMar
}
if (generateNote) {
- writer->writeEndElement(); // note
+ m_writer->writeEndElement(); // note
newLine();
}
}
@@ -3498,7 +3499,7 @@ void DocBookGenerator::generateAddendum(const Node *node, Addendum type, CodeMar
void DocBookGenerator::generateDetailedMember(const Node *node, const PageNode *relative)
{
// From HtmlGenerator::generateDetailedMember.
- writer->writeStartElement(dbNamespace, "section");
+ m_writer->writeStartElement(dbNamespace, "section");
if (node->isSharedCommentNode()) {
const auto scn = reinterpret_cast<const SharedCommentNode *>(node);
const QList<Node *> &collective = scn->collective();
@@ -3509,20 +3510,20 @@ void DocBookGenerator::generateDetailedMember(const Node *node, const PageNode *
QString nodeRef = refForNode(n);
if (firstFunction) {
- writer->writeAttribute("xml:id", refForNode(collective.at(0)));
+ m_writer->writeAttribute("xml:id", refForNode(collective.at(0)));
newLine();
- writer->writeStartElement(dbNamespace, "title");
+ m_writer->writeStartElement(dbNamespace, "title");
generateSynopsis(n, relative, Section::Details);
- writer->writeEndElement(); // title
+ m_writer->writeEndElement(); // title
newLine();
firstFunction = false;
} else {
- writer->writeStartElement(dbNamespace, "bridgehead");
- writer->writeAttribute("renderas", "sect2");
- writer->writeAttribute("xml:id", nodeRef);
+ m_writer->writeStartElement(dbNamespace, "bridgehead");
+ m_writer->writeAttribute("renderas", "sect2");
+ m_writer->writeAttribute("xml:id", nodeRef);
generateSynopsis(n, relative, Section::Details);
- writer->writeEndElement(); // bridgehead
+ m_writer->writeEndElement(); // bridgehead
newLine();
}
}
@@ -3531,22 +3532,22 @@ void DocBookGenerator::generateDetailedMember(const Node *node, const PageNode *
const EnumNode *etn;
QString nodeRef = refForNode(node);
if (node->isEnumType() && (etn = static_cast<const EnumNode *>(node))->flagsType()) {
- writer->writeAttribute("xml:id", nodeRef);
+ m_writer->writeAttribute("xml:id", nodeRef);
newLine();
- writer->writeStartElement(dbNamespace, "title");
+ m_writer->writeStartElement(dbNamespace, "title");
generateSynopsis(etn, relative, Section::Details);
- writer->writeEndElement(); // title
+ m_writer->writeEndElement(); // title
newLine();
- writer->writeStartElement(dbNamespace, "bridgehead");
+ m_writer->writeStartElement(dbNamespace, "bridgehead");
generateSynopsis(etn->flagsType(), relative, Section::Details);
- writer->writeEndElement(); // bridgehead
+ m_writer->writeEndElement(); // bridgehead
newLine();
} else {
- writer->writeAttribute("xml:id", nodeRef);
+ m_writer->writeAttribute("xml:id", nodeRef);
newLine();
- writer->writeStartElement(dbNamespace, "title");
+ m_writer->writeStartElement(dbNamespace, "title");
generateSynopsis(node, relative, Section::Details);
- writer->writeEndElement(); // title
+ m_writer->writeEndElement(); // title
newLine();
}
}
@@ -3569,15 +3570,15 @@ void DocBookGenerator::generateDetailedMember(const Node *node, const PageNode *
section.appendMembers(property->resetters().toVector());
if (!section.members().isEmpty()) {
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
newLine();
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
- writer->writeCharacters("Access functions:");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
+ m_writer->writeCharacters("Access functions:");
newLine();
- writer->writeEndElement(); // emphasis
+ m_writer->writeEndElement(); // emphasis
newLine();
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
generateSectionList(section, node);
}
@@ -3586,15 +3587,15 @@ void DocBookGenerator::generateDetailedMember(const Node *node, const PageNode *
notifiers.appendMembers(property->notifiers().toVector());
if (!notifiers.members().isEmpty()) {
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
newLine();
- writer->writeStartElement(dbNamespace, "emphasis");
- writer->writeAttribute("role", "bold");
- writer->writeCharacters("Notifier signal:");
+ m_writer->writeStartElement(dbNamespace, "emphasis");
+ m_writer->writeAttribute("role", "bold");
+ m_writer->writeCharacters("Notifier signal:");
newLine();
- writer->writeEndElement(); // emphasis
+ m_writer->writeEndElement(); // emphasis
newLine();
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
generateSectionList(notifiers, node);
}
@@ -3602,19 +3603,19 @@ void DocBookGenerator::generateDetailedMember(const Node *node, const PageNode *
} else if (node->isEnumType()) {
const auto en = static_cast<const EnumNode *>(node);
- if (qflagsHref_.isEmpty()) {
+ if (m_qflagsHref.isEmpty()) {
Node *qflags = m_qdb->findClassNode(QStringList("QFlags"));
if (qflags)
- qflagsHref_ = linkForNode(qflags, nullptr);
+ m_qflagsHref = linkForNode(qflags, nullptr);
}
if (en->flagsType()) {
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters("The " + en->flagsType()->name() + " type is a typedef for ");
- generateSimpleLink(qflagsHref_, "QFlags");
- writer->writeCharacters("&lt;" + en->name() + "&gt;. ");
- writer->writeCharacters("It stores an OR combination of " + en->name() + "values.");
- writer->writeEndElement(); // para
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters("The " + en->flagsType()->name() + " type is a typedef for ");
+ generateSimpleLink(m_qflagsHref, "QFlags");
+ m_writer->writeCharacters("&lt;" + en->name() + "&gt;. ");
+ m_writer->writeCharacters("It stores an OR combination of " + en->name() + "values.");
+ m_writer->writeEndElement(); // para
newLine();
}
}
@@ -3632,7 +3633,7 @@ void DocBookGenerator::generateSectionList(const Section &section, const Node *r
bool hasPrivateSignals = false;
bool isInvokable = false;
- writer->writeStartElement(dbNamespace, "itemizedlist");
+ m_writer->writeStartElement(dbNamespace, "itemizedlist");
newLine();
int i = 0;
@@ -3643,9 +3644,9 @@ void DocBookGenerator::generateSectionList(const Section &section, const Node *r
continue;
}
- writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeStartElement(dbNamespace, "listitem");
newLine();
- writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeStartElement(dbNamespace, "para");
// prefix no more needed.
generateSynopsis(*m, relative, section.style());
@@ -3657,16 +3658,16 @@ void DocBookGenerator::generateSectionList(const Section &section, const Node *r
isInvokable = true;
}
- writer->writeEndElement(); // para
+ m_writer->writeEndElement(); // para
newLine();
- writer->writeEndElement(); // listitem
+ m_writer->writeEndElement(); // listitem
newLine();
i++;
++m;
}
- writer->writeEndElement(); // itemizedlist
+ m_writer->writeEndElement(); // itemizedlist
newLine();
if (hasPrivateSignals)
@@ -3677,12 +3678,12 @@ void DocBookGenerator::generateSectionList(const Section &section, const Node *r
if (status != Section::Obsolete && section.style() == Section::Summary
&& !section.inheritedMembers().isEmpty()) {
- writer->writeStartElement(dbNamespace, "itemizedlist");
+ m_writer->writeStartElement(dbNamespace, "itemizedlist");
newLine();
generateSectionInheritedList(section, relative);
- writer->writeEndElement(); // itemizedlist
+ m_writer->writeEndElement(); // itemizedlist
newLine();
}
}
@@ -3692,13 +3693,13 @@ void DocBookGenerator::generateSectionInheritedList(const Section &section, cons
// From HtmlGenerator::generateSectionInheritedList.
QList<QPair<Aggregate *, int>>::ConstIterator p = section.inheritedMembers().constBegin();
while (p != section.inheritedMembers().constEnd()) {
- writer->writeStartElement(dbNamespace, "listitem");
- writer->writeCharacters(QString::number((*p).second) + u' ');
+ m_writer->writeStartElement(dbNamespace, "listitem");
+ m_writer->writeCharacters(QString::number((*p).second) + u' ');
if ((*p).second == 1)
- writer->writeCharacters(section.singular());
+ m_writer->writeCharacters(section.singular());
else
- writer->writeCharacters(section.plural());
- writer->writeCharacters(" inherited from ");
+ m_writer->writeCharacters(section.plural());
+ m_writer->writeCharacters(" inherited from ");
generateSimpleLink(fileName((*p).first) + '#'
+ Generator::cleanRef(section.title().toLower()),
(*p).first->plainFullName(relative));
@@ -3712,9 +3713,9 @@ void DocBookGenerator::generateSectionInheritedList(const Section &section, cons
*/
void DocBookGenerator::generatePageNode(PageNode *pn)
{
- Q_ASSERT(writer == nullptr);
+ Q_ASSERT(m_writer == nullptr);
// From HtmlGenerator::generatePageNode, remove anything related to TOCs.
- writer = startDocument(pn);
+ m_writer = startDocument(pn);
generateHeader(pn->fullTitle(), pn->subtitle(), pn);
generateBody(pn);
@@ -3762,8 +3763,8 @@ void DocBookGenerator::generateQmlTypePage(QmlTypeNode *qcn)
{
// From HtmlGenerator::generateQmlTypePage.
// Start producing the DocBook file.
- Q_ASSERT(writer == nullptr);
- writer = startDocument(qcn);
+ Q_ASSERT(m_writer == nullptr);
+ m_writer = startDocument(qcn);
Generator::setQmlTypeContext(qcn);
QString title = qcn->fullTitle();
@@ -3813,8 +3814,8 @@ void DocBookGenerator::generateQmlBasicTypePage(QmlBasicTypeNode *qbtn)
{
// From HtmlGenerator::generateQmlBasicTypePage.
// Start producing the DocBook file.
- Q_ASSERT(writer == nullptr);
- writer = startDocument(qbtn);
+ Q_ASSERT(m_writer == nullptr);
+ m_writer = startDocument(qbtn);
QString htmlTitle = qbtn->fullTitle();
if (qbtn->isJsType())
@@ -3914,11 +3915,11 @@ void DocBookGenerator::generateDetailedQmlMember(Node *node, const Aggregate *re
if (node->isQmlProperty() || node->isJsProperty()) {
auto *qpn = static_cast<QmlPropertyNode *>(node);
- writer->writeStartElement(dbNamespace, "bridgehead");
- writer->writeAttribute("renderas", "sect2");
- writer->writeAttribute("xml:id", refForNode(qpn));
- writer->writeCharacters(getQmlPropertyTitle(qpn));
- writer->writeEndElement(); // bridgehead
+ m_writer->writeStartElement(dbNamespace, "bridgehead");
+ m_writer->writeAttribute("renderas", "sect2");
+ m_writer->writeAttribute("xml:id", refForNode(qpn));
+ m_writer->writeCharacters(getQmlPropertyTitle(qpn));
+ m_writer->writeEndElement(); // bridgehead
newLine();
generateDocBookSynopsis(qpn);
@@ -3944,21 +3945,22 @@ void DocBookGenerator::generateDetailedQmlMember(Node *node, const Aggregate *re
// Complete the section tag.
if (i == 0) {
- writer->writeStartElement(dbNamespace, "section");
- writer->writeAttribute("xml:id", refForNode(m));
+ m_writer->writeStartElement(dbNamespace, "section");
+ m_writer->writeAttribute("xml:id", refForNode(m));
newLine();
}
// Write the tag containing the title.
- writer->writeStartElement(dbNamespace, (i == 0) ? "title" : "bridgehead");
+ m_writer->writeStartElement(dbNamespace, (i == 0) ? "title" : "bridgehead");
if (i > 0)
- writer->writeAttribute("renderas", "sect2");
+ m_writer->writeAttribute("renderas", "sect2");
// Write the title.
if (node->isFunction(Node::QML) || node->isFunction(Node::JS))
generateQmlMethodTitle(node);
else if (node->isQmlProperty() || node->isJsProperty())
- writer->writeCharacters(getQmlPropertyTitle(static_cast<QmlPropertyNode *>(node)));
+ m_writer->writeCharacters(
+ getQmlPropertyTitle(static_cast<QmlPropertyNode *>(node)));
// Complete the title and the synopsis.
generateDocBookSynopsis(m);
@@ -4066,8 +4068,8 @@ void DocBookGenerator::generateProxyPage(Aggregate *aggregate)
Q_ASSERT(aggregate->isProxyNode());
// Start producing the DocBook file.
- Q_ASSERT(writer == nullptr);
- writer = startDocument(aggregate);
+ Q_ASSERT(m_writer == nullptr);
+ m_writer = startDocument(aggregate);
// Info container.
generateHeader(aggregate->plainFullName(), "", aggregate);
@@ -4124,8 +4126,8 @@ void DocBookGenerator::generateCollectionNode(CollectionNode *cn)
{
// Adapted from HtmlGenerator::generateCollectionNode.
// Start producing the DocBook file.
- Q_ASSERT(writer == nullptr);
- writer = startDocument(cn);
+ Q_ASSERT(m_writer == nullptr);
+ m_writer = startDocument(cn);
// Info container.
generateHeader(cn->fullTitle(), cn->subtitle(), cn);
@@ -4197,8 +4199,8 @@ void DocBookGenerator::generateGenericCollectionPage(CollectionNode *cn)
QString filename = cn->tree()->physicalModuleName() + "-" + name + "." + fileExtension();
// Start producing the DocBook file.
- Q_ASSERT(writer == nullptr);
- writer = startGenericDocument(cn, filename);
+ Q_ASSERT(m_writer == nullptr);
+ m_writer = startGenericDocument(cn, filename);
// Info container.
generateHeader(cn->fullTitle(), cn->subtitle(), cn);
@@ -4207,12 +4209,12 @@ void DocBookGenerator::generateGenericCollectionPage(CollectionNode *cn)
generateDocBookSynopsis(cn);
// Actual content.
- writer->writeStartElement(dbNamespace, "para");
- writer->writeCharacters("Each function or type documented here is related to a class or "
- "namespace that is documented in a different module. The reference "
- "page for that class or namespace will link to the function or type "
- "on this page.");
- writer->writeEndElement(); // para
+ m_writer->writeStartElement(dbNamespace, "para");
+ m_writer->writeCharacters("Each function or type documented here is related to a class or "
+ "namespace that is documented in a different module. The reference "
+ "page for that class or namespace will link to the function or type "
+ "on this page.");
+ m_writer->writeEndElement(); // para
const CollectionNode *cnc = cn;
const QList<Node *> members = cn->members();
@@ -4230,11 +4232,11 @@ void DocBookGenerator::generateFullName(const Node *node, const Node *relative)
Q_ASSERT(relative);
// From Generator::appendFullName.
- writer->writeStartElement(dbNamespace, "link");
- writer->writeAttribute(xlinkNamespace, "href", fullDocumentLocation(node));
- writer->writeAttribute(xlinkNamespace, "role", targetType(node));
- writer->writeCharacters(node->fullName(relative));
- writer->writeEndElement(); // link
+ m_writer->writeStartElement(dbNamespace, "link");
+ m_writer->writeAttribute(xlinkNamespace, "href", fullDocumentLocation(node));
+ m_writer->writeAttribute(xlinkNamespace, "role", targetType(node));
+ m_writer->writeCharacters(node->fullName(relative));
+ m_writer->writeEndElement(); // link
}
void DocBookGenerator::generateFullName(const Node *apparentNode, const QString &fullName,
@@ -4246,11 +4248,11 @@ void DocBookGenerator::generateFullName(const Node *apparentNode, const QString
// From Generator::appendFullName.
if (actualNode == nullptr)
actualNode = apparentNode;
- writer->writeStartElement(dbNamespace, "link");
- writer->writeAttribute(xlinkNamespace, "href", fullDocumentLocation(actualNode));
- writer->writeAttribute("type", targetType(actualNode));
- writer->writeCharacters(fullName);
- writer->writeEndElement(); // link
+ m_writer->writeStartElement(dbNamespace, "link");
+ m_writer->writeAttribute(xlinkNamespace, "href", fullDocumentLocation(actualNode));
+ m_writer->writeAttribute("type", targetType(actualNode));
+ m_writer->writeCharacters(fullName);
+ m_writer->writeEndElement(); // link
}
QT_END_NAMESPACE
diff --git a/src/qdoc/docbookgenerator.h b/src/qdoc/docbookgenerator.h
index 33bbdb5c7..24fd5a9a9 100644
--- a/src/qdoc/docbookgenerator.h
+++ b/src/qdoc/docbookgenerator.h
@@ -52,7 +52,7 @@ public:
QString format() override;
protected:
- QString fileExtension() const override;
+ [[nodiscard]] QString fileExtension() const override;
void generateDocumentation(Node *node) override;
using Generator::generateCppReferencePage;
void generateCppReferencePage(Node *node);
@@ -159,19 +159,18 @@ private:
void generateSynopsisInfo(const QString &key, const QString &value);
void generateModifier(const QString &value);
- bool inListItemLineOpen {};
- bool inLink {};
+ bool m_inListItemLineOpen {};
int currentSectionLevel {};
QStack<int> sectionLevels {};
- QString qflagsHref_;
+ QString m_qflagsHref {};
- QString project;
- QString projectDescription;
- QString naturalLanguage;
- QString buildversion;
- QXmlStreamWriter *writer = nullptr;
+ QString m_project {};
+ QString m_projectDescription {};
+ QString m_naturalLanguage {};
+ QString m_buildVersion {};
+ QXmlStreamWriter *m_writer { nullptr };
- Config *config = nullptr;
+ Config *m_config { nullptr };
};
QT_END_NAMESPACE
diff --git a/src/qdoc/docparser.cpp b/src/qdoc/docparser.cpp
index d46a4bc86..4a84020f7 100644
--- a/src/qdoc/docparser.cpp
+++ b/src/qdoc/docparser.cpp
@@ -44,7 +44,7 @@
QT_BEGIN_NAMESPACE
-DocUtilities &DocParser::m_utilities = DocUtilities::instance();
+DocUtilities &DocParser::s_utilities = DocUtilities::instance();
enum {
CMD_A,
@@ -257,13 +257,13 @@ static struct
{ "endjs", CMD_ENDJS, nullptr },
{ nullptr, 0, nullptr } };
-int DocParser::tabSize;
-QStringList DocParser::exampleFiles;
-QStringList DocParser::exampleDirs;
-QStringList DocParser::sourceFiles;
-QStringList DocParser::sourceDirs;
-QStringList DocParser::ignoreWords;
-bool DocParser::quoting = false;
+int DocParser::s_tabSize;
+QStringList DocParser::s_exampleFiles;
+QStringList DocParser::s_exampleDirs;
+QStringList DocParser::s_sourceFiles;
+QStringList DocParser::s_sourceDirs;
+QStringList DocParser::s_ignoreWords;
+bool DocParser::s_quoting = false;
static QString cleanLink(const QString &link)
{
@@ -275,17 +275,17 @@ static QString cleanLink(const QString &link)
void DocParser::initialize(const Config &config)
{
- tabSize = config.getInt(CONFIG_TABSIZE);
- exampleFiles = config.getCanonicalPathList(CONFIG_EXAMPLES);
- exampleDirs = config.getCanonicalPathList(CONFIG_EXAMPLEDIRS);
- sourceFiles = config.getCanonicalPathList(CONFIG_SOURCES);
- sourceDirs = config.getCanonicalPathList(CONFIG_SOURCEDIRS);
- ignoreWords = config.getStringList(CONFIG_IGNOREWORDS);
+ s_tabSize = config.getInt(CONFIG_TABSIZE);
+ s_exampleFiles = config.getCanonicalPathList(CONFIG_EXAMPLES);
+ s_exampleDirs = config.getCanonicalPathList(CONFIG_EXAMPLEDIRS);
+ s_sourceFiles = config.getCanonicalPathList(CONFIG_SOURCES);
+ s_sourceDirs = config.getCanonicalPathList(CONFIG_SOURCEDIRS);
+ s_ignoreWords = config.getStringList(CONFIG_IGNOREWORDS);
int i = 0;
while (cmds[i].english) {
cmds[i].alias = new QString(Doc::alias(cmds[i].english));
- m_utilities.cmdHash.insert(*cmds[i].alias, cmds[i].no);
+ s_utilities.cmdHash.insert(*cmds[i].alias, cmds[i].no);
if (cmds[i].no != i)
Location::internalError(QStringLiteral("command %1 missing").arg(i));
@@ -293,18 +293,18 @@ void DocParser::initialize(const Config &config)
}
// If any of the formats define quotinginformation, activate quoting
- DocParser::quoting = config.getBool(CONFIG_QUOTINGINFORMATION);
+ DocParser::s_quoting = config.getBool(CONFIG_QUOTINGINFORMATION);
for (const auto &format : config.getOutputFormats())
- DocParser::quoting = DocParser::quoting
+ DocParser::s_quoting = DocParser::s_quoting
|| config.getBool(format + Config::dot + CONFIG_QUOTINGINFORMATION);
}
void DocParser::terminate()
{
- exampleFiles.clear();
- exampleDirs.clear();
- sourceFiles.clear();
- sourceDirs.clear();
+ s_exampleFiles.clear();
+ s_exampleDirs.clear();
+ s_sourceFiles.clear();
+ s_sourceDirs.clear();
int i = 0;
while (cmds[i].english) {
@@ -329,11 +329,11 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
m_input = source;
m_position = 0;
m_inputLength = m_input.length();
- m_cachedLocation = docPrivate->start_loc;
+ m_cachedLocation = docPrivate->m_start_loc;
m_cachedPosition = 0;
m_private = docPrivate;
- m_private->text << Atom::Nop;
- m_private->topics_.clear();
+ m_private->m_text << Atom::Nop;
+ m_private->m_topics.clear();
m_paragraphState = OutsideParagraph;
m_inTableHeader = false;
@@ -385,10 +385,10 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
} else {
// Ignore quoting atoms to make appendToCode()
// append to the correct atom.
- if (!quoting || !isQuote(m_private->text.lastAtom()))
- m_lastAtom = m_private->text.lastAtom();
+ if (!s_quoting || !isQuote(m_private->m_text.lastAtom()))
+ m_lastAtom = m_private->m_text.lastAtom();
- int cmd = m_utilities.cmdHash.value(cmdStr, NOT_A_CMD);
+ int cmd = s_utilities.cmdHash.value(cmdStr, NOT_A_CMD);
switch (cmd) {
case CMD_A:
enterPara();
@@ -396,7 +396,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
append(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER);
append(Atom::String, p1);
append(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER);
- m_private->params.insert(p1);
+ m_private->m_params.insert(p1);
break;
case CMD_BADCODE:
leavePara();
@@ -459,7 +459,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
closeCommand(cmd);
break;
case CMD_CODELINE:
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, " ");
}
@@ -471,7 +471,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
QString arg = getOptionalArgument();
if (arg.isEmpty())
arg = "4";
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, arg);
}
@@ -538,9 +538,9 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
break;
case CMD_ENDLINK:
if (closeCommand(cmd)) {
- if (m_private->text.lastAtom()->type() == Atom::String
- && m_private->text.lastAtom()->string().endsWith(QLatin1Char(' ')))
- m_private->text.lastAtom()->chopString();
+ if (m_private->m_text.lastAtom()->type() == Atom::String
+ && m_private->m_text.lastAtom()->string().endsWith(QLatin1Char(' ')))
+ m_private->m_text.lastAtom()->chopString();
append(Atom::FormattingRight, ATOM_FORMATTING_LINK);
}
break;
@@ -671,7 +671,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
enterPara();
m_indexStartedParagraph = true;
} else {
- const Atom *last = m_private->text.lastAtom();
+ const Atom *last = m_private->m_text.lastAtom();
if (m_indexStartedParagraph
&& (last->type() != Atom::FormattingRight
|| last->string() != ATOM_FORMATTING_INDEX))
@@ -689,14 +689,14 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
if (isLeftBraceAhead()) {
p1 = getArgument();
append(p1, p2);
- if (!p2.isEmpty() && !(m_private->text.lastAtom()->error().isEmpty()))
+ if (!p2.isEmpty() && !(m_private->m_text.lastAtom()->error().isEmpty()))
location().warning(
QStringLiteral(
"Check parameter in '[ ]' of '\\l' command: '%1', "
"possible misspelling, or unrecognized module name")
- .arg(m_private->text.lastAtom()->error()));
+ .arg(m_private->m_text.lastAtom()->error()));
if (isLeftBraceAhead()) {
- currentLinkAtom = m_private->text.lastAtom();
+ currentLinkAtom = m_private->m_text.lastAtom();
startFormat(ATOM_FORMATTING_LINK, cmd);
} else {
append(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
@@ -706,12 +706,12 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
} else {
p1 = getArgument();
append(p1, p2);
- if (!p2.isEmpty() && !(m_private->text.lastAtom()->error().isEmpty()))
+ if (!p2.isEmpty() && !(m_private->m_text.lastAtom()->error().isEmpty()))
location().warning(
QStringLiteral(
"Check parameter in '[ ]' of '\\l' command: '%1', "
"possible misspelling, or unrecognized module name")
- .arg(m_private->text.lastAtom()->error()));
+ .arg(m_private->m_text.lastAtom()->error()));
append(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
append(Atom::String, cleanLink(p1));
append(Atom::FormattingRight, ATOM_FORMATTING_LINK);
@@ -722,7 +722,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
leavePara();
if (openCommand(cmd))
append(Atom::LegaleseLeft);
- docPrivate->hasLegalese = true;
+ docPrivate->m_hasLegalese = true;
break;
case CMD_LINK:
if (openCommand(cmd)) {
@@ -742,7 +742,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
case CMD_META:
m_private->constructExtra();
p1 = getArgument();
- m_private->extra->metaMap_.insert(p1, getArgument());
+ m_private->extra->m_metaMap.insert(p1, getArgument());
break;
case CMD_NEWCODE:
location().warning(
@@ -804,10 +804,10 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
break;
case CMD_OMITVALUE: {
p1 = getArgument();
- if (!m_private->enumItemList.contains(p1))
- m_private->enumItemList.append(p1);
- if (!m_private->omitEnumItemList.contains(p1))
- m_private->omitEnumItemList.append(p1);
+ if (!m_private->m_enumItemList.contains(p1))
+ m_private->m_enumItemList.append(p1);
+ if (!m_private->m_omitEnumItemList.contains(p1))
+ m_private->m_omitEnumItemList.append(p1);
skipSpacesOrOneEndl();
// Skip potential description paragraph
while (m_position < m_inputLength && !isBlankLine()) {
@@ -817,7 +817,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
QString nextCmdStr;
while (pos < m_input.size() && m_input[pos].isLetterOrNumber())
nextCmdStr += m_input[pos++];
- int nextCmd = m_utilities.cmdHash.value(cmdStr, NOT_A_CMD);
+ int nextCmd = s_utilities.cmdHash.value(cmdStr, NOT_A_CMD);
if (nextCmd == cmd || nextCmd == CMD_VALUE)
break;
}
@@ -828,7 +828,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
case CMD_PRINTLINE: {
leavePara();
QString rest = getRestOfLine();
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, rest);
}
@@ -838,7 +838,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
case CMD_PRINTTO: {
leavePara();
QString rest = getRestOfLine();
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, rest);
}
@@ -848,7 +848,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
case CMD_PRINTUNTIL: {
leavePara();
QString rest = getRestOfLine();
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, rest);
}
@@ -865,7 +865,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
leavePara();
QString fileName = getArgument();
Doc::quoteFromFile(location(), m_quoter, fileName);
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, fileName);
}
@@ -876,7 +876,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
case CMD_QUOTEFROMFILE: {
leavePara();
QString arg = getArgument();
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, arg);
}
@@ -887,7 +887,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
leavePara();
marker = quoteFromFile();
p1 = getRestOfLine();
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, slashed(marker->functionEndRegExp(p1)));
}
@@ -951,7 +951,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
case CMD_SKIPLINE: {
leavePara();
QString rest = getRestOfLine();
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, rest);
}
@@ -961,7 +961,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
case CMD_SKIPTO: {
leavePara();
QString rest = getRestOfLine();
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, rest);
}
@@ -971,7 +971,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
case CMD_SKIPUNTIL: {
leavePara();
QString rest = getRestOfLine();
- if (quoting) {
+ if (s_quoting) {
append(Atom::CodeQuoteCommand, cmdStr);
append(Atom::CodeQuoteArgument, rest);
}
@@ -986,7 +986,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
leavePara();
QString snippet = getArgument();
QString identifier = getRestOfLine();
- if (quoting) {
+ if (s_quoting) {
append(Atom::SnippetCommand, cmdStr);
append(Atom::SnippetLocation, snippet);
append(Atom::SnippetIdentifier, identifier);
@@ -1055,8 +1055,8 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
p2 = p1.mid(7, p1.length() - 8);
p1 = getArgument();
}
- if (!m_private->enumItemList.contains(p1))
- m_private->enumItemList.append(p1);
+ if (!m_private->m_enumItemList.contains(p1))
+ m_private->m_enumItemList.append(p1);
m_openedLists.top().next();
append(Atom::ListTagLeft, ATOM_LIST_VALUE);
@@ -1085,7 +1085,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
append(Atom::String, " ");
break;
case CMD_OVERLOAD:
- m_private->metacommandsUsed.insert(cmdStr);
+ m_private->m_metacommandsUsed.insert(cmdStr);
p1.clear();
if (!isBlankLine())
p1 = getRestOfLine();
@@ -1101,15 +1101,15 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
append(Atom::ParaRight);
p1 = getMetaCommandArgument(cmdStr);
}
- m_private->metaCommandMap[cmdStr].append(ArgLocPair(p1, location()));
+ m_private->m_metaCommandMap[cmdStr].append(ArgLocPair(p1, location()));
break;
case NOT_A_CMD:
if (metaCommandSet.contains(cmdStr)) {
QString arg;
- m_private->metacommandsUsed.insert(cmdStr);
+ m_private->m_metacommandsUsed.insert(cmdStr);
if (isLeftBracketAhead()) {
m_private->constructExtra();
- m_private->extra->bracketedArgs_[cmdStr] = getBracketedArgument();
+ m_private->extra->m_bracketedArgs[cmdStr] = getBracketedArgument();
}
// Force a linebreak after \obsolete or \deprecated
// to treat potential arguments as a new text paragraph.
@@ -1119,25 +1119,25 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
m_input[m_position] = '\n';
else
arg = getMetaCommandArgument(cmdStr);
- m_private->metaCommandMap[cmdStr].append(ArgLocPair(arg, location()));
+ m_private->m_metaCommandMap[cmdStr].append(ArgLocPair(arg, location()));
if (possibleTopics.contains(cmdStr)) {
if (!cmdStr.endsWith(QLatin1String("propertygroup")))
- m_private->topics_.append(Topic(cmdStr, arg));
+ m_private->m_topics.append(Topic(cmdStr, arg));
}
- } else if (m_utilities.macroHash.contains(cmdStr)) {
- const Macro &macro = m_utilities.macroHash.value(cmdStr);
+ } else if (s_utilities.macroHash.contains(cmdStr)) {
+ const Macro &macro = s_utilities.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.m_otherDefs.constBegin();
+ it != macro.m_otherDefs.constEnd(); ++it) {
if (it.key() == "match") {
matchExpr = it.value();
} else {
append(Atom::FormatIf, it.key());
expandMacro(cmdStr, *it, macro.numParams);
++numFormatDefs;
- if (it == macro.otherDefs.constEnd()) {
+ if (it == macro.m_otherDefs.constEnd()) {
append(Atom::FormatEndif);
} else {
append(Atom::FormatElse);
@@ -1148,14 +1148,14 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
while (numPendingFi-- > 0)
append(Atom::FormatEndif);
- if (!macro.defaultDef.isEmpty()) {
+ if (!macro.m_defaultDef.isEmpty()) {
if (numFormatDefs > 0) {
- macro.defaultDefLocation.warning(
+ macro.m_defaultDefLocation.warning(
QStringLiteral("Macro cannot have both "
"format-specific and qdoc-"
"syntax definitions"));
} else {
- QString expanded = expandMacroToString(cmdStr, macro.defaultDef,
+ QString expanded = expandMacroToString(cmdStr, macro.m_defaultDef,
macro.numParams, matchExpr);
m_input.replace(m_backslashPosition,
m_endPosition - m_backslashPosition, expanded);
@@ -1202,8 +1202,9 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
// hack for C++ to support links like
// \l{QString::}{count()}
if (currentLinkAtom && currentLinkAtom->string().endsWith("::")) {
- QString suffix = Text::subText(currentLinkAtom, m_private->text.lastAtom())
- .toString();
+ QString suffix =
+ Text::subText(currentLinkAtom, m_private->m_text.lastAtom())
+ .toString();
currentLinkAtom->appendString(suffix);
}
currentLinkAtom = nullptr;
@@ -1225,7 +1226,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
}
default: {
bool newWord;
- switch (m_private->text.lastAtom()->type()) {
+ switch (m_private->m_text.lastAtom()->type()) {
case Atom::ParaLeft:
newWord = true;
break;
@@ -1268,7 +1269,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
} else {
QString word = m_input.mid(startPos, m_position - startPos);
if (autolink) {
- if (ignoreWords.contains(word) || word.startsWith(QString("__")))
+ if (s_ignoreWords.contains(word) || word.startsWith(QString("__")))
appendWord(word);
else
append(Atom::AutoLink, word);
@@ -1300,7 +1301,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
m_currentSection = Doc::NoSection;
}
- m_private->text.stripFirstAtom();
+ m_private->m_text.stripFirstAtom();
}
/*!
@@ -1326,10 +1327,10 @@ QString DocParser::detailsUnknownCommand(const QSet<QString> &metaCommandSet, co
++i;
}
- if (m_utilities.aliasMap.contains(str))
+ if (s_utilities.aliasMap.contains(str))
return QStringLiteral("The command '\\%1' was renamed '\\%2' by the configuration"
" file. Use the new name.")
- .arg(str, m_utilities.aliasMap[str]);
+ .arg(str, s_utilities.aliasMap[str]);
QString best = nearestName(str, commandSet);
if (best.isEmpty())
@@ -1347,10 +1348,10 @@ void DocParser::insertTarget(const QString &target, bool keyword)
m_private->constructExtra();
if (keyword) {
append(Atom::Keyword, target);
- m_private->extra->keywords_.append(m_private->text.lastAtom());
+ m_private->extra->m_keywords.append(m_private->m_text.lastAtom());
} else {
append(Atom::Target, target);
- m_private->extra->targets_.append(m_private->text.lastAtom());
+ m_private->extra->m_targets.append(m_private->m_text.lastAtom());
}
}
}
@@ -1576,8 +1577,8 @@ void DocParser::startSection(Doc::Sections unit, int cmd)
append(Atom::SectionLeft, QString::number(unit));
m_private->constructExtra();
- m_private->extra->tableOfContents_.append(m_private->text.lastAtom());
- m_private->extra->tableOfContentsLevels_.append(unit);
+ m_private->extra->m_tableOfContents.append(m_private->m_text.lastAtom());
+ m_private->extra->m_tableOfContentsLevels.append(unit);
enterPara(Atom::SectionHeadingLeft, Atom::SectionHeadingRight, QString::number(unit));
m_currentSection = unit;
}
@@ -1636,48 +1637,48 @@ void DocParser::parseAlso()
void DocParser::append(Atom::AtomType type, const QString &string)
{
- Atom::AtomType lastType = m_private->text.lastAtom()->type();
+ Atom::AtomType lastType = m_private->m_text.lastAtom()->type();
if ((lastType == Atom::Code)
- && m_private->text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
- m_private->text.lastAtom()->chopString();
- m_private->text << Atom(type, string);
+ && m_private->m_text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
+ m_private->m_text.lastAtom()->chopString();
+ m_private->m_text << Atom(type, string);
}
void DocParser::append(const QString &string)
{
- Atom::AtomType lastType = m_private->text.lastAtom()->type();
+ Atom::AtomType lastType = m_private->m_text.lastAtom()->type();
if ((lastType == Atom::Code)
- && m_private->text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
- m_private->text.lastAtom()->chopString();
- m_private->text << Atom(Atom::Link, string);
+ && m_private->m_text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
+ m_private->m_text.lastAtom()->chopString();
+ m_private->m_text << Atom(Atom::Link, string);
}
void DocParser::append(Atom::AtomType type, const QString &p1, const QString &p2)
{
- Atom::AtomType lastType = m_private->text.lastAtom()->type();
+ Atom::AtomType lastType = m_private->m_text.lastAtom()->type();
if ((lastType == Atom::Code)
- && m_private->text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
- m_private->text.lastAtom()->chopString();
- m_private->text << Atom(type, p1, p2);
+ && m_private->m_text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
+ m_private->m_text.lastAtom()->chopString();
+ m_private->m_text << Atom(type, p1, p2);
}
void DocParser::append(const QString &p1, const QString &p2)
{
- Atom::AtomType lastType = m_private->text.lastAtom()->type();
+ Atom::AtomType lastType = m_private->m_text.lastAtom()->type();
if ((lastType == Atom::Code)
- && m_private->text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
- m_private->text.lastAtom()->chopString();
+ && m_private->m_text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
+ m_private->m_text.lastAtom()->chopString();
if (p2.isEmpty())
- m_private->text << Atom(Atom::Link, p1);
+ m_private->m_text << Atom(Atom::Link, p1);
else
- m_private->text << LinkAtom(p1, p2);
+ m_private->m_text << LinkAtom(p1, p2);
}
void DocParser::appendChar(QChar ch)
{
- if (m_private->text.lastAtom()->type() != Atom::String)
+ if (m_private->m_text.lastAtom()->type() != Atom::String)
append(Atom::String);
- Atom *atom = m_private->text.lastAtom();
+ Atom *atom = m_private->m_text.lastAtom();
if (ch == QLatin1Char(' ')) {
if (!atom->string().endsWith(QLatin1Char(' ')))
atom->appendChar(QLatin1Char(' '));
@@ -1687,17 +1688,17 @@ void DocParser::appendChar(QChar ch)
void DocParser::appendWord(const QString &word)
{
- if (m_private->text.lastAtom()->type() != Atom::String) {
+ if (m_private->m_text.lastAtom()->type() != Atom::String) {
append(Atom::String, word);
} else
- m_private->text.lastAtom()->appendString(word);
+ m_private->m_text.lastAtom()->appendString(word);
}
void DocParser::appendToCode(const QString &markedCode)
{
if (!isCode(m_lastAtom)) {
append(Atom::Code);
- m_lastAtom = m_private->text.lastAtom();
+ m_lastAtom = m_private->m_text.lastAtom();
}
m_lastAtom->appendString(markedCode);
}
@@ -1706,7 +1707,7 @@ void DocParser::appendToCode(const QString &markedCode, Atom::AtomType defaultTy
{
if (!isCode(m_lastAtom)) {
append(defaultType, markedCode);
- m_lastAtom = m_private->text.lastAtom();
+ m_lastAtom = m_private->m_text.lastAtom();
} else {
m_lastAtom->appendString(markedCode);
}
@@ -1716,8 +1717,8 @@ void DocParser::enterPara(Atom::AtomType leftType, Atom::AtomType rightType, con
{
if (m_paragraphState == OutsideParagraph) {
- if ((m_private->text.lastAtom()->type() != Atom::ListItemLeft)
- && (m_private->text.lastAtom()->type() != Atom::DivLeft)) {
+ if ((m_private->m_text.lastAtom()->type() != Atom::ListItemLeft)
+ && (m_private->m_text.lastAtom()->type() != Atom::DivLeft)) {
leaveValueList();
}
@@ -1743,12 +1744,12 @@ void DocParser::leavePara()
m_pendingFormats.clear();
}
- if (m_private->text.lastAtom()->type() == m_pendingParagraphLeftType) {
- m_private->text.stripLastAtom();
+ if (m_private->m_text.lastAtom()->type() == m_pendingParagraphLeftType) {
+ m_private->m_text.stripLastAtom();
} else {
- if (m_private->text.lastAtom()->type() == Atom::String
- && m_private->text.lastAtom()->string().endsWith(QLatin1Char(' '))) {
- m_private->text.lastAtom()->chopString();
+ if (m_private->m_text.lastAtom()->type() == Atom::String
+ && m_private->m_text.lastAtom()->string().endsWith(QLatin1Char(' '))) {
+ m_private->m_text.lastAtom()->chopString();
}
append(m_pendingParagraphRightType, m_pendingParagraphString);
}
@@ -1766,8 +1767,8 @@ void DocParser::leaveValue()
m_openedLists.push(OpenedList(OpenedList::Value));
append(Atom::ListLeft, ATOM_LIST_VALUE);
} else {
- if (m_private->text.lastAtom()->type() == Atom::Nop)
- m_private->text.stripLastAtom();
+ if (m_private->m_text.lastAtom()->type() == Atom::Nop)
+ m_private->m_text.stripLastAtom();
append(Atom::ListItemRight, ATOM_LIST_VALUE);
}
}
@@ -1776,8 +1777,8 @@ void DocParser::leaveValueList()
{
leavePara();
if (!m_openedLists.isEmpty() && (m_openedLists.top().style() == OpenedList::Value)) {
- if (m_private->text.lastAtom()->type() == Atom::Nop)
- m_private->text.stripLastAtom();
+ if (m_private->m_text.lastAtom()->type() == Atom::Nop)
+ m_private->m_text.stripLastAtom();
append(Atom::ListItemRight, ATOM_LIST_VALUE);
append(Atom::ListRight, ATOM_LIST_VALUE);
m_openedLists.pop();
@@ -1829,11 +1830,11 @@ bool DocParser::expandMacro()
m_endPosition = m_position;
if (!cmdStr.isEmpty()) {
- if (m_utilities.macroHash.contains(cmdStr)) {
- const Macro &macro = m_utilities.macroHash.value(cmdStr);
- if (!macro.defaultDef.isEmpty()) {
- QString expanded = expandMacroToString(cmdStr, macro.defaultDef, macro.numParams,
- macro.otherDefs.value("match"));
+ if (s_utilities.macroHash.contains(cmdStr)) {
+ const Macro &macro = s_utilities.macroHash.value(cmdStr);
+ if (!macro.m_defaultDef.isEmpty()) {
+ QString expanded = expandMacroToString(cmdStr, macro.m_defaultDef, macro.numParams,
+ macro.m_otherDefs.value("match"));
m_input.replace(backslashPos, m_position - backslashPos, expanded);
m_inputLength = m_input.length();
m_position = backslashPos;
@@ -2402,8 +2403,8 @@ QString DocParser::untabifyEtc(const QString &str)
if (character == QLatin1Char('\r'))
continue;
if (character == QLatin1Char('\t')) {
- result += &" "[column % tabSize];
- column = ((column / tabSize) + 1) * tabSize;
+ result += &" "[column % s_tabSize];
+ column = ((column / s_tabSize) + 1) * s_tabSize;
continue;
}
if (character == QLatin1Char('\n')) {
diff --git a/src/qdoc/docparser.h b/src/qdoc/docparser.h
index 83f5441b0..d59115c16 100644
--- a/src/qdoc/docparser.h
+++ b/src/qdoc/docparser.h
@@ -63,13 +63,13 @@ public:
static QString dedent(int level, const QString &str);
static QString slashed(const QString &str);
- static int tabSize;
- static QStringList exampleFiles;
- static QStringList exampleDirs;
- static QStringList sourceFiles;
- static QStringList sourceDirs;
- static QStringList ignoreWords;
- static bool quoting;
+ static int s_tabSize;
+ static QStringList s_exampleFiles;
+ static QStringList s_exampleDirs;
+ static QStringList s_sourceFiles;
+ static QStringList s_sourceDirs;
+ static QStringList s_ignoreWords;
+ static bool s_quoting;
private:
Location &location();
@@ -123,14 +123,14 @@ private:
static bool isCode(const Atom *atom);
static bool isQuote(const Atom *atom);
- QStack<qsizetype> m_openedInputs;
+ QStack<qsizetype> m_openedInputs {};
- QString m_input;
+ QString m_input {};
qsizetype m_position {};
qsizetype m_backslashPosition {};
qsizetype m_endPosition {};
qsizetype m_inputLength {};
- Location m_cachedLocation;
+ Location m_cachedLocation {};
qsizetype m_cachedPosition {};
DocPrivate *m_private { nullptr };
@@ -142,18 +142,18 @@ private:
bool m_indexStartedParagraph {}; // ### rename
Atom::AtomType m_pendingParagraphLeftType {};
Atom::AtomType m_pendingParagraphRightType {};
- QString m_pendingParagraphString;
+ QString m_pendingParagraphString {};
int m_braceDepth {};
Doc::Sections m_currentSection {};
- QMap<QString, Location> m_targetMap;
- QMap<int, QString> m_pendingFormats;
- QStack<int> m_openedCommands;
- QStack<OpenedList> m_openedLists;
- Quoter m_quoter;
+ QMap<QString, Location> m_targetMap {};
+ QMap<int, QString> m_pendingFormats {};
+ QStack<int> m_openedCommands {};
+ QStack<OpenedList> m_openedLists {};
+ Quoter m_quoter {};
Atom *m_lastAtom { nullptr };
- static DocUtilities &m_utilities;
+ static DocUtilities &s_utilities;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/docprivate.cpp b/src/qdoc/docprivate.cpp
index 609f58b9d..d72cc247b 100644
--- a/src/qdoc/docprivate.cpp
+++ b/src/qdoc/docprivate.cpp
@@ -43,7 +43,7 @@ DocPrivate::~DocPrivate()
void DocPrivate::addAlso(const Text &also)
{
- alsoList.append(also);
+ m_alsoList.append(also);
}
void DocPrivate::constructExtra()
diff --git a/src/qdoc/docprivate.h b/src/qdoc/docprivate.h
index a4db39b88..d3db5219f 100644
--- a/src/qdoc/docprivate.h
+++ b/src/qdoc/docprivate.h
@@ -58,12 +58,12 @@ typedef QMap<QString, ArgList> CommandMap;
struct DocPrivateExtra
{
- QList<Atom *> tableOfContents_;
- QList<int> tableOfContentsLevels_;
- QList<Atom *> keywords_;
- QList<Atom *> targets_;
- QStringMultiMap metaMap_;
- QMap<QString, QString> bracketedArgs_ {};
+ QList<Atom *> m_tableOfContents {};
+ QList<int> m_tableOfContentsLevels {};
+ QList<Atom *> m_keywords {};
+ QList<Atom *> m_targets {};
+ QStringMultiMap m_metaMap {};
+ QMap<QString, QString> m_bracketedArgs {};
};
class DocPrivate
@@ -71,7 +71,7 @@ class DocPrivate
public:
explicit DocPrivate(const Location &start = Location(), const Location &end = Location(),
QString source = QString())
- : start_loc(start), end_loc(end), src(std::move(source)), hasLegalese(false) {};
+ : m_start_loc(start), m_end_loc(end), m_src(std::move(source)), m_hasLegalese(false) {};
~DocPrivate();
void addAlso(const Text &also);
@@ -81,20 +81,20 @@ public:
int count { 1 };
// ### move some of this in DocPrivateExtra
- Location start_loc;
- Location end_loc;
- QString src;
- Text text;
- QSet<QString> params;
- QList<Text> alsoList;
- QStringList enumItemList;
- QStringList omitEnumItemList;
- QSet<QString> metacommandsUsed;
- CommandMap metaCommandMap;
+ Location m_start_loc {};
+ Location m_end_loc {};
+ QString m_src {};
+ Text m_text {};
+ QSet<QString> m_params {};
+ QList<Text> m_alsoList {};
+ QStringList m_enumItemList {};
+ QStringList m_omitEnumItemList {};
+ QSet<QString> m_metacommandsUsed {};
+ CommandMap m_metaCommandMap {};
DocPrivateExtra *extra { nullptr };
- TopicList topics_;
+ TopicList m_topics {};
- bool hasLegalese : 1;
+ bool m_hasLegalese : 1;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/enumitem.h b/src/qdoc/enumitem.h
index 5ce3f79e2..bf360f56a 100644
--- a/src/qdoc/enumitem.h
+++ b/src/qdoc/enumitem.h
@@ -42,8 +42,8 @@ public:
EnumItem() = default;
EnumItem(QString name, QString value) : m_name(std::move(name)), m_value(std::move(value)) { }
- const QString &name() const { return m_name; }
- const QString &value() const { return m_value; }
+ [[nodiscard]] const QString &name() const { return m_name; }
+ [[nodiscard]] const QString &value() const { return m_value; }
private:
QString m_name {};
diff --git a/src/qdoc/examplenode.h b/src/qdoc/examplenode.h
index 598f8e535..0ce2294f2 100644
--- a/src/qdoc/examplenode.h
+++ b/src/qdoc/examplenode.h
@@ -41,11 +41,11 @@ class ExampleNode : public PageNode
{
public:
ExampleNode(Aggregate *parent, const QString &name) : PageNode(Node::Example, parent, name) {}
- QString imageFileName() const override { return m_imageFileName; }
+ [[nodiscard]] QString imageFileName() const override { return m_imageFileName; }
void setImageFileName(const QString &ifn) override { m_imageFileName = ifn; }
- const QStringList &files() const { return m_files; }
- const QStringList &images() const { return m_images; }
- const QString &projectFile() const { return m_projectFile; }
+ [[nodiscard]] const QStringList &files() const { return m_files; }
+ [[nodiscard]] const QStringList &images() const { return m_images; }
+ [[nodiscard]] const QString &projectFile() const { return m_projectFile; }
void setFiles(const QStringList &files, const QString &projectFile)
{
m_files = files;
diff --git a/src/qdoc/functionnode.h b/src/qdoc/functionnode.h
index ad9e59317..b7162eb51 100644
--- a/src/qdoc/functionnode.h
+++ b/src/qdoc/functionnode.h
@@ -68,11 +68,11 @@ public:
FunctionNode(Metaness type, Aggregate *parent, const QString &name, bool attached = false);
Node *clone(Aggregate *parent) override;
- Metaness metaness() const { return m_metaness; }
- QString metanessString() const;
+ [[nodiscard]] Metaness metaness() const { return m_metaness; }
+ [[nodiscard]] QString metanessString() const;
bool changeMetaness(Metaness from, Metaness to);
void setMetaness(Metaness metaness) { m_metaness = metaness; }
- QString kindString() const;
+ [[nodiscard]] QString kindString() const;
static Metaness getMetaness(const QString &value);
static Metaness getMetanessFromTopic(const QString &topic);
static Genus getGenus(Metaness metaness);
@@ -88,94 +88,110 @@ public:
void setReimpFlag() { m_reimpFlag = true; }
void setOverridesThis(const QString &path) { m_overridesThis = path; }
- const QString &returnType() const { return m_returnType; }
- QString virtualness() const;
- bool isConst() const { return m_const; }
- bool isDefault() const override { return m_default; }
- bool isStatic() const override { return m_static; }
- bool isOverload() const { return m_overloadFlag; }
- bool isMarkedReimp() const override { return m_reimpFlag; }
- bool isSomeCtor() const { return isCtor() || isCCtor() || isMCtor(); }
- bool isMacroWithParams() const { return (m_metaness == MacroWithParams); }
- bool isMacroWithoutParams() const { return (m_metaness == MacroWithoutParams); }
- bool isMacro() const override { return (isMacroWithParams() || isMacroWithoutParams()); }
- bool isDeprecated() const override;
-
- bool isCppFunction() const { return m_metaness == Plain; } // Is this correct?
- bool isSignal() const { return (m_metaness == Signal); }
- bool isSlot() const { return (m_metaness == Slot); }
- bool isCtor() const { return (m_metaness == Ctor); }
- bool isDtor() const { return (m_metaness == Dtor); }
- bool isCCtor() const { return (m_metaness == CCtor); }
- bool isMCtor() const { return (m_metaness == MCtor); }
- bool isCAssign() const { return (m_metaness == CAssign); }
- bool isMAssign() const { return (m_metaness == MAssign); }
-
- bool isJsMethod() const { return (m_metaness == JsMethod); }
- bool isJsSignal() const { return (m_metaness == JsSignal); }
- bool isJsSignalHandler() const { return (m_metaness == JsSignalHandler); }
-
- bool isQmlMethod() const { return (m_metaness == QmlMethod); }
- bool isQmlSignal() const { return (m_metaness == QmlSignal); }
- bool isQmlSignalHandler() const { return (m_metaness == QmlSignalHandler); }
-
- bool isSpecialMemberFunction() const
+ [[nodiscard]] const QString &returnType() const { return m_returnType; }
+ [[nodiscard]] QString virtualness() const;
+ [[nodiscard]] bool isConst() const { return m_const; }
+ [[nodiscard]] bool isDefault() const override { return m_default; }
+ [[nodiscard]] bool isStatic() const override { return m_static; }
+ [[nodiscard]] bool isOverload() const { return m_overloadFlag; }
+ [[nodiscard]] bool isMarkedReimp() const override { return m_reimpFlag; }
+ [[nodiscard]] bool isSomeCtor() const { return isCtor() || isCCtor() || isMCtor(); }
+ [[nodiscard]] bool isMacroWithParams() const { return (m_metaness == MacroWithParams); }
+ [[nodiscard]] bool isMacroWithoutParams() const { return (m_metaness == MacroWithoutParams); }
+ [[nodiscard]] bool isMacro() const override
+ {
+ return (isMacroWithParams() || isMacroWithoutParams());
+ }
+ [[nodiscard]] bool isDeprecated() const override;
+
+ [[nodiscard]] bool isCppFunction() const { return m_metaness == Plain; } // Is this correct?
+ [[nodiscard]] bool isSignal() const { return (m_metaness == Signal); }
+ [[nodiscard]] bool isSlot() const { return (m_metaness == Slot); }
+ [[nodiscard]] bool isCtor() const { return (m_metaness == Ctor); }
+ [[nodiscard]] bool isDtor() const { return (m_metaness == Dtor); }
+ [[nodiscard]] bool isCCtor() const { return (m_metaness == CCtor); }
+ [[nodiscard]] bool isMCtor() const { return (m_metaness == MCtor); }
+ [[nodiscard]] bool isCAssign() const { return (m_metaness == CAssign); }
+ [[nodiscard]] bool isMAssign() const { return (m_metaness == MAssign); }
+
+ [[nodiscard]] bool isJsMethod() const { return (m_metaness == JsMethod); }
+ [[nodiscard]] bool isJsSignal() const { return (m_metaness == JsSignal); }
+ [[nodiscard]] bool isJsSignalHandler() const { return (m_metaness == JsSignalHandler); }
+
+ [[nodiscard]] bool isQmlMethod() const { return (m_metaness == QmlMethod); }
+ [[nodiscard]] bool isQmlSignal() const { return (m_metaness == QmlSignal); }
+ [[nodiscard]] bool isQmlSignalHandler() const { return (m_metaness == QmlSignalHandler); }
+
+ [[nodiscard]] bool isSpecialMemberFunction() const
{
return (isCtor() || isDtor() || isCCtor() || isMCtor() || isCAssign() || isMAssign());
}
- bool isNonvirtual() const { return (m_virtualness == NonVirtual); }
- bool isVirtual() const { return (m_virtualness == NormalVirtual); }
- bool isPureVirtual() const { return (m_virtualness == PureVirtual); }
- bool returnsBool() const { return (m_returnType == QLatin1String("bool")); }
+ [[nodiscard]] bool isNonvirtual() const { return (m_virtualness == NonVirtual); }
+ [[nodiscard]] bool isVirtual() const { return (m_virtualness == NormalVirtual); }
+ [[nodiscard]] bool isPureVirtual() const { return (m_virtualness == PureVirtual); }
+ [[nodiscard]] bool returnsBool() const { return (m_returnType == QLatin1String("bool")); }
Parameters &parameters() { return m_parameters; }
- const Parameters &parameters() const { return m_parameters; }
- bool isPrivateSignal() const { return m_parameters.isPrivateSignal(); }
+ [[nodiscard]] const Parameters &parameters() const { return m_parameters; }
+ [[nodiscard]] bool isPrivateSignal() const { return m_parameters.isPrivateSignal(); }
void setParameters(const QString &signature) { m_parameters.set(signature); }
- QString signature(bool values, bool noReturnType, bool templateParams = false) const override;
-
- const QString &overridesThis() const { return m_overridesThis; }
- const NodeList &associatedProperties() const { return m_associatedProperties; }
- bool hasAssociatedProperties() const { return !m_associatedProperties.isEmpty(); }
- bool hasOneAssociatedProperty() const { return (m_associatedProperties.size() == 1); }
- Node *firstAssociatedProperty() const { return m_associatedProperties[0]; }
-
- QString element() const override { return parent()->name(); }
- bool isAttached() const override { return m_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(); }
+ [[nodiscard]] QString signature(bool values, bool noReturnType,
+ bool templateParams = false) const override;
+
+ [[nodiscard]] const QString &overridesThis() const { return m_overridesThis; }
+ [[nodiscard]] const NodeList &associatedProperties() const { return m_associatedProperties; }
+ [[nodiscard]] bool hasAssociatedProperties() const { return !m_associatedProperties.isEmpty(); }
+ [[nodiscard]] bool hasOneAssociatedProperty() const
+ {
+ return (m_associatedProperties.size() == 1);
+ }
+ [[nodiscard]] Node *firstAssociatedProperty() const { return m_associatedProperties[0]; }
+
+ [[nodiscard]] QString element() const override { return parent()->name(); }
+ [[nodiscard]] bool isAttached() const override { return m_attached; }
+ [[nodiscard]] bool isQtQuickNode() const override { return parent()->isQtQuickNode(); }
+ [[nodiscard]] QString qmlTypeName() const override { return parent()->qmlTypeName(); }
+ [[nodiscard]] QString logicalModuleName() const override
+ {
+ return parent()->logicalModuleName();
+ }
+ [[nodiscard]] QString logicalModuleVersion() const override
+ {
+ return parent()->logicalModuleVersion();
+ }
+ [[nodiscard]] QString logicalModuleIdentifier() const override
+ {
+ return parent()->logicalModuleIdentifier();
+ }
void debug() const;
void setFinal(bool b) { m_isFinal = b; }
- bool isFinal() const { return m_isFinal; }
+ [[nodiscard]] bool isFinal() const { return m_isFinal; }
void setOverride(bool b) { m_isOverride = b; }
- bool isOverride() const { return m_isOverride; }
+ [[nodiscard]] bool isOverride() const { return m_isOverride; }
void setRef(bool b) { m_isRef = b; }
- bool isRef() const { return m_isRef; }
+ [[nodiscard]] bool isRef() const { return m_isRef; }
void setRefRef(bool b) { m_isRefRef = b; }
- bool isRefRef() const { return m_isRefRef; }
+ [[nodiscard]] bool isRefRef() const { return m_isRefRef; }
void setInvokable(bool b) { m_isInvokable = b; }
- bool isInvokable() const { return m_isInvokable; }
+ [[nodiscard]] bool isInvokable() const { return m_isInvokable; }
- bool hasTag(const QString &tag) const override { return (m_tag == tag); }
+ [[nodiscard]] bool hasTag(const QString &tag) const override { return (m_tag == tag); }
void setTag(const QString &tag) { m_tag = tag; }
- const QString &tag() const { return m_tag; }
+ [[nodiscard]] const QString &tag() const { return m_tag; }
bool compare(const Node *node, bool sameParent = true) const;
- bool isIgnored() const;
- bool hasOverloads() const;
+ [[nodiscard]] bool isIgnored() const;
+ [[nodiscard]] bool hasOverloads() const;
void setOverloadFlag() { m_overloadFlag = true; }
void setOverloadNumber(signed short number);
void appendOverload(FunctionNode *functionNode);
void removeOverload(FunctionNode *functionNode);
- signed short overloadNumber() const { return m_overloadNumber; }
+ [[nodiscard]] signed short overloadNumber() const { return m_overloadNumber; }
FunctionNode *nextOverload() { return m_nextOverload; }
void setNextOverload(FunctionNode *functionNode) { m_nextOverload = functionNode; }
FunctionNode *findPrimaryFunction();
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp
index 5ddf5b2d7..0c845ba0f 100644
--- a/src/qdoc/generator.cpp
+++ b/src/qdoc/generator.cpp
@@ -60,27 +60,27 @@
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;
-QList<Generator *> Generator::generators;
-QStringList Generator::imageDirs;
-QStringList Generator::imageFiles;
-QMap<QString, QStringList> Generator::imgFileExts;
-QString Generator::outDir_;
-QString Generator::outSubdir_;
-QStringList Generator::outFileNames_;
-QSet<QString> Generator::outputFormats;
-QHash<QString, QString> Generator::outputPrefixes;
-QHash<QString, QString> Generator::outputSuffixes;
-QString Generator::project_;
-bool Generator::noLinkErrors_ = false;
-bool Generator::autolinkErrors_ = false;
-bool Generator::redirectDocumentationToDevNull_ = false;
-bool Generator::useOutputSubdirs_ = true;
-QmlTypeNode *Generator::qmlTypeContext_ = nullptr;
+Generator *Generator::s_currentGenerator;
+QStringList Generator::s_exampleDirs;
+QStringList Generator::s_exampleImgExts;
+QMap<QString, QMap<QString, QString>> Generator::s_fmtLeftMaps;
+QMap<QString, QMap<QString, QString>> Generator::s_fmtRightMaps;
+QList<Generator *> Generator::s_generators;
+QStringList Generator::s_imageDirs;
+QStringList Generator::s_imageFiles;
+QMap<QString, QStringList> Generator::s_imgFileExts;
+QString Generator::s_outDir;
+QString Generator::s_outSubdir;
+QStringList Generator::s_outFileNames;
+QSet<QString> Generator::s_outputFormats;
+QHash<QString, QString> Generator::s_outputPrefixes;
+QHash<QString, QString> Generator::s_outputSuffixes;
+QString Generator::s_project;
+bool Generator::s_noLinkErrors = false;
+bool Generator::s_autolinkErrors = false;
+bool Generator::s_redirectDocumentationToDevNull = false;
+bool Generator::s_useOutputSubdirs = true;
+QmlTypeNode *Generator::s_qmlTypeContext = nullptr;
static QRegularExpression tag("</?@[^>]*>");
static QLatin1String amp("&amp;");
@@ -97,7 +97,7 @@ static QLatin1String quot("&quot;");
Generator::Generator()
{
m_qdb = QDocDatabase::qdocDB();
- generators.prepend(this);
+ s_generators.prepend(this);
}
/*!
@@ -106,7 +106,7 @@ Generator::Generator()
*/
Generator::~Generator()
{
- generators.removeAll(this);
+ s_generators.removeAll(this);
}
void Generator::appendFullName(Text &text, const Node *apparentNode, const Node *relative,
@@ -223,10 +223,10 @@ QFile *Generator::openSubPageFile(const Node *node, const QString &fileName)
}
path += fileName;
- auto outPath = redirectDocumentationToDevNull_ ? QStringLiteral("/dev/null") : path;
+ auto outPath = s_redirectDocumentationToDevNull ? QStringLiteral("/dev/null") : path;
auto outFile = new QFile(outPath);
- if (!redirectDocumentationToDevNull_ && outFile->exists())
+ if (!s_redirectDocumentationToDevNull && outFile->exists())
qCDebug(lcQdoc) << "Output file already exists; overwriting" << qPrintable(outFile->fileName());
if (!outFile->open(QFile::WriteOnly)) {
@@ -235,7 +235,7 @@ QFile *Generator::openSubPageFile(const Node *node, const QString &fileName)
}
qCDebug(lcQdoc, "Writing: %s", qPrintable(path));
- outFileNames_ << fileName;
+ s_outFileNames << fileName;
return outFile;
}
@@ -343,7 +343,7 @@ QString Generator::fileBase(const Node *node) const
if (node->isExample()) {
QString modPrefix(node->physicalModuleName());
if (modPrefix.isEmpty()) {
- modPrefix = project_;
+ modPrefix = s_project;
}
base.prepend(modPrefix.toLower() + QLatin1Char('-'));
}
@@ -405,7 +405,7 @@ QString Generator::linkForExampleFile(const QString &path, const Node *parent,
QString link = path;
QString modPrefix(parent->physicalModuleName());
if (modPrefix.isEmpty())
- modPrefix = project_;
+ modPrefix = s_project;
link.prepend(modPrefix.toLower() + QLatin1Char('-'));
QString res;
@@ -500,12 +500,12 @@ QString Generator::cleanRef(const QString &ref)
QMap<QString, QString> &Generator::formattingLeftMap()
{
- return fmtLeftMaps[format()];
+ return s_fmtLeftMaps[format()];
}
QMap<QString, QString> &Generator::formattingRightMap()
{
- return fmtRightMaps[format()];
+ return s_fmtRightMaps[format()];
}
/*!
@@ -966,11 +966,11 @@ 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);
- outFileNames_ << prefix.mid(1) + userFriendlyFilePath;
+ QString srcPath = Config::findFile(en->location(), QStringList(), s_exampleDirs, file,
+ s_exampleImgExts, &userFriendlyFilePath);
+ s_outFileNames << prefix.mid(1) + userFriendlyFilePath;
userFriendlyFilePath.truncate(userFriendlyFilePath.lastIndexOf('/'));
- QString imgOutDir = outDir_ + prefix + userFriendlyFilePath;
+ QString imgOutDir = s_outDir + prefix + userFriendlyFilePath;
if (!dirInfo.mkpath(imgOutDir))
en->location().fatal(QStringLiteral("Cannot create output directory '%1'").arg(imgOutDir));
Config::copyFile(en->location(), srcPath, file, imgOutDir);
@@ -1568,13 +1568,13 @@ void Generator::generateOverloadedSignal(const Node *node, CodeMarker *marker)
*/
void Generator::generateDocs()
{
- currentGenerator_ = this;
+ s_currentGenerator = this;
generateDocumentation(m_qdb->primaryTreeRoot());
}
Generator *Generator::generatorForFormat(const QString &format)
{
- for (const auto &generator : qAsConst(generators)) {
+ for (const auto &generator : qAsConst(s_generators)) {
if (generator->format() == format)
return generator;
}
@@ -1607,8 +1607,8 @@ 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(), s_imageFiles, s_imageDirs,
+ fileBase, s_imgFileExts[format()], &userFriendlyFilePath);
if (filePath.isEmpty())
return QString();
@@ -1649,21 +1649,21 @@ QString Generator::indent(int level, const QString &markedCode)
void Generator::initialize()
{
Config &config = Config::instance();
- outputFormats = config.getOutputFormats();
- redirectDocumentationToDevNull_ = config.getBool(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL);
+ s_outputFormats = config.getOutputFormats();
+ s_redirectDocumentationToDevNull = config.getBool(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL);
- imageFiles = config.getCanonicalPathList(CONFIG_IMAGES);
- imageDirs = config.getCanonicalPathList(CONFIG_IMAGEDIRS);
- exampleDirs = config.getCanonicalPathList(CONFIG_EXAMPLEDIRS);
- exampleImgExts = config.getStringList(CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS);
+ s_imageFiles = config.getCanonicalPathList(CONFIG_IMAGES);
+ s_imageDirs = config.getCanonicalPathList(CONFIG_IMAGEDIRS);
+ s_exampleDirs = config.getCanonicalPathList(CONFIG_EXAMPLEDIRS);
+ s_exampleImgExts = config.getStringList(CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS);
QString imagesDotFileExtensions = CONFIG_IMAGES + Config::dot + CONFIG_FILEEXTENSIONS;
for (const auto &ext : config.subVars(imagesDotFileExtensions))
- imgFileExts[ext] = config.getStringList(imagesDotFileExtensions + Config::dot + ext);
+ s_imgFileExts[ext] = config.getStringList(imagesDotFileExtensions + Config::dot + ext);
- for (auto &g : generators) {
- if (outputFormats.contains(g->format())) {
- currentGenerator_ = g;
+ for (auto &g : s_generators) {
+ if (s_outputFormats.contains(g->format())) {
+ s_currentGenerator = g;
g->initializeGenerator();
}
}
@@ -1690,33 +1690,34 @@ void Generator::initialize()
.arg(numOccs));
} else {
int paramPos = def.indexOf("\1");
- fmtLeftMaps[f].insert(n, def.left(paramPos));
- fmtRightMaps[f].insert(n, def.mid(paramPos + 1));
+ s_fmtLeftMaps[f].insert(n, def.left(paramPos));
+ s_fmtRightMaps[f].insert(n, def.mid(paramPos + 1));
}
}
}
}
- project_ = config.getString(CONFIG_PROJECT);
- outDir_ = config.getOutputDir();
- outSubdir_ = outDir_.mid(outDir_.lastIndexOf('/') + 1);
+ s_project = config.getString(CONFIG_PROJECT);
+ s_outDir = config.getOutputDir();
+ s_outSubdir = s_outDir.mid(s_outDir.lastIndexOf('/') + 1);
- outputPrefixes.clear();
+ s_outputPrefixes.clear();
QStringList items = config.getStringList(CONFIG_OUTPUTPREFIXES);
if (!items.isEmpty()) {
for (const auto &prefix : items)
- outputPrefixes[prefix] = config.getString(CONFIG_OUTPUTPREFIXES + Config::dot + prefix);
+ s_outputPrefixes[prefix] =
+ config.getString(CONFIG_OUTPUTPREFIXES + Config::dot + prefix);
} else {
- outputPrefixes[QLatin1String("QML")] = QLatin1String("qml-");
- outputPrefixes[QLatin1String("JS")] = QLatin1String("js-");
+ s_outputPrefixes[QLatin1String("QML")] = QLatin1String("qml-");
+ s_outputPrefixes[QLatin1String("JS")] = QLatin1String("js-");
}
- outputSuffixes.clear();
+ s_outputSuffixes.clear();
for (const auto &suffix : config.getStringList(CONFIG_OUTPUTSUFFIXES))
- outputSuffixes[suffix] = config.getString(CONFIG_OUTPUTSUFFIXES + Config::dot + suffix);
+ s_outputSuffixes[suffix] = config.getString(CONFIG_OUTPUTSUFFIXES + Config::dot + suffix);
- noLinkErrors_ = config.getBool(CONFIG_NOLINKERRORS);
- autolinkErrors_ = config.getBool(CONFIG_AUTOLINKERRORS);
+ s_noLinkErrors = config.getBool(CONFIG_NOLINKERRORS);
+ s_autolinkErrors = config.getBool(CONFIG_AUTOLINKERRORS);
}
/*!
@@ -1729,7 +1730,7 @@ void Generator::copyTemplateFiles(const QString &configVar, const QString &subDi
QStringList files = config.getCanonicalPathList(configVar, true);
if (!files.isEmpty()) {
QDir dirInfo;
- QString templateDir = outDir_ + QLatin1Char('/') + subDir;
+ QString templateDir = s_outDir + QLatin1Char('/') + subDir;
if (!dirInfo.exists(templateDir) && !dirInfo.mkdir(templateDir)) {
config.lastLocation().fatal(
QStringLiteral("Cannot create %1 directory '%2'").arg(subDir, templateDir));
@@ -1750,32 +1751,33 @@ void Generator::copyTemplateFiles(const QString &configVar, const QString &subDi
void Generator::initializeFormat()
{
Config &config = Config::instance();
- outFileNames_.clear();
- useOutputSubdirs_ = true;
+ s_outFileNames.clear();
+ s_useOutputSubdirs = true;
if (config.getBool(format() + Config::dot + "nosubdirs"))
resetUseOutputSubdirs();
- if (outputFormats.isEmpty())
+ if (s_outputFormats.isEmpty())
return;
- outDir_ = config.getOutputDir(format());
- if (outDir_.isEmpty()) {
+ s_outDir = config.getOutputDir(format());
+ if (s_outDir.isEmpty()) {
config.lastLocation().fatal(QStringLiteral("No output directory specified in "
"configuration file or on the command line"));
} else {
- outSubdir_ = outDir_.mid(outDir_.lastIndexOf('/') + 1);
+ s_outSubdir = s_outDir.mid(s_outDir.lastIndexOf('/') + 1);
}
- QDir outputDir(outDir_);
+ QDir outputDir(s_outDir);
if (outputDir.exists()) {
if (!config.generating() && Generator::useOutputSubdirs()) {
if (!outputDir.isEmpty())
config.lastLocation().error(
- QStringLiteral("Output directory '%1' exists but is not empty").arg(outDir_));
+ QStringLiteral("Output directory '%1' exists but is not empty")
+ .arg(s_outDir));
}
} else if (!outputDir.mkpath(QStringLiteral("."))) {
config.lastLocation().fatal(
- QStringLiteral("Cannot create output directory '%1'").arg(outDir_));
+ QStringLiteral("Cannot create output directory '%1'").arg(s_outDir));
}
// Output directory exists, which is enough for prepare phase.
@@ -1807,7 +1809,7 @@ void Generator::augmentImageDirs(QSet<QString> &moreImageDirs)
if (moreImageDirs.isEmpty())
return;
for (const auto &it : moreImageDirs)
- imageDirs.append(it);
+ s_imageDirs.append(it);
}
/*!
@@ -1842,9 +1844,9 @@ QString Generator::outputPrefix(const Node *node)
{
// Prefix is applied to QML and JS types
if (node->isQmlType() || node->isQmlBasicType())
- return outputPrefixes[QLatin1String("QML")];
+ return s_outputPrefixes[QLatin1String("QML")];
if (node->isJsType() || node->isJsBasicType())
- return outputPrefixes[QLatin1String("JS")];
+ return s_outputPrefixes[QLatin1String("JS")];
return QString();
}
@@ -1853,9 +1855,9 @@ QString Generator::outputSuffix(const Node *node)
// Suffix is applied to QML and JS types, as
// well as module pages.
if (node->isQmlModule() || node->isQmlType() || node->isQmlBasicType())
- return outputSuffixes[QLatin1String("QML")];
+ return s_outputSuffixes[QLatin1String("QML")];
if (node->isJsModule() || node->isJsType() || node->isJsBasicType())
- return outputSuffixes[QLatin1String("JS")];
+ return s_outputSuffixes[QLatin1String("JS")];
return QString();
}
@@ -1962,7 +1964,7 @@ QString Generator::plainCode(const QString &markedCode)
void Generator::setImageFileExtensions(const QStringList &extensions)
{
- imgFileExts[format()] = extensions;
+ s_imgFileExts[format()] = extensions;
}
int Generator::skipAtoms(const Atom *atom, Atom::AtomType type) const
@@ -2042,17 +2044,17 @@ void Generator::supplementAlsoList(const Node *node, QList<Text> &alsoList)
void Generator::terminate()
{
- for (const auto &generator : qAsConst(generators)) {
- if (outputFormats.contains(generator->format()))
+ for (const auto &generator : qAsConst(s_generators)) {
+ if (s_outputFormats.contains(generator->format()))
generator->terminateGenerator();
}
- fmtLeftMaps.clear();
- fmtRightMaps.clear();
- imgFileExts.clear();
- imageFiles.clear();
- imageDirs.clear();
- outDir_.clear();
+ s_fmtLeftMaps.clear();
+ s_fmtRightMaps.clear();
+ s_imgFileExts.clear();
+ s_imageFiles.clear();
+ s_imageDirs.clear();
+ s_outDir.clear();
}
void Generator::terminateGenerator() {}
diff --git a/src/qdoc/generator.h b/src/qdoc/generator.h
index d69845fef..9ef8f29c6 100644
--- a/src/qdoc/generator.h
+++ b/src/qdoc/generator.h
@@ -80,21 +80,21 @@ public:
QString linkForExampleFile(const QString &path, const Node *parent,
const QString &fileExt = QString());
static QString exampleFileTitle(const ExampleNode *relative, const QString &fileName);
- static Generator *currentGenerator() { return currentGenerator_; }
+ static Generator *currentGenerator() { return s_currentGenerator; }
static Generator *generatorForFormat(const QString &format);
static void initialize();
- static const QString &outputDir() { return outDir_; }
- static const QString &outputSubdir() { return outSubdir_; }
+ static const QString &outputDir() { return s_outDir; }
+ static const QString &outputSubdir() { return s_outSubdir; }
static void terminate();
- static const QStringList &outputFileNames() { return outFileNames_; }
+ static const QStringList &outputFileNames() { return s_outFileNames; }
static void augmentImageDirs(QSet<QString> &moreImageDirs);
- static bool noLinkErrors() { return noLinkErrors_; }
- static bool autolinkErrors() { return autolinkErrors_; }
- static QString defaultModuleName() { return project_; }
- static void resetUseOutputSubdirs() { useOutputSubdirs_ = false; }
- static bool useOutputSubdirs() { return useOutputSubdirs_; }
- static void setQmlTypeContext(QmlTypeNode *t) { qmlTypeContext_ = t; }
- static QmlTypeNode *qmlTypeContext() { return qmlTypeContext_; }
+ static bool noLinkErrors() { return s_noLinkErrors; }
+ static bool autolinkErrors() { return s_autolinkErrors; }
+ static QString defaultModuleName() { return s_project; }
+ static void resetUseOutputSubdirs() { s_useOutputSubdirs = false; }
+ static bool useOutputSubdirs() { return s_useOutputSubdirs; }
+ static void setQmlTypeContext(QmlTypeNode *t) { s_qmlTypeContext = t; }
+ static QmlTypeNode *qmlTypeContext() { return s_qmlTypeContext; }
static QString cleanRef(const QString &ref);
static QString plainCode(const QString &markedCode);
virtual QString fileBase(const Node *node) const;
@@ -105,7 +105,7 @@ protected:
void endFilePage() { endSubPage(); } // for symmetry
void beginSubPage(const Node *node, const QString &fileName);
void endSubPage();
- virtual QString fileExtension() const = 0;
+ [[nodiscard]] virtual QString fileExtension() const = 0;
virtual void generateExampleFilePage(const Node *, const QString &, CodeMarker *) {}
virtual void generateAlsoList(const Node *node, CodeMarker *marker);
virtual qsizetype generateAtom(const Atom *, const Node *, CodeMarker *) { return 0; }
@@ -145,7 +145,11 @@ protected:
void generateSince(const Node *node, CodeMarker *marker);
void generateStatus(const Node *node, CodeMarker *marker);
virtual void generateAddendum(const Node *node, Addendum type, CodeMarker *marker,
- bool generateNote = true);
+ bool generateNote);
+ virtual void generateAddendum(const Node *node, Addendum type, CodeMarker *marker)
+ {
+ generateAddendum(node, type, marker, true);
+ };
void generateThreadSafeness(const Node *node, CodeMarker *marker);
QStringList getMetadataElements(const Aggregate *inner, const QString &t);
void generateOverloadedSignal(const Node *node, CodeMarker *marker);
@@ -179,27 +183,27 @@ protected:
static bool comparePaths(const QString &a, const QString &b) { return (a < b); }
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 QList<Generator *> generators;
- static QStringList imageDirs;
- static QStringList imageFiles;
- static QMap<QString, QStringList> imgFileExts;
- static QString project_;
- static QString outDir_;
- static QString outSubdir_;
- static QStringList outFileNames_;
- static QSet<QString> outputFormats;
- static QHash<QString, QString> outputPrefixes;
- static QHash<QString, QString> outputSuffixes;
- static bool noLinkErrors_;
- static bool autolinkErrors_;
- static bool redirectDocumentationToDevNull_;
- static bool useOutputSubdirs_;
- static QmlTypeNode *qmlTypeContext_;
+ static Generator *s_currentGenerator;
+ static QStringList s_exampleDirs;
+ static QStringList s_exampleImgExts;
+ static QMap<QString, QMap<QString, QString>> s_fmtLeftMaps;
+ static QMap<QString, QMap<QString, QString>> s_fmtRightMaps;
+ static QList<Generator *> s_generators;
+ static QStringList s_imageDirs;
+ static QStringList s_imageFiles;
+ static QMap<QString, QStringList> s_imgFileExts;
+ static QString s_project;
+ static QString s_outDir;
+ static QString s_outSubdir;
+ static QStringList s_outFileNames;
+ static QSet<QString> s_outputFormats;
+ static QHash<QString, QString> s_outputPrefixes;
+ static QHash<QString, QString> s_outputSuffixes;
+ static bool s_noLinkErrors;
+ static bool s_autolinkErrors;
+ static bool s_redirectDocumentationToDevNull;
+ static bool s_useOutputSubdirs;
+ static QmlTypeNode *s_qmlTypeContext;
void generateReimplementsClause(const FunctionNode *fn, CodeMarker *marker);
static void copyTemplateFiles(const QString &configVar, const QString &subDir);
diff --git a/src/qdoc/headernode.h b/src/qdoc/headernode.h
index bae57c8d5..83ba581ae 100644
--- a/src/qdoc/headernode.h
+++ b/src/qdoc/headernode.h
@@ -40,12 +40,12 @@ class HeaderNode : public Aggregate
{
public:
HeaderNode(Aggregate *parent, const QString &name);
- bool docMustBeGenerated() const override;
- bool isFirstClassAggregate() const override { return true; }
- bool isRelatableType() const override { return true; }
- QString title() const override { return (m_title.isEmpty() ? name() : m_title); }
- QString subtitle() const override { return m_subtitle; }
- QString fullTitle() const override
+ [[nodiscard]] bool docMustBeGenerated() const override;
+ [[nodiscard]] bool isFirstClassAggregate() const override { return true; }
+ [[nodiscard]] bool isRelatableType() const override { return true; }
+ [[nodiscard]] QString title() const override { return (m_title.isEmpty() ? name() : m_title); }
+ [[nodiscard]] QString subtitle() const override { return m_subtitle; }
+ [[nodiscard]] QString fullTitle() const override
{
return (m_title.isEmpty() ? name() : name() + " - " + m_title);
}
@@ -59,12 +59,12 @@ public:
m_subtitle = subtitle;
return true;
}
- QString nameForLists() const override { return title(); }
- bool hasDocumentedChildren() const;
+ [[nodiscard]] QString nameForLists() const override { return title(); }
+ [[nodiscard]] bool hasDocumentedChildren() const;
private:
- QString m_title;
- QString m_subtitle;
+ QString m_title {};
+ QString m_subtitle {};
};
QT_END_NAMESPACE
diff --git a/src/qdoc/helpprojectwriter.cpp b/src/qdoc/helpprojectwriter.cpp
index de54f0afd..447cb8264 100644
--- a/src/qdoc/helpprojectwriter.cpp
+++ b/src/qdoc/helpprojectwriter.cpp
@@ -54,41 +54,41 @@ HelpProjectWriter::HelpProjectWriter(const QString &defaultFileName, Generator *
void HelpProjectWriter::reset(const QString &defaultFileName, Generator *g)
{
- projects.clear();
- gen_ = g;
+ m_projects.clear();
+ m_gen = g;
/*
Get the pointer to the singleton for the qdoc database and
store it locally. This replaces all the local accesses to
the node tree, which are now private.
*/
- qdb_ = QDocDatabase::qdocDB();
+ m_qdb = QDocDatabase::qdocDB();
// The output directory should already have been checked by the calling
// generator.
Config &config = Config::instance();
- outputDir = config.getOutputDir();
+ m_outputDir = config.getOutputDir();
const QStringList names = config.getStringList(CONFIG_QHP + Config::dot + "projects");
for (const auto &projectName : names) {
HelpProject project;
- project.name = projectName;
+ project.m_name = projectName;
QString prefix = CONFIG_QHP + Config::dot + projectName + Config::dot;
- project.helpNamespace = config.getString(prefix + "namespace");
- project.virtualFolder = config.getString(prefix + "virtualFolder");
- project.version = config.getString(CONFIG_VERSION);
- project.fileName = config.getString(prefix + "file");
- if (project.fileName.isEmpty())
- project.fileName = defaultFileName;
- project.extraFiles = config.getStringSet(prefix + "extraFiles");
- project.extraFiles += config.getStringSet(CONFIG_QHP + Config::dot + "extraFiles");
- project.indexTitle = config.getString(prefix + "indexTitle");
- project.indexRoot = config.getString(prefix + "indexRoot");
+ project.m_helpNamespace = config.getString(prefix + "namespace");
+ project.m_virtualFolder = config.getString(prefix + "virtualFolder");
+ project.m_version = config.getString(CONFIG_VERSION);
+ project.m_fileName = config.getString(prefix + "file");
+ if (project.m_fileName.isEmpty())
+ project.m_fileName = defaultFileName;
+ project.m_extraFiles = config.getStringSet(prefix + "extraFiles");
+ project.m_extraFiles += config.getStringSet(CONFIG_QHP + Config::dot + "extraFiles");
+ project.m_indexTitle = config.getString(prefix + "indexTitle");
+ project.m_indexRoot = config.getString(prefix + "indexRoot");
const auto &filterAttributes = config.getStringList(prefix + "filterAttributes");
- project.filterAttributes =
+ project.m_filterAttributes =
QSet<QString>(filterAttributes.cbegin(), filterAttributes.cend());
- project.includeIndexNodes = config.getBool(prefix + "includeIndexNodes");
+ project.m_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
@@ -96,34 +96,34 @@ void HelpProjectWriter::reset(const QString &defaultFileName, Generator *g)
const auto &filters =
config.getStringList(prefix + "customFilters" + Config::dot + filterName
+ Config::dot + "filterAttributes");
- project.customFilters[name] = QSet<QString>(filters.cbegin(), filters.cend());
+ project.m_customFilters[name] = QSet<QString>(filters.cbegin(), filters.cend());
}
const auto excludedPrefixes = config.getStringSet(prefix + "excluded");
for (auto name : excludedPrefixes)
- project.excluded.insert(name.replace(QLatin1Char('\\'), QLatin1Char('/')));
+ project.m_excluded.insert(name.replace(QLatin1Char('\\'), QLatin1Char('/')));
const auto subprojectPrefixes = config.getStringList(prefix + "subprojects");
for (const auto &name : subprojectPrefixes) {
SubProject subproject;
QString subprefix = prefix + "subprojects" + Config::dot + name + Config::dot;
- subproject.title = config.getString(subprefix + "title");
- if (subproject.title.isEmpty())
+ subproject.m_title = config.getString(subprefix + "title");
+ if (subproject.m_title.isEmpty())
continue;
- subproject.indexTitle = config.getString(subprefix + "indexTitle");
- subproject.sortPages = config.getBool(subprefix + "sortPages");
- subproject.type = config.getString(subprefix + "type");
+ subproject.m_indexTitle = config.getString(subprefix + "indexTitle");
+ subproject.m_sortPages = config.getBool(subprefix + "sortPages");
+ subproject.m_type = config.getString(subprefix + "type");
readSelectors(subproject, config.getStringList(subprefix + "selectors"));
- project.subprojects.append(subproject);
+ project.m_subprojects.append(subproject);
}
- if (project.subprojects.isEmpty()) {
+ if (project.m_subprojects.isEmpty()) {
SubProject subproject;
readSelectors(subproject, config.getStringList(prefix + "selectors"));
- project.subprojects.insert(0, subproject);
+ project.m_subprojects.insert(0, subproject);
}
- projects.append(project);
+ m_projects.append(project);
}
}
@@ -167,7 +167,7 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList
if (!typeHash.contains(typeName))
continue;
- subproject.selectors << typeHash.value(typeName);
+ subproject.m_selectors << typeHash.value(typeName);
if (!pieces.isEmpty()) {
pieces = pieces[0].split(QLatin1Char(','));
for (const auto &piece : qAsConst(pieces)) {
@@ -175,7 +175,7 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList
|| typeHash[typeName] == Node::Module
|| typeHash[typeName] == Node::QmlModule
|| typeHash[typeName] == Node::JsModule) {
- subproject.groups << piece.toLower();
+ subproject.m_groups << piece.toLower();
}
}
}
@@ -184,13 +184,13 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList
void HelpProjectWriter::addExtraFile(const QString &file)
{
- for (HelpProject &project : projects)
- project.extraFiles.insert(file);
+ for (HelpProject &project : m_projects)
+ project.m_extraFiles.insert(file);
}
Keyword HelpProjectWriter::keywordDetails(const Node *node) const
{
- QString ref = gen_->fullDocumentLocation(node, false);
+ QString ref = m_gen->fullDocumentLocation(node, false);
if (node->parent() && !node->parent()->name().isEmpty()) {
QString name = (node->isEnumType() || node->isTypedef())
@@ -224,7 +224,7 @@ Keyword HelpProjectWriter::keywordDetails(const Node *node) const
bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter & /* writer */,
const Node *node)
{
- if (!node->url().isEmpty() && !(project.includeIndexNodes && !node->url().startsWith("http")))
+ if (!node->url().isEmpty() && !(project.m_includeIndexNodes && !node->url().startsWith("http")))
return false;
if (node->isPrivate() || node->isInternal() || node->isDontDocument())
@@ -234,22 +234,22 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
return true;
QString docPath = node->doc().location().filePath();
- if (!docPath.isEmpty() && project.excluded.contains(docPath))
+ if (!docPath.isEmpty() && project.m_excluded.contains(docPath))
return false;
QString objName = node->isTextPageNode() ? node->fullTitle() : node->fullDocumentName();
// Only add nodes to the set for each subproject if they match a selector.
// Those that match will be listed in the table of contents.
- for (int i = 0; i < project.subprojects.length(); i++) {
- SubProject subproject = project.subprojects[i];
+ for (int i = 0; i < project.m_subprojects.length(); i++) {
+ SubProject subproject = project.m_subprojects[i];
// No selectors: accept all nodes.
- if (subproject.selectors.isEmpty()) {
- project.subprojects[i].nodes[objName] = node;
- } else if (subproject.selectors.contains(node->nodeType())) {
+ if (subproject.m_selectors.isEmpty()) {
+ project.m_subprojects[i].m_nodes[objName] = node;
+ } else if (subproject.m_selectors.contains(node->nodeType())) {
// Add all group members for '[group|module|qmlmodule]:name' selector
if (node->isCollectionNode()) {
- if (project.subprojects[i].groups.contains(node->name().toLower())) {
+ if (project.m_subprojects[i].m_groups.contains(node->name().toLower())) {
const auto *cn = static_cast<const CollectionNode *>(node);
const auto members = cn->members();
for (const Node *m : members) {
@@ -257,17 +257,17 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
continue;
QString memberName =
m->isTextPageNode() ? m->fullTitle() : m->fullDocumentName();
- project.subprojects[i].nodes[memberName] = m;
+ project.m_subprojects[i].m_nodes[memberName] = m;
}
continue;
- } else if (!project.subprojects[i].groups.isEmpty()) {
+ } else if (!project.m_subprojects[i].m_groups.isEmpty()) {
continue; // Node does not represent specified group(s)
}
} else if (node->isTextPageNode()) {
if (node->isExternalPage() || node->fullTitle().isEmpty())
continue;
}
- project.subprojects[i].nodes[objName] = node;
+ project.m_subprojects[i].m_nodes[objName] = node;
}
}
@@ -276,7 +276,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
case Node::Class:
case Node::Struct:
case Node::Union:
- project.keywords.append(keywordDetails(node));
+ project.m_keywords.append(keywordDetails(node));
break;
case Node::QmlType:
case Node::QmlBasicType:
@@ -286,25 +286,24 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
const auto keywords = node->doc().keywords();
for (const Atom *keyword : keywords) {
if (!keyword->string().isEmpty()) {
- project.keywords.append(Keyword(keyword->string(),
- keyword->string(),
- gen_->fullDocumentLocation(node, false)));
+ project.m_keywords.append(Keyword(keyword->string(), keyword->string(),
+ m_gen->fullDocumentLocation(node, false)));
}
else
node->doc().location().warning(
QStringLiteral("Bad keyword in %1")
- .arg(gen_->fullDocumentLocation(node, false)));
+ .arg(m_gen->fullDocumentLocation(node, false)));
}
}
- project.keywords.append(keywordDetails(node));
+ project.m_keywords.append(keywordDetails(node));
break;
case Node::Namespace:
- project.keywords.append(keywordDetails(node));
+ project.m_keywords.append(keywordDetails(node));
break;
case Node::Enum:
- project.keywords.append(keywordDetails(node));
+ project.m_keywords.append(keywordDetails(node));
{
const auto *enumNode = static_cast<const EnumNode *>(node);
const auto items = enumNode->items();
@@ -319,8 +318,8 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
} else {
name = id = item.name();
}
- QString ref = gen_->fullDocumentLocation(node, false);
- project.keywords.append(Keyword(name, id, ref));
+ QString ref = m_gen->fullDocumentLocation(node, false);
+ project.m_keywords.append(Keyword(name, id, ref));
}
}
break;
@@ -335,23 +334,23 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
const auto keywords = cn->doc().keywords();
for (const Atom *keyword : keywords) {
if (!keyword->string().isEmpty()) {
- project.keywords.append(Keyword(keyword->string(),
- keyword->string(),
- gen_->fullDocumentLocation(node, false)));
+ project.m_keywords.append(
+ Keyword(keyword->string(), keyword->string(),
+ m_gen->fullDocumentLocation(node, false)));
} else
cn->doc().location().warning(
QStringLiteral("Bad keyword in %1")
- .arg(gen_->fullDocumentLocation(node, false)));
+ .arg(m_gen->fullDocumentLocation(node, false)));
}
}
- project.keywords.append(keywordDetails(node));
+ project.m_keywords.append(keywordDetails(node));
}
} break;
case Node::Property:
case Node::QmlProperty:
case Node::JsProperty:
- project.keywords.append(keywordDetails(node));
+ project.m_keywords.append(keywordDetails(node));
break;
case Node::Function: {
@@ -365,14 +364,14 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
because we already know it is NodeType::Function.
*/
if (funcNode->isQmlNode() || funcNode->isJsNode()) {
- project.keywords.append(keywordDetails(node));
+ project.m_keywords.append(keywordDetails(node));
break;
}
// Only insert keywords for non-constructors. Constructors are covered
// by the classes themselves.
if (!funcNode->isSomeCtor())
- project.keywords.append(keywordDetails(node));
+ project.m_keywords.append(keywordDetails(node));
// Insert member status flags into the entries for the parent
// node of the function, or the node it is related to.
@@ -381,7 +380,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
// are inserted.
if (node->parent())
- project.memberStatus[node->parent()].insert(node->status());
+ project.m_memberStatus[node->parent()].insert(node->status());
} break;
case Node::TypeAlias:
case Node::Typedef: {
@@ -391,13 +390,13 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
// Use the location of any associated enum node in preference
// to that of the typedef.
if (enumNode)
- typedefDetails.ref = gen_->fullDocumentLocation(enumNode, false);
+ typedefDetails.m_ref = m_gen->fullDocumentLocation(enumNode, false);
- project.keywords.append(typedefDetails);
+ project.m_keywords.append(typedefDetails);
} break;
case Node::Variable: {
- project.keywords.append(keywordDetails(node));
+ project.m_keywords.append(keywordDetails(node));
} break;
// Page nodes (such as manual pages) contain subtypes, titles and other
@@ -409,16 +408,16 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
const auto keywords = pn->doc().keywords();
for (const Atom *keyword : keywords) {
if (!keyword->string().isEmpty()) {
- project.keywords.append(Keyword(keyword->string(),
- keyword->string(),
- gen_->fullDocumentLocation(node, false)));
+ project.m_keywords.append(
+ Keyword(keyword->string(), keyword->string(),
+ m_gen->fullDocumentLocation(node, false)));
} else {
- QString loc = gen_->fullDocumentLocation(node, false);
+ QString loc = m_gen->fullDocumentLocation(node, false);
pn->doc().location().warning(QStringLiteral("Bad keyword in %1").arg(loc));
}
}
}
- project.keywords.append(keywordDetails(node));
+ project.m_keywords.append(keywordDetails(node));
}
break;
}
@@ -432,7 +431,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
// Images are all placed within a single directory regardless of
// whether the source images are in a nested directory structure.
QStringList pieces = atom->string().split(QLatin1Char('/'));
- project.files.insert("images/" + pieces.last());
+ project.m_files.insert("images/" + pieces.last());
}
atom = atom->next();
}
@@ -467,7 +466,7 @@ void HelpProjectWriter::generateSections(HelpProject &project, QXmlStreamWriter
childSet << child;
} else {
// Store member status of children
- project.memberStatus[node].insert(child->status());
+ project.m_memberStatus[node].insert(child->status());
if (child->isFunction() && static_cast<const FunctionNode *>(child)->isOverload())
continue;
childSet << child;
@@ -480,7 +479,7 @@ void HelpProjectWriter::generateSections(HelpProject &project, QXmlStreamWriter
void HelpProjectWriter::generate()
{
- for (HelpProject &project : projects)
+ for (HelpProject &project : m_projects)
generateProject(project);
}
@@ -514,7 +513,7 @@ void HelpProjectWriter::addMembers(HelpProject &project, QXmlStreamWriter &write
if (node->isQmlBasicType() || node->isJsBasicType())
return;
- QString href = gen_->fullDocumentLocation(node, false);
+ QString href = m_gen->fullDocumentLocation(node, false);
href = href.left(href.size() - 5);
if (href.isEmpty())
return;
@@ -527,11 +526,11 @@ void HelpProjectWriter::addMembers(HelpProject &project, QXmlStreamWriter &write
// but always generate it for derived classes and QML classes
if (!node->isNamespace() && !node->isHeader()
&& (derivedClass || node->isQmlType() || node->isJsType()
- || !project.memberStatus[node].isEmpty())) {
+ || !project.m_memberStatus[node].isEmpty())) {
QString membersPath = href + QStringLiteral("-members.html");
writeSection(writer, membersPath, QStringLiteral("List of all members"));
}
- if (project.memberStatus[node].contains(Node::Deprecated)) {
+ if (project.m_memberStatus[node].contains(Node::Deprecated)) {
QString obsoletePath = href + QStringLiteral("-obsolete.html");
writeSection(writer, obsoletePath, QStringLiteral("Obsolete members"));
}
@@ -539,7 +538,7 @@ void HelpProjectWriter::addMembers(HelpProject &project, QXmlStreamWriter &write
void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer, const Node *node)
{
- QString href = gen_->fullDocumentLocation(node, false);
+ QString href = m_gen->fullDocumentLocation(node, false);
QString objName = node->name();
switch (node->nodeType()) {
@@ -551,7 +550,7 @@ void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer
case Node::JsType:
case Node::QmlBasicType:
case Node::JsBasicType: {
- QString typeStr = gen_->typeString(node);
+ QString typeStr = m_gen->typeString(node);
if (!typeStr.isEmpty())
typeStr[0] = typeStr[0].toTitleCase();
writer.writeStartElement("section");
@@ -594,21 +593,21 @@ void HelpProjectWriter::generateProject(HelpProject &project)
const Node *rootNode;
// Restrict searching only to the local (primary) tree
- QList<Tree *> searchOrder = qdb_->searchOrder();
- qdb_->setLocalSearch();
+ QList<Tree *> searchOrder = m_qdb->searchOrder();
+ m_qdb->setLocalSearch();
- if (!project.indexRoot.isEmpty())
- rootNode = qdb_->findPageNodeByTitle(project.indexRoot);
+ if (!project.m_indexRoot.isEmpty())
+ rootNode = m_qdb->findPageNodeByTitle(project.m_indexRoot);
else
- rootNode = qdb_->primaryTreeRoot();
+ rootNode = m_qdb->primaryTreeRoot();
if (rootNode == nullptr)
return;
- project.files.clear();
- project.keywords.clear();
+ project.m_files.clear();
+ project.m_keywords.clear();
- QFile file(outputDir + QDir::separator() + project.fileName);
+ QFile file(m_outputDir + QDir::separator() + project.m_fileName);
if (!file.open(QFile::WriteOnly | QFile::Text))
return;
@@ -619,15 +618,15 @@ void HelpProjectWriter::generateProject(HelpProject &project)
writer.writeAttribute("version", "1.0");
// Write metaData, virtualFolder and namespace elements.
- writer.writeTextElement("namespace", project.helpNamespace);
- writer.writeTextElement("virtualFolder", project.virtualFolder);
+ writer.writeTextElement("namespace", project.m_helpNamespace);
+ writer.writeTextElement("virtualFolder", project.m_virtualFolder);
writer.writeStartElement("metaData");
writer.writeAttribute("name", "version");
- writer.writeAttribute("value", project.version);
+ writer.writeAttribute("value", project.m_version);
writer.writeEndElement();
// Write customFilter elements.
- for (auto it = project.customFilters.constBegin(); it != project.customFilters.constEnd();
+ for (auto it = project.m_customFilters.constBegin(); it != project.m_customFilters.constEnd();
++it) {
writer.writeStartElement("customFilter");
writer.writeAttribute("name", it.key());
@@ -642,34 +641,34 @@ void HelpProjectWriter::generateProject(HelpProject &project)
writer.writeStartElement("filterSection");
// Write filterAttribute elements.
- QStringList sortedFilterAttributes = project.filterAttributes.values();
+ QStringList sortedFilterAttributes = project.m_filterAttributes.values();
sortedFilterAttributes.sort();
for (const auto &filterName : qAsConst(sortedFilterAttributes))
writer.writeTextElement("filterAttribute", filterName);
writer.writeStartElement("toc");
writer.writeStartElement("section");
- const Node *node = qdb_->findPageNodeByTitle(project.indexTitle);
+ const Node *node = m_qdb->findPageNodeByTitle(project.m_indexTitle);
if (!node)
- node = qdb_->findNodeByNameAndType(QStringList(project.indexTitle), &Node::isPageNode);
+ node = m_qdb->findNodeByNameAndType(QStringList(project.m_indexTitle), &Node::isPageNode);
if (!node)
- node = qdb_->findNodeByNameAndType(QStringList("index.html"), &Node::isPageNode);
+ node = m_qdb->findNodeByNameAndType(QStringList("index.html"), &Node::isPageNode);
QString indexPath;
if (node)
- indexPath = gen_->fullDocumentLocation(node, false);
+ indexPath = m_gen->fullDocumentLocation(node, false);
else
indexPath = "index.html";
writer.writeAttribute("ref", indexPath);
- writer.writeAttribute("title", project.indexTitle);
+ writer.writeAttribute("title", project.m_indexTitle);
generateSections(project, writer, rootNode);
- for (int i = 0; i < project.subprojects.length(); i++) {
- SubProject subproject = project.subprojects[i];
+ for (int i = 0; i < project.m_subprojects.length(); i++) {
+ SubProject subproject = project.m_subprojects[i];
- if (subproject.type == QLatin1String("manual")) {
+ if (subproject.m_type == QLatin1String("manual")) {
- const Node *indexPage = qdb_->findNodeForTarget(subproject.indexTitle, nullptr);
+ const Node *indexPage = m_qdb->findNodeForTarget(subproject.m_indexTitle, nullptr);
if (indexPage) {
Text indexBody = indexPage->doc().body();
const Atom *atom = indexBody.firstAtom();
@@ -696,9 +695,9 @@ void HelpProjectWriter::generateProject(HelpProject &project)
if (sectionStack.top() > 0)
writer.writeEndElement(); // section
- const Node *page = qdb_->findNodeForTarget(atom->string(), nullptr);
+ const Node *page = m_qdb->findNodeForTarget(atom->string(), nullptr);
writer.writeStartElement("section");
- QString indexPath = gen_->fullDocumentLocation(page, false);
+ QString indexPath = m_gen->fullDocumentLocation(page, false);
writer.writeAttribute("ref", indexPath);
writer.writeAttribute("title", atom->linkText());
@@ -714,32 +713,32 @@ void HelpProjectWriter::generateProject(HelpProject &project)
}
} else
rootNode->doc().location().warning(
- QStringLiteral("Failed to find index: %1").arg(subproject.indexTitle));
+ QStringLiteral("Failed to find index: %1").arg(subproject.m_indexTitle));
} else {
writer.writeStartElement("section");
- QString indexPath = gen_->fullDocumentLocation(
- qdb_->findNodeForTarget(subproject.indexTitle, nullptr), false);
+ QString indexPath = m_gen->fullDocumentLocation(
+ m_qdb->findNodeForTarget(subproject.m_indexTitle, nullptr), false);
writer.writeAttribute("ref", indexPath);
- writer.writeAttribute("title", subproject.title);
+ writer.writeAttribute("title", subproject.m_title);
- if (subproject.sortPages) {
- QStringList titles = subproject.nodes.keys();
+ if (subproject.m_sortPages) {
+ QStringList titles = subproject.m_nodes.keys();
titles.sort();
for (const auto &title : qAsConst(titles)) {
- writeNode(project, writer, subproject.nodes[title]);
+ writeNode(project, writer, subproject.m_nodes[title]);
}
} else {
// Find a contents node and navigate from there, using the NextLink values.
QSet<QString> visited;
bool contentsFound = false;
- for (const auto *node : qAsConst(subproject.nodes)) {
+ for (const auto *node : qAsConst(subproject.m_nodes)) {
QString nextTitle = node->links().value(Node::NextLink).first;
if (!nextTitle.isEmpty()
&& node->links().value(Node::ContentsLink).first.isEmpty()) {
- const Node *nextPage = qdb_->findNodeForTarget(nextTitle, nullptr);
+ const Node *nextPage = m_qdb->findNodeForTarget(nextTitle, nullptr);
// Write the contents node.
writeNode(project, writer, node);
@@ -750,7 +749,7 @@ void HelpProjectWriter::generateProject(HelpProject &project)
nextTitle = nextPage->links().value(Node::NextLink).first;
if (nextTitle.isEmpty() || visited.contains(nextTitle))
break;
- nextPage = qdb_->findNodeForTarget(nextTitle, nullptr);
+ nextPage = m_qdb->findNodeForTarget(nextTitle, nullptr);
visited.insert(nextTitle);
}
break;
@@ -758,7 +757,7 @@ void HelpProjectWriter::generateProject(HelpProject &project)
}
// No contents/nextpage links found, write all nodes unsorted
if (!contentsFound) {
- QList<const Node *> subnodes = subproject.nodes.values();
+ QList<const Node *> subnodes = subproject.m_nodes.values();
std::sort(subnodes.begin(), subnodes.end(), Node::nodeNameLessThan);
@@ -772,19 +771,19 @@ void HelpProjectWriter::generateProject(HelpProject &project)
}
// Restore original search order
- qdb_->setSearchOrder(searchOrder);
+ m_qdb->setSearchOrder(searchOrder);
writer.writeEndElement(); // section
writer.writeEndElement(); // toc
writer.writeStartElement("keywords");
- std::sort(project.keywords.begin(), project.keywords.end());
- for (const auto &k : qAsConst(project.keywords)) {
- for (const auto &id : qAsConst(k.ids)) {
+ std::sort(project.m_keywords.begin(), project.m_keywords.end());
+ for (const auto &k : qAsConst(project.m_keywords)) {
+ for (const auto &id : qAsConst(k.m_ids)) {
writer.writeStartElement("keyword");
- writer.writeAttribute("name", k.name);
+ writer.writeAttribute("name", k.m_name);
writer.writeAttribute("id", id);
- writer.writeAttribute("ref", k.ref);
+ writer.writeAttribute("ref", k.m_ref);
writer.writeEndElement(); //keyword
}
}
@@ -795,9 +794,9 @@ 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());
- files.unite(project.files);
- files.unite(project.extraFiles);
+ QSet<QString>(m_gen->outputFileNames().cbegin(), m_gen->outputFileNames().cend());
+ files.unite(project.m_files);
+ files.unite(project.m_extraFiles);
QStringList sortedFiles = files.values();
sortedFiles.sort();
for (const auto &usedFile : qAsConst(sortedFiles)) {
diff --git a/src/qdoc/helpprojectwriter.h b/src/qdoc/helpprojectwriter.h
index 691c21608..caf0f8065 100644
--- a/src/qdoc/helpprojectwriter.h
+++ b/src/qdoc/helpprojectwriter.h
@@ -34,23 +34,24 @@
#include <QtCore/qstring.h>
#include <QtCore/qxmlstream.h>
+#include <utility>
+
QT_BEGIN_NAMESPACE
class QDocDatabase;
class Generator;
-typedef QPair<QString, const Node *> QStringNodePair;
using NodeTypeSet = QSet<unsigned char>;
struct SubProject
{
- QString title;
- QString indexTitle;
- NodeTypeSet selectors;
- bool sortPages;
- QString type;
- QHash<QString, const Node *> nodes;
- QStringList groups;
+ QString m_title {};
+ QString m_indexTitle {};
+ NodeTypeSet m_selectors {};
+ bool m_sortPages {};
+ QString m_type {};
+ QHash<QString, const Node *> m_nodes {};
+ QStringList m_groups {};
};
/*
@@ -59,15 +60,21 @@ struct SubProject
* Ref is the location of the documentation for the keyword.
*/
struct Keyword {
- QString name;
- QStringList ids;
- QString ref;
- Keyword(QString name, QString id, QString ref) : name(name), ids(QStringList(id)), ref(ref) {}
- Keyword(QString name, QStringList ids, QString ref) : name(name), ids(ids), ref(ref) {}
+ QString m_name {};
+ QStringList m_ids {};
+ QString m_ref {};
+ Keyword(QString name, const QString &id, QString ref)
+ : m_name(std::move(name)), m_ids(QStringList(id)), m_ref(std::move(ref))
+ {
+ }
+ Keyword(QString name, QStringList ids, QString ref)
+ : m_name(std::move(name)), m_ids(std::move(ids)), m_ref(std::move(ref))
+ {
+ }
bool operator<(const Keyword &o) const
{
// Order by name; use ref as a secondary sort key
- return (name == o.name) ? ref < o.ref : name < o.name;
+ return (m_name == o.m_name) ? m_ref < o.m_ref : m_name < o.m_name;
}
};
@@ -75,22 +82,22 @@ struct HelpProject
{
using NodeStatusSet = QSet<unsigned char>;
- QString name;
- QString helpNamespace;
- QString virtualFolder;
- QString version;
- QString fileName;
- QString indexRoot;
- QString indexTitle;
- QList<Keyword> keywords;
- QSet<QString> files;
- QSet<QString> extraFiles;
- QSet<QString> filterAttributes;
- QHash<QString, QSet<QString>> customFilters;
- QSet<QString> excluded;
- QList<SubProject> subprojects;
- QHash<const Node *, NodeStatusSet> memberStatus;
- bool includeIndexNodes;
+ QString m_name {};
+ QString m_helpNamespace {};
+ QString m_virtualFolder {};
+ QString m_version {};
+ QString m_fileName {};
+ QString m_indexRoot {};
+ QString m_indexTitle {};
+ QList<Keyword> m_keywords {};
+ QSet<QString> m_files {};
+ QSet<QString> m_extraFiles {};
+ QSet<QString> m_filterAttributes {};
+ QHash<QString, QSet<QString>> m_customFilters {};
+ QSet<QString> m_excluded {};
+ QList<SubProject> m_subprojects {};
+ QHash<const Node *, NodeStatusSet> m_memberStatus {};
+ bool m_includeIndexNodes {};
};
@@ -113,11 +120,11 @@ private:
void addMembers(HelpProject &project, QXmlStreamWriter &writer, const Node *node);
void writeSection(QXmlStreamWriter &writer, const QString &path, const QString &value);
- QDocDatabase *qdb_ {};
- Generator *gen_ {};
+ QDocDatabase *m_qdb {};
+ Generator *m_gen {};
- QString outputDir;
- QList<HelpProject> projects;
+ QString m_outputDir {};
+ QList<HelpProject> m_projects {};
};
QT_END_NAMESPACE
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index d7ae96ef8..e21174430 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -58,8 +58,6 @@
QT_BEGIN_NAMESPACE
-int HtmlGenerator::id = 0;
-
static bool showBrokenLinks = false;
static void addLink(const QString &linkTarget, QStringView nestedStuff, QString *res)
diff --git a/src/qdoc/htmlgenerator.h b/src/qdoc/htmlgenerator.h
index ca75a77b6..fa2bd4988 100644
--- a/src/qdoc/htmlgenerator.h
+++ b/src/qdoc/htmlgenerator.h
@@ -68,7 +68,7 @@ protected:
void generatePageNode(PageNode *pn, CodeMarker *marker) override;
void generateCollectionNode(CollectionNode *cn, CodeMarker *marker) override;
void generateGenericCollectionPage(CollectionNode *cn, CodeMarker *marker) override;
- QString fileExtension() const override;
+ [[nodiscard]] QString fileExtension() const override;
private:
enum SubTitleSize { SmallSubTitle, LargeSubTitle };
@@ -167,7 +167,6 @@ private:
QString m_projectUrl {};
QString m_navigationLinks {};
QString m_navigationSeparator {};
- static int id;
QString m_homepage {};
QString m_hometitle {};
QString m_landingpage {};
diff --git a/src/qdoc/importrec.h b/src/qdoc/importrec.h
index e120ce41e..aae89d0a6 100644
--- a/src/qdoc/importrec.h
+++ b/src/qdoc/importrec.h
@@ -38,9 +38,9 @@ QT_BEGIN_NAMESPACE
struct ImportRec
{
- QString m_moduleName;
- QString m_majorMinorVersion;
- QString m_importUri; // subdirectory of module directory
+ QString m_moduleName {};
+ QString m_majorMinorVersion {};
+ QString m_importUri {}; // subdirectory of module directory
ImportRec(QString name, QString version, QString importUri)
: m_moduleName(std::move(name)),
@@ -50,7 +50,7 @@ struct ImportRec
}
QString &name() { return m_moduleName; }
QString &version() { return m_majorMinorVersion; }
- bool isEmpty() const { return m_moduleName.isEmpty(); }
+ [[nodiscard]] bool isEmpty() const { return m_moduleName.isEmpty(); }
};
QT_END_NAMESPACE
diff --git a/src/qdoc/jscodemarker.h b/src/qdoc/jscodemarker.h
index dbf6523a7..6f74753f8 100644
--- a/src/qdoc/jscodemarker.h
+++ b/src/qdoc/jscodemarker.h
@@ -42,7 +42,7 @@ public:
bool recognizeCode(const QString &code) override;
bool recognizeExtension(const QString &ext) override;
bool recognizeLanguage(const QString &language) override;
- Atom::AtomType atomType() const override;
+ [[nodiscard]] Atom::AtomType atomType() const override;
QString markedUpCode(const QString &code, const Node *relative,
const Location &location) override;
diff --git a/src/qdoc/location.cpp b/src/qdoc/location.cpp
index e9118cf08..ea0ed4cd4 100644
--- a/src/qdoc/location.cpp
+++ b/src/qdoc/location.cpp
@@ -40,12 +40,12 @@
QT_BEGIN_NAMESPACE
-int Location::tabSize;
-int Location::warningCount = 0;
-int Location::warningLimit = -1;
-QString Location::programName;
-QString Location::project;
-QRegularExpression *Location::spuriousRegExp = nullptr;
+int Location::s_tabSize;
+int Location::s_warningCount = 0;
+int Location::s_warningLimit = -1;
+QString Location::s_programName;
+QString Location::s_project;
+QRegularExpression *Location::s_spuriousRegExp = nullptr;
/*!
\class Location
@@ -61,7 +61,7 @@ QRegularExpression *Location::spuriousRegExp = nullptr;
/*!
Constructs an empty location.
*/
-Location::Location() : stk(nullptr), stkTop(&stkBottom), stkDepth(0), etcetera(false)
+Location::Location() : m_stk(nullptr), m_stkTop(&m_stkBottom), m_stkDepth(0), m_etc(false)
{
// nothing.
}
@@ -71,7 +71,7 @@ Location::Location() : stk(nullptr), stkTop(&stkBottom), stkDepth(0), etcetera(f
position stack.
*/
Location::Location(const QString &fileName)
- : stk(nullptr), stkTop(&stkBottom), stkDepth(0), etcetera(false)
+ : m_stk(nullptr), m_stkTop(&m_stkBottom), m_stkDepth(0), m_etc(false)
{
push(fileName);
}
@@ -81,7 +81,7 @@ Location::Location(const QString &fileName)
this Location using the assignment operator.
*/
Location::Location(const Location &other)
- : stk(nullptr), stkTop(&stkBottom), stkDepth(0), etcetera(false)
+ : m_stk(nullptr), m_stkTop(&m_stkBottom), m_stkDepth(0), m_etc(false)
{
*this = other;
}
@@ -92,18 +92,18 @@ Location::Location(const Location &other)
*/
Location &Location::operator=(const Location &other)
{
- QStack<StackEntry> *oldStk = stk;
+ QStack<StackEntry> *oldStk = m_stk;
- stkBottom = other.stkBottom;
- if (other.stk == nullptr) {
- stk = nullptr;
- stkTop = &stkBottom;
+ m_stkBottom = other.m_stkBottom;
+ if (other.m_stk == nullptr) {
+ m_stk = nullptr;
+ m_stkTop = &m_stkBottom;
} else {
- stk = new QStack<StackEntry>(*other.stk);
- stkTop = &stk->top();
+ m_stk = new QStack<StackEntry>(*other.m_stk);
+ m_stkTop = &m_stk->top();
}
- stkDepth = other.stkDepth;
- etcetera = other.etcetera;
+ m_stkDepth = other.m_stkDepth;
+ m_etc = other.m_etc;
delete oldStk;
return *this;
}
@@ -115,9 +115,9 @@ Location &Location::operator=(const Location &other)
*/
void Location::start()
{
- if (stkTop->lineNo < 1) {
- stkTop->lineNo = 1;
- stkTop->columnNo = 1;
+ if (m_stkTop->m_lineNo < 1) {
+ m_stkTop->m_lineNo = 1;
+ m_stkTop->m_columnNo = 1;
}
}
@@ -132,12 +132,12 @@ void Location::start()
void Location::advance(QChar ch)
{
if (ch == QLatin1Char('\n')) {
- stkTop->lineNo++;
- stkTop->columnNo = 1;
+ m_stkTop->m_lineNo++;
+ m_stkTop->m_columnNo = 1;
} else if (ch == QLatin1Char('\t')) {
- stkTop->columnNo = 1 + tabSize * (stkTop->columnNo + tabSize - 1) / tabSize;
+ m_stkTop->m_columnNo = 1 + s_tabSize * (m_stkTop->m_columnNo + s_tabSize - 1) / s_tabSize;
} else {
- stkTop->columnNo++;
+ m_stkTop->m_columnNo++;
}
}
@@ -149,16 +149,16 @@ void Location::advance(QChar ch)
*/
void Location::push(const QString &filePath)
{
- if (stkDepth++ >= 1) {
- if (stk == nullptr)
- stk = new QStack<StackEntry>;
- stk->push(StackEntry());
- stkTop = &stk->top();
+ if (m_stkDepth++ >= 1) {
+ if (m_stk == nullptr)
+ m_stk = new QStack<StackEntry>;
+ m_stk->push(StackEntry());
+ m_stkTop = &m_stk->top();
}
- stkTop->filePath = filePath;
- stkTop->lineNo = INT_MIN;
- stkTop->columnNo = 1;
+ m_stkTop->m_filePath = filePath;
+ m_stkTop->m_lineNo = INT_MIN;
+ m_stkTop->m_columnNo = 1;
}
/*!
@@ -169,16 +169,16 @@ void Location::push(const QString &filePath)
*/
void Location::pop()
{
- if (--stkDepth == 0) {
- stkBottom = StackEntry();
+ if (--m_stkDepth == 0) {
+ m_stkBottom = StackEntry();
} else {
- stk->pop();
- if (stk->isEmpty()) {
- delete stk;
- stk = nullptr;
- stkTop = &stkBottom;
+ m_stk->pop();
+ if (m_stk->isEmpty()) {
+ delete m_stk;
+ m_stk = nullptr;
+ m_stkTop = &m_stkBottom;
} else {
- stkTop = &stk->top();
+ m_stkTop = &m_stk->top();
}
}
}
@@ -262,15 +262,16 @@ void Location::error(const QString &message, const QString &details) const
*/
int Location::exitCode()
{
- if (warningLimit < 0 || warningCount <= warningLimit)
+ if (s_warningLimit < 0 || s_warningCount <= s_warningLimit)
return EXIT_SUCCESS;
Location().emitMessage(
Error,
QStringLiteral("Documentation warnings (%1) exceeded the limit (%2) for '%3'.")
- .arg(QString::number(warningCount), QString::number(warningLimit), project),
+ .arg(QString::number(s_warningCount), QString::number(s_warningLimit),
+ s_project),
QString());
- return warningCount;
+ return s_warningCount;
}
/*!
@@ -305,18 +306,18 @@ void Location::report(const QString &message, const QString &details) const
void Location::initialize()
{
Config &config = Config::instance();
- tabSize = config.getInt(CONFIG_TABSIZE);
- programName = config.programName();
- project = config.getString(CONFIG_PROJECT);
+ s_tabSize = config.getInt(CONFIG_TABSIZE);
+ s_programName = config.programName();
+ s_project = config.getString(CONFIG_PROJECT);
if (!config.singleExec())
- warningCount = 0;
+ s_warningCount = 0;
if (qEnvironmentVariableIsSet("QDOC_ENABLE_WARNINGLIMIT")
|| config.getBool(CONFIG_WARNINGLIMIT + Config::dot + "enabled"))
- warningLimit = config.getInt(CONFIG_WARNINGLIMIT);
+ s_warningLimit = config.getInt(CONFIG_WARNINGLIMIT);
QRegularExpression regExp = config.getRegExp(CONFIG_SPURIOUS);
if (regExp.isValid()) {
- spuriousRegExp = new QRegularExpression(regExp);
+ s_spuriousRegExp = new QRegularExpression(regExp);
} else {
config.lastLocation().warning(
QStringLiteral("Invalid regular expression '%1'").arg(regExp.pattern()));
@@ -330,8 +331,8 @@ void Location::initialize()
*/
void Location::terminate()
{
- delete spuriousRegExp;
- spuriousRegExp = nullptr;
+ delete s_spuriousRegExp;
+ s_spuriousRegExp = nullptr;
}
/*!
@@ -351,7 +352,7 @@ void Location::internalError(const QString &hint)
Location().fatal(QStringLiteral("Internal error (%1)").arg(hint),
QStringLiteral("There is a bug in %1. Seek advice from your local"
" %2 guru.")
- .arg(programName, programName));
+ .arg(s_programName, s_programName));
}
/*!
@@ -361,8 +362,9 @@ void Location::internalError(const QString &hint)
*/
void Location::emitMessage(MessageType type, const QString &message, const QString &details) const
{
- if (type == Warning && spuriousRegExp != nullptr) {
- auto match = spuriousRegExp->match(message, 0, QRegularExpression::NormalMatch, QRegularExpression::AnchorAtOffsetMatchOption);
+ if (type == Warning && s_spuriousRegExp != nullptr) {
+ auto match = s_spuriousRegExp->match(message, 0, QRegularExpression::NormalMatch,
+ QRegularExpression::AnchorAtOffsetMatchOption);
if (match.hasMatch() && match.capturedLength() == message.length())
return;
}
@@ -376,14 +378,14 @@ void Location::emitMessage(MessageType type, const QString &message, const QStri
result.prepend(QStringLiteral(": error: "));
else if (type == Warning) {
result.prepend(QStringLiteral(": warning: "));
- ++warningCount;
+ ++s_warningCount;
}
} else {
if (type == Error)
result.prepend(QStringLiteral(": (qdoc) error: "));
else if (type == Warning) {
result.prepend(QStringLiteral(": (qdoc) warning: "));
- ++warningCount;
+ ++s_warningCount;
}
}
if (type != Report)
@@ -401,7 +403,7 @@ QString Location::toString() const
QString str;
if (isEmpty()) {
- str = programName;
+ str = s_programName;
} else {
Location loc2 = *this;
loc2.setEtc(false);
diff --git a/src/qdoc/location.h b/src/qdoc/location.h
index 6c641eb96..dbf603394 100644
--- a/src/qdoc/location.h
+++ b/src/qdoc/location.h
@@ -42,7 +42,7 @@ public:
Location();
explicit Location(const QString &filePath);
Location(const Location &other);
- ~Location() { delete stk; }
+ ~Location() { delete m_stk; }
Location &operator=(const Location &other);
@@ -50,24 +50,24 @@ public:
void advance(QChar ch);
void advanceLines(int n)
{
- stkTop->lineNo += n;
- stkTop->columnNo = 1;
+ m_stkTop->m_lineNo += n;
+ m_stkTop->m_columnNo = 1;
}
void push(const QString &filePath);
void pop();
- void setEtc(bool etc) { etcetera = etc; }
- void setLineNo(int no) { stkTop->lineNo = no; }
- void setColumnNo(int no) { stkTop->columnNo = no; }
-
- bool isEmpty() const { return stkDepth == 0; }
- int depth() const { return stkDepth; }
- const QString &filePath() const { return stkTop->filePath; }
- QString fileName() const;
- QString fileSuffix() const;
- int lineNo() const { return stkTop->lineNo; }
- int columnNo() const { return stkTop->columnNo; }
- bool etc() const { return etcetera; }
+ void setEtc(bool etc) { m_etc = etc; }
+ void setLineNo(int no) { m_stkTop->m_lineNo = no; }
+ void setColumnNo(int no) { m_stkTop->m_columnNo = no; }
+
+ [[nodiscard]] bool isEmpty() const { return m_stkDepth == 0; }
+ [[nodiscard]] int depth() const { return m_stkDepth; }
+ [[nodiscard]] const QString &filePath() const { return m_stkTop->m_filePath; }
+ [[nodiscard]] QString fileName() const;
+ [[nodiscard]] QString fileSuffix() const;
+ [[nodiscard]] int lineNo() const { return m_stkTop->m_lineNo; }
+ [[nodiscard]] int columnNo() const { return m_stkTop->m_columnNo; }
+ [[nodiscard]] bool etc() const { return m_etc; }
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;
@@ -85,29 +85,29 @@ private:
struct StackEntry
{
- QString filePath;
- int lineNo;
- int columnNo;
+ QString m_filePath {};
+ int m_lineNo {};
+ int m_columnNo {};
};
friend class QTypeInfo<StackEntry>;
void emitMessage(MessageType type, const QString &message, const QString &details) const;
- QString toString() const;
- QString top() const;
+ [[nodiscard]] QString toString() const;
+ [[nodiscard]] QString top() const;
private:
- StackEntry stkBottom;
- QStack<StackEntry> *stk;
- StackEntry *stkTop;
- int stkDepth;
- bool etcetera;
-
- static int tabSize;
- static int warningCount;
- static int warningLimit;
- static QString programName;
- static QString project;
- static QRegularExpression *spuriousRegExp;
+ StackEntry m_stkBottom {};
+ QStack<StackEntry> *m_stk {};
+ StackEntry *m_stkTop {};
+ int m_stkDepth {};
+ bool m_etc {};
+
+ static int s_tabSize;
+ static int s_warningCount;
+ static int s_warningLimit;
+ static QString s_programName;
+ static QString s_project;
+ static QRegularExpression *s_spuriousRegExp;
};
Q_DECLARE_TYPEINFO(Location::StackEntry, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(Location, Q_COMPLEX_TYPE); // stkTop = &stkBottom
diff --git a/src/qdoc/macro.h b/src/qdoc/macro.h
index 1c902fbb4..30cc088c8 100644
--- a/src/qdoc/macro.h
+++ b/src/qdoc/macro.h
@@ -41,9 +41,9 @@ QT_BEGIN_NAMESPACE
struct Macro
{
public:
- QString defaultDef;
- Location defaultDefLocation;
- QMap<QString, QString> otherDefs;
+ QString m_defaultDef {};
+ Location m_defaultDefLocation {};
+ QMap<QString, QString> m_otherDefs {};
int numParams {};
};
diff --git a/src/qdoc/manifestwriter.cpp b/src/qdoc/manifestwriter.cpp
index 4f969bedd..f47e64ebb 100644
--- a/src/qdoc/manifestwriter.cpp
+++ b/src/qdoc/manifestwriter.cpp
@@ -159,7 +159,7 @@ template <typename F>
void ManifestWriter::processManifestMetaContent(const QString &fullName, F matchFunc)
{
for (const auto &index : m_manifestMetaContent) {
- const auto &names = index.names;
+ const auto &names = index.m_names;
for (const QString &name : names) {
bool match;
qsizetype wildcard = name.indexOf(QChar('*'));
@@ -229,9 +229,8 @@ void ManifestWriter::generateManifestFile(const QString &manifest, const QString
const QString installPath = retrieveExampleInstallationPath(example);
const QString fullName = m_project + QLatin1Char('/') + example->title();
- processManifestMetaContent(fullName, [&](const ManifestMetaFilter &filter) {
- m_tags += filter.tags;
- });
+ processManifestMetaContent(
+ fullName, [&](const ManifestMetaFilter &filter) { m_tags += filter.m_tags; });
includeTagsAddedWithMetaCommand(example);
// omit from the manifest if explicitly marked broken
if (m_tags.contains("broken"))
@@ -247,16 +246,16 @@ void ManifestWriter::generateManifestFile(const QString &manifest, const QString
usedAttributes.insert("imageUrl", m_manifestDir + example->imageFileName());
processManifestMetaContent(fullName, [&](const ManifestMetaFilter &filter) {
- const auto attributes = filter.attributes;
- for (const auto &attribute : attributes) {
- const QLatin1Char div(':');
- QStringList attrList = attribute.split(div);
- if (attrList.count() == 1)
- attrList.append(QStringLiteral("true"));
- QString attrName = attrList.takeFirst();
- if (!usedAttributes.contains(attrName))
- usedAttributes.insert(attrName, attrList.join(div));
- }
+ const auto attributes = filter.m_attributes;
+ for (const auto &attribute : attributes) {
+ const QLatin1Char div(':');
+ QStringList attrList = attribute.split(div);
+ if (attrList.count() == 1)
+ attrList.append(QStringLiteral("true"));
+ QString attrName = attrList.takeFirst();
+ if (!usedAttributes.contains(attrName))
+ usedAttributes.insert(attrName, attrList.join(div));
+ }
});
// write the example/demo element
@@ -396,9 +395,9 @@ void ManifestWriter::readManifestMetaContent()
for (const auto &manifest : names) {
ManifestMetaFilter filter;
QString prefix = CONFIG_MANIFESTMETA + Config::dot + manifest + Config::dot;
- filter.names = config.getStringSet(prefix + QStringLiteral("names"));
- filter.attributes = config.getStringSet(prefix + QStringLiteral("attributes"));
- filter.tags = config.getStringSet(prefix + QStringLiteral("tags"));
+ filter.m_names = config.getStringSet(prefix + QStringLiteral("names"));
+ filter.m_attributes = config.getStringSet(prefix + QStringLiteral("attributes"));
+ filter.m_tags = config.getStringSet(prefix + QStringLiteral("tags"));
m_manifestMetaContent.append(filter);
}
}
diff --git a/src/qdoc/manifestwriter.h b/src/qdoc/manifestwriter.h
index c9a6283b0..75e78ed27 100644
--- a/src/qdoc/manifestwriter.h
+++ b/src/qdoc/manifestwriter.h
@@ -41,9 +41,9 @@ class ManifestWriter
{
struct ManifestMetaFilter
{
- QSet<QString> names;
- QSet<QString> attributes;
- QSet<QString> tags;
+ QSet<QString> m_names {};
+ QSet<QString> m_attributes {};
+ QSet<QString> m_tags {};
};
public:
diff --git a/src/qdoc/namespacenode.h b/src/qdoc/namespacenode.h
index d098937e8..373759968 100644
--- a/src/qdoc/namespacenode.h
+++ b/src/qdoc/namespacenode.h
@@ -43,22 +43,22 @@ class NamespaceNode : public Aggregate
public:
NamespaceNode(Aggregate *parent, const QString &name) : Aggregate(Namespace, parent, name) {}
~NamespaceNode() override;
- Tree *tree() const override { return (parent() ? parent()->tree() : m_tree); }
+ [[nodiscard]] Tree *tree() const override { return (parent() ? parent()->tree() : m_tree); }
- bool isFirstClassAggregate() const override { return true; }
- bool isRelatableType() const override { return true; }
- bool wasSeen() const override { return m_seen; }
+ [[nodiscard]] bool isFirstClassAggregate() const override { return true; }
+ [[nodiscard]] bool isRelatableType() const override { return true; }
+ [[nodiscard]] bool wasSeen() const override { return m_seen; }
void markSeen() { m_seen = true; }
void setTree(Tree *t) { m_tree = t; }
- const NodeList &includedChildren() const;
+ [[nodiscard]] const NodeList &includedChildren() const;
void includeChild(Node *child);
void setWhereDocumented(const QString &t) { m_whereDocumented = t; }
- bool isDocumentedHere() const;
- bool hasDocumentedChildren() const;
+ [[nodiscard]] bool isDocumentedHere() const;
+ [[nodiscard]] bool hasDocumentedChildren() const;
void reportDocumentedChildrenInUndocumentedNamespace() const;
- bool docMustBeGenerated() const override;
+ [[nodiscard]] bool docMustBeGenerated() const override;
void setDocNode(NamespaceNode *ns) { m_docNode = ns; }
- NamespaceNode *docNode() const { return m_docNode; }
+ [[nodiscard]] NamespaceNode *docNode() const { return m_docNode; }
private:
bool m_seen { false };
diff --git a/src/qdoc/node.h b/src/qdoc/node.h
index 01ffcb01c..672431bb5 100644
--- a/src/qdoc/node.h
+++ b/src/qdoc/node.h
@@ -103,8 +103,7 @@ public:
JsBasicType,
SharedComment,
Collection,
- Proxy,
- LastType
+ Proxy
};
enum Genus : unsigned char {
@@ -142,104 +141,110 @@ public:
HowToPage,
OverviewPage,
TutorialPage,
- FAQPage,
- OnBeyondZebra
+ FAQPage
};
enum FlagValue { FlagValueDefault = -1, FlagValueFalse = 0, FlagValueTrue = 1 };
virtual ~Node() = default;
virtual Node *clone(Aggregate *) { return nullptr; } // currently only FunctionNode
- virtual Tree *tree() const;
- Aggregate *root() const;
+ [[nodiscard]] virtual Tree *tree() const;
+ [[nodiscard]] Aggregate *root() const;
- NodeType nodeType() const { return m_nodeType; }
- QString nodeTypeString() const;
+ [[nodiscard]] NodeType nodeType() const { return m_nodeType; }
+ [[nodiscard]] QString nodeTypeString() const;
bool changeType(NodeType from, NodeType to);
- Genus genus() const { return m_genus; }
+ [[nodiscard]] Genus genus() const { return m_genus; }
void setGenus(Genus t) { m_genus = t; }
static Genus getGenus(NodeType t);
- PageType pageType() const { return m_pageType; }
+ [[nodiscard]] PageType pageType() const { return m_pageType; }
void setPageType(PageType t) { m_pageType = t; }
void setPageType(const QString &t);
static PageType getPageType(NodeType t);
- bool isActive() const { return m_status == Active; }
- bool isClass() const { return m_nodeType == Class; }
- bool isCppNode() const { return genus() == CPP; }
- bool isDontDocument() const { return (m_status == DontDocument); }
- bool isEnumType() const { return m_nodeType == Enum; }
- bool isExample() const { return m_nodeType == Example; }
- bool isExternalPage() const { return m_nodeType == ExternalPage; }
- bool isFunction(Genus g = DontCare) const
+ [[nodiscard]] bool isActive() const { return m_status == Active; }
+ [[nodiscard]] bool isClass() const { return m_nodeType == Class; }
+ [[nodiscard]] bool isCppNode() const { return genus() == CPP; }
+ [[nodiscard]] bool isDontDocument() const { return (m_status == DontDocument); }
+ [[nodiscard]] bool isEnumType() const { return m_nodeType == Enum; }
+ [[nodiscard]] bool isExample() const { return m_nodeType == Example; }
+ [[nodiscard]] bool isExternalPage() const { return m_nodeType == ExternalPage; }
+ [[nodiscard]] bool isFunction(Genus g = DontCare) const
{
return m_nodeType == Function && (genus() == g || g == DontCare);
}
- bool isGroup() const { return m_nodeType == Group; }
- bool isHeader() const { return m_nodeType == HeaderFile; }
- bool isIndexNode() const { return m_indexNodeFlag; }
- bool isJsBasicType() const { return m_nodeType == JsBasicType; }
- bool isJsModule() const { return m_nodeType == JsModule; }
- bool isJsNode() const { return genus() == JS; }
- bool isJsProperty() const { return m_nodeType == JsProperty; }
- bool isJsType() const { return m_nodeType == JsType; }
- bool isModule() const { return m_nodeType == Module; }
- bool isNamespace() const { return m_nodeType == Namespace; }
- bool isPage() const { return m_nodeType == Page; }
- bool isPreliminary() const { return (m_status == Preliminary); }
- bool isPrivate() const { return m_access == Access::Private; }
- bool isProperty() const { return m_nodeType == Property; }
- bool isProxyNode() const { return m_nodeType == Proxy; }
- bool isPublic() const { return m_access == Access::Public; }
- bool isProtected() const { return m_access == Access::Protected; }
- bool isQmlBasicType() const { return m_nodeType == QmlBasicType; }
- bool isQmlModule() const { return m_nodeType == QmlModule; }
- bool isQmlNode() const { return genus() == QML; }
- bool isQmlProperty() const { return m_nodeType == QmlProperty; }
- bool isQmlType() const { return m_nodeType == QmlType; }
- bool isRelatedNonmember() const { return m_relatedNonmember; }
- bool isStruct() const { return m_nodeType == Struct; }
- bool isSharedCommentNode() const { return m_nodeType == SharedComment; }
- bool isTypeAlias() const { return m_nodeType == TypeAlias; }
- bool isTypedef() const { return m_nodeType == Typedef || m_nodeType == TypeAlias; }
- bool isUnion() const { return m_nodeType == Union; }
- bool isVariable() const { return m_nodeType == Variable; }
- bool isGenericCollection() const { return (m_nodeType == Node::Collection); }
-
- virtual bool isDeprecated() const { return (m_status == Deprecated); }
- virtual bool isAbstract() const { return false; }
- virtual bool isAggregate() const { return false; } // means "can have children"
- virtual bool isFirstClassAggregate() const
+ [[nodiscard]] bool isGroup() const { return m_nodeType == Group; }
+ [[nodiscard]] bool isHeader() const { return m_nodeType == HeaderFile; }
+ [[nodiscard]] bool isIndexNode() const { return m_indexNodeFlag; }
+ [[nodiscard]] bool isJsBasicType() const { return m_nodeType == JsBasicType; }
+ [[nodiscard]] bool isJsModule() const { return m_nodeType == JsModule; }
+ [[nodiscard]] bool isJsNode() const { return genus() == JS; }
+ [[nodiscard]] bool isJsProperty() const { return m_nodeType == JsProperty; }
+ [[nodiscard]] bool isJsType() const { return m_nodeType == JsType; }
+ [[nodiscard]] bool isModule() const { return m_nodeType == Module; }
+ [[nodiscard]] bool isNamespace() const { return m_nodeType == Namespace; }
+ [[nodiscard]] bool isPage() const { return m_nodeType == Page; }
+ [[nodiscard]] bool isPreliminary() const { return (m_status == Preliminary); }
+ [[nodiscard]] bool isPrivate() const { return m_access == Access::Private; }
+ [[nodiscard]] bool isProperty() const { return m_nodeType == Property; }
+ [[nodiscard]] bool isProxyNode() const { return m_nodeType == Proxy; }
+ [[nodiscard]] bool isPublic() const { return m_access == Access::Public; }
+ [[nodiscard]] bool isProtected() const { return m_access == Access::Protected; }
+ [[nodiscard]] bool isQmlBasicType() const { return m_nodeType == QmlBasicType; }
+ [[nodiscard]] bool isQmlModule() const { return m_nodeType == QmlModule; }
+ [[nodiscard]] bool isQmlNode() const { return genus() == QML; }
+ [[nodiscard]] bool isQmlProperty() const { return m_nodeType == QmlProperty; }
+ [[nodiscard]] bool isQmlType() const { return m_nodeType == QmlType; }
+ [[nodiscard]] bool isRelatedNonmember() const { return m_relatedNonmember; }
+ [[nodiscard]] bool isStruct() const { return m_nodeType == Struct; }
+ [[nodiscard]] bool isSharedCommentNode() const { return m_nodeType == SharedComment; }
+ [[nodiscard]] bool isTypeAlias() const { return m_nodeType == TypeAlias; }
+ [[nodiscard]] bool isTypedef() const
+ {
+ return m_nodeType == Typedef || m_nodeType == TypeAlias;
+ }
+ [[nodiscard]] bool isUnion() const { return m_nodeType == Union; }
+ [[nodiscard]] bool isVariable() const { return m_nodeType == Variable; }
+ [[nodiscard]] bool isGenericCollection() const { return (m_nodeType == Node::Collection); }
+
+ [[nodiscard]] virtual bool isDeprecated() const { return (m_status == Deprecated); }
+ [[nodiscard]] virtual bool isAbstract() const { return false; }
+ [[nodiscard]] virtual bool isAggregate() const { return false; } // means "can have children"
+ [[nodiscard]] 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; }
- virtual bool isCollectionNode() const { return false; }
- virtual bool isDefault() const { return false; }
- virtual bool isInternal() const;
- virtual bool isMacro() const { return false; }
- virtual bool isPageNode() const { return false; } // means "generates a doc page"
- virtual bool isQtQuickNode() const { return false; }
- virtual bool isReadOnly() const { return false; }
- virtual bool isRelatableType() const { return false; }
- virtual bool isMarkedReimp() const { return false; }
- virtual bool isPropertyGroup() const { return false; }
- virtual bool isStatic() const { return false; }
- virtual bool isTextPageNode() const { return false; } // means PageNode but not Aggregate
- virtual bool isWrapper() const;
-
- QString plainName() const;
+ [[nodiscard]] virtual bool isAlias() const { return false; }
+ [[nodiscard]] virtual bool isAttached() const { return false; }
+ [[nodiscard]] virtual bool isClassNode() const { return false; }
+ [[nodiscard]] virtual bool isCollectionNode() const { return false; }
+ [[nodiscard]] virtual bool isDefault() const { return false; }
+ [[nodiscard]] virtual bool isInternal() const;
+ [[nodiscard]] virtual bool isMacro() const { return false; }
+ [[nodiscard]] virtual bool isPageNode() const { return false; } // means "generates a doc page"
+ [[nodiscard]] virtual bool isQtQuickNode() const { return false; }
+ [[nodiscard]] virtual bool isReadOnly() const { return false; }
+ [[nodiscard]] virtual bool isRelatableType() const { return false; }
+ [[nodiscard]] virtual bool isMarkedReimp() const { return false; }
+ [[nodiscard]] virtual bool isPropertyGroup() const { return false; }
+ [[nodiscard]] virtual bool isStatic() const { return false; }
+ [[nodiscard]] virtual bool isTextPageNode() const
+ {
+ return false;
+ } // means PageNode but not Aggregate
+ [[nodiscard]] virtual bool isWrapper() const;
+
+ [[nodiscard]] QString plainName() const;
QString plainFullName(const Node *relative = nullptr) const;
- QString plainSignature() const;
+ [[nodiscard]] QString plainSignature() const;
QString fullName(const Node *relative = nullptr) const;
- virtual QString signature(bool, bool, bool = false) const { return plainName(); }
+ [[nodiscard]] virtual QString signature(bool, bool) const { return plainName(); }
+ [[nodiscard]] virtual QString signature(bool, bool, bool) const { return plainName(); }
- const QString &fileNameBase() const { return m_fileNameBase; }
- bool hasFileNameBase() const { return !m_fileNameBase.isEmpty(); }
+ [[nodiscard]] const QString &fileNameBase() const { return m_fileNameBase; }
+ [[nodiscard]] bool hasFileNameBase() const { return !m_fileNameBase.isEmpty(); }
void setFileNameBase(const QString &t) { m_fileNameBase = t; }
void setAccess(Access t) { m_access = t; }
@@ -258,22 +263,22 @@ public:
virtual void setRelatedNonmember(bool b) { m_relatedNonmember = b; }
virtual void setOutputFileName(const QString &) {}
virtual void addMember(Node *) {}
- virtual bool hasNamespaces() const { return false; }
- virtual bool hasClasses() const { return false; }
+ [[nodiscard]] virtual bool hasNamespaces() const { return false; }
+ [[nodiscard]] 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 bool wasSeen() const { return false; }
+ [[nodiscard]] virtual bool wasSeen() const { return false; }
virtual void appendGroupName(const QString &) {}
- virtual QString element() const { return QString(); }
+ [[nodiscard]] virtual QString element() const { return QString(); }
virtual void setNoAutoList(bool) {}
- virtual bool docMustBeGenerated() const { return false; }
+ [[nodiscard]] virtual bool docMustBeGenerated() const { return false; }
- virtual QString title() const { return name(); }
- virtual QString subtitle() const { return QString(); }
- virtual QString fullTitle() const { return name(); }
+ [[nodiscard]] virtual QString title() const { return name(); }
+ [[nodiscard]] virtual QString subtitle() const { return QString(); }
+ [[nodiscard]] virtual QString fullTitle() const { return name(); }
virtual bool setTitle(const QString &) { return false; }
virtual bool setSubtitle(const QString &) { return false; }
@@ -285,67 +290,67 @@ public:
virtual void markDefault() {}
virtual void markReadOnly(bool) {}
- bool match(const QList<int> &types) const;
- Aggregate *parent() const { return m_parent; }
- const QString &name() const { return m_name; }
- QString physicalModuleName() const;
- QString url() const { return m_url; }
- virtual QString nameForLists() const { return m_name; }
- virtual QString outputFileName() const { return QString(); }
- virtual QString obsoleteLink() const { return QString(); }
+ [[nodiscard]] bool match(const QList<int> &types) const;
+ [[nodiscard]] Aggregate *parent() const { return m_parent; }
+ [[nodiscard]] const QString &name() const { return m_name; }
+ [[nodiscard]] QString physicalModuleName() const;
+ [[nodiscard]] QString url() const { return m_url; }
+ [[nodiscard]] virtual QString nameForLists() const { return m_name; }
+ [[nodiscard]] virtual QString outputFileName() const { return QString(); }
+ [[nodiscard]] virtual QString obsoleteLink() const { return QString(); }
virtual void setObsoleteLink(const QString &) {}
virtual void setQtVariable(const QString &) {}
- virtual QString qtVariable() const { return QString(); }
+ [[nodiscard]] virtual QString qtVariable() const { return QString(); }
virtual void setQtCMakeComponent(const QString &) {}
- virtual QString qtCMakeComponent() const { return QString(); }
- virtual bool hasTag(const QString &) const { return false; }
+ [[nodiscard]] virtual QString qtCMakeComponent() const { return QString(); }
+ [[nodiscard]] virtual bool hasTag(const QString &) const { return false; }
void setDeprecatedSince(const QString &sinceVersion);
[[nodiscard]] const QString &deprecatedSince() const { return m_deprecatedSince; }
- const QMap<LinkType, QPair<QString, QString>> &links() const { return m_linkMap; }
+ [[nodiscard]] const QMap<LinkType, QPair<QString, QString>> &links() const { return m_linkMap; }
void setLink(LinkType linkType, const QString &link, const QString &desc);
- Access access() const { return m_access; }
- const Location &declLocation() const { return m_declLocation; }
- const Location &defLocation() const { return m_defLocation; }
- const Location &location() const
+ [[nodiscard]] Access access() const { return m_access; }
+ [[nodiscard]] const Location &declLocation() const { return m_declLocation; }
+ [[nodiscard]] const Location &defLocation() const { return m_defLocation; }
+ [[nodiscard]] const Location &location() const
{
return (m_defLocation.isEmpty() ? m_declLocation : m_defLocation);
}
- const Doc &doc() const { return m_doc; }
- bool isInAPI() const { return !isPrivate() && !isInternal() && hasDoc(); }
- bool hasDoc() const { return (m_hadDoc || !m_doc.isEmpty()); }
- bool hadDoc() const { return m_hadDoc; }
- Status status() const { return m_status; }
- ThreadSafeness threadSafeness() const;
- ThreadSafeness inheritedThreadSafeness() const;
- QString since() const { return m_since; }
- const QString &templateDecl() const { return m_templateDecl; }
- const QString &reconstitutedBrief() const { return m_reconstitutedBrief; }
-
- bool isSharingComment() const { return (m_sharedCommentNode != nullptr); }
- bool hasSharedDoc() const;
+ [[nodiscard]] const Doc &doc() const { return m_doc; }
+ [[nodiscard]] bool isInAPI() const { return !isPrivate() && !isInternal() && hasDoc(); }
+ [[nodiscard]] bool hasDoc() const { return (m_hadDoc || !m_doc.isEmpty()); }
+ [[nodiscard]] bool hadDoc() const { return m_hadDoc; }
+ [[nodiscard]] Status status() const { return m_status; }
+ [[nodiscard]] ThreadSafeness threadSafeness() const;
+ [[nodiscard]] ThreadSafeness inheritedThreadSafeness() const;
+ [[nodiscard]] QString since() const { return m_since; }
+ [[nodiscard]] const QString &templateDecl() const { return m_templateDecl; }
+ [[nodiscard]] const QString &reconstitutedBrief() const { return m_reconstitutedBrief; }
+
+ [[nodiscard]] bool isSharingComment() const { return (m_sharedCommentNode != nullptr); }
+ [[nodiscard]] bool hasSharedDoc() const;
void setSharedCommentNode(SharedCommentNode *t) { m_sharedCommentNode = t; }
SharedCommentNode *sharedCommentNode() { return m_sharedCommentNode; }
- QString extractClassName(const QString &string) const;
- virtual QString qmlTypeName() const { return m_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(); }
+ [[nodiscard]] QString extractClassName(const QString &string) const;
+ [[nodiscard]] virtual QString qmlTypeName() const { return m_name; }
+ [[nodiscard]] virtual QString qmlFullBaseName() const { return QString(); }
+ [[nodiscard]] virtual QString logicalModuleName() const { return QString(); }
+ [[nodiscard]] virtual QString logicalModuleVersion() const { return QString(); }
+ [[nodiscard]] virtual QString logicalModuleIdentifier() const { return QString(); }
virtual void setLogicalModuleInfo(const QString &) {}
virtual void setLogicalModuleInfo(const QStringList &) {}
- virtual CollectionNode *logicalModule() const { return nullptr; }
+ [[nodiscard]] virtual CollectionNode *logicalModule() const { return nullptr; }
virtual void setQmlModule(CollectionNode *) {}
virtual ClassNode *classNode() { return nullptr; }
virtual void setClassNode(ClassNode *) {}
QmlTypeNode *qmlTypeNode();
ClassNode *declarativeCppNode();
- const QString &outputSubdirectory() const { return m_outSubDir; }
+ [[nodiscard]] const QString &outputSubdirectory() const { return m_outSubDir; }
virtual void setOutputSubdirectory(const QString &t) { m_outSubDir = t; }
- QString fullDocumentName() const;
+ [[nodiscard]] QString fullDocumentName() const;
QString qualifyCppName();
QString qualifyQmlName();
QString qualifyWithParentName();
diff --git a/src/qdoc/openedlist.h b/src/qdoc/openedlist.h
index 00476170a..66daf4fda 100644
--- a/src/qdoc/openedlist.h
+++ b/src/qdoc/openedlist.h
@@ -41,18 +41,18 @@ public:
enum ListStyle { Bullet, Tag, Value, Numeric, UpperAlpha, LowerAlpha, UpperRoman, LowerRoman };
OpenedList() : sty(Bullet), ini(1), nex(0) {}
- OpenedList(ListStyle style);
+ explicit OpenedList(ListStyle style);
OpenedList(const Location &location, const QString &hint);
void next() { nex++; }
- bool isStarted() const { return nex >= ini; }
- ListStyle style() const { return sty; }
- QString styleString() const;
- int number() const { return nex; }
- QString numberString() const;
- QString prefix() const { return pref; }
- QString suffix() const { return suff; }
+ [[nodiscard]] bool isStarted() const { return nex >= ini; }
+ [[nodiscard]] ListStyle style() const { return sty; }
+ [[nodiscard]] QString styleString() const;
+ [[nodiscard]] int number() const { return nex; }
+ [[nodiscard]] QString numberString() const;
+ [[nodiscard]] QString prefix() const { return pref; }
+ [[nodiscard]] QString suffix() const { return suff; }
private:
static int fromAlpha(const QString &str);
diff --git a/src/qdoc/pagenode.h b/src/qdoc/pagenode.h
index 6611ef6e4..d8f903a8e 100644
--- a/src/qdoc/pagenode.h
+++ b/src/qdoc/pagenode.h
@@ -49,30 +49,33 @@ public:
setPageType(ptype);
}
- bool isPageNode() const override { return true; }
- bool isTextPageNode() const override { return !isAggregate(); } // PageNode but not Aggregate
+ [[nodiscard]] bool isPageNode() const override { return true; }
+ [[nodiscard]] bool isTextPageNode() const override
+ {
+ return !isAggregate();
+ } // PageNode but not Aggregate
- QString title() const override { return m_title; }
- QString subtitle() const override { return m_subtitle; }
- QString fullTitle() const override;
+ [[nodiscard]] QString title() const override { return m_title; }
+ [[nodiscard]] QString subtitle() const override { return m_subtitle; }
+ [[nodiscard]] QString fullTitle() const override;
bool setTitle(const QString &title) override;
bool setSubtitle(const QString &subtitle) override
{
m_subtitle = subtitle;
return true;
}
- QString nameForLists() const override { return title(); }
+ [[nodiscard]] QString nameForLists() const override { return title(); }
- virtual QString imageFileName() const { return QString(); }
+ [[nodiscard]] virtual QString imageFileName() const { return QString(); }
virtual void setImageFileName(const QString &) {}
- bool noAutoList() const { return m_noAutoList; }
+ [[nodiscard]] bool noAutoList() const { return m_noAutoList; }
void setNoAutoList(bool b) override { m_noAutoList = b; }
- const QStringList &groupNames() const { return m_groupNames; }
+ [[nodiscard]] const QStringList &groupNames() const { return m_groupNames; }
void appendGroupName(const QString &t) override { m_groupNames.append(t); }
void setOutputFileName(const QString &f) override { m_outputFileName = f; }
- QString outputFileName() const override { return m_outputFileName; }
+ [[nodiscard]] QString outputFileName() const override { return m_outputFileName; }
protected:
friend class Node;
diff --git a/src/qdoc/parameters.cpp b/src/qdoc/parameters.cpp
index 638d99902..f583aefe9 100644
--- a/src/qdoc/parameters.cpp
+++ b/src/qdoc/parameters.cpp
@@ -34,7 +34,7 @@
QT_BEGIN_NAMESPACE
-QRegularExpression Parameters::varComment_(R"(^/\*\s*([a-zA-Z_0-9]+)\s*\*/$)");
+QRegularExpression Parameters::s_varComment(R"(^/\*\s*([a-zA-Z_0-9]+)\s*\*/$)");
/*!
\class Parameter
@@ -60,16 +60,14 @@ QRegularExpression Parameters::varComment_(R"(^/\*\s*([a-zA-Z_0-9]+)\s*\*/$)");
*/
QString Parameter::signature(bool includeValue) const
{
- QString p = type_;
- if (!p.endsWith(QChar('*')) &&
- !p.endsWith(QChar('&')) &&
- !p.endsWith(QChar(' ')) &&
- !name_.isEmpty()) {
+ QString p = m_type;
+ if (!p.endsWith(QChar('*')) && !p.endsWith(QChar('&')) && !p.endsWith(QChar(' '))
+ && !m_name.isEmpty()) {
p += QLatin1Char(' ');
}
- p += name_;
- if (includeValue && !defaultValue_.isEmpty())
- p += " = " + defaultValue_;
+ p += m_name;
+ if (includeValue && !m_defaultValue.isEmpty())
+ p += " = " + m_defaultValue;
return p;
}
@@ -87,18 +85,18 @@ QString Parameter::signature(bool includeValue) const
of its parameters.
*/
-Parameters::Parameters() : valid_(true), privateSignal_(false), tok_(0), tokenizer_(nullptr)
+Parameters::Parameters() : m_valid(true), m_privateSignal(false), m_tok(0), m_tokenizer(nullptr)
{
// nothing.
}
Parameters::Parameters(const QString &signature)
- : valid_(true), privateSignal_(false), tok_(0), tokenizer_(nullptr)
+ : m_valid(true), m_privateSignal(false), m_tok(0), m_tokenizer(nullptr)
{
if (!signature.isEmpty()) {
if (!parse(signature)) {
- parameters_.clear();
- valid_ = false;
+ m_parameters.clear();
+ m_valid = false;
}
}
}
@@ -109,7 +107,7 @@ Parameters::Parameters(const QString &signature)
*/
void Parameters::readToken()
{
- tok_ = tokenizer_->getToken();
+ m_tok = m_tokenizer->getToken();
}
/*!
@@ -117,7 +115,7 @@ void Parameters::readToken()
*/
QString Parameters::lexeme()
{
- return tokenizer_->lexeme();
+ return m_tokenizer->lexeme();
}
/*!
@@ -125,7 +123,7 @@ QString Parameters::lexeme()
*/
QString Parameters::previousLexeme()
{
- return tokenizer_->previousLexeme();
+ return m_tokenizer->previousLexeme();
}
/*!
@@ -135,7 +133,7 @@ QString Parameters::previousLexeme()
*/
bool Parameters::match(int target)
{
- if (tok_ == target) {
+ if (m_tok == target) {
readToken();
return true;
}
@@ -149,23 +147,23 @@ bool Parameters::match(int target)
*/
void Parameters::matchTemplateAngles(CodeChunk &type)
{
- if (tok_ == Tok_LeftAngle) {
+ if (m_tok == Tok_LeftAngle) {
int leftAngleDepth = 0;
int parenAndBraceDepth = 0;
do {
- if (tok_ == Tok_LeftAngle) {
+ if (m_tok == Tok_LeftAngle) {
leftAngleDepth++;
- } else if (tok_ == Tok_RightAngle) {
+ } else if (m_tok == Tok_RightAngle) {
leftAngleDepth--;
- } else if (tok_ == Tok_LeftParen || tok_ == Tok_LeftBrace) {
+ } else if (m_tok == Tok_LeftParen || m_tok == Tok_LeftBrace) {
++parenAndBraceDepth;
- } else if (tok_ == Tok_RightParen || tok_ == Tok_RightBrace) {
+ } else if (m_tok == Tok_RightParen || m_tok == Tok_RightBrace) {
if (--parenAndBraceDepth < 0)
return;
}
type.append(lexeme());
readToken();
- } while (leftAngleDepth > 0 && tok_ != Tok_Eoi);
+ } while (leftAngleDepth > 0 && m_tok != Tok_Eoi);
}
}
@@ -182,13 +180,13 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name)
for (;;) {
bool virgin = true;
- if (tok_ != Tok_Ident) {
+ if (m_tok != Tok_Ident) {
/*
There is special processing for 'Foo::operator int()'
and such elsewhere. This is the only case where we
return something with a trailing gulbrandsen ('Foo::').
*/
- if (tok_ == Tok_operator)
+ if (m_tok == Tok_operator)
return true;
/*
@@ -198,12 +196,12 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name)
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) {
- if (tok_ == Tok_signed)
+ while (m_tok == Tok_signed || m_tok == Tok_int || m_tok == Tok_unsigned
+ || m_tok == Tok_short || m_tok == Tok_long || m_tok == Tok_int64) {
+ if (m_tok == Tok_signed)
pending = lexeme();
else {
- if (tok_ == Tok_unsigned && !pending.isEmpty())
+ if (m_tok == Tok_unsigned && !pending.isEmpty())
type.append(pending);
pending.clear();
type.append(lexeme());
@@ -283,7 +281,7 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name)
type.append(previousLexeme());
/* parse the parameters. Ignore the parameter name from the type */
- while (tok_ != Tok_RightParen && tok_ != Tok_Eoi) {
+ while (m_tok != Tok_RightParen && m_tok != Tok_Eoi) {
QString dummy;
if (!matchTypeAndName(type, dummy))
return false;
@@ -311,12 +309,12 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name)
inside a C++-style comment, because the explanation
does not fit on one line.
*/
- auto match = varComment_.match(previousLexeme());
+ auto match = s_varComment.match(previousLexeme());
if (match.hasMatch())
name = match.captured(1);
} else if (match(Tok_LeftParen)) {
name = "(";
- while (tok_ != Tok_RightParen && tok_ != Tok_Eoi) {
+ while (m_tok != Tok_RightParen && m_tok != Tok_Eoi) {
name.append(lexeme());
readToken();
}
@@ -324,7 +322,7 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name)
readToken();
if (match(Tok_LeftBracket)) {
name.append("[");
- while (tok_ != Tok_RightBracket && tok_ != Tok_Eoi) {
+ while (m_tok != Tok_RightBracket && m_tok != Tok_Eoi) {
name.append(lexeme());
readToken();
}
@@ -333,10 +331,10 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name)
}
}
- if (tok_ == Tok_LeftBracket) {
- int bracketDepth0 = tokenizer_->bracketDepth();
- while ((tokenizer_->bracketDepth() >= bracketDepth0 && tok_ != Tok_Eoi)
- || tok_ == Tok_RightBracket) {
+ if (m_tok == Tok_LeftBracket) {
+ int bracketDepth0 = m_tokenizer->bracketDepth();
+ while ((m_tokenizer->bracketDepth() >= bracketDepth0 && m_tok != Tok_Eoi)
+ || m_tok == Tok_RightBracket) {
type.append(lexeme());
readToken();
}
@@ -353,7 +351,7 @@ bool Parameters::matchTypeAndName(CodeChunk &type, QString &name)
bool Parameters::matchParameter()
{
if (match(Tok_QPrivateSignal)) {
- privateSignal_ = true;
+ m_privateSignal = true;
return true;
}
@@ -366,9 +364,10 @@ bool Parameters::matchParameter()
match(Tok_Comment);
if (match(Tok_Equal)) {
chunk.clear();
- int pdepth = tokenizer_->parenDepth();
- while (tokenizer_->parenDepth() >= pdepth
- && (tok_ != Tok_Comma || (tokenizer_->parenDepth() > pdepth)) && tok_ != Tok_Eoi) {
+ int pdepth = m_tokenizer->parenDepth();
+ while (m_tokenizer->parenDepth() >= pdepth
+ && (m_tok != Tok_Comma || (m_tokenizer->parenDepth() > pdepth))
+ && m_tok != Tok_Eoi) {
chunk.append(lexeme());
readToken();
}
@@ -386,26 +385,26 @@ bool Parameters::matchParameter()
*/
bool Parameters::parse(const QString &signature)
{
- Tokenizer *outerTokenizer = tokenizer_;
- int outerTok = tok_;
+ Tokenizer *outerTokenizer = m_tokenizer;
+ int outerTok = m_tok;
QByteArray latin1 = signature.toLatin1();
Tokenizer stringTokenizer(Location(), latin1);
stringTokenizer.setParsingFnOrMacro(true);
- tokenizer_ = &stringTokenizer;
+ m_tokenizer = &stringTokenizer;
readToken();
do {
if (!matchParameter()) {
- parameters_.clear();
- valid_ = false;
+ m_parameters.clear();
+ m_valid = false;
break;
}
} while (match(Tok_Comma));
- tokenizer_ = outerTokenizer;
- tok_ = outerTok;
- return valid_;
+ m_tokenizer = outerTokenizer;
+ m_tok = outerTok;
+ return m_valid;
}
/*!
@@ -414,7 +413,7 @@ bool Parameters::parse(const QString &signature)
*/
void Parameters::append(const QString &type, const QString &name, const QString &value)
{
- parameters_.append(Parameter(type, name, value));
+ m_parameters.append(Parameter(type, name, value));
}
/*!
@@ -424,11 +423,11 @@ void Parameters::append(const QString &type, const QString &name, const QString
QString Parameters::signature(bool includeValues) const
{
QString result;
- if (!parameters_.empty()) {
- for (int i = 0; i < parameters_.size(); i++) {
+ if (!m_parameters.empty()) {
+ for (int i = 0; i < m_parameters.size(); i++) {
if (i > 0)
result += ", ";
- result += parameters_.at(i).signature(includeValues);
+ result += m_parameters.at(i).signature(includeValues);
}
}
return result;
@@ -445,7 +444,7 @@ QString Parameters::signature(bool includeValues) const
QString Parameters::rawSignature(bool names, bool values) const
{
QString raw;
- const auto params = parameters_;
+ const auto params = m_parameters;
for (const auto &parameter : params) {
raw += parameter.type();
if (names)
@@ -468,7 +467,7 @@ void Parameters::set(const QString &signature)
clear();
if (!signature.isEmpty()) {
QStringList commaSplit = signature.split(',');
- parameters_.resize(commaSplit.size());
+ m_parameters.resize(commaSplit.size());
int i = 0;
for (const auto &item : qAsConst(commaSplit)) {
QStringList blankSplit = item.split(' ', Qt::SkipEmptyParts);
@@ -492,7 +491,7 @@ void Parameters::set(const QString &signature)
pName = pName.mid(j);
}
}
- parameters_[i++].set(pType, pName, pDefault);
+ m_parameters[i++].set(pType, pName, pDefault);
}
}
}
@@ -503,7 +502,7 @@ void Parameters::set(const QString &signature)
QSet<QString> Parameters::getNames() const
{
QSet<QString> names;
- const auto params = parameters_;
+ const auto params = m_parameters;
for (const auto &parameter : params) {
if (!parameter.name().isEmpty())
names.insert(parameter.name());
@@ -521,7 +520,7 @@ QString Parameters::generateTypeList() const
for (int i = 0; i < count(); ++i) {
if (i > 0)
out += ", ";
- out += parameters_.at(i).type();
+ out += m_parameters.at(i).type();
}
}
return out;
@@ -538,7 +537,7 @@ QString Parameters::generateTypeAndNameList() const
for (int i = 0; i < count(); ++i) {
if (i != 0)
out += ", ";
- const Parameter &p = parameters_.at(i);
+ const Parameter &p = m_parameters.at(i);
out += p.type();
if (out[out.size() - 1].isLetterOrNumber())
out += QLatin1Char(' ');
@@ -559,7 +558,7 @@ bool Parameters::match(const Parameters &parameters) const
if (count() == 0)
return true;
for (int i = 0; i < count(); i++) {
- if (parameters.at(i).type() != parameters_.at(i).type())
+ if (parameters.at(i).type() != m_parameters.at(i).type())
return false;
}
return true;
diff --git a/src/qdoc/parameters.h b/src/qdoc/parameters.h
index 539418d62..f2f4d93a1 100644
--- a/src/qdoc/parameters.h
+++ b/src/qdoc/parameters.h
@@ -33,6 +33,8 @@
#include <QtCore/qregularexpression.h>
#include <QtCore/qset.h>
+#include <utility>
+
QT_BEGIN_NAMESPACE
class Location;
@@ -42,37 +44,36 @@ class CodeChunk;
class Parameter
{
public:
- Parameter() {}
- Parameter(const QString &type, const QString &name = QString(),
- const QString &defaultValue = QString())
- : type_(type), name_(name), defaultValue_(defaultValue)
+ Parameter() = default;
+ explicit Parameter(QString type, QString name = QString(), QString defaultValue = QString())
+ : m_type(std::move(type)), m_name(std::move(name)), m_defaultValue(std::move(defaultValue))
{
}
- void setName(const QString &name) { name_ = name; }
- bool hasType() const { return !type_.isEmpty(); }
- const QString &type() const { return type_; }
- const QString &name() const { return name_; }
- const QString &defaultValue() const { return defaultValue_; }
- void setDefaultValue(const QString &t) { defaultValue_ = t; }
+ void setName(const QString &name) { m_name = name; }
+ [[nodiscard]] bool hasType() const { return !m_type.isEmpty(); }
+ [[nodiscard]] const QString &type() const { return m_type; }
+ [[nodiscard]] const QString &name() const { return m_name; }
+ [[nodiscard]] const QString &defaultValue() const { return m_defaultValue; }
+ void setDefaultValue(const QString &t) { m_defaultValue = t; }
void set(const QString &type, const QString &name, const QString &defaultValue = QString())
{
- type_ = type;
- name_ = name;
- defaultValue_ = defaultValue;
+ m_type = type;
+ m_name = name;
+ m_defaultValue = defaultValue;
}
- QString signature(bool includeValue = false) const;
+ [[nodiscard]] QString signature(bool includeValue = false) const;
- const QString &canonicalType() const { return canonicalType_; }
- void setCanonicalType(const QString &t) { canonicalType_ = t; }
+ [[nodiscard]] const QString &canonicalType() const { return m_canonicalType; }
+ void setCanonicalType(const QString &t) { m_canonicalType = t; }
public:
- QString canonicalType_ {};
- QString type_;
- QString name_;
- QString defaultValue_;
+ QString m_canonicalType {};
+ QString m_type {};
+ QString m_name {};
+ QString m_defaultValue {};
};
typedef QList<Parameter> ParameterVector;
@@ -85,32 +86,32 @@ public:
void clear()
{
- parameters_.clear();
- privateSignal_ = false;
- valid_ = true;
+ m_parameters.clear();
+ m_privateSignal = false;
+ m_valid = true;
}
- const ParameterVector &parameters() const { return parameters_; }
- bool isPrivateSignal() const { return privateSignal_; }
- bool isEmpty() const { return parameters_.isEmpty(); }
- bool isValid() const { return valid_; }
- int count() const { return parameters_.size(); }
- void reserve(int count) { parameters_.reserve(count); }
- const Parameter &at(int i) const { return parameters_.at(i); }
- Parameter &last() { return parameters_.last(); }
- const Parameter &last() const { return parameters_.last(); }
- inline Parameter &operator[](int index) { return parameters_[index]; }
+ [[nodiscard]] const ParameterVector &parameters() const { return m_parameters; }
+ [[nodiscard]] bool isPrivateSignal() const { return m_privateSignal; }
+ [[nodiscard]] bool isEmpty() const { return m_parameters.isEmpty(); }
+ [[nodiscard]] bool isValid() const { return m_valid; }
+ [[nodiscard]] int count() const { return m_parameters.size(); }
+ void reserve(int count) { m_parameters.reserve(count); }
+ [[nodiscard]] const Parameter &at(int i) const { return m_parameters.at(i); }
+ Parameter &last() { return m_parameters.last(); }
+ [[nodiscard]] const Parameter &last() const { return m_parameters.last(); }
+ inline Parameter &operator[](int index) { return m_parameters[index]; }
void append(const QString &type, const QString &name, const QString &value);
void append(const QString &type, const QString &name) { append(type, name, QString()); }
void append(const QString &type) { append(type, QString(), QString()); }
- void pop_back() { parameters_.pop_back(); }
- void setPrivateSignal() { privateSignal_ = true; }
- QString signature(bool includeValues = false) const;
- QString rawSignature(bool names = false, bool values = false) const;
+ void pop_back() { m_parameters.pop_back(); }
+ void setPrivateSignal() { m_privateSignal = true; }
+ [[nodiscard]] QString signature(bool includeValues = false) const;
+ [[nodiscard]] QString rawSignature(bool names = false, bool values = false) const;
void set(const QString &signature);
- QSet<QString> getNames() const;
- QString generateTypeList() const;
- QString generateTypeAndNameList() const;
- bool match(const Parameters &parameters) const;
+ [[nodiscard]] QSet<QString> getNames() const;
+ [[nodiscard]] QString generateTypeList() const;
+ [[nodiscard]] QString generateTypeAndNameList() const;
+ [[nodiscard]] bool match(const Parameters &parameters) const;
private:
void readToken();
@@ -123,13 +124,13 @@ private:
bool parse(const QString &signature);
private:
- static QRegularExpression varComment_;
+ static QRegularExpression s_varComment;
- bool valid_;
- bool privateSignal_;
- int tok_;
- Tokenizer *tokenizer_;
- ParameterVector parameters_;
+ bool m_valid {};
+ bool m_privateSignal {};
+ int m_tok {};
+ Tokenizer *m_tokenizer { nullptr };
+ ParameterVector m_parameters;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/propertynode.h b/src/qdoc/propertynode.h
index 530834f51..e7df52111 100644
--- a/src/qdoc/propertynode.h
+++ b/src/qdoc/propertynode.h
@@ -60,26 +60,29 @@ public:
void setRequired() { m_required = true; }
void setPropertyType(PropertyType type) { m_propertyType = type; }
- const QString &dataType() const { return m_type; }
- QString qualifiedDataType() const;
- NodeList functions() const;
- const NodeList &functions(FunctionRole role) const { return m_functions[(int)role]; }
- const NodeList &getters() const { return functions(Getter); }
- const NodeList &setters() const { return functions(Setter); }
- const NodeList &resetters() const { return functions(Resetter); }
- const NodeList &notifiers() const { return functions(Notifier); }
- bool hasAccessFunction(const QString &name) const;
+ [[nodiscard]] const QString &dataType() const { return m_type; }
+ [[nodiscard]] QString qualifiedDataType() const;
+ [[nodiscard]] NodeList functions() const;
+ [[nodiscard]] const NodeList &functions(FunctionRole role) const
+ {
+ return m_functions[(int)role];
+ }
+ [[nodiscard]] const NodeList &getters() const { return functions(Getter); }
+ [[nodiscard]] const NodeList &setters() const { return functions(Setter); }
+ [[nodiscard]] const NodeList &resetters() const { return functions(Resetter); }
+ [[nodiscard]] const NodeList &notifiers() const { return functions(Notifier); }
+ [[nodiscard]] bool hasAccessFunction(const QString &name) const;
FunctionRole role(const FunctionNode *functionNode) const;
- bool isStored() const { return fromFlagValue(m_stored, storedDefault()); }
- bool isWritable() const { return fromFlagValue(m_writable, writableDefault()); }
- bool isConstant() const { return m_const; }
- bool isRequired() const { return m_required; }
- PropertyType propertyType() const { return m_propertyType; }
- const PropertyNode *overriddenFrom() const { return m_overrides; }
-
- bool storedDefault() const { return true; }
- bool designableDefault() const { return !setters().isEmpty(); }
- bool writableDefault() const { return !setters().isEmpty(); }
+ [[nodiscard]] bool isStored() const { return fromFlagValue(m_stored, storedDefault()); }
+ [[nodiscard]] bool isWritable() const { return fromFlagValue(m_writable, writableDefault()); }
+ [[nodiscard]] bool isConstant() const { return m_const; }
+ [[nodiscard]] bool isRequired() const { return m_required; }
+ [[nodiscard]] PropertyType propertyType() const { return m_propertyType; }
+ [[nodiscard]] const PropertyNode *overriddenFrom() const { return m_overrides; }
+
+ [[nodiscard]] bool storedDefault() const { return true; }
+ [[nodiscard]] bool designableDefault() const { return !setters().isEmpty(); }
+ [[nodiscard]] bool writableDefault() const { return !setters().isEmpty(); }
private:
QString m_type {};
diff --git a/src/qdoc/proxynode.h b/src/qdoc/proxynode.h
index 4cfcb8d0a..65b59cc75 100644
--- a/src/qdoc/proxynode.h
+++ b/src/qdoc/proxynode.h
@@ -39,8 +39,8 @@ class ProxyNode : public Aggregate
{
public:
ProxyNode(Aggregate *parent, const QString &name);
- bool docMustBeGenerated() const override { return true; }
- bool isRelatableType() const override { return true; }
+ [[nodiscard]] bool docMustBeGenerated() const override { return true; }
+ [[nodiscard]] bool isRelatableType() const override { return true; }
};
QT_END_NAMESPACE
diff --git a/src/qdoc/puredocparser.cpp b/src/qdoc/puredocparser.cpp
index 5e2e31556..095a2664b 100644
--- a/src/qdoc/puredocparser.cpp
+++ b/src/qdoc/puredocparser.cpp
@@ -56,11 +56,11 @@ QStringList PureDocParser::sourceFileNameFilter()
void PureDocParser::parseSourceFile(const Location &location, const QString &filePath)
{
QFile in(filePath);
- currentFile_ = filePath;
+ m_currentFile = filePath;
if (!in.open(QIODevice::ReadOnly)) {
location.error(
QStringLiteral("Can't open source file '%1' (%2)").arg(filePath, strerror(errno)));
- currentFile_.clear();
+ m_currentFile.clear();
return;
}
@@ -73,11 +73,11 @@ void PureDocParser::parseSourceFile(const Location &location, const QString &fil
The set of open namespaces is cleared before parsing
each source file. The word "source" here means cpp file.
*/
- qdb_->clearOpenNamespaces();
+ m_qdb->clearOpenNamespaces();
processQdocComments();
in.close();
- currentFile_.clear();
+ m_currentFile.clear();
}
/*!
@@ -112,7 +112,7 @@ bool PureDocParser::processQdocComments()
DocList docs;
NodeList nodes;
- QString topic = topics[0].topic;
+ QString topic = topics[0].m_topic;
processTopicArgs(doc, topic, nodes, docs);
processMetaCommands(nodes, docs);
diff --git a/src/qdoc/puredocparser.h b/src/qdoc/puredocparser.h
index 7c9affb51..15717ec31 100644
--- a/src/qdoc/puredocparser.h
+++ b/src/qdoc/puredocparser.h
@@ -46,8 +46,8 @@ public:
private:
bool processQdocComments();
- Tokenizer *m_tokenizer = nullptr;
- int m_token = 0;
+ Tokenizer *m_tokenizer { nullptr };
+ int m_token { 0 };
};
QT_END_NAMESPACE
diff --git a/src/qdoc/qdocdatabase.cpp b/src/qdoc/qdocdatabase.cpp
index 2a050fe90..04f2f4054 100644
--- a/src/qdoc/qdocdatabase.cpp
+++ b/src/qdoc/qdocdatabase.cpp
@@ -40,7 +40,6 @@
QT_BEGIN_NAMESPACE
static NodeMultiMap emptyNodeMultiMap_;
-bool QDocDatabase::debug = false;
/*!
\class QDocForest
@@ -88,13 +87,13 @@ bool QDocDatabase::debug = false;
*/
QDocForest::~QDocForest()
{
- for (auto *entry : searchOrder_)
+ for (auto *entry : m_searchOrder)
delete entry;
- forest_.clear();
- searchOrder_.clear();
- indexSearchOrder_.clear();
- moduleNames_.clear();
- primaryTree_ = nullptr;
+ m_forest.clear();
+ m_searchOrder.clear();
+ m_indexSearchOrder.clear();
+ m_moduleNames.clear();
+ m_primaryTree = nullptr;
}
/*!
@@ -104,8 +103,9 @@ QDocForest::~QDocForest()
*/
NamespaceNode *QDocForest::nextRoot()
{
- ++currentIndex_;
- return (currentIndex_ < searchOrder().size() ? searchOrder()[currentIndex_]->root() : nullptr);
+ ++m_currentIndex;
+ return (m_currentIndex < searchOrder().size() ? searchOrder()[m_currentIndex]->root()
+ : nullptr);
}
/*!
@@ -115,7 +115,7 @@ NamespaceNode *QDocForest::nextRoot()
*/
Tree *QDocForest::firstTree()
{
- currentIndex_ = 0;
+ m_currentIndex = 0;
return (!searchOrder().isEmpty() ? searchOrder()[0] : nullptr);
}
@@ -126,8 +126,8 @@ Tree *QDocForest::firstTree()
*/
Tree *QDocForest::nextTree()
{
- ++currentIndex_;
- return (currentIndex_ < searchOrder().size() ? searchOrder()[currentIndex_] : nullptr);
+ ++m_currentIndex;
+ return (m_currentIndex < searchOrder().size() ? searchOrder()[m_currentIndex] : nullptr);
}
/*!
@@ -148,9 +148,9 @@ Tree *QDocForest::nextTree()
void QDocForest::setPrimaryTree(const QString &t)
{
QString T = t.toLower();
- primaryTree_ = findTree(T);
- forest_.remove(T);
- if (primaryTree_ == nullptr)
+ m_primaryTree = findTree(T);
+ m_forest.remove(T);
+ if (m_primaryTree == nullptr)
qDebug() << "ERROR: Could not set primary tree to:" << t;
}
@@ -160,28 +160,28 @@ void QDocForest::setPrimaryTree(const QString &t)
*/
void QDocForest::setSearchOrder(const QStringList &t)
{
- if (!searchOrder_.isEmpty())
+ if (!m_searchOrder.isEmpty())
return;
/* Allocate space for the search order. */
- searchOrder_.reserve(forest_.size() + 1);
- searchOrder_.clear();
- moduleNames_.reserve(forest_.size() + 1);
- moduleNames_.clear();
+ m_searchOrder.reserve(m_forest.size() + 1);
+ m_searchOrder.clear();
+ m_moduleNames.reserve(m_forest.size() + 1);
+ m_moduleNames.clear();
/* The primary tree is always first in the search order. */
QString primaryName = primaryTree()->physicalModuleName();
- searchOrder_.append(primaryTree_);
- moduleNames_.append(primaryName);
- forest_.remove(primaryName);
+ m_searchOrder.append(m_primaryTree);
+ m_moduleNames.append(primaryName);
+ m_forest.remove(primaryName);
for (const QString &m : t) {
if (primaryName != m) {
- auto it = forest_.find(m);
- if (it != forest_.end()) {
- searchOrder_.append(it.value());
- moduleNames_.append(m);
- forest_.remove(m);
+ auto it = m_forest.find(m);
+ if (it != m_forest.end()) {
+ m_searchOrder.append(it.value());
+ m_moduleNames.append(m);
+ m_forest.remove(m);
}
}
}
@@ -190,12 +190,12 @@ void QDocForest::setSearchOrder(const QStringList &t)
to the search order sequentially, because we don't
know any better at this point.
*/
- if (!forest_.isEmpty()) {
- for (auto it = forest_.begin(); it != forest_.end(); ++it) {
- searchOrder_.append(it.value());
- moduleNames_.append(it.key());
+ if (!m_forest.isEmpty()) {
+ for (auto it = m_forest.begin(); it != m_forest.end(); ++it) {
+ m_searchOrder.append(it.value());
+ m_moduleNames.append(it.key());
}
- forest_.clear();
+ m_forest.clear();
}
/*
@@ -206,9 +206,9 @@ 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) {
- if (!forest_.contains(moduleNames_.at(i))) {
- forest_.insert(moduleNames_.at(i), searchOrder_.at(i));
+ for (int i = 0; i < m_searchOrder.size(); ++i) {
+ if (!m_forest.contains(m_moduleNames.at(i))) {
+ m_forest.insert(m_moduleNames.at(i), m_searchOrder.at(i));
}
}
}
@@ -240,9 +240,9 @@ void QDocForest::setSearchOrder(const QStringList &t)
*/
const QList<Tree *> &QDocForest::searchOrder()
{
- if (searchOrder_.isEmpty())
+ if (m_searchOrder.isEmpty())
return indexSearchOrder();
- return searchOrder_;
+ return m_searchOrder;
}
/*!
@@ -262,9 +262,9 @@ const QList<Tree *> &QDocForest::searchOrder()
*/
const QList<Tree *> &QDocForest::indexSearchOrder()
{
- if (forest_.size() > indexSearchOrder_.size())
- indexSearchOrder_.prepend(primaryTree_);
- return indexSearchOrder_;
+ if (m_forest.size() > m_indexSearchOrder.size())
+ m_indexSearchOrder.prepend(m_primaryTree);
+ return m_indexSearchOrder;
}
/*!
@@ -274,9 +274,9 @@ const QList<Tree *> &QDocForest::indexSearchOrder()
*/
NamespaceNode *QDocForest::newIndexTree(const QString &module)
{
- primaryTree_ = new Tree(module, qdb_);
- forest_.insert(module.toLower(), primaryTree_);
- return primaryTree_->root();
+ m_primaryTree = new Tree(module, m_qdb);
+ m_forest.insert(module.toLower(), m_primaryTree);
+ return m_primaryTree->root();
}
/*!
@@ -285,7 +285,7 @@ NamespaceNode *QDocForest::newIndexTree(const QString &module)
*/
void QDocForest::newPrimaryTree(const QString &module)
{
- primaryTree_ = new Tree(module, qdb_);
+ m_primaryTree = new Tree(module, m_qdb);
}
/*!
@@ -348,19 +348,19 @@ const FunctionNode *QDocForest::findFunctionNode(const QStringList &path,
other useful data structures.
*/
-QDocDatabase *QDocDatabase::qdocDB_ = nullptr;
-NodeMap QDocDatabase::typeNodeMap_;
-NodeMultiMap QDocDatabase::obsoleteClasses_;
-NodeMultiMap QDocDatabase::classesWithObsoleteMembers_;
-NodeMultiMap QDocDatabase::obsoleteQmlTypes_;
-NodeMultiMap QDocDatabase::qmlTypesWithObsoleteMembers_;
-NodeMultiMap QDocDatabase::cppClasses_;
-NodeMultiMap QDocDatabase::qmlBasicTypes_;
-NodeMultiMap QDocDatabase::qmlTypes_;
-NodeMultiMap QDocDatabase::examples_;
-NodeMultiMapMap QDocDatabase::newClassMaps_;
-NodeMultiMapMap QDocDatabase::newQmlTypeMaps_;
-NodeMultiMapMap QDocDatabase::newSinceMaps_;
+QDocDatabase *QDocDatabase::s_qdocDB = nullptr;
+NodeMap QDocDatabase::s_typeNodeMap;
+NodeMultiMap QDocDatabase::s_obsoleteClasses;
+NodeMultiMap QDocDatabase::s_classesWithObsoleteMembers;
+NodeMultiMap QDocDatabase::s_obsoleteQmlTypes;
+NodeMultiMap QDocDatabase::s_qmlTypesWithObsoleteMembers;
+NodeMultiMap QDocDatabase::s_cppClasses;
+NodeMultiMap QDocDatabase::s_qmlBasicTypes;
+NodeMultiMap QDocDatabase::s_qmlTypes;
+NodeMultiMap QDocDatabase::s_examples;
+NodeMultiMapMap QDocDatabase::s_newClassMaps;
+NodeMultiMapMap QDocDatabase::s_newQmlTypeMaps;
+NodeMultiMapMap QDocDatabase::s_newSinceMaps;
/*!
Constructs the singleton qdoc database object. The singleton
@@ -378,7 +378,7 @@ NodeMultiMapMap QDocDatabase::newSinceMaps_;
modules sequentially in a loop. Each source file for each module
is read exactly once.
*/
-QDocDatabase::QDocDatabase() : forest_(this)
+QDocDatabase::QDocDatabase() : m_forest(this)
{
// nothing
}
@@ -389,11 +389,11 @@ QDocDatabase::QDocDatabase() : forest_(this)
*/
QDocDatabase *QDocDatabase::qdocDB()
{
- if (qdocDB_ == nullptr) {
- qdocDB_ = new QDocDatabase;
+ if (s_qdocDB == nullptr) {
+ s_qdocDB = new QDocDatabase;
initializeDB();
}
- return qdocDB_;
+ return s_qdocDB;
}
/*!
@@ -401,9 +401,9 @@ QDocDatabase *QDocDatabase::qdocDB()
*/
void QDocDatabase::destroyQdocDB()
{
- if (qdocDB_ != nullptr) {
- delete qdocDB_;
- qdocDB_ = nullptr;
+ if (s_qdocDB != nullptr) {
+ delete s_qdocDB;
+ s_qdocDB = nullptr;
}
}
@@ -426,139 +426,139 @@ void QDocDatabase::destroyQdocDB()
void QDocDatabase::initializeDB()
{
Node::initialize();
- typeNodeMap_.insert("accepted", nullptr);
- typeNodeMap_.insert("actionPerformed", nullptr);
- typeNodeMap_.insert("activated", nullptr);
- typeNodeMap_.insert("alias", nullptr);
- typeNodeMap_.insert("anchors", nullptr);
- typeNodeMap_.insert("any", nullptr);
- typeNodeMap_.insert("array", nullptr);
- typeNodeMap_.insert("autoSearch", nullptr);
- typeNodeMap_.insert("axis", nullptr);
- typeNodeMap_.insert("backClicked", nullptr);
- typeNodeMap_.insert("boomTime", nullptr);
- typeNodeMap_.insert("border", nullptr);
- typeNodeMap_.insert("buttonClicked", nullptr);
- typeNodeMap_.insert("callback", nullptr);
- typeNodeMap_.insert("char", nullptr);
- typeNodeMap_.insert("clicked", nullptr);
- typeNodeMap_.insert("close", nullptr);
- typeNodeMap_.insert("closed", nullptr);
- typeNodeMap_.insert("cond", nullptr);
- typeNodeMap_.insert("data", nullptr);
- typeNodeMap_.insert("dataReady", nullptr);
- typeNodeMap_.insert("dateString", nullptr);
- typeNodeMap_.insert("dateTimeString", nullptr);
- typeNodeMap_.insert("datetime", nullptr);
- typeNodeMap_.insert("day", nullptr);
- typeNodeMap_.insert("deactivated", nullptr);
- typeNodeMap_.insert("drag", nullptr);
- typeNodeMap_.insert("easing", nullptr);
- typeNodeMap_.insert("error", nullptr);
- typeNodeMap_.insert("exposure", nullptr);
- typeNodeMap_.insert("fatalError", nullptr);
- typeNodeMap_.insert("fileSelected", nullptr);
- typeNodeMap_.insert("flags", nullptr);
- typeNodeMap_.insert("float", nullptr);
- typeNodeMap_.insert("focus", nullptr);
- typeNodeMap_.insert("focusZone", nullptr);
- typeNodeMap_.insert("format", nullptr);
- typeNodeMap_.insert("framePainted", nullptr);
- typeNodeMap_.insert("from", nullptr);
- typeNodeMap_.insert("frontClicked", nullptr);
- typeNodeMap_.insert("function", nullptr);
- typeNodeMap_.insert("hasOpened", nullptr);
- typeNodeMap_.insert("hovered", nullptr);
- typeNodeMap_.insert("hoveredTitle", nullptr);
- typeNodeMap_.insert("hoveredUrl", nullptr);
- typeNodeMap_.insert("imageCapture", nullptr);
- typeNodeMap_.insert("imageProcessing", nullptr);
- typeNodeMap_.insert("index", nullptr);
- typeNodeMap_.insert("initialized", nullptr);
- typeNodeMap_.insert("isLoaded", nullptr);
- typeNodeMap_.insert("item", nullptr);
- typeNodeMap_.insert("jsdict", nullptr);
- typeNodeMap_.insert("jsobject", nullptr);
- typeNodeMap_.insert("key", nullptr);
- typeNodeMap_.insert("keysequence", nullptr);
- typeNodeMap_.insert("listViewClicked", nullptr);
- typeNodeMap_.insert("loadRequest", nullptr);
- typeNodeMap_.insert("locale", nullptr);
- typeNodeMap_.insert("location", nullptr);
- typeNodeMap_.insert("long", nullptr);
- typeNodeMap_.insert("message", nullptr);
- typeNodeMap_.insert("messageReceived", nullptr);
- typeNodeMap_.insert("mode", nullptr);
- typeNodeMap_.insert("month", nullptr);
- typeNodeMap_.insert("name", nullptr);
- typeNodeMap_.insert("number", nullptr);
- typeNodeMap_.insert("object", nullptr);
- typeNodeMap_.insert("offset", nullptr);
- typeNodeMap_.insert("ok", nullptr);
- typeNodeMap_.insert("openCamera", nullptr);
- typeNodeMap_.insert("openImage", nullptr);
- typeNodeMap_.insert("openVideo", nullptr);
- typeNodeMap_.insert("padding", nullptr);
- typeNodeMap_.insert("parent", nullptr);
- typeNodeMap_.insert("path", nullptr);
- typeNodeMap_.insert("photoModeSelected", nullptr);
- typeNodeMap_.insert("position", nullptr);
- typeNodeMap_.insert("precision", nullptr);
- typeNodeMap_.insert("presetClicked", nullptr);
- typeNodeMap_.insert("preview", nullptr);
- typeNodeMap_.insert("previewSelected", nullptr);
- typeNodeMap_.insert("progress", nullptr);
- typeNodeMap_.insert("puzzleLost", nullptr);
- typeNodeMap_.insert("qmlSignal", nullptr);
- typeNodeMap_.insert("rectangle", nullptr);
- typeNodeMap_.insert("request", nullptr);
- typeNodeMap_.insert("requestId", nullptr);
- typeNodeMap_.insert("section", nullptr);
- typeNodeMap_.insert("selected", nullptr);
- typeNodeMap_.insert("send", nullptr);
- typeNodeMap_.insert("settingsClicked", nullptr);
- typeNodeMap_.insert("shoe", nullptr);
- typeNodeMap_.insert("short", nullptr);
- typeNodeMap_.insert("signed", nullptr);
- typeNodeMap_.insert("sizeChanged", nullptr);
- typeNodeMap_.insert("size_t", nullptr);
- typeNodeMap_.insert("sockaddr", nullptr);
- typeNodeMap_.insert("someOtherSignal", nullptr);
- typeNodeMap_.insert("sourceSize", nullptr);
- typeNodeMap_.insert("startButtonClicked", nullptr);
- typeNodeMap_.insert("state", nullptr);
- typeNodeMap_.insert("std::initializer_list", nullptr);
- typeNodeMap_.insert("std::list", nullptr);
- typeNodeMap_.insert("std::map", nullptr);
- typeNodeMap_.insert("std::pair", nullptr);
- typeNodeMap_.insert("std::string", nullptr);
- typeNodeMap_.insert("std::vector", nullptr);
- typeNodeMap_.insert("stringlist", nullptr);
- typeNodeMap_.insert("swapPlayers", nullptr);
- typeNodeMap_.insert("symbol", nullptr);
- typeNodeMap_.insert("t", nullptr);
- typeNodeMap_.insert("T", nullptr);
- typeNodeMap_.insert("tagChanged", nullptr);
- typeNodeMap_.insert("timeString", nullptr);
- typeNodeMap_.insert("timeout", nullptr);
- typeNodeMap_.insert("to", nullptr);
- typeNodeMap_.insert("toggled", nullptr);
- typeNodeMap_.insert("type", nullptr);
- typeNodeMap_.insert("unsigned", nullptr);
- typeNodeMap_.insert("urllist", nullptr);
- typeNodeMap_.insert("va_list", nullptr);
- typeNodeMap_.insert("value", nullptr);
- typeNodeMap_.insert("valueEmitted", nullptr);
- typeNodeMap_.insert("videoFramePainted", nullptr);
- typeNodeMap_.insert("videoModeSelected", nullptr);
- typeNodeMap_.insert("videoRecorder", nullptr);
- typeNodeMap_.insert("void", nullptr);
- typeNodeMap_.insert("volatile", nullptr);
- typeNodeMap_.insert("wchar_t", nullptr);
- typeNodeMap_.insert("x", nullptr);
- typeNodeMap_.insert("y", nullptr);
- typeNodeMap_.insert("zoom", nullptr);
- typeNodeMap_.insert("zoomTo", nullptr);
+ s_typeNodeMap.insert("accepted", nullptr);
+ s_typeNodeMap.insert("actionPerformed", nullptr);
+ s_typeNodeMap.insert("activated", nullptr);
+ s_typeNodeMap.insert("alias", nullptr);
+ s_typeNodeMap.insert("anchors", nullptr);
+ s_typeNodeMap.insert("any", nullptr);
+ s_typeNodeMap.insert("array", nullptr);
+ s_typeNodeMap.insert("autoSearch", nullptr);
+ s_typeNodeMap.insert("axis", nullptr);
+ s_typeNodeMap.insert("backClicked", nullptr);
+ s_typeNodeMap.insert("boomTime", nullptr);
+ s_typeNodeMap.insert("border", nullptr);
+ s_typeNodeMap.insert("buttonClicked", nullptr);
+ s_typeNodeMap.insert("callback", nullptr);
+ s_typeNodeMap.insert("char", nullptr);
+ s_typeNodeMap.insert("clicked", nullptr);
+ s_typeNodeMap.insert("close", nullptr);
+ s_typeNodeMap.insert("closed", nullptr);
+ s_typeNodeMap.insert("cond", nullptr);
+ s_typeNodeMap.insert("data", nullptr);
+ s_typeNodeMap.insert("dataReady", nullptr);
+ s_typeNodeMap.insert("dateString", nullptr);
+ s_typeNodeMap.insert("dateTimeString", nullptr);
+ s_typeNodeMap.insert("datetime", nullptr);
+ s_typeNodeMap.insert("day", nullptr);
+ s_typeNodeMap.insert("deactivated", nullptr);
+ s_typeNodeMap.insert("drag", nullptr);
+ s_typeNodeMap.insert("easing", nullptr);
+ s_typeNodeMap.insert("error", nullptr);
+ s_typeNodeMap.insert("exposure", nullptr);
+ s_typeNodeMap.insert("fatalError", nullptr);
+ s_typeNodeMap.insert("fileSelected", nullptr);
+ s_typeNodeMap.insert("flags", nullptr);
+ s_typeNodeMap.insert("float", nullptr);
+ s_typeNodeMap.insert("focus", nullptr);
+ s_typeNodeMap.insert("focusZone", nullptr);
+ s_typeNodeMap.insert("format", nullptr);
+ s_typeNodeMap.insert("framePainted", nullptr);
+ s_typeNodeMap.insert("from", nullptr);
+ s_typeNodeMap.insert("frontClicked", nullptr);
+ s_typeNodeMap.insert("function", nullptr);
+ s_typeNodeMap.insert("hasOpened", nullptr);
+ s_typeNodeMap.insert("hovered", nullptr);
+ s_typeNodeMap.insert("hoveredTitle", nullptr);
+ s_typeNodeMap.insert("hoveredUrl", nullptr);
+ s_typeNodeMap.insert("imageCapture", nullptr);
+ s_typeNodeMap.insert("imageProcessing", nullptr);
+ s_typeNodeMap.insert("index", nullptr);
+ s_typeNodeMap.insert("initialized", nullptr);
+ s_typeNodeMap.insert("isLoaded", nullptr);
+ s_typeNodeMap.insert("item", nullptr);
+ s_typeNodeMap.insert("jsdict", nullptr);
+ s_typeNodeMap.insert("jsobject", nullptr);
+ s_typeNodeMap.insert("key", nullptr);
+ s_typeNodeMap.insert("keysequence", nullptr);
+ s_typeNodeMap.insert("listViewClicked", nullptr);
+ s_typeNodeMap.insert("loadRequest", nullptr);
+ s_typeNodeMap.insert("locale", nullptr);
+ s_typeNodeMap.insert("location", nullptr);
+ s_typeNodeMap.insert("long", nullptr);
+ s_typeNodeMap.insert("message", nullptr);
+ s_typeNodeMap.insert("messageReceived", nullptr);
+ s_typeNodeMap.insert("mode", nullptr);
+ s_typeNodeMap.insert("month", nullptr);
+ s_typeNodeMap.insert("name", nullptr);
+ s_typeNodeMap.insert("number", nullptr);
+ s_typeNodeMap.insert("object", nullptr);
+ s_typeNodeMap.insert("offset", nullptr);
+ s_typeNodeMap.insert("ok", nullptr);
+ s_typeNodeMap.insert("openCamera", nullptr);
+ s_typeNodeMap.insert("openImage", nullptr);
+ s_typeNodeMap.insert("openVideo", nullptr);
+ s_typeNodeMap.insert("padding", nullptr);
+ s_typeNodeMap.insert("parent", nullptr);
+ s_typeNodeMap.insert("path", nullptr);
+ s_typeNodeMap.insert("photoModeSelected", nullptr);
+ s_typeNodeMap.insert("position", nullptr);
+ s_typeNodeMap.insert("precision", nullptr);
+ s_typeNodeMap.insert("presetClicked", nullptr);
+ s_typeNodeMap.insert("preview", nullptr);
+ s_typeNodeMap.insert("previewSelected", nullptr);
+ s_typeNodeMap.insert("progress", nullptr);
+ s_typeNodeMap.insert("puzzleLost", nullptr);
+ s_typeNodeMap.insert("qmlSignal", nullptr);
+ s_typeNodeMap.insert("rectangle", nullptr);
+ s_typeNodeMap.insert("request", nullptr);
+ s_typeNodeMap.insert("requestId", nullptr);
+ s_typeNodeMap.insert("section", nullptr);
+ s_typeNodeMap.insert("selected", nullptr);
+ s_typeNodeMap.insert("send", nullptr);
+ s_typeNodeMap.insert("settingsClicked", nullptr);
+ s_typeNodeMap.insert("shoe", nullptr);
+ s_typeNodeMap.insert("short", nullptr);
+ s_typeNodeMap.insert("signed", nullptr);
+ s_typeNodeMap.insert("sizeChanged", nullptr);
+ s_typeNodeMap.insert("size_t", nullptr);
+ s_typeNodeMap.insert("sockaddr", nullptr);
+ s_typeNodeMap.insert("someOtherSignal", nullptr);
+ s_typeNodeMap.insert("sourceSize", nullptr);
+ s_typeNodeMap.insert("startButtonClicked", nullptr);
+ s_typeNodeMap.insert("state", nullptr);
+ s_typeNodeMap.insert("std::initializer_list", nullptr);
+ s_typeNodeMap.insert("std::list", nullptr);
+ s_typeNodeMap.insert("std::map", nullptr);
+ s_typeNodeMap.insert("std::pair", nullptr);
+ s_typeNodeMap.insert("std::string", nullptr);
+ s_typeNodeMap.insert("std::vector", nullptr);
+ s_typeNodeMap.insert("stringlist", nullptr);
+ s_typeNodeMap.insert("swapPlayers", nullptr);
+ s_typeNodeMap.insert("symbol", nullptr);
+ s_typeNodeMap.insert("t", nullptr);
+ s_typeNodeMap.insert("T", nullptr);
+ s_typeNodeMap.insert("tagChanged", nullptr);
+ s_typeNodeMap.insert("timeString", nullptr);
+ s_typeNodeMap.insert("timeout", nullptr);
+ s_typeNodeMap.insert("to", nullptr);
+ s_typeNodeMap.insert("toggled", nullptr);
+ s_typeNodeMap.insert("type", nullptr);
+ s_typeNodeMap.insert("unsigned", nullptr);
+ s_typeNodeMap.insert("urllist", nullptr);
+ s_typeNodeMap.insert("va_list", nullptr);
+ s_typeNodeMap.insert("value", nullptr);
+ s_typeNodeMap.insert("valueEmitted", nullptr);
+ s_typeNodeMap.insert("videoFramePainted", nullptr);
+ s_typeNodeMap.insert("videoModeSelected", nullptr);
+ s_typeNodeMap.insert("videoRecorder", nullptr);
+ s_typeNodeMap.insert("void", nullptr);
+ s_typeNodeMap.insert("volatile", nullptr);
+ s_typeNodeMap.insert("wchar_t", nullptr);
+ s_typeNodeMap.insert("x", nullptr);
+ s_typeNodeMap.insert("y", nullptr);
+ s_typeNodeMap.insert("zoom", nullptr);
+ s_typeNodeMap.insert("zoomTo", nullptr);
}
/*! \fn NamespaceNode *QDocDatabase::primaryTreeRoot()
@@ -687,7 +687,7 @@ void QDocDatabase::initializeDB()
*/
QmlTypeNode *QDocDatabase::findQmlType(const QString &name)
{
- QmlTypeNode *qcn = forest_.lookupQmlType(name);
+ QmlTypeNode *qcn = m_forest.lookupQmlType(name);
if (qcn)
return qcn;
return nullptr;
@@ -705,13 +705,13 @@ QmlTypeNode *QDocDatabase::findQmlType(const QString &qmid, const QString &name)
{
if (!qmid.isEmpty()) {
QString t = qmid + "::" + name;
- QmlTypeNode *qcn = forest_.lookupQmlType(t);
+ QmlTypeNode *qcn = m_forest.lookupQmlType(t);
if (qcn)
return qcn;
}
QStringList path(name);
- Node *n = forest_.findNodeByNameAndType(path, &Node::isQmlType);
+ Node *n = m_forest.findNodeByNameAndType(path, &Node::isQmlType);
if (n && (n->isQmlType() || n->isJsType()))
return static_cast<QmlTypeNode *>(n);
return nullptr;
@@ -729,13 +729,13 @@ Aggregate *QDocDatabase::findQmlBasicType(const QString &qmid, const QString &na
{
if (!qmid.isEmpty()) {
QString t = qmid + "::" + name;
- Aggregate *a = forest_.lookupQmlBasicType(t);
+ Aggregate *a = m_forest.lookupQmlBasicType(t);
if (a)
return a;
}
QStringList path(name);
- Node *n = forest_.findNodeByNameAndType(path, &Node::isQmlBasicType);
+ Node *n = m_forest.findNodeByNameAndType(path, &Node::isQmlBasicType);
if (n && n->isQmlBasicType())
return static_cast<Aggregate *>(n);
return nullptr;
@@ -759,7 +759,7 @@ QmlTypeNode *QDocDatabase::findQmlType(const ImportRec &import, const QString &n
qmName = import.m_importUri;
for (const auto &namePart : dotSplit) {
QString qualifiedName = qmName + "::" + namePart;
- QmlTypeNode *qcn = forest_.lookupQmlType(qualifiedName);
+ QmlTypeNode *qcn = m_forest.lookupQmlType(qualifiedName);
if (qcn)
return qcn;
}
@@ -776,7 +776,7 @@ QmlTypeNode *QDocDatabase::findQmlType(const ImportRec &import, const QString &n
*/
void QDocDatabase::processForest()
{
- Tree *t = forest_.firstTree();
+ Tree *t = m_forest.firstTree();
while (t) {
findAllClasses(t->root());
findAllFunctions(t->root());
@@ -785,7 +785,7 @@ void QDocDatabase::processForest()
findAllSince(t->root());
findAllAttributions(t->root());
t->setTreeHasBeenAnalyzed();
- t = forest_.nextTree();
+ t = m_forest.nextTree();
}
resolveNamespaces();
}
@@ -799,12 +799,12 @@ void QDocDatabase::processForest()
*/
void QDocDatabase::processForest(void (QDocDatabase::*func)(Aggregate *))
{
- Tree *t = forest_.firstTree();
+ Tree *t = m_forest.firstTree();
while (t) {
if (!t->treeHasBeenAnalyzed()) {
(this->*(func))(t->root());
}
- t = forest_.nextTree();
+ t = m_forest.nextTree();
}
}
@@ -814,9 +814,9 @@ void QDocDatabase::processForest(void (QDocDatabase::*func)(Aggregate *))
*/
TextToNodeMap &QDocDatabase::getLegaleseTexts()
{
- if (legaleseTexts_.isEmpty())
+ if (m_legaleseTexts.isEmpty())
processForest(&QDocDatabase::findAllLegaleseTexts);
- return legaleseTexts_;
+ return m_legaleseTexts;
}
/*!
@@ -826,9 +826,9 @@ TextToNodeMap &QDocDatabase::getLegaleseTexts()
*/
NodeMultiMap &QDocDatabase::getClassesWithObsoleteMembers()
{
- if (obsoleteClasses_.isEmpty() && obsoleteQmlTypes_.isEmpty())
+ if (s_obsoleteClasses.isEmpty() && s_obsoleteQmlTypes.isEmpty())
processForest(&QDocDatabase::findAllObsoleteThings);
- return classesWithObsoleteMembers_;
+ return s_classesWithObsoleteMembers;
}
/*!
@@ -838,9 +838,9 @@ NodeMultiMap &QDocDatabase::getClassesWithObsoleteMembers()
*/
NodeMultiMap &QDocDatabase::getObsoleteQmlTypes()
{
- if (obsoleteClasses_.isEmpty() && obsoleteQmlTypes_.isEmpty())
+ if (s_obsoleteClasses.isEmpty() && s_obsoleteQmlTypes.isEmpty())
processForest(&QDocDatabase::findAllObsoleteThings);
- return obsoleteQmlTypes_;
+ return s_obsoleteQmlTypes;
}
/*!
@@ -850,9 +850,9 @@ NodeMultiMap &QDocDatabase::getObsoleteQmlTypes()
*/
NodeMultiMap &QDocDatabase::getQmlTypesWithObsoleteMembers()
{
- if (obsoleteClasses_.isEmpty() && obsoleteQmlTypes_.isEmpty())
+ if (s_obsoleteClasses.isEmpty() && s_obsoleteQmlTypes.isEmpty())
processForest(&QDocDatabase::findAllObsoleteThings);
- return qmlTypesWithObsoleteMembers_;
+ return s_qmlTypesWithObsoleteMembers;
}
/*! \fn NodeMultiMap &QDocDatabase::getNamespaces()
@@ -867,9 +867,9 @@ NodeMultiMap &QDocDatabase::getQmlTypesWithObsoleteMembers()
*/
NodeMultiMap &QDocDatabase::getQmlBasicTypes()
{
- if (cppClasses_.isEmpty() && qmlBasicTypes_.isEmpty())
+ if (s_cppClasses.isEmpty() && s_qmlBasicTypes.isEmpty())
processForest(&QDocDatabase::findAllClasses);
- return qmlBasicTypes_;
+ return s_qmlBasicTypes;
}
/*!
@@ -879,9 +879,9 @@ NodeMultiMap &QDocDatabase::getQmlBasicTypes()
*/
NodeMultiMap &QDocDatabase::getQmlTypes()
{
- if (cppClasses_.isEmpty() && qmlTypes_.isEmpty())
+ if (s_cppClasses.isEmpty() && s_qmlTypes.isEmpty())
processForest(&QDocDatabase::findAllClasses);
- return qmlTypes_;
+ return s_qmlTypes;
}
/*!
@@ -891,9 +891,9 @@ NodeMultiMap &QDocDatabase::getQmlTypes()
*/
NodeMultiMap &QDocDatabase::getExamples()
{
- if (cppClasses_.isEmpty() && examples_.isEmpty())
+ if (s_cppClasses.isEmpty() && s_examples.isEmpty())
processForest(&QDocDatabase::findAllClasses);
- return examples_;
+ return s_examples;
}
/*!
@@ -903,9 +903,9 @@ NodeMultiMap &QDocDatabase::getExamples()
*/
NodeMultiMap &QDocDatabase::getAttributions()
{
- if (attributions_.isEmpty())
+ if (m_attributions.isEmpty())
processForest(&QDocDatabase::findAllAttributions);
- return attributions_;
+ return m_attributions;
}
/*!
@@ -915,9 +915,9 @@ NodeMultiMap &QDocDatabase::getAttributions()
*/
NodeMultiMap &QDocDatabase::getObsoleteClasses()
{
- if (obsoleteClasses_.isEmpty() && obsoleteQmlTypes_.isEmpty())
+ if (s_obsoleteClasses.isEmpty() && s_obsoleteQmlTypes.isEmpty())
processForest(&QDocDatabase::findAllObsoleteThings);
- return obsoleteClasses_;
+ return s_obsoleteClasses;
}
/*!
@@ -927,9 +927,9 @@ NodeMultiMap &QDocDatabase::getObsoleteClasses()
*/
NodeMultiMap &QDocDatabase::getCppClasses()
{
- if (cppClasses_.isEmpty() && qmlTypes_.isEmpty())
+ if (s_cppClasses.isEmpty() && s_qmlTypes.isEmpty())
processForest(&QDocDatabase::findAllClasses);
- return cppClasses_;
+ return s_cppClasses;
}
/*!
@@ -938,9 +938,9 @@ NodeMultiMap &QDocDatabase::getCppClasses()
*/
NodeMapMap &QDocDatabase::getFunctionIndex()
{
- if (functionIndex_.isEmpty())
+ if (m_functionIndex.isEmpty())
processForest(&QDocDatabase::findAllFunctions);
- return functionIndex_;
+ return m_functionIndex;
}
/*!
@@ -953,7 +953,7 @@ void QDocDatabase::findAllLegaleseTexts(Aggregate *node)
if (childNode->isPrivate())
continue;
if (!childNode->doc().legaleseText().isEmpty())
- legaleseTexts_.insert(childNode->doc().legaleseText(), childNode);
+ m_legaleseTexts.insert(childNode->doc().legaleseText(), childNode);
if (childNode->isAggregate())
findAllLegaleseTexts(static_cast<Aggregate *>(childNode));
}
@@ -985,10 +985,10 @@ void QDocDatabase::findAllLegaleseTexts(Aggregate *node)
*/
const NodeMultiMap &QDocDatabase::getClassMap(const QString &key)
{
- if (newSinceMaps_.isEmpty() && newClassMaps_.isEmpty() && newQmlTypeMaps_.isEmpty())
+ if (s_newSinceMaps.isEmpty() && s_newClassMaps.isEmpty() && s_newQmlTypeMaps.isEmpty())
processForest(&QDocDatabase::findAllSince);
- auto it = newClassMaps_.constFind(key);
- if (it != newClassMaps_.constEnd())
+ auto it = s_newClassMaps.constFind(key);
+ if (it != s_newClassMaps.constEnd())
return it.value();
return emptyNodeMultiMap_;
}
@@ -1000,10 +1000,10 @@ const NodeMultiMap &QDocDatabase::getClassMap(const QString &key)
*/
const NodeMultiMap &QDocDatabase::getQmlTypeMap(const QString &key)
{
- if (newSinceMaps_.isEmpty() && newClassMaps_.isEmpty() && newQmlTypeMaps_.isEmpty())
+ if (s_newSinceMaps.isEmpty() && s_newClassMaps.isEmpty() && s_newQmlTypeMaps.isEmpty())
processForest(&QDocDatabase::findAllSince);
- auto it = newQmlTypeMaps_.constFind(key);
- if (it != newQmlTypeMaps_.constEnd())
+ auto it = s_newQmlTypeMaps.constFind(key);
+ if (it != s_newQmlTypeMaps.constEnd())
return it.value();
return emptyNodeMultiMap_;
}
@@ -1015,10 +1015,10 @@ const NodeMultiMap &QDocDatabase::getQmlTypeMap(const QString &key)
*/
const NodeMultiMap &QDocDatabase::getSinceMap(const QString &key)
{
- if (newSinceMaps_.isEmpty() && newClassMaps_.isEmpty() && newQmlTypeMaps_.isEmpty())
+ if (s_newSinceMaps.isEmpty() && s_newClassMaps.isEmpty() && s_newQmlTypeMaps.isEmpty())
processForest(&QDocDatabase::findAllSince);
- auto it = newSinceMaps_.constFind(key);
- if (it != newSinceMaps_.constEnd())
+ auto it = s_newSinceMaps.constFind(key);
+ if (it != s_newSinceMaps.constEnd())
return it.value();
return emptyNodeMultiMap_;
}
@@ -1064,10 +1064,10 @@ void QDocDatabase::resolveStuff()
void QDocDatabase::resolveBaseClasses()
{
- Tree *t = forest_.firstTree();
+ Tree *t = m_forest.firstTree();
while (t) {
t->resolveBaseClasses(t->root());
- t = forest_.nextTree();
+ t = m_forest.nextTree();
}
}
@@ -1078,7 +1078,7 @@ void QDocDatabase::resolveBaseClasses()
NodeMultiMap &QDocDatabase::getNamespaces()
{
resolveNamespaces();
- return namespaceIndex_;
+ return m_namespaceIndex;
}
/*!
@@ -1091,13 +1091,13 @@ NodeMultiMap &QDocDatabase::getNamespaces()
*/
void QDocDatabase::resolveNamespaces()
{
- if (!namespaceIndex_.isEmpty())
+ if (!m_namespaceIndex.isEmpty())
return;
NodeMultiMap namespaceMultimap;
- Tree *t = forest_.firstTree();
+ Tree *t = m_forest.firstTree();
while (t) {
t->root()->findAllNamespaces(namespaceMultimap);
- t = forest_.nextTree();
+ t = m_forest.nextTree();
}
const QList<QString> keys = namespaceMultimap.uniqueKeys();
for (const QString &key : keys) {
@@ -1160,7 +1160,7 @@ void QDocDatabase::resolveNamespaces()
}
if (ns == nullptr)
ns = static_cast<NamespaceNode *>(namespaces.at(0));
- namespaceIndex_.insert(ns->name(), ns);
+ m_namespaceIndex.insert(ns->name(), ns);
}
}
@@ -1178,8 +1178,8 @@ void QDocDatabase::resolveProxies()
{
// The first tree is the primary tree.
// Skip the primary tree.
- Tree *t = forest_.firstTree();
- t = forest_.nextTree();
+ Tree *t = m_forest.firstTree();
+ t = m_forest.nextTree();
while (t) {
const NodeList &proxies = t->proxies();
if (!proxies.isEmpty()) {
@@ -1192,7 +1192,7 @@ void QDocDatabase::resolveProxies()
}
}
}
- t = forest_.nextTree();
+ t = m_forest.nextTree();
}
}
@@ -1223,7 +1223,7 @@ const FunctionNode *QDocDatabase::findFunctionNode(const QString &target, const
function = function.left(position);
}
QStringList path = function.split("::");
- return forest_.findFunctionNode(path, Parameters(signature), relative, genus);
+ return m_forest.findFunctionNode(path, Parameters(signature), relative, genus);
}
/*!
@@ -1240,11 +1240,11 @@ const Node *QDocDatabase::findTypeNode(const QString &type, const Node *relative
{
QStringList path = type.split("::");
if ((path.size() == 1) && (path.at(0)[0].isLower() || path.at(0) == QString("T"))) {
- auto it = typeNodeMap_.find(path.at(0));
- if (it != typeNodeMap_.end())
+ auto it = s_typeNodeMap.find(path.at(0));
+ if (it != s_typeNodeMap.end())
return it.value();
}
- return forest_.findTypeNode(path, relative, genus);
+ return m_forest.findTypeNode(path, relative, genus);
}
/*!
@@ -1334,8 +1334,8 @@ Node *QDocDatabase::findNodeInOpenNamespace(QStringList &path, bool (Node::*isMa
if (path.isEmpty())
return nullptr;
Node *n = nullptr;
- if (!openNamespaces_.isEmpty()) {
- const auto &openNamespaces = openNamespaces_;
+ if (!m_openNamespaces.isEmpty()) {
+ const auto &openNamespaces = m_openNamespaces;
for (const QString &t : openNamespaces) {
QStringList p;
if (t != path[0])
diff --git a/src/qdoc/qdocdatabase.h b/src/qdoc/qdocdatabase.h
index bbe14495c..76d4b63a7 100644
--- a/src/qdoc/qdocdatabase.h
+++ b/src/qdoc/qdocdatabase.h
@@ -59,18 +59,20 @@ class QDocForest
{
private:
friend class QDocDatabase;
- explicit QDocForest(QDocDatabase *qdb) : qdb_(qdb), primaryTree_(nullptr), currentIndex_(0) { }
+ explicit QDocForest(QDocDatabase *qdb) : m_qdb(qdb), m_primaryTree(nullptr), m_currentIndex(0)
+ {
+ }
~QDocForest();
NamespaceNode *nextRoot();
Tree *firstTree();
Tree *nextTree();
- Tree *primaryTree() { return primaryTree_; }
- Tree *findTree(const QString &t) { return forest_.value(t); }
- QStringList keys() { return forest_.keys(); }
- NamespaceNode *primaryTreeRoot() { return (primaryTree_ ? primaryTree_->root() : nullptr); }
+ Tree *primaryTree() { return m_primaryTree; }
+ Tree *findTree(const QString &t) { return m_forest.value(t); }
+ QStringList keys() { return m_forest.keys(); }
+ NamespaceNode *primaryTreeRoot() { return (m_primaryTree ? m_primaryTree->root() : nullptr); }
bool isEmpty() { return searchOrder().isEmpty(); }
- bool done() { return (currentIndex_ >= searchOrder().size()); }
+ bool done() { return (m_currentIndex >= searchOrder().size()); }
const QList<Tree *> &searchOrder();
const QList<Tree *> &indexSearchOrder();
void setSearchOrder(const QStringList &t);
@@ -180,19 +182,19 @@ private:
}
return nullptr;
}
- void clearSearchOrder() { searchOrder_.clear(); }
+ void clearSearchOrder() { m_searchOrder.clear(); }
void newPrimaryTree(const QString &module);
void setPrimaryTree(const QString &t);
NamespaceNode *newIndexTree(const QString &module);
private:
- QDocDatabase *qdb_;
- Tree *primaryTree_;
- int currentIndex_;
- QMap<QString, Tree *> forest_;
- QList<Tree *> searchOrder_;
- QList<Tree *> indexSearchOrder_;
- QList<QString> moduleNames_;
+ QDocDatabase *m_qdb;
+ Tree *m_primaryTree;
+ int m_currentIndex;
+ QMap<QString, Tree *> m_forest;
+ QList<Tree *> m_searchOrder;
+ QList<Tree *> m_indexSearchOrder;
+ QList<QString> m_moduleNames;
};
class QDocDatabase
@@ -202,7 +204,7 @@ public:
static void destroyQdocDB();
~QDocDatabase() = default;
- Tree *findTree(const QString &t) { return forest_.findTree(t); }
+ Tree *findTree(const QString &t) { return m_forest.findTree(t); }
const CNMap &groups() { return primaryTree()->groups(); }
const CNMap &modules() { return primaryTree()->modules(); }
@@ -239,22 +241,22 @@ public:
QmlTypeNode *findQmlType(const ImportRec &import, const QString &name);
Aggregate *findQmlBasicType(const QString &qmid, const QString &name);
- static NodeMultiMap &obsoleteClasses() { return obsoleteClasses_; }
- static NodeMultiMap &obsoleteQmlTypes() { return obsoleteQmlTypes_; }
- static NodeMultiMap &classesWithObsoleteMembers() { return classesWithObsoleteMembers_; }
- static NodeMultiMap &qmlTypesWithObsoleteMembers() { return qmlTypesWithObsoleteMembers_; }
- static NodeMultiMap &cppClasses() { return cppClasses_; }
- static NodeMultiMap &qmlBasicTypes() { return qmlBasicTypes_; }
- static NodeMultiMap &qmlTypes() { return qmlTypes_; }
- static NodeMultiMap &examples() { return examples_; }
- static NodeMultiMapMap &newClassMaps() { return newClassMaps_; }
- static NodeMultiMapMap &newQmlTypeMaps() { return newQmlTypeMaps_; }
- static NodeMultiMapMap &newSinceMaps() { return newSinceMaps_; }
+ static NodeMultiMap &obsoleteClasses() { return s_obsoleteClasses; }
+ static NodeMultiMap &obsoleteQmlTypes() { return s_obsoleteQmlTypes; }
+ static NodeMultiMap &classesWithObsoleteMembers() { return s_classesWithObsoleteMembers; }
+ static NodeMultiMap &qmlTypesWithObsoleteMembers() { return s_qmlTypesWithObsoleteMembers; }
+ static NodeMultiMap &cppClasses() { return s_cppClasses; }
+ static NodeMultiMap &qmlBasicTypes() { return s_qmlBasicTypes; }
+ static NodeMultiMap &qmlTypes() { return s_qmlTypes; }
+ static NodeMultiMap &examples() { return s_examples; }
+ static NodeMultiMapMap &newClassMaps() { return s_newClassMaps; }
+ static NodeMultiMapMap &newQmlTypeMaps() { return s_newQmlTypeMaps; }
+ static NodeMultiMapMap &newSinceMaps() { return s_newSinceMaps; }
private:
void findAllClasses(Aggregate *node) { node->findAllClasses(); }
- void findAllFunctions(Aggregate *node) { node->findAllFunctions(functionIndex_); }
- void findAllAttributions(Aggregate *node) { node->findAllAttributions(attributions_); }
+ void findAllFunctions(Aggregate *node) { node->findAllFunctions(m_functionIndex); }
+ void findAllAttributions(Aggregate *node) { node->findAllAttributions(m_attributions); }
void findAllLegaleseTexts(Aggregate *node);
void findAllObsoleteThings(Aggregate *node) { node->findAllObsoleteThings(); }
void findAllSince(Aggregate *node) { node->findAllSince(); }
@@ -309,23 +311,23 @@ public:
/*******************************************************************
The functions declared below are called for all trees.
********************************************************************/
- ClassNode *findClassNode(const QStringList &path) { return forest_.findClassNode(path); }
- Node *findNodeForInclude(const QStringList &path) { return forest_.findNodeForInclude(path); }
+ ClassNode *findClassNode(const QStringList &path) { return m_forest.findClassNode(path); }
+ Node *findNodeForInclude(const QStringList &path) { return m_forest.findNodeForInclude(path); }
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)
{
- return forest_.findPageNodeByTitle(title);
+ return m_forest.findPageNodeByTitle(title);
}
Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch)() const)
{
- return forest_.findNodeByNameAndType(path, isMatch);
+ return m_forest.findNodeByNameAndType(path, isMatch);
}
const CollectionNode *getCollectionNode(const QString &name, Node::NodeType type)
{
- return forest_.getCollectionNode(name, type);
+ return m_forest.getCollectionNode(name, type);
}
FunctionNode *findFunctionNodeForTag(const QString &tag)
{
@@ -339,12 +341,12 @@ private:
const Node *findNodeForTarget(QStringList &targetPath, const Node *relative, Node::Genus genus,
QString &ref)
{
- return forest_.findNodeForTarget(targetPath, relative, genus, ref);
+ return m_forest.findNodeForTarget(targetPath, relative, genus, ref);
}
const FunctionNode *findFunctionNode(const QStringList &path, const Parameters &parameters,
const Node *relative, Node::Genus genus)
{
- return forest_.findFunctionNode(path, parameters, relative, genus);
+ return m_forest.findFunctionNode(path, parameters, relative, genus);
}
/*******************************************************************/
@@ -355,31 +357,31 @@ public:
primaryTree()->addPropertyFunction(property, funcName, funcRole);
}
- void setVersion(const QString &v) { version_ = v; }
- QString version() const { return version_; }
+ void setVersion(const QString &v) { m_version = v; }
+ [[nodiscard]] QString version() const { return m_version; }
void readIndexes(const QStringList &indexFiles);
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); }
+ void clearOpenNamespaces() { m_openNamespaces.clear(); }
+ void insertOpenNamespace(const QString &path) { m_openNamespaces.insert(path); }
void processForest();
// Try to make this function private.
- 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); }
- NamespaceNode *newIndexTree(const QString &module) { return forest_.newIndexTree(module); }
- const QList<Tree *> &searchOrder() { return forest_.searchOrder(); }
- void setLocalSearch() { forest_.searchOrder_ = QList<Tree *>(1, primaryTree()); }
- void setSearchOrder(const QList<Tree *> &searchOrder) { forest_.searchOrder_ = searchOrder; }
- void setSearchOrder(QStringList &t) { forest_.setSearchOrder(t); }
+ QDocForest &forest() { return m_forest; }
+ NamespaceNode *primaryTreeRoot() { return m_forest.primaryTreeRoot(); }
+ void newPrimaryTree(const QString &module) { m_forest.newPrimaryTree(module); }
+ void setPrimaryTree(const QString &t) { m_forest.setPrimaryTree(t); }
+ NamespaceNode *newIndexTree(const QString &module) { return m_forest.newIndexTree(module); }
+ const QList<Tree *> &searchOrder() { return m_forest.searchOrder(); }
+ void setLocalSearch() { m_forest.m_searchOrder = QList<Tree *>(1, primaryTree()); }
+ void setSearchOrder(const QList<Tree *> &searchOrder) { m_forest.m_searchOrder = searchOrder; }
+ void setSearchOrder(QStringList &t) { m_forest.setSearchOrder(t); }
void mergeCollections(Node::NodeType type, CNMap &cnm, const Node *relative);
void mergeCollections(CollectionNode *c);
- void clearSearchOrder() { forest_.clearSearchOrder(); }
- QStringList keys() { return forest_.keys(); }
+ void clearSearchOrder() { m_forest.clearSearchOrder(); }
+ QStringList keys() { return m_forest.keys(); }
void resolveNamespaces();
void resolveProxies();
void resolveBaseClasses();
@@ -391,44 +393,43 @@ private:
const Node *findNode(const QStringList &path, const Node *relative, int findFlags,
Node::Genus genus)
{
- return forest_.findNode(path, relative, findFlags, genus);
+ return m_forest.findNode(path, relative, findFlags, genus);
}
void processForest(void (QDocDatabase::*)(Aggregate *));
- bool isLoaded(const QString &t) { return forest_.isLoaded(t); }
+ bool isLoaded(const QString &t) { return m_forest.isLoaded(t); }
static void initializeDB();
private:
QDocDatabase();
- QDocDatabase(QDocDatabase const &) : forest_(this) { }
+ QDocDatabase(QDocDatabase const &) : m_forest(this) { }
QDocDatabase &operator=(QDocDatabase const &);
public:
- static bool debug;
- Tree *primaryTree() { return forest_.primaryTree(); }
+ Tree *primaryTree() { return m_forest.primaryTree(); }
private:
- static QDocDatabase *qdocDB_;
- static NodeMap typeNodeMap_;
- static NodeMultiMap obsoleteClasses_;
- static NodeMultiMap classesWithObsoleteMembers_;
- static NodeMultiMap obsoleteQmlTypes_;
- static NodeMultiMap qmlTypesWithObsoleteMembers_;
- static NodeMultiMap cppClasses_;
- static NodeMultiMap qmlBasicTypes_;
- static NodeMultiMap qmlTypes_;
- static NodeMultiMap examples_;
- static NodeMultiMapMap newClassMaps_;
- static NodeMultiMapMap newQmlTypeMaps_;
- static NodeMultiMapMap newSinceMaps_;
-
- QString version_;
- QDocForest forest_;
-
- NodeMultiMap namespaceIndex_;
- NodeMultiMap attributions_;
- NodeMapMap functionIndex_;
- TextToNodeMap legaleseTexts_;
- QSet<QString> openNamespaces_;
+ static QDocDatabase *s_qdocDB;
+ static NodeMap s_typeNodeMap;
+ static NodeMultiMap s_obsoleteClasses;
+ static NodeMultiMap s_classesWithObsoleteMembers;
+ static NodeMultiMap s_obsoleteQmlTypes;
+ static NodeMultiMap s_qmlTypesWithObsoleteMembers;
+ static NodeMultiMap s_cppClasses;
+ static NodeMultiMap s_qmlBasicTypes;
+ static NodeMultiMap s_qmlTypes;
+ static NodeMultiMap s_examples;
+ static NodeMultiMapMap s_newClassMaps;
+ static NodeMultiMapMap s_newQmlTypeMaps;
+ static NodeMultiMapMap s_newSinceMaps;
+
+ QString m_version {};
+ QDocForest m_forest;
+
+ NodeMultiMap m_namespaceIndex {};
+ NodeMultiMap m_attributions {};
+ NodeMapMap m_functionIndex {};
+ TextToNodeMap m_legaleseTexts {};
+ QSet<QString> m_openNamespaces {};
};
QT_END_NAMESPACE
diff --git a/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdocindexfiles.cpp
index 729ff0626..7641bedcf 100644
--- a/src/qdoc/qdocindexfiles.cpp
+++ b/src/qdoc/qdocindexfiles.cpp
@@ -71,15 +71,15 @@ static IndexSectionWriter *post_ = nullptr;
This class handles qdoc index files.
*/
-QDocIndexFiles *QDocIndexFiles::qdocIndexFiles_ = nullptr;
+QDocIndexFiles *QDocIndexFiles::s_qdocIndexFiles = nullptr;
/*!
Constructs the singleton QDocIndexFiles.
*/
-QDocIndexFiles::QDocIndexFiles() : gen_(nullptr)
+QDocIndexFiles::QDocIndexFiles() : m_gen(nullptr)
{
- qdb_ = QDocDatabase::qdocDB();
- storeLocationInfo_ = Config::instance().getBool(CONFIG_LOCATIONINFO);
+ m_qdb = QDocDatabase::qdocDB();
+ m_storeLocationInfo = Config::instance().getBool(CONFIG_LOCATIONINFO);
}
/*!
@@ -87,8 +87,8 @@ QDocIndexFiles::QDocIndexFiles() : gen_(nullptr)
*/
QDocIndexFiles::~QDocIndexFiles()
{
- qdb_ = nullptr;
- gen_ = nullptr;
+ m_qdb = nullptr;
+ m_gen = nullptr;
}
/*!
@@ -97,9 +97,9 @@ QDocIndexFiles::~QDocIndexFiles()
*/
QDocIndexFiles *QDocIndexFiles::qdocIndexFiles()
{
- if (qdocIndexFiles_ == nullptr)
- qdocIndexFiles_ = new QDocIndexFiles;
- return qdocIndexFiles_;
+ if (s_qdocIndexFiles == nullptr)
+ s_qdocIndexFiles = new QDocIndexFiles;
+ return s_qdocIndexFiles;
}
/*!
@@ -107,9 +107,9 @@ QDocIndexFiles *QDocIndexFiles::qdocIndexFiles()
*/
void QDocIndexFiles::destroyQDocIndexFiles()
{
- if (qdocIndexFiles_ != nullptr) {
- delete qdocIndexFiles_;
- qdocIndexFiles_ = nullptr;
+ if (s_qdocIndexFiles != nullptr) {
+ delete s_qdocIndexFiles;
+ s_qdocIndexFiles = nullptr;
}
}
@@ -158,12 +158,12 @@ void QDocIndexFiles::readIndexFile(const QString &path)
QDir installDir(path.section('/', 0, -3) + '/' + Generator::outputSubdir());
indexUrl = installDir.relativeFilePath(path).section('/', 0, -2);
}
- project_ = attrs.value(QLatin1String("project")).toString();
+ m_project = attrs.value(QLatin1String("project")).toString();
QString indexTitle = attrs.value(QLatin1String("indexTitle")).toString();
- basesList_.clear();
- relatedNodes_.clear();
+ m_basesList.clear();
+ m_relatedNodes.clear();
- NamespaceNode *root = qdb_->newIndexTree(project_);
+ NamespaceNode *root = m_qdb->newIndexTree(m_project);
if (!root) {
qWarning() << "Issue parsing index tree" << path;
return;
@@ -235,7 +235,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
if (attributes.hasAttribute(QLatin1String("bases"))) {
QString bases = attributes.value(QLatin1String("bases")).toString();
if (!bases.isEmpty())
- basesList_.append(
+ m_basesList.append(
QPair<ClassNode *, QString>(static_cast<ClassNode *>(node), bases));
}
if (!indexUrl.isEmpty())
@@ -261,7 +261,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
qmlTypeNode->setTitle(attributes.value(QLatin1String("title")).toString());
QString logicalModuleName = attributes.value(QLatin1String("qml-module-name")).toString();
if (!logicalModuleName.isEmpty())
- qdb_->addToQmlModule(logicalModuleName, qmlTypeNode);
+ m_qdb->addToQmlModule(logicalModuleName, qmlTypeNode);
bool abstract = false;
if (attributes.value(QLatin1String("abstract")) == QLatin1String("true"))
abstract = true;
@@ -283,7 +283,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
qmlTypeNode->setTitle(attributes.value(QLatin1String("title")).toString());
QString logicalModuleName = attributes.value(QLatin1String("js-module-name")).toString();
if (!logicalModuleName.isEmpty())
- qdb_->addToQmlModule(logicalModuleName, qmlTypeNode);
+ m_qdb->addToQmlModule(logicalModuleName, qmlTypeNode);
bool abstract = false;
if (attributes.value(QLatin1String("abstract")) == QLatin1String("true"))
abstract = true;
@@ -346,14 +346,14 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
qmlPropertyNode->markReadOnly(readonly);
node = qmlPropertyNode;
} else if (elementName == QLatin1String("group")) {
- auto *collectionNode = qdb_->addGroup(name);
+ auto *collectionNode = m_qdb->addGroup(name);
collectionNode->setTitle(attributes.value(QLatin1String("title")).toString());
collectionNode->setSubtitle(attributes.value(QLatin1String("subtitle")).toString());
if (attributes.value(QLatin1String("seen")) == QLatin1String("true"))
collectionNode->markSeen();
node = collectionNode;
} else if (elementName == QLatin1String("module")) {
- auto *collectionNode = qdb_->addModule(name);
+ auto *collectionNode = m_qdb->addModule(name);
collectionNode->setTitle(attributes.value(QLatin1String("title")).toString());
collectionNode->setSubtitle(attributes.value(QLatin1String("subtitle")).toString());
if (attributes.value(QLatin1String("seen")) == QLatin1String("true"))
@@ -361,7 +361,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
node = collectionNode;
} else if (elementName == QLatin1String("qmlmodule")) {
QString t = attributes.value(QLatin1String("qml-module-name")).toString();
- auto *collectionNode = qdb_->addQmlModule(t);
+ auto *collectionNode = m_qdb->addQmlModule(t);
QStringList info;
info << t << attributes.value(QLatin1String("qml-module-version")).toString();
collectionNode->setLogicalModuleInfo(info);
@@ -372,7 +372,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
node = collectionNode;
} else if (elementName == QLatin1String("jsmodule")) {
QString t = attributes.value(QLatin1String("js-module-name")).toString();
- auto *collectionNode = qdb_->addJsModule(t);
+ auto *collectionNode = m_qdb->addJsModule(t);
QStringList info;
info << t << attributes.value(QLatin1String("js-module-version")).toString();
collectionNode->setLogicalModuleInfo(info);
@@ -580,7 +580,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
if (attributes.hasAttribute(QLatin1String("related"))) {
node->setRelatedNonmember(true);
- relatedNodes_ << node;
+ m_relatedNodes << node;
}
if (attributes.hasAttribute(QLatin1String("threadsafety"))) {
@@ -611,7 +611,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
QString physicalModuleName = attributes.value(QLatin1String("module")).toString();
if (!physicalModuleName.isEmpty())
- qdb_->addToModule(physicalModuleName, node);
+ m_qdb->addToModule(physicalModuleName, node);
if (!href.isEmpty()) {
node->setUrl(href);
// Include the index URL if it exists
@@ -633,7 +633,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
if (!groupsAttr.isEmpty()) {
const QStringList groupNames = groupsAttr.split(QLatin1Char(','));
for (const auto &group : groupNames) {
- qdb_->addToGroup(group, node);
+ m_qdb->addToGroup(group, node);
}
}
@@ -648,7 +648,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
Doc doc(location, location, QString(), emptySet, emptySet); // placeholder
node->setDoc(doc);
node->setIndexNodeFlag(); // Important: This node came from an index file.
- node->setOutputSubdirectory(project_.toLower());
+ node->setOutputSubdirectory(m_project.toLower());
QString briefAttr = attributes.value(QLatin1String("brief")).toString();
if (!briefAttr.isEmpty()) {
node->setReconstitutedBrief(briefAttr);
@@ -693,7 +693,7 @@ void QDocIndexFiles::insertTarget(TargetRec::TargetType type,
QString name = attributes.value(QLatin1String("name")).toString();
QString title = attributes.value(QLatin1String("title")).toString();
- qdb_->insertTarget(name, title, type, node, priority);
+ m_qdb->insertTarget(name, title, type, node, priority);
}
/*!
@@ -712,11 +712,11 @@ void QDocIndexFiles::insertTarget(TargetRec::TargetType type,
*/
void QDocIndexFiles::resolveIndex()
{
- for (const auto &pair : qAsConst(basesList_)) {
+ for (const auto &pair : qAsConst(m_basesList)) {
const QStringList bases = pair.second.split(QLatin1Char(','));
for (const auto &base : bases) {
QStringList basePath = base.split(QString("::"));
- Node *n = qdb_->findClassNode(basePath);
+ Node *n = m_qdb->findClassNode(basePath);
if (n)
pair.first->addResolvedBaseClass(Access::Public, static_cast<ClassNode *>(n));
else
@@ -724,7 +724,7 @@ void QDocIndexFiles::resolveIndex()
}
}
// No longer needed.
- basesList_.clear();
+ m_basesList.clear();
}
static QString getAccessString(Access t)
@@ -783,10 +783,10 @@ static QString getThreadSafenessString(Node::ThreadSafeness t)
*/
int QDocIndexFiles::indexForNode(Node *node)
{
- qsizetype i = relatedNodes_.indexOf(node);
+ qsizetype i = m_relatedNodes.indexOf(node);
if (i == -1) {
- i = relatedNodes_.size();
- relatedNodes_ << node;
+ i = m_relatedNodes.size();
+ m_relatedNodes << node;
}
return i;
}
@@ -797,7 +797,7 @@ int QDocIndexFiles::indexForNode(Node *node)
*/
bool QDocIndexFiles::adoptRelatedNode(Aggregate *adoptiveParent, int index)
{
- Node *related = relatedNodes_.value(index);
+ Node *related = m_relatedNodes.value(index);
if (adoptiveParent && related) {
adoptiveParent->adoptChild(related);
@@ -817,10 +817,10 @@ bool QDocIndexFiles::adoptRelatedNode(Aggregate *adoptiveParent, int index)
bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
IndexSectionWriter *post)
{
- if (gen_ == nullptr)
- gen_ = Generator::currentGenerator();
+ if (m_gen == nullptr)
+ m_gen = Generator::currentGenerator();
- Q_ASSERT(gen_);
+ Q_ASSERT(m_gen);
post_ = nullptr;
/*
@@ -937,7 +937,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
QString objName = node->name();
// Special case: only the root node should have an empty name.
- if (objName.isEmpty() && node != qdb_->primaryTreeRoot())
+ if (objName.isEmpty() && node != m_qdb->primaryTreeRoot())
return false;
writer.writeStartElement(nodeName);
@@ -966,7 +966,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
QString fullName = node->fullDocumentName();
if (fullName != objName)
writer.writeAttribute("fullname", fullName);
- href = gen_->fullDocumentLocation(node);
+ href = m_gen->fullDocumentLocation(node);
} else
href = node->name();
if (node->isQmlNode() || node->isJsNode()) {
@@ -986,7 +986,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
const Location &declLocation = node->declLocation();
if (!declLocation.fileName().isEmpty())
writer.writeAttribute("location", declLocation.fileName());
- if (storeLocationInfo_ && !declLocation.filePath().isEmpty()) {
+ if (m_storeLocationInfo && !declLocation.filePath().isEmpty()) {
writer.writeAttribute("filepath", declLocation.filePath());
writer.writeAttribute("lineno", QString("%1").arg(declLocation.lineNo()));
}
@@ -1000,7 +1000,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
if (node->hasDoc())
writer.writeAttribute("documented", "true");
- QStringList groups = qdb_->groupNamesForNode(node);
+ QStringList groups = m_qdb->groupNamesForNode(node);
if (!groups.isEmpty())
writer.writeAttribute("groups", groups.join(QLatin1Char(',')));
@@ -1314,13 +1314,13 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
}
// WebXMLGenerator - skip the nested <page> elements for example
// files/images, as the generator produces them separately
- if (node->isExample() && gen_->format() != QLatin1String("WebXML")) {
+ if (node->isExample() && m_gen->format() != QLatin1String("WebXML")) {
const auto *exampleNode = static_cast<const ExampleNode *>(node);
const auto &files = exampleNode->files();
for (const QString &file : files) {
writer.writeStartElement("page");
writer.writeAttribute("name", file);
- QString href = gen_->linkForExampleFile(file, exampleNode);
+ QString href = m_gen->linkForExampleFile(file, exampleNode);
writer.writeAttribute("href", href);
writer.writeAttribute("status", "active");
writer.writeAttribute("subtype", "file");
@@ -1333,7 +1333,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
for (const QString &file : images) {
writer.writeStartElement("page");
writer.writeAttribute("name", file);
- QString href = gen_->linkForExampleFile(file, exampleNode);
+ QString href = m_gen->linkForExampleFile(file, exampleNode);
writer.writeAttribute("href", href);
writer.writeAttribute("status", "active");
writer.writeAttribute("subtype", "image");
@@ -1364,7 +1364,7 @@ void QDocIndexFiles::generateFunctionSection(QXmlStreamWriter &writer, FunctionN
QString fullName = fn->fullDocumentName();
if (fullName != objName)
writer.writeAttribute("fullname", fullName);
- QString href = gen_->fullDocumentLocation(fn);
+ QString href = m_gen->fullDocumentLocation(fn);
if (!href.isEmpty())
writer.writeAttribute("href", href);
if (fn->threadSafeness() != Node::UnspecifiedSafeness)
@@ -1375,7 +1375,7 @@ void QDocIndexFiles::generateFunctionSection(QXmlStreamWriter &writer, FunctionN
const Location &declLocation = fn->declLocation();
if (!declLocation.fileName().isEmpty())
writer.writeAttribute("location", declLocation.fileName());
- if (storeLocationInfo_ && !declLocation.filePath().isEmpty()) {
+ if (m_storeLocationInfo && !declLocation.filePath().isEmpty()) {
writer.writeAttribute("filepath", declLocation.filePath());
writer.writeAttribute("lineno", QString("%1").arg(declLocation.lineNo()));
}
@@ -1436,7 +1436,7 @@ void QDocIndexFiles::generateFunctionSection(QXmlStreamWriter &writer, FunctionN
signature += " = 0";
writer.writeAttribute("signature", signature);
- QStringList groups = qdb_->groupNamesForNode(fn);
+ QStringList groups = m_qdb->groupNamesForNode(fn);
if (!groups.isEmpty())
writer.writeAttribute("groups", groups.join(QLatin1Char(',')));
@@ -1527,7 +1527,7 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
create the group, module, or QML module element and add each member to
its member list.
*/
- const CNMap &groups = qdb_->groups();
+ const CNMap &groups = m_qdb->groups();
if (!groups.isEmpty()) {
for (auto it = groups.constBegin(); it != groups.constEnd(); ++it) {
if (generateIndexSection(writer, it.value(), post))
@@ -1535,7 +1535,7 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
}
}
- const CNMap &modules = qdb_->modules();
+ const CNMap &modules = m_qdb->modules();
if (!modules.isEmpty()) {
for (auto it = modules.constBegin(); it != modules.constEnd(); ++it) {
if (generateIndexSection(writer, it.value(), post))
@@ -1543,7 +1543,7 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
}
}
- const CNMap &qmlModules = qdb_->qmlModules();
+ const CNMap &qmlModules = m_qdb->qmlModules();
if (!qmlModules.isEmpty()) {
for (auto it = qmlModules.constBegin(); it != qmlModules.constEnd(); ++it) {
if (generateIndexSection(writer, it.value(), post))
@@ -1551,7 +1551,7 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
}
}
- const CNMap &jsModules = qdb_->jsModules();
+ const CNMap &jsModules = m_qdb->jsModules();
if (!jsModules.isEmpty()) {
for (auto it = jsModules.constBegin(); it != jsModules.constEnd(); ++it) {
if (generateIndexSection(writer, it.value(), post))
@@ -1579,8 +1579,8 @@ void QDocIndexFiles::generateIndex(const QString &fileName, const QString &url,
qCDebug(lcQdoc) << "Writing index file:" << fileName;
- gen_ = g;
- relatedNodes_.clear();
+ m_gen = g;
+ m_relatedNodes.clear();
QXmlStreamWriter writer(&file);
writer.setAutoFormatting(true);
writer.writeStartDocument();
@@ -1589,10 +1589,10 @@ void QDocIndexFiles::generateIndex(const QString &fileName, const QString &url,
writer.writeStartElement("INDEX");
writer.writeAttribute("url", url);
writer.writeAttribute("title", title);
- writer.writeAttribute("version", qdb_->version());
+ writer.writeAttribute("version", m_qdb->version());
writer.writeAttribute("project", Config::instance().getString(CONFIG_PROJECT));
- root_ = qdb_->primaryTreeRoot();
+ root_ = m_qdb->primaryTreeRoot();
if (!root_->tree()->indexTitle().isEmpty())
writer.writeAttribute("indexTitle", root_->tree()->indexTitle());
diff --git a/src/qdoc/qdocindexfiles.h b/src/qdoc/qdocindexfiles.h
index e161189ba..242c8675b 100644
--- a/src/qdoc/qdocindexfiles.h
+++ b/src/qdoc/qdocindexfiles.h
@@ -47,7 +47,7 @@ class QXmlStreamAttributes;
class IndexSectionWriter
{
public:
- virtual ~IndexSectionWriter() {}
+ virtual ~IndexSectionWriter() = default;
virtual void append(QXmlStreamWriter &writer, Node *node) = 0;
};
@@ -82,13 +82,13 @@ private:
IndexSectionWriter *post = nullptr);
private:
- static QDocIndexFiles *qdocIndexFiles_;
- QDocDatabase *qdb_;
- Generator *gen_;
- QString project_;
- QList<QPair<ClassNode *, QString>> basesList_;
- NodeList relatedNodes_;
- bool storeLocationInfo_;
+ static QDocIndexFiles *s_qdocIndexFiles;
+ QDocDatabase *m_qdb {};
+ Generator *m_gen {};
+ QString m_project;
+ QList<QPair<ClassNode *, QString>> m_basesList;
+ NodeList m_relatedNodes;
+ bool m_storeLocationInfo;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/qmlcodemarker.h b/src/qdoc/qmlcodemarker.h
index ef409750c..6f6fc6990 100644
--- a/src/qdoc/qmlcodemarker.h
+++ b/src/qdoc/qmlcodemarker.h
@@ -46,7 +46,7 @@ public:
bool recognizeCode(const QString &code) override;
bool recognizeExtension(const QString &ext) override;
bool recognizeLanguage(const QString &language) override;
- Atom::AtomType atomType() const override;
+ [[nodiscard]] Atom::AtomType atomType() const override;
QString markedUpCode(const QString &code, const Node *relative,
const Location &location) override;
diff --git a/src/qdoc/qmlcodeparser.cpp b/src/qdoc/qmlcodeparser.cpp
index ad15b5628..e89290bf4 100644
--- a/src/qdoc/qmlcodeparser.cpp
+++ b/src/qdoc/qmlcodeparser.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
*/
QmlCodeParser::QmlCodeParser()
#ifndef QT_NO_DECLARATIVE
- : lexer(nullptr), parser(nullptr)
+ : m_lexer(nullptr), m_parser(nullptr)
#endif
{
}
@@ -57,8 +57,8 @@ void QmlCodeParser::initializeParser()
CodeParser::initializeParser();
#ifndef QT_NO_DECLARATIVE
- lexer = new QQmlJS::Lexer(&engine);
- parser = new QQmlJS::Parser(&engine);
+ m_lexer = new QQmlJS::Lexer(&m_engine);
+ m_parser = new QQmlJS::Parser(&m_engine);
#endif
}
@@ -69,8 +69,8 @@ void QmlCodeParser::initializeParser()
void QmlCodeParser::terminateParser()
{
#ifndef QT_NO_DECLARATIVE
- delete lexer;
- delete parser;
+ delete m_lexer;
+ delete m_parser;
#endif
}
@@ -101,10 +101,10 @@ QStringList QmlCodeParser::sourceFileNameFilter()
void QmlCodeParser::parseSourceFile(const Location &location, const QString &filePath)
{
QFile in(filePath);
- currentFile_ = filePath;
+ m_currentFile = filePath;
if (!in.open(QIODevice::ReadOnly)) {
location.error(QStringLiteral("Cannot open QML file '%1'").arg(filePath));
- currentFile_.clear();
+ m_currentFile.clear();
return;
}
@@ -116,11 +116,11 @@ void QmlCodeParser::parseSourceFile(const Location &location, const QString &fil
QString newCode = document;
extractPragmas(newCode);
- lexer->setCode(newCode, 1);
+ m_lexer->setCode(newCode, 1);
- if (parser->parse()) {
- QQmlJS::AST::UiProgram *ast = parser->ast();
- QmlDocVisitor visitor(filePath, newCode, &engine, topicCommands() + commonMetaCommands(),
+ if (m_parser->parse()) {
+ QQmlJS::AST::UiProgram *ast = m_parser->ast();
+ QmlDocVisitor visitor(filePath, newCode, &m_engine, topicCommands() + commonMetaCommands(),
topicCommands());
QQmlJS::AST::Node::accept(ast, &visitor);
if (visitor.hasError()) {
@@ -128,14 +128,14 @@ void QmlCodeParser::parseSourceFile(const Location &location, const QString &fil
<< "The output is incomplete.";
}
}
- const auto &messages = parser->diagnosticMessages();
+ const auto &messages = m_parser->diagnosticMessages();
for (const auto &msg : messages) {
qDebug().nospace() << qPrintable(filePath) << ':'
<< msg.loc.startLine << ": QML syntax error at col "
<< msg.loc.startColumn
<< ": " << qPrintable(msg.message);
}
- currentFile_.clear();
+ m_currentFile.clear();
#else
location.warning("QtDeclarative not installed; cannot parse QML or JS.");
#endif
diff --git a/src/qdoc/qmlcodeparser.h b/src/qdoc/qmlcodeparser.h
index 4a6dbe0ca..b8b141681 100644
--- a/src/qdoc/qmlcodeparser.h
+++ b/src/qdoc/qmlcodeparser.h
@@ -66,9 +66,9 @@ protected:
private:
#ifndef QT_NO_DECLARATIVE
- QQmlJS::Engine engine;
- QQmlJS::Lexer *lexer;
- QQmlJS::Parser *parser;
+ QQmlJS::Engine m_engine {};
+ QQmlJS::Lexer *m_lexer { nullptr };
+ QQmlJS::Parser *m_parser { nullptr };
#endif
};
diff --git a/src/qdoc/qmlmarkupvisitor.cpp b/src/qdoc/qmlmarkupvisitor.cpp
index 24d60f3bc..65c3955dc 100644
--- a/src/qdoc/qmlmarkupvisitor.cpp
+++ b/src/qdoc/qmlmarkupvisitor.cpp
@@ -43,11 +43,11 @@ QmlMarkupVisitor::QmlMarkupVisitor(const QString &source,
const QList<QQmlJS::SourceLocation> &pragmas,
QQmlJS::Engine *engine)
{
- this->source = source;
- this->engine = engine;
+ this->m_source = source;
+ this->m_engine = engine;
- cursor = 0;
- extraIndex = 0;
+ m_cursor = 0;
+ m_extraIndex = 0;
// Merge the lists of locations of pragmas and comments in the source code.
int i = 0;
@@ -55,25 +55,25 @@ QmlMarkupVisitor::QmlMarkupVisitor(const QString &source,
const QList<QQmlJS::SourceLocation> comments = engine->comments();
while (i < comments.size() && j < pragmas.length()) {
if (comments[i].offset < pragmas[j].offset) {
- extraTypes.append(Comment);
- extraLocations.append(comments[i]);
+ m_extraTypes.append(Comment);
+ m_extraLocations.append(comments[i]);
++i;
} else {
- extraTypes.append(Pragma);
- extraLocations.append(comments[j]);
+ m_extraTypes.append(Pragma);
+ m_extraLocations.append(comments[j]);
++j;
}
}
while (i < comments.size()) {
- extraTypes.append(Comment);
- extraLocations.append(comments[i]);
+ m_extraTypes.append(Comment);
+ m_extraLocations.append(comments[i]);
++i;
}
while (j < pragmas.length()) {
- extraTypes.append(Pragma);
- extraLocations.append(pragmas[j]);
+ m_extraTypes.append(Pragma);
+ m_extraLocations.append(pragmas[j]);
++j;
}
}
@@ -114,73 +114,73 @@ QString QmlMarkupVisitor::protect(const QString &str)
QString QmlMarkupVisitor::markedUpCode()
{
- if (int(cursor) < source.length())
- addExtra(cursor, source.length());
+ if (int(m_cursor) < m_source.length())
+ addExtra(m_cursor, m_source.length());
- return output;
+ return m_output;
}
bool QmlMarkupVisitor::hasError() const
{
- return hasRecursionDepthError;
+ return m_hasRecursionDepthError;
}
void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish)
{
- if (extraIndex >= extraLocations.length()) {
- QString extra = source.mid(start, finish - start);
+ if (m_extraIndex >= m_extraLocations.length()) {
+ QString extra = m_source.mid(start, finish - start);
if (extra.trimmed().isEmpty())
- output += extra;
+ m_output += extra;
else
- output += protect(extra); // text that should probably have been caught by the parser
+ m_output += protect(extra); // text that should probably have been caught by the parser
- cursor = finish;
+ m_cursor = finish;
return;
}
- while (extraIndex < extraLocations.length()) {
- if (extraTypes[extraIndex] == Comment) {
- if (extraLocations[extraIndex].offset - 2 >= start)
+ while (m_extraIndex < m_extraLocations.length()) {
+ if (m_extraTypes[m_extraIndex] == Comment) {
+ if (m_extraLocations[m_extraIndex].offset - 2 >= start)
break;
} else {
- if (extraLocations[extraIndex].offset >= start)
+ if (m_extraLocations[m_extraIndex].offset >= start)
break;
}
- extraIndex++;
+ m_extraIndex++;
}
quint32 i = start;
- while (i < finish && extraIndex < extraLocations.length()) {
- quint32 j = extraLocations[extraIndex].offset - 2;
+ while (i < finish && m_extraIndex < m_extraLocations.length()) {
+ quint32 j = m_extraLocations[m_extraIndex].offset - 2;
if (i <= j && j < finish) {
if (i < j)
- output += protect(source.mid(i, j - i));
+ m_output += protect(m_source.mid(i, j - i));
- quint32 l = extraLocations[extraIndex].length;
- if (extraTypes[extraIndex] == Comment) {
- if (source.mid(j, 2) == QLatin1String("/*"))
+ quint32 l = m_extraLocations[m_extraIndex].length;
+ if (m_extraTypes[m_extraIndex] == Comment) {
+ if (m_source.mid(j, 2) == QLatin1String("/*"))
l += 4;
else
l += 2;
- output += QLatin1String("<@comment>");
- output += protect(source.mid(j, l));
- output += QLatin1String("</@comment>");
+ m_output += QLatin1String("<@comment>");
+ m_output += protect(m_source.mid(j, l));
+ m_output += QLatin1String("</@comment>");
} else
- output += protect(source.mid(j, l));
+ m_output += protect(m_source.mid(j, l));
- extraIndex++;
+ m_extraIndex++;
i = j + l;
} else
break;
}
- QString extra = source.mid(i, finish - i);
+ QString extra = m_source.mid(i, finish - i);
if (extra.trimmed().isEmpty())
- output += extra;
+ m_output += extra;
else
- output += protect(extra); // text that should probably have been caught by the parser
+ m_output += protect(extra); // text that should probably have been caught by the parser
- cursor = finish;
+ m_cursor = finish;
}
void QmlMarkupVisitor::addMarkedUpToken(QQmlJS::SourceLocation &location,
@@ -190,21 +190,21 @@ void QmlMarkupVisitor::addMarkedUpToken(QQmlJS::SourceLocation &location,
if (!location.isValid())
return;
- if (cursor < location.offset)
- addExtra(cursor, location.offset);
- else if (cursor > location.offset)
+ if (m_cursor < location.offset)
+ addExtra(m_cursor, location.offset);
+ else if (m_cursor > location.offset)
return;
- output += QString(QLatin1String("<@%1")).arg(tagName);
+ m_output += QString(QLatin1String("<@%1")).arg(tagName);
for (const auto &key : attributes)
- output += QString(QLatin1String(" %1=\"%2\"")).arg(key, attributes[key]);
- output += QString(QLatin1String(">%2</@%3>")).arg(protect(sourceText(location)), tagName);
- cursor += location.length;
+ m_output += QString(QLatin1String(" %1=\"%2\"")).arg(key, attributes[key]);
+ m_output += QString(QLatin1String(">%2</@%3>")).arg(protect(sourceText(location)), tagName);
+ m_cursor += location.length;
}
QString QmlMarkupVisitor::sourceText(QQmlJS::SourceLocation &location)
{
- return source.mid(location.offset, location.length);
+ return m_source.mid(location.offset, location.length);
}
void QmlMarkupVisitor::addVerbatim(QQmlJS::SourceLocation first,
@@ -220,14 +220,14 @@ void QmlMarkupVisitor::addVerbatim(QQmlJS::SourceLocation first,
else
finish = first.end();
- if (cursor < start)
- addExtra(cursor, start);
- else if (cursor > start)
+ if (m_cursor < start)
+ addExtra(m_cursor, start);
+ else if (m_cursor > start)
return;
- QString text = source.mid(start, finish - start);
- output += protect(text);
- cursor = finish;
+ QString text = m_source.mid(start, finish - start);
+ m_output += protect(text);
+ m_cursor = finish;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UiImport *uiimport)
@@ -816,7 +816,7 @@ bool QmlMarkupVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
void QmlMarkupVisitor::throwRecursionDepthError()
{
- hasRecursionDepthError = true;
+ m_hasRecursionDepthError = true;
}
#endif
diff --git a/src/qdoc/qmlmarkupvisitor.h b/src/qdoc/qmlmarkupvisitor.h
index efc3e36f7..936d217a1 100644
--- a/src/qdoc/qmlmarkupvisitor.h
+++ b/src/qdoc/qmlmarkupvisitor.h
@@ -50,7 +50,7 @@ public:
~QmlMarkupVisitor() override = default;
QString markedUpCode();
- bool hasError() const;
+ [[nodiscard]] bool hasError() const;
bool visit(QQmlJS::AST::UiImport *) override;
void endVisit(QQmlJS::AST::UiImport *) override;
@@ -149,14 +149,14 @@ private:
QString sourceText(QQmlJS::SourceLocation &location);
void throwRecursionDepthError() final;
- QQmlJS::Engine *engine;
- QList<ExtraType> extraTypes;
- QList<QQmlJS::SourceLocation> extraLocations;
- QString source;
- QString output;
- quint32 cursor;
- int extraIndex;
- bool hasRecursionDepthError = false;
+ QQmlJS::Engine *m_engine { nullptr };
+ QList<ExtraType> m_extraTypes {};
+ QList<QQmlJS::SourceLocation> m_extraLocations {};
+ QString m_source {};
+ QString m_output {};
+ quint32 m_cursor {};
+ int m_extraIndex {};
+ bool m_hasRecursionDepthError { false };
};
Q_DECLARE_TYPEINFO(QmlMarkupVisitor::ExtraType, Q_PRIMITIVE_TYPE);
diff --git a/src/qdoc/qmlpropertynode.h b/src/qdoc/qmlpropertynode.h
index 7665f9a2b..07f2c7f43 100644
--- a/src/qdoc/qmlpropertynode.h
+++ b/src/qdoc/qmlpropertynode.h
@@ -48,22 +48,31 @@ public:
void setDesignable(bool designable) { m_designable = toFlagValue(designable); }
void setRequired() { m_required = toFlagValue(true); }
- const QString &dataType() const { return m_type; }
- const QString &defaultValue() const { return m_defaultValue; }
- bool isReadOnlySet() const { return (readOnly_ != FlagValueDefault); }
- bool isStored() const { return fromFlagValue(m_stored, true); }
+ [[nodiscard]] const QString &dataType() const { return m_type; }
+ [[nodiscard]] const QString &defaultValue() const { return m_defaultValue; }
+ [[nodiscard]] bool isReadOnlySet() const { return (readOnly_ != FlagValueDefault); }
+ [[nodiscard]] bool isStored() const { return fromFlagValue(m_stored, true); }
bool isWritable();
bool isRequired();
- bool isDefault() const override { return m_isDefault; }
- bool isReadOnly() const override { return fromFlagValue(readOnly_, false); }
- bool isAlias() const override { return m_isAlias; }
- bool isAttached() const override { return m_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 element() const override { return parent()->name(); }
+ [[nodiscard]] bool isDefault() const override { return m_isDefault; }
+ [[nodiscard]] bool isReadOnly() const override { return fromFlagValue(readOnly_, false); }
+ [[nodiscard]] bool isAlias() const override { return m_isAlias; }
+ [[nodiscard]] bool isAttached() const override { return m_attached; }
+ [[nodiscard]] bool isQtQuickNode() const override { return parent()->isQtQuickNode(); }
+ [[nodiscard]] QString qmlTypeName() const override { return parent()->qmlTypeName(); }
+ [[nodiscard]] QString logicalModuleName() const override
+ {
+ return parent()->logicalModuleName();
+ }
+ [[nodiscard]] QString logicalModuleVersion() const override
+ {
+ return parent()->logicalModuleVersion();
+ }
+ [[nodiscard]] QString logicalModuleIdentifier() const override
+ {
+ return parent()->logicalModuleIdentifier();
+ }
+ [[nodiscard]] QString element() const override { return parent()->name(); }
void markDefault() override { m_isDefault = true; }
void markReadOnly(bool flag) override { readOnly_ = toFlagValue(flag); }
diff --git a/src/qdoc/qmltypenode.cpp b/src/qdoc/qmltypenode.cpp
index bc58d964a..ffa0eb47a 100644
--- a/src/qdoc/qmltypenode.cpp
+++ b/src/qdoc/qmltypenode.cpp
@@ -34,7 +34,7 @@
QT_BEGIN_NAMESPACE
-QMultiMap<const Node *, Node *> QmlTypeNode::inheritedBy;
+QMultiMap<const Node *, Node *> QmlTypeNode::s_inheritedBy;
/*!
Constructs a Qml type node or a Js type node depending on
@@ -54,7 +54,7 @@ QmlTypeNode::QmlTypeNode(Aggregate *parent, const QString &name, NodeType type)
*/
void QmlTypeNode::terminate()
{
- inheritedBy.clear();
+ s_inheritedBy.clear();
}
/*!
@@ -65,8 +65,8 @@ void QmlTypeNode::addInheritedBy(const Node *base, Node *sub)
{
if (sub->isInternal())
return;
- if (!inheritedBy.contains(base, sub))
- inheritedBy.insert(base, sub);
+ if (!s_inheritedBy.contains(base, sub))
+ s_inheritedBy.insert(base, sub);
}
/*!
@@ -75,8 +75,8 @@ void QmlTypeNode::addInheritedBy(const Node *base, Node *sub)
void QmlTypeNode::subclasses(const Node *base, NodeList &subs)
{
subs.clear();
- if (inheritedBy.count(base) > 0) {
- subs = inheritedBy.values(base);
+ if (s_inheritedBy.count(base) > 0) {
+ subs = s_inheritedBy.values(base);
}
}
diff --git a/src/qdoc/qmltypenode.h b/src/qdoc/qmltypenode.h
index 81067d6f6..612564dc4 100644
--- a/src/qdoc/qmltypenode.h
+++ b/src/qdoc/qmltypenode.h
@@ -47,40 +47,40 @@ class QmlTypeNode : public Aggregate
{
public:
QmlTypeNode(Aggregate *parent, const QString &name, NodeType type = QmlType);
- bool isFirstClassAggregate() const override { return true; }
- bool isQtQuickNode() const override
+ [[nodiscard]] bool isFirstClassAggregate() const override { return true; }
+ [[nodiscard]] bool isQtQuickNode() const override
{
return (logicalModuleName() == QLatin1String("QtQuick"));
}
ClassNode *classNode() override { return m_classNode; }
void setClassNode(ClassNode *cn) override { m_classNode = cn; }
- bool isAbstract() const override { return m_abstract; }
- bool isWrapper() const override { return m_wrapper; }
+ [[nodiscard]] bool isAbstract() const override { return m_abstract; }
+ [[nodiscard]] bool isWrapper() const override { return m_wrapper; }
void setAbstract(bool b) override { m_abstract = b; }
void setWrapper() override { m_wrapper = true; }
- bool isInternal() const override { return (status() == Internal); }
- QString qmlFullBaseName() const override;
- QString obsoleteLink() const override { return m_obsoleteLink; }
+ [[nodiscard]] bool isInternal() const override { return (status() == Internal); }
+ [[nodiscard]] QString qmlFullBaseName() const override;
+ [[nodiscard]] QString obsoleteLink() const override { return m_obsoleteLink; }
void setObsoleteLink(const QString &t) override { m_obsoleteLink = t; }
- QString logicalModuleName() const override;
- QString logicalModuleVersion() const override;
- QString logicalModuleIdentifier() const override;
- CollectionNode *logicalModule() const override { return m_logicalModule; }
+ [[nodiscard]] QString logicalModuleName() const override;
+ [[nodiscard]] QString logicalModuleVersion() const override;
+ [[nodiscard]] QString logicalModuleIdentifier() const override;
+ [[nodiscard]] CollectionNode *logicalModule() const override { return m_logicalModule; }
void setQmlModule(CollectionNode *t) override { m_logicalModule = t; }
void setImportList(const ImportList &il) { m_importList = il; }
- const QString &qmlBaseName() const { return m_qmlBaseName; }
+ [[nodiscard]] const QString &qmlBaseName() const { return m_qmlBaseName; }
void setQmlBaseName(const QString &name) { m_qmlBaseName = name; }
- QmlTypeNode *qmlBaseNode() const override { return m_qmlBaseNode; }
+ [[nodiscard]] QmlTypeNode *qmlBaseNode() const override { return m_qmlBaseNode; }
void resolveInheritance(NodeMap &previousSearches);
- bool cppClassRequired() const { return m_classNodeRequired; }
+ [[nodiscard]] bool cppClassRequired() const { return m_classNodeRequired; }
static void addInheritedBy(const Node *base, Node *sub);
static void subclasses(const Node *base, NodeList &subs);
static void terminate();
bool inherits(Aggregate *type);
public:
- static QMultiMap<const Node *, Node *> inheritedBy;
+ static QMultiMap<const Node *, Node *> s_inheritedBy;
private:
bool m_abstract { false };
@@ -98,7 +98,7 @@ class QmlBasicTypeNode : public Aggregate
{
public:
QmlBasicTypeNode(Aggregate *parent, const QString &name, NodeType type = QmlBasicType);
- bool isFirstClassAggregate() const override { return true; }
+ [[nodiscard]] bool isFirstClassAggregate() const override { return true; }
};
QT_END_NAMESPACE
diff --git a/src/qdoc/qmlvisitor.cpp b/src/qdoc/qmlvisitor.cpp
index 1998f3238..5d32fc481 100644
--- a/src/qdoc/qmlvisitor.cpp
+++ b/src/qdoc/qmlvisitor.cpp
@@ -54,16 +54,16 @@ QT_BEGIN_NAMESPACE
*/
QmlDocVisitor::QmlDocVisitor(const QString &filePath, const QString &code, QQmlJS::Engine *engine,
const QSet<QString> &commands, const QSet<QString> &topics)
- : nestingLevel(0)
-{
- lastEndOffset = 0;
- this->filePath_ = filePath;
- this->name = QFileInfo(filePath).baseName();
- document = code;
- this->engine = engine;
- this->commands_ = commands;
- this->topics_ = topics;
- current = QDocDatabase::qdocDB()->primaryTreeRoot();
+ : m_nestingLevel(0)
+{
+ m_lastEndOffset = 0;
+ this->m_filePath = filePath;
+ this->m_name = QFileInfo(filePath).baseName();
+ m_document = code;
+ this->m_engine = engine;
+ this->m_commands = commands;
+ this->m_topics = topics;
+ m_current = QDocDatabase::qdocDB()->primaryTreeRoot();
}
/*!
@@ -71,20 +71,20 @@ QmlDocVisitor::QmlDocVisitor(const QString &filePath, const QString &code, QQmlJ
*/
QQmlJS::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) const
{
- const auto comments = engine->comments();
+ const auto comments = m_engine->comments();
for (auto it = comments.rbegin(); it != comments.rend(); ++it) {
QQmlJS::SourceLocation loc = *it;
- if (loc.begin() <= lastEndOffset) {
+ if (loc.begin() <= m_lastEndOffset) {
// Return if we reach the end of the preceding structure.
break;
- } else if (usedComments.contains(loc.begin())) {
+ } else if (m_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() > m_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);
+ if (m_document.at(loc.offset - 1) == QLatin1Char('*')) {
+ QString comment = m_document.mid(loc.offset, loc.length);
if (comment.startsWith(QLatin1Char('!')) || comment.startsWith(QLatin1Char('*'))) {
return loc;
}
@@ -131,15 +131,15 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::SourceLocation location, Node *no
QQmlJS::SourceLocation loc = precedingComment(location.begin());
if (loc.isValid()) {
- QString source = document.mid(loc.offset, loc.length);
- Location start(filePath_);
+ QString source = m_document.mid(loc.offset, loc.length);
+ Location start(m_filePath);
start.setLineNo(loc.startLine);
start.setColumnNo(loc.startColumn);
- Location finish(filePath_);
+ Location finish(m_filePath);
finish.setLineNo(loc.startLine);
finish.setColumnNo(loc.startColumn);
- Doc doc(start, finish, source.mid(1), commands_, topics_);
+ Doc doc(start, finish, source.mid(1), m_commands, m_topics);
const TopicList &topicsUsed = doc.topicsUsed();
NodeList nodes;
Node *nodePassedIn = node;
@@ -148,24 +148,24 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::SourceLocation location, Node *no
nodes.append(node);
if (!topicsUsed.empty()) {
for (int i = 0; i < topicsUsed.size(); ++i) {
- QString topic = topicsUsed.at(i).topic;
+ QString topic = topicsUsed.at(i).m_topic;
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;
+ QString args = topicsUsed.at(i).m_args;
if (topic == COMMAND_JSTYPE) {
node->changeType(Node::QmlType, Node::JsType);
} else if (topic.endsWith(QLatin1String("property"))) {
QmlPropArgs qpa;
if (splitQmlPropertyArg(doc, args, qpa)) {
- if (qpa.name_ == nodePassedIn->name()) {
+ if (qpa.m_name == nodePassedIn->name()) {
if (nodePassedIn->isAlias())
- nodePassedIn->setDataType(qpa.type_);
+ nodePassedIn->setDataType(qpa.m_type);
} else {
bool isAttached = topic.contains(QLatin1String("attached"));
- QmlPropertyNode *n = parent->hasQmlProperty(qpa.name_, isAttached);
+ QmlPropertyNode *n = parent->hasQmlProperty(qpa.m_name, isAttached);
if (n == nullptr)
- n = new QmlPropertyNode(parent, qpa.name_, qpa.type_, isAttached);
+ n = new QmlPropertyNode(parent, qpa.m_name, qpa.m_type, isAttached);
n->setLocation(doc.location());
n->setDoc(doc);
n->markReadOnly(nodePassedIn->isReadOnly());
@@ -192,13 +192,13 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::SourceLocation location, Node *no
}
for (const auto &node : nodes)
applyMetacommands(loc, node, doc);
- usedComments.insert(loc.offset);
+ m_usedComments.insert(loc.offset);
if (doc.isEmpty()) {
return false;
}
return true;
}
- Location codeLoc(filePath_);
+ Location codeLoc(m_filePath);
codeLoc.setLineNo(location.startLine);
node->setLocation(codeLoc);
return false;
@@ -384,19 +384,19 @@ bool QmlDocVisitor::splitQmlPropertyArg(const Doc &doc, const QString &arg, QmlP
qpa.clear();
QStringList blankSplit = arg.split(QLatin1Char(' '));
if (blankSplit.size() > 1) {
- qpa.type_ = blankSplit[0];
+ qpa.m_type = blankSplit[0];
QStringList colonSplit(blankSplit[1].split("::"));
if (colonSplit.size() == 3) {
- qpa.module_ = colonSplit[0];
- qpa.component_ = colonSplit[1];
- qpa.name_ = colonSplit[2];
+ qpa.m_module = colonSplit[0];
+ qpa.m_component = colonSplit[1];
+ qpa.m_name = colonSplit[2];
return true;
} else if (colonSplit.size() == 2) {
- qpa.component_ = colonSplit[0];
- qpa.name_ = colonSplit[1];
+ qpa.m_component = colonSplit[0];
+ qpa.m_name = colonSplit[1];
return true;
} else if (colonSplit.size() == 1) {
- qpa.name_ = colonSplit[0];
+ qpa.m_name = colonSplit[0];
return true;
}
doc.location().warning(
@@ -415,7 +415,7 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::SourceLocation, Node *node, Doc &d
QDocDatabase *qdb = QDocDatabase::qdocDB();
QSet<QString> metacommands = doc.metaCommandsUsed();
if (metacommands.count() > 0) {
- metacommands.subtract(topics_);
+ metacommands.subtract(m_topics);
for (const auto &command : qAsConst(metacommands)) {
const ArgList args = doc.metaCommandArgs(command);
if ((command == COMMAND_QMLABSTRACT) || (command == COMMAND_ABSTRACT)) {
@@ -507,21 +507,21 @@ QString QmlDocVisitor::getFullyQualifiedId(QQmlJS::AST::UiQualifiedId *id)
bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
{
QString type = getFullyQualifiedId(definition->qualifiedTypeNameId);
- nestingLevel++;
+ m_nestingLevel++;
- if (current->isNamespace()) {
+ if (m_current->isNamespace()) {
QmlTypeNode *component = nullptr;
- Node *candidate = current->findChildNode(name, Node::QML);
+ Node *candidate = m_current->findChildNode(m_name, Node::QML);
if (candidate != nullptr)
component = static_cast<QmlTypeNode *>(candidate);
else
- component = new QmlTypeNode(current, name);
- component->setTitle(name);
- component->setImportList(importList);
- importList.clear();
+ component = new QmlTypeNode(m_current, m_name);
+ component->setTitle(m_name);
+ component->setImportList(m_importList);
+ m_importList.clear();
if (applyDocumentation(definition->firstSourceLocation(), component))
component->setQmlBaseName(type);
- current = component;
+ m_current = component;
}
return true;
@@ -535,43 +535,43 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
*/
void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *definition)
{
- if (nestingLevel > 0) {
- --nestingLevel;
+ if (m_nestingLevel > 0) {
+ --m_nestingLevel;
}
- lastEndOffset = definition->lastSourceLocation().end();
+ m_lastEndOffset = definition->lastSourceLocation().end();
}
bool QmlDocVisitor::visit(QQmlJS::AST::UiImport *import)
{
- QString name = document.mid(import->fileNameToken.offset, import->fileNameToken.length);
+ QString name = m_document.mid(import->fileNameToken.offset, import->fileNameToken.length);
if (name[0] == '\"')
name = name.mid(1, name.length() - 2);
QString version;
if (import->version) {
const auto start = import->version->firstSourceLocation().begin();
const auto end = import->version->lastSourceLocation().end();
- version = document.mid(start, end - start);
+ version = m_document.mid(start, end - start);
}
QString importUri = getFullyQualifiedId(import->importUri);
- importList.append(ImportRec(name, version, importUri));
+ m_importList.append(ImportRec(name, version, importUri));
return true;
}
void QmlDocVisitor::endVisit(QQmlJS::AST::UiImport *definition)
{
- lastEndOffset = definition->lastSourceLocation().end();
+ m_lastEndOffset = definition->lastSourceLocation().end();
}
bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectBinding *)
{
- ++nestingLevel;
+ ++m_nestingLevel;
return true;
}
void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectBinding *)
{
- --nestingLevel;
+ --m_nestingLevel;
}
bool QmlDocVisitor::visit(QQmlJS::AST::UiArrayBinding *)
@@ -612,19 +612,19 @@ QString qualifiedIdToString(QQmlJS::AST::UiQualifiedId *node)
*/
bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member)
{
- if (nestingLevel > 1) {
+ if (m_nestingLevel > 1) {
return true;
}
switch (member->type) {
case QQmlJS::AST::UiPublicMember::Signal: {
- if (current->isQmlType() || current->isJsType()) {
- auto *qmlType = static_cast<QmlTypeNode *>(current);
+ if (m_current->isQmlType() || m_current->isJsType()) {
+ auto *qmlType = static_cast<QmlTypeNode *>(m_current);
if (qmlType) {
FunctionNode::Metaness metaness = FunctionNode::QmlSignal;
if (qmlType->isJsType())
metaness = FunctionNode::JsSignal;
QString name = member->name.toString();
- auto *newSignal = new FunctionNode(metaness, current, name);
+ auto *newSignal = new FunctionNode(metaness, m_current, name);
Parameters &parameters = newSignal->parameters();
for (QQmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) {
const QString type = qualifiedIdToString(it->type);
@@ -638,8 +638,8 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member)
}
case QQmlJS::AST::UiPublicMember::Property: {
QString type = qualifiedIdToString(member->memberType);
- if (current->isQmlType() || current->isJsType()) {
- auto *qmlType = static_cast<QmlTypeNode *>(current);
+ if (m_current->isQmlType() || m_current->isJsType()) {
+ auto *qmlType = static_cast<QmlTypeNode *>(m_current);
if (qmlType) {
QString name = member->name.toString();
QmlPropertyNode *qmlPropNode = qmlType->hasQmlProperty(name);
@@ -667,7 +667,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member)
*/
void QmlDocVisitor::endVisit(QQmlJS::AST::UiPublicMember *member)
{
- lastEndOffset = member->lastSourceLocation().end();
+ m_lastEndOffset = member->lastSourceLocation().end();
}
bool QmlDocVisitor::visit(QQmlJS::AST::IdentifierPropertyName *)
@@ -681,14 +681,14 @@ bool QmlDocVisitor::visit(QQmlJS::AST::IdentifierPropertyName *)
*/
bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration *fd)
{
- if (nestingLevel <= 1) {
+ if (m_nestingLevel <= 1) {
FunctionNode::Metaness metaness = FunctionNode::QmlMethod;
- if (current->isJsType())
+ if (m_current->isJsType())
metaness = FunctionNode::JsMethod;
- else if (!current->isQmlType())
+ else if (!m_current->isQmlType())
return true;
QString name = fd->name.toString();
- auto *method = new FunctionNode(metaness, current, name);
+ auto *method = new FunctionNode(metaness, m_current, name);
Parameters &parameters = method->parameters();
QQmlJS::AST::FormalParameterList *formals = fd->formals;
if (formals) {
@@ -698,7 +698,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration *fd)
auto initializer = fp->element->initializer;
if (initializer) {
auto loc = initializer->firstSourceLocation();
- defaultValue = document.mid(loc.begin(), loc.length);
+ defaultValue = m_document.mid(loc.begin(), loc.length);
}
parameters.append(QString(), fp->element->bindingIdentifier.toString(),
defaultValue);
@@ -715,7 +715,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration *fd)
*/
void QmlDocVisitor::endVisit(QQmlJS::AST::FunctionDeclaration *fd)
{
- lastEndOffset = fd->lastSourceLocation().end();
+ m_lastEndOffset = fd->lastSourceLocation().end();
}
/*!
@@ -734,7 +734,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiScriptBinding *)
void QmlDocVisitor::endVisit(QQmlJS::AST::UiScriptBinding *sb)
{
- lastEndOffset = sb->lastSourceLocation().end();
+ m_lastEndOffset = sb->lastSourceLocation().end();
}
bool QmlDocVisitor::visit(QQmlJS::AST::UiQualifiedId *)
diff --git a/src/qdoc/qmlvisitor.h b/src/qdoc/qmlvisitor.h
index 17cff7617..2d2e80add 100644
--- a/src/qdoc/qmlvisitor.h
+++ b/src/qdoc/qmlvisitor.h
@@ -45,17 +45,17 @@ class Aggregate;
struct QmlPropArgs
{
- QString type_;
- QString module_;
- QString component_;
- QString name_;
+ QString m_type {};
+ QString m_module {};
+ QString m_component {};
+ QString m_name;
void clear()
{
- type_.clear();
- module_.clear();
- component_.clear();
- name_.clear();
+ m_type.clear();
+ m_module.clear();
+ m_component.clear();
+ m_name.clear();
}
};
@@ -93,27 +93,27 @@ public:
void endVisit(QQmlJS::AST::UiQualifiedId *) override;
void throwRecursionDepthError() final;
- bool hasError() const;
+ [[nodiscard]] bool hasError() const;
private:
QString getFullyQualifiedId(QQmlJS::AST::UiQualifiedId *id);
- QQmlJS::SourceLocation precedingComment(quint32 offset) const;
+ [[nodiscard]] QQmlJS::SourceLocation precedingComment(quint32 offset) const;
bool applyDocumentation(QQmlJS::SourceLocation location, Node *node);
void applyMetacommands(QQmlJS::SourceLocation location, Node *node, Doc &doc);
bool splitQmlPropertyArg(const Doc &doc, const QString &arg, QmlPropArgs &qpa);
- QQmlJS::Engine *engine;
- quint32 lastEndOffset;
- quint32 nestingLevel;
- QString filePath_;
- QString name;
- QString document;
- ImportList importList;
- QSet<QString> commands_;
- QSet<QString> topics_;
- QSet<quint32> usedComments;
- Aggregate *current;
- bool hasRecursionDepthError = false;
+ QQmlJS::Engine *m_engine { nullptr };
+ quint32 m_lastEndOffset {};
+ quint32 m_nestingLevel {};
+ QString m_filePath {};
+ QString m_name {};
+ QString m_document {};
+ ImportList m_importList {};
+ QSet<QString> m_commands {};
+ QSet<QString> m_topics {};
+ QSet<quint32> m_usedComments {};
+ Aggregate *m_current { nullptr };
+ bool hasRecursionDepthError { false };
};
#endif
diff --git a/src/qdoc/quoter.cpp b/src/qdoc/quoter.cpp
index c3302f107..6692572b3 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::s_commentHash;
static void replaceMultipleNewlines(QString &s)
{
@@ -106,7 +106,7 @@ static void trimWhiteSpace(QString &str)
str.resize(++j);
}
-Quoter::Quoter() : silent(false)
+Quoter::Quoter() : m_silent(false)
{
/* We're going to hard code these delimiters:
* C++, Qt, Qt Script, Java:
@@ -116,30 +116,30 @@ Quoter::Quoter() : silent(false)
* .html, .qrc, .ui, .xq, .xml files:
<!-- [<id>] -->
*/
- if (commentHash.empty()) {
- commentHash["pro"] = "#!";
- commentHash["py"] = "#!";
- commentHash["cmake"] = "#!";
- commentHash["html"] = "<!--";
- commentHash["qrc"] = "<!--";
- commentHash["ui"] = "<!--";
- commentHash["xml"] = "<!--";
- commentHash["xq"] = "<!--";
+ if (s_commentHash.empty()) {
+ s_commentHash["pro"] = "#!";
+ s_commentHash["py"] = "#!";
+ s_commentHash["cmake"] = "#!";
+ s_commentHash["html"] = "<!--";
+ s_commentHash["qrc"] = "<!--";
+ s_commentHash["ui"] = "<!--";
+ s_commentHash["xml"] = "<!--";
+ s_commentHash["xq"] = "<!--";
}
}
void Quoter::reset()
{
- silent = false;
- plainLines.clear();
- markedLines.clear();
- codeLocation = Location();
+ m_silent = false;
+ m_plainLines.clear();
+ m_markedLines.clear();
+ m_codeLocation = Location();
}
void Quoter::quoteFromFile(const QString &userFriendlyFilePath, const QString &plainCode,
const QString &markedCode)
{
- silent = false;
+ m_silent = false;
/*
Split the source code into logical lines. Empty lines are
@@ -162,28 +162,28 @@ void Quoter::quoteFromFile(const QString &userFriendlyFilePath, const QString &p
Newlines are preserved because they affect codeLocation.
*/
- codeLocation = Location(userFriendlyFilePath);
+ m_codeLocation = Location(userFriendlyFilePath);
- plainLines = splitLines(plainCode);
- markedLines = splitLines(markedCode);
- if (markedLines.count() != plainLines.count()) {
- codeLocation.warning(
+ m_plainLines = splitLines(plainCode);
+ m_markedLines = splitLines(markedCode);
+ if (m_markedLines.count() != m_plainLines.count()) {
+ m_codeLocation.warning(
QStringLiteral("Something is wrong with qdoc's handling of marked code"));
- markedLines = plainLines;
+ m_markedLines = m_plainLines;
}
/*
Squeeze blanks (cat -s).
*/
- for (auto &line : markedLines)
+ for (auto &line : m_markedLines)
replaceMultipleNewlines(line);
- codeLocation.start();
+ m_codeLocation.start();
}
QString Quoter::quoteLine(const Location &docLocation, const QString &command,
const QString &pattern)
{
- if (plainLines.isEmpty()) {
+ if (m_plainLines.isEmpty()) {
failedAtEnd(docLocation, command);
return QString();
}
@@ -193,13 +193,13 @@ QString Quoter::quoteLine(const Location &docLocation, const QString &command,
return QString();
}
- if (match(docLocation, pattern, plainLines.first()))
+ if (match(docLocation, pattern, m_plainLines.first()))
return getLine();
- if (!silent) {
+ if (!m_silent) {
docLocation.warning(QStringLiteral("Command '\\%1' failed").arg(command));
- codeLocation.warning(QStringLiteral("Pattern '%1' didn't match here").arg(pattern));
- silent = true;
+ m_codeLocation.warning(QStringLiteral("Pattern '%1' didn't match here").arg(pattern));
+ m_silent = true;
}
return QString();
}
@@ -211,8 +211,8 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif
QString t;
int indent = 0;
- while (!plainLines.isEmpty()) {
- if (match(docLocation, delimiter, plainLines.first())) {
+ while (!m_plainLines.isEmpty()) {
+ if (match(docLocation, delimiter, m_plainLines.first())) {
QString startLine = getLine();
while (indent < startLine.length() && startLine[indent] == QLatin1Char(' '))
indent++;
@@ -220,8 +220,8 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif
}
getLine();
}
- while (!plainLines.isEmpty()) {
- QString line = plainLines.first();
+ while (!m_plainLines.isEmpty()) {
+ QString line = m_plainLines.first();
if (match(docLocation, delimiter, line)) {
QString lastLine = getLine(indent);
qsizetype dIndex = lastLine.indexOf(delimiter);
@@ -252,13 +252,13 @@ QString Quoter::quoteTo(const Location &docLocation, const QString &command, con
QString comment = commentForCode();
if (pattern.isEmpty()) {
- while (!plainLines.isEmpty()) {
- QString line = plainLines.first();
+ while (!m_plainLines.isEmpty()) {
+ QString line = m_plainLines.first();
t += removeSpecialLines(line, comment);
}
} else {
- while (!plainLines.isEmpty()) {
- if (match(docLocation, pattern, plainLines.first())) {
+ while (!m_plainLines.isEmpty()) {
+ if (match(docLocation, pattern, m_plainLines.first())) {
return t;
}
t += getLine();
@@ -278,19 +278,19 @@ QString Quoter::quoteUntil(const Location &docLocation, const QString &command,
QString Quoter::getLine(int unindent)
{
- if (plainLines.isEmpty())
+ if (m_plainLines.isEmpty())
return QString();
- plainLines.removeFirst();
+ m_plainLines.removeFirst();
- QString t = markedLines.takeFirst();
+ QString t = m_markedLines.takeFirst();
int i = 0;
while (i < unindent && i < t.length() && t[i] == QLatin1Char(' '))
i++;
t = t.mid(i);
t += QLatin1Char('\n');
- codeLocation.advanceLines(t.count(QLatin1Char('\n')));
+ m_codeLocation.advanceLines(t.count(QLatin1Char('\n')));
return t;
}
@@ -304,10 +304,10 @@ bool Quoter::match(const Location &docLocation, const QString &pattern0, const Q
if (pattern.startsWith(QLatin1Char('/')) && pattern.endsWith(QLatin1Char('/'))
&& pattern.length() > 2) {
QRegularExpression rx(pattern.mid(1, pattern.length() - 2));
- if (!silent && !rx.isValid()) {
+ if (!m_silent && !rx.isValid()) {
docLocation.warning(
QStringLiteral("Invalid regular expression '%1'").arg(rx.pattern()));
- silent = true;
+ m_silent = true;
}
return str.indexOf(rx) != -1;
}
@@ -318,23 +318,23 @@ bool Quoter::match(const Location &docLocation, const QString &pattern0, const Q
void Quoter::failedAtEnd(const Location &docLocation, const QString &command)
{
- if (!silent && !command.isEmpty()) {
- if (codeLocation.filePath().isEmpty()) {
+ if (!m_silent && !command.isEmpty()) {
+ if (m_codeLocation.filePath().isEmpty()) {
docLocation.warning(QStringLiteral("Unexpected '\\%1'").arg(command));
} else {
docLocation.warning(QStringLiteral("Command '\\%1' failed at end of file '%2'")
- .arg(command, codeLocation.filePath()));
+ .arg(command, m_codeLocation.filePath()));
}
- silent = true;
+ m_silent = true;
}
}
QString Quoter::commentForCode() const
{
- QFileInfo fi = QFileInfo(codeLocation.fileName());
+ QFileInfo fi = QFileInfo(m_codeLocation.fileName());
if (fi.fileName() == "CMakeLists.txt")
return "#!";
- return commentHash.value(fi.suffix(), "//!");
+ return s_commentHash.value(fi.suffix(), "//!");
}
QString Quoter::removeSpecialLines(const QString &line, const QString &comment, int unindent)
diff --git a/src/qdoc/quoter.h b/src/qdoc/quoter.h
index 743d5dcec..33231ceb7 100644
--- a/src/qdoc/quoter.h
+++ b/src/qdoc/quoter.h
@@ -55,14 +55,14 @@ 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);
- QString commentForCode() const;
+ [[nodiscard]] QString commentForCode() const;
QString removeSpecialLines(const QString &line, const QString &comment, int unindent = 0);
- bool silent;
- QStringList plainLines;
- QStringList markedLines;
- Location codeLocation;
- static QHash<QString, QString> commentHash;
+ bool m_silent {};
+ QStringList m_plainLines {};
+ QStringList m_markedLines {};
+ Location m_codeLocation {};
+ static QHash<QString, QString> s_commentHash;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/relatedclass.h b/src/qdoc/relatedclass.h
index 74b9565ba..b1c921d2a 100644
--- a/src/qdoc/relatedclass.h
+++ b/src/qdoc/relatedclass.h
@@ -47,7 +47,7 @@ struct RelatedClass
RelatedClass(Access access, ClassNode *node) : m_access(access), m_node(node) {}
// constructor for unresolved base class
RelatedClass(Access access, QStringList path) : m_access(access), m_path(std::move(path)) { }
- bool isPrivate() const;
+ [[nodiscard]] bool isPrivate() const;
Access m_access {};
ClassNode *m_node { nullptr };
diff --git a/src/qdoc/sections.cpp b/src/qdoc/sections.cpp
index 76f3e5baa..1c685cef0 100644
--- a/src/qdoc/sections.cpp
+++ b/src/qdoc/sections.cpp
@@ -47,15 +47,16 @@
QT_BEGIN_NAMESPACE
static bool sectionsInitialized = false;
-QList<Section> Sections::stdSummarySections_(7, Section(Section::Summary, Section::Active));
-QList<Section> Sections::stdDetailsSections_(7, Section(Section::Details, Section::Active));
-QList<Section> Sections::stdCppClassSummarySections_(18,
- Section(Section::Summary, Section::Active));
-QList<Section> Sections::stdCppClassDetailsSections_(6, Section(Section::Details, Section::Active));
-QList<Section> Sections::sinceSections_(15, Section(Section::Details, Section::Active));
-QList<Section> Sections::allMembers_(1, Section(Section::AllMembers, Section::Active));
-QList<Section> Sections::stdQmlTypeSummarySections_(7, Section(Section::Summary, Section::Active));
-QList<Section> Sections::stdQmlTypeDetailsSections_(7, Section(Section::Details, Section::Active));
+QList<Section> Sections::s_stdSummarySections(7, Section(Section::Summary, Section::Active));
+QList<Section> Sections::s_stdDetailsSections(7, Section(Section::Details, Section::Active));
+QList<Section> Sections::s_stdCppClassSummarySections(18,
+ Section(Section::Summary, Section::Active));
+QList<Section> Sections::s_stdCppClassDetailsSections(6,
+ Section(Section::Details, Section::Active));
+QList<Section> Sections::s_sinceSections(15, Section(Section::Details, Section::Active));
+QList<Section> Sections::s_allMembers(1, Section(Section::AllMembers, Section::Active));
+QList<Section> Sections::s_stdQmlTypeSummarySections(7, Section(Section::Summary, Section::Active));
+QList<Section> Sections::s_stdQmlTypeDetailsSections(7, Section(Section::Details, Section::Active));
/*!
\class Section
@@ -86,30 +87,30 @@ Section::~Section()
*/
void Section::clear()
{
- memberMap_.clear();
- obsoleteMemberMap_.clear();
- reimplementedMemberMap_.clear();
- if (!classMapList_.isEmpty()) {
- for (ClassMap *classMap : classMapList_) {
+ m_memberMap.clear();
+ m_obsoleteMemberMap.clear();
+ m_reimplementedMemberMap.clear();
+ if (!m_classMapList.isEmpty()) {
+ for (ClassMap *classMap : m_classMapList) {
classMap = nullptr;
delete classMap;
}
- classMapList_.clear();
+ m_classMapList.clear();
}
- keys_.clear();
- obsoleteKeys_.clear();
- members_.clear();
- obsoleteMembers_.clear();
- reimplementedMembers_.clear();
- inheritedMembers_.clear();
- if (!classKeysNodesList_.isEmpty()) {
- for (ClassKeysNodes *classKeysNode : classKeysNodesList_) {
+ m_keys.clear();
+ m_obsoleteKeys.clear();
+ m_members.clear();
+ m_obsoleteMembers.clear();
+ m_reimplementedMembers.clear();
+ m_inheritedMembers.clear();
+ if (!m_classKeysNodesList.isEmpty()) {
+ for (ClassKeysNodes *classKeysNode : m_classKeysNodesList) {
classKeysNode = nullptr;
delete classKeysNode;
}
- classKeysNodesList_.clear();
+ m_classKeysNodesList.clear();
}
- aggregate_ = nullptr;
+ m_aggregate = nullptr;
}
/*!
@@ -177,7 +178,7 @@ void Section::insert(Node *node)
bool inherited = false;
if (!node->isRelatedNonmember()) {
Aggregate *p = node->parent();
- if (!p->isNamespace() && p != aggregate_) {
+ if (!p->isNamespace() && p != m_aggregate) {
if ((!p->isQmlType() && !p->isJsType()) || !p->isAbstract())
inherited = true;
}
@@ -190,8 +191,8 @@ void Section::insert(Node *node)
irrelevant = (inherited && (func->isSomeCtor() || func->isDtor()));
} else if (node->isClassNode() || node->isEnumType() || node->isTypedef()
|| node->isVariable()) {
- irrelevant = (inherited && style_ != AllMembers);
- if (!irrelevant && style_ == Details && node->isTypedef()) {
+ irrelevant = (inherited && m_style != AllMembers);
+ if (!irrelevant && m_style == Details && node->isTypedef()) {
const auto *tdn = static_cast<const TypedefNode *>(node);
if (tdn->associatedEnum())
irrelevant = true;
@@ -201,21 +202,21 @@ void Section::insert(Node *node)
if (!irrelevant) {
QString key = sortName(node);
if (node->isDeprecated()) {
- obsoleteMemberMap_.insert(key, node);
+ m_obsoleteMemberMap.insert(key, node);
} else {
if (!inherited)
- memberMap_.insert(key, node);
- else if (style_ == AllMembers) {
- if (!memberMap_.contains(key))
- memberMap_.insert(key, node);
+ m_memberMap.insert(key, node);
+ else if (m_style == AllMembers) {
+ if (!m_memberMap.contains(key))
+ m_memberMap.insert(key, node);
}
if (inherited && (node->parent()->isClassNode() || node->parent()->isNamespace())) {
- if (inheritedMembers_.isEmpty()
- || inheritedMembers_.last().first != node->parent()) {
+ if (m_inheritedMembers.isEmpty()
+ || m_inheritedMembers.last().first != node->parent()) {
QPair<Aggregate *, int> p(node->parent(), 0);
- inheritedMembers_.append(p);
+ m_inheritedMembers.append(p);
}
- inheritedMembers_.last().second++;
+ m_inheritedMembers.last().second++;
}
}
}
@@ -234,11 +235,11 @@ bool Section::insertReimplementedMember(Node *node)
{
if (!node->isPrivate() && !node->isRelatedNonmember()) {
const auto *fn = static_cast<const FunctionNode *>(node);
- if (!fn->overridesThis().isEmpty() && (status_ == Active)) {
- if (fn->parent() == aggregate_) {
+ if (!fn->overridesThis().isEmpty() && (m_status == Active)) {
+ if (fn->parent() == m_aggregate) {
QString key = sortName(fn);
- if (!reimplementedMemberMap_.contains(key)) {
- reimplementedMemberMap_.insert(key, node);
+ if (!m_reimplementedMemberMap.contains(key)) {
+ m_reimplementedMemberMap.insert(key, node);
return true;
}
}
@@ -256,7 +257,7 @@ ClassMap *Section::newClassMap(const Aggregate *aggregate)
{
auto *classMap = new ClassMap;
classMap->first = static_cast<const QmlTypeNode *>(aggregate);
- classMapList_.append(classMap);
+ m_classMapList.append(classMap);
return classMap;
}
@@ -267,7 +268,7 @@ void Section::add(ClassMap *classMap, Node *n)
{
QString key = n->name();
key = sortName(n, &key);
- memberMap_.insert(key, n);
+ m_memberMap.insert(key, n);
classMap->second.insert(key, n);
}
@@ -278,21 +279,21 @@ void Section::add(ClassMap *classMap, Node *n)
void Section::reduce()
{
if (!isEmpty()) {
- keys_ = memberMap_.keys();
- members_ = memberMap_.values().toVector();
- reimplementedMembers_ = reimplementedMemberMap_.values().toVector();
- for (int i = 0; i < classMapList_.size(); i++) {
- ClassMap *cm = classMapList_[i];
+ m_keys = m_memberMap.keys();
+ m_members = m_memberMap.values().toVector();
+ m_reimplementedMembers = m_reimplementedMemberMap.values().toVector();
+ for (int i = 0; i < m_classMapList.size(); i++) {
+ ClassMap *cm = m_classMapList[i];
auto *ckn = new ClassKeysNodes;
ckn->first = cm->first;
ckn->second.second = cm->second.values().toVector();
ckn->second.first = cm->second.keys();
- classKeysNodesList_.append(ckn);
+ m_classKeysNodesList.append(ckn);
}
}
- if (!obsoleteMemberMap_.isEmpty()) {
- obsoleteKeys_ = obsoleteMemberMap_.keys();
- obsoleteMembers_ = obsoleteMemberMap_.values().toVector();
+ if (!m_obsoleteMemberMap.isEmpty()) {
+ m_obsoleteKeys = m_obsoleteMemberMap.keys();
+ m_obsoleteMembers = m_obsoleteMemberMap.values().toVector();
}
}
@@ -309,32 +310,32 @@ void Section::reduce()
This constructor builds the vectors of sections based on the
type of the \a aggregate node.
*/
-Sections::Sections(Aggregate *aggregate) : aggregate_(aggregate)
+Sections::Sections(Aggregate *aggregate) : m_aggregate(aggregate)
{
initSections();
- initAggregate(allMembers_, aggregate_);
- switch (aggregate_->nodeType()) {
+ initAggregate(s_allMembers, m_aggregate);
+ switch (m_aggregate->nodeType()) {
case Node::Class:
case Node::Struct:
case Node::Union:
- initAggregate(stdCppClassSummarySections_, aggregate_);
- initAggregate(stdCppClassDetailsSections_, aggregate_);
+ initAggregate(s_stdCppClassSummarySections, m_aggregate);
+ initAggregate(s_stdCppClassDetailsSections, m_aggregate);
buildStdCppClassRefPageSections();
break;
case Node::JsType:
case Node::JsBasicType:
case Node::QmlType:
case Node::QmlBasicType:
- initAggregate(stdQmlTypeSummarySections_, aggregate_);
- initAggregate(stdQmlTypeDetailsSections_, aggregate_);
+ initAggregate(s_stdQmlTypeSummarySections, m_aggregate);
+ initAggregate(s_stdQmlTypeDetailsSections, m_aggregate);
buildStdQmlTypeRefPageSections();
break;
case Node::Namespace:
case Node::HeaderFile:
case Node::Proxy:
default:
- initAggregate(stdSummarySections_, aggregate_);
- initAggregate(stdDetailsSections_, aggregate_);
+ initAggregate(s_stdSummarySections, m_aggregate);
+ initAggregate(s_stdDetailsSections, m_aggregate);
buildStdRefPageSections();
break;
}
@@ -344,7 +345,7 @@ Sections::Sections(Aggregate *aggregate) : aggregate_(aggregate)
This constructor builds a vector of sections from the \e since
node map, \a nsmap
*/
-Sections::Sections(const NodeMultiMap &nsmap) : aggregate_(nullptr)
+Sections::Sections(const NodeMultiMap &nsmap) : m_aggregate(nullptr)
{
initSections();
if (nsmap.isEmpty())
@@ -435,8 +436,8 @@ Sections::Sections(const NodeMultiMap &nsmap) : aggregate_(nullptr)
*/
Sections::~Sections()
{
- if (aggregate_) {
- switch (aggregate_->nodeType()) {
+ if (m_aggregate) {
+ switch (m_aggregate->nodeType()) {
case Node::Class:
case Node::Struct:
case Node::Union:
@@ -458,7 +459,7 @@ Sections::~Sections()
allMembersSection().clear();
break;
}
- aggregate_ = nullptr;
+ m_aggregate = nullptr;
} else {
clear(sinceSections());
}
@@ -487,9 +488,9 @@ void Sections::initSections()
return;
sectionsInitialized = true;
- allMembers_[0].init("member", "members");
+ s_allMembers[0].init("member", "members");
{
- QList<Section> &v = stdCppClassSummarySections_;
+ QList<Section> &v = s_stdCppClassSummarySections;
v[0].init("Public Types", "public type", "public types");
v[1].init("Properties", "property", "properties");
v[2].init("Public Functions", "public function", "public functions");
@@ -512,7 +513,7 @@ void Sections::initSections()
}
{
- QList<Section> &v = stdCppClassDetailsSections_;
+ QList<Section> &v = s_stdCppClassDetailsSections;
v[0].init("Member Type Documentation", "types", "member", "members");
v[1].init("Property Documentation", "prop", "member", "members");
v[2].init("Member Function Documentation", "func", "member", "members");
@@ -522,7 +523,7 @@ void Sections::initSections()
}
{
- QList<Section> &v = stdSummarySections_;
+ QList<Section> &v = s_stdSummarySections;
v[0].init("Namespaces", "namespace", "namespaces");
v[1].init("Classes", "class", "classes");
v[2].init("Types", "type", "types");
@@ -533,7 +534,7 @@ void Sections::initSections()
}
{
- QList<Section> &v = stdDetailsSections_;
+ QList<Section> &v = s_stdDetailsSections;
v[0].init("Namespaces", "nmspace", "namespace", "namespaces");
v[1].init("Classes", "classes", "class", "classes");
v[2].init("Type Documentation", "types", "type", "types");
@@ -544,7 +545,7 @@ void Sections::initSections()
}
{
- QList<Section> &v = sinceSections_;
+ QList<Section> &v = s_sinceSections;
v[SinceNamespaces].init(" New Namespaces");
v[SinceClasses].init(" New Classes");
v[SinceMemberFunctions].init(" New Member Functions");
@@ -564,7 +565,7 @@ void Sections::initSections()
}
{
- QList<Section> &v = stdQmlTypeSummarySections_;
+ QList<Section> &v = s_stdQmlTypeSummarySections;
v[0].init("Properties", "property", "properties");
v[1].init("Attached Properties", "attached property", "attached properties");
v[2].init("Signals", "signal", "signals");
@@ -575,7 +576,7 @@ void Sections::initSections()
}
{
- QList<Section> &v = stdQmlTypeDetailsSections_;
+ QList<Section> &v = s_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");
@@ -679,20 +680,20 @@ void Sections::buildStdRefPageSections()
{
const NamespaceNode *ns = nullptr;
bool documentAll = true; // document all the children
- if (aggregate_->isNamespace()) {
- ns = static_cast<const NamespaceNode *>(aggregate_);
+ if (m_aggregate->isNamespace()) {
+ ns = static_cast<const NamespaceNode *>(m_aggregate);
if (!ns->hasDoc())
documentAll = false; // only document children that have documentation
}
- for (auto it = aggregate_->constBegin(); it != aggregate_->constEnd(); ++it) {
+ for (auto it = m_aggregate->constBegin(); it != m_aggregate->constEnd(); ++it) {
Node *n = *it;
if (documentAll || n->hasDoc()) {
stdRefPageSwitch(stdSummarySections(), n);
stdRefPageSwitch(stdDetailsSections(), n);
}
}
- if (!aggregate_->relatedByProxy().isEmpty()) {
- const QList<Node *> &relatedBy = aggregate_->relatedByProxy();
+ if (!m_aggregate->relatedByProxy().isEmpty()) {
+ const QList<Node *> &relatedBy = m_aggregate->relatedByProxy();
for (const auto &node : relatedBy)
stdRefPageSwitch(stdSummarySections(), node);
}
@@ -950,9 +951,9 @@ void Sections::buildStdCppClassRefPageSections()
SectionVector &detailsSections = stdCppClassDetailsSections();
Section &allMembers = allMembersSection();
bool documentAll = true;
- if (aggregate_->parent() && !aggregate_->name().isEmpty() && !aggregate_->hasDoc())
+ if (m_aggregate->parent() && !m_aggregate->name().isEmpty() && !m_aggregate->hasDoc())
documentAll = false;
- for (auto it = aggregate_->constBegin(); it != aggregate_->constEnd(); ++it) {
+ for (auto it = m_aggregate->constBegin(); it != m_aggregate->constEnd(); ++it) {
Node *n = *it;
if (!n->isPrivate() && !n->isProperty() && !n->isRelatedNonmember()
&& !n->isSharedCommentNode())
@@ -963,14 +964,14 @@ void Sections::buildStdCppClassRefPageSections()
distributeNodeInSummaryVector(summarySections, n);
distributeNodeInDetailsVector(detailsSections, n);
}
- if (!aggregate_->relatedByProxy().isEmpty()) {
- const QList<Node *> relatedBy = aggregate_->relatedByProxy();
+ if (!m_aggregate->relatedByProxy().isEmpty()) {
+ const QList<Node *> relatedBy = m_aggregate->relatedByProxy();
for (const auto &node : relatedBy)
distributeNodeInSummaryVector(summarySections, node);
}
QStack<ClassNode *> stack;
- auto *cn = static_cast<ClassNode *>(aggregate_);
+ auto *cn = static_cast<ClassNode *>(m_aggregate);
pushBaseClasses(stack, cn);
while (!stack.isEmpty()) {
ClassNode *cn = stack.pop();
@@ -1000,7 +1001,7 @@ void Sections::buildStdQmlTypeRefPageSections()
SectionVector &detailsSections = stdQmlTypeDetailsSections();
Section &allMembers = allMembersSection();
- const Aggregate *qtn = aggregate_;
+ const Aggregate *qtn = m_aggregate;
while (qtn) {
if (!qtn->isAbstract() || !classMap)
classMap = allMembers.newClassMap(qtn);
@@ -1009,9 +1010,9 @@ void Sections::buildStdQmlTypeRefPageSections()
continue;
// Skip overridden property/function documentation from abstract base type
- if (qtn != aggregate_ && qtn->isAbstract()) {
+ if (qtn != m_aggregate && qtn->isAbstract()) {
NodeList candidates;
- aggregate_->findChildren(n->name(), candidates);
+ m_aggregate->findChildren(n->name(), candidates);
if (std::any_of(candidates.cbegin(), candidates.cend(), [&n](const Node *c) {
if (c->nodeType() == n->nodeType()) {
if (!n->isFunction() || static_cast<const FunctionNode*>(n)->compare(c, false))
@@ -1026,7 +1027,7 @@ void Sections::buildStdQmlTypeRefPageSections()
if (!n->isSharedCommentNode() || n->isPropertyGroup())
allMembers.add(classMap, n);
- if (qtn == aggregate_ || qtn->isAbstract()) {
+ if (qtn == m_aggregate || qtn->isAbstract()) {
distributeQmlNodeInSummaryVector(summarySections, n);
distributeQmlNodeInDetailsVector(detailsSections, n);
}
@@ -1054,9 +1055,9 @@ bool Sections::hasObsoleteMembers(SectionPtrVector *summary_spv,
SectionPtrVector *details_spv) const
{
const SectionVector *sections = nullptr;
- if (aggregate_->isClassNode())
+ if (m_aggregate->isClassNode())
sections = &stdCppClassSummarySections();
- else if (aggregate_->isQmlType() || aggregate_->isQmlBasicType())
+ else if (m_aggregate->isQmlType() || m_aggregate->isQmlBasicType())
sections = &stdQmlTypeSummarySections();
else
sections = &stdSummarySections();
@@ -1064,9 +1065,9 @@ bool Sections::hasObsoleteMembers(SectionPtrVector *summary_spv,
if (!section.obsoleteMembers().isEmpty())
summary_spv->append(&section);
}
- if (aggregate_->isClassNode())
+ if (m_aggregate->isClassNode())
sections = &stdCppClassDetailsSections();
- else if (aggregate_->isQmlType() || aggregate_->isQmlBasicType())
+ else if (m_aggregate->isQmlType() || m_aggregate->isQmlBasicType())
sections = &stdQmlTypeDetailsSections();
else
sections = &stdDetailsSections();
diff --git a/src/qdoc/sections.h b/src/qdoc/sections.h
index 3ad52d613..e09ebbd0c 100644
--- a/src/qdoc/sections.h
+++ b/src/qdoc/sections.h
@@ -52,89 +52,95 @@ public:
enum Status { Obsolete, Active };
public:
- Section() : style_(Details), status_(Active), aggregate_(nullptr) {}
- Section(Style style, Status status) : style_(style), status_(status), aggregate_(nullptr) {};
+ Section() : m_style(Details), m_status(Active), m_aggregate(nullptr) { }
+ Section(Style style, Status status) : m_style(style), m_status(status), m_aggregate(nullptr) {};
~Section();
- void init(const QString &title) { title_ = title; }
+ void init(const QString &title) { m_title = title; }
void init(const QString &singular, const QString &plural)
{
- singular_ = singular;
- plural_ = plural;
+ m_singular = singular;
+ m_plural = plural;
}
void init(const QString &title, const QString &singular, const QString &plural)
{
- title_ = title;
- divClass_.clear();
- singular_ = singular;
- plural_ = plural;
+ m_title = title;
+ m_divClass.clear();
+ m_singular = singular;
+ m_plural = plural;
}
void init(const QString &title, const QString &divClass, const QString &singular,
const QString &plural)
{
- title_ = title;
- divClass_ = divClass;
- singular_ = singular;
- plural_ = plural;
+ m_title = title;
+ m_divClass = divClass;
+ m_singular = singular;
+ m_plural = plural;
}
void insert(Node *node);
- void insert(const QString &key, Node *node) { memberMap_.insert(key, node); }
+ void insert(const QString &key, Node *node) { m_memberMap.insert(key, node); }
bool insertReimplementedMember(Node *node);
ClassMap *newClassMap(const Aggregate *aggregate);
void add(ClassMap *classMap, Node *n);
- void appendMember(Node *node) { members_.append(node); }
+ void appendMember(Node *node) { m_members.append(node); }
void clear();
void reduce();
- bool isEmpty() const
+ [[nodiscard]] bool isEmpty() const
{
- return (memberMap_.isEmpty() && inheritedMembers_.isEmpty()
- && reimplementedMemberMap_.isEmpty() && classMapList_.isEmpty());
+ return (m_memberMap.isEmpty() && m_inheritedMembers.isEmpty()
+ && m_reimplementedMemberMap.isEmpty() && m_classMapList.isEmpty());
}
- Style style() const { return style_; }
- Status status() const { return status_; }
- const QString &title() const { return title_; }
- const QString &divClass() const { return divClass_; }
- const QString &singular() const { return singular_; }
- const QString &plural() const { return plural_; }
- const QStringList &keys() const { return keys_; }
- const QStringList &keys(Status t) const { return (t == Obsolete ? obsoleteKeys_ : keys_); }
- const NodeVector &members() const { return members_; }
- const NodeVector &reimplementedMembers() const { return reimplementedMembers_; }
- const QList<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); }
- const Aggregate *aggregate() const { return aggregate_; }
- void setAggregate(Aggregate *t) { aggregate_ = t; }
+ [[nodiscard]] Style style() const { return m_style; }
+ [[nodiscard]] Status status() const { return m_status; }
+ [[nodiscard]] const QString &title() const { return m_title; }
+ [[nodiscard]] const QString &divClass() const { return m_divClass; }
+ [[nodiscard]] const QString &singular() const { return m_singular; }
+ [[nodiscard]] const QString &plural() const { return m_plural; }
+ [[nodiscard]] const QStringList &keys() const { return m_keys; }
+ [[nodiscard]] const QStringList &keys(Status t) const
+ {
+ return (t == Obsolete ? m_obsoleteKeys : m_keys);
+ }
+ [[nodiscard]] const NodeVector &members() const { return m_members; }
+ [[nodiscard]] const NodeVector &reimplementedMembers() const { return m_reimplementedMembers; }
+ [[nodiscard]] const QList<QPair<Aggregate *, int>> &inheritedMembers() const
+ {
+ return m_inheritedMembers;
+ }
+ ClassKeysNodesList &classKeysNodesList() { return m_classKeysNodesList; }
+ [[nodiscard]] const NodeVector &obsoleteMembers() const { return m_obsoleteMembers; }
+ void appendMembers(const NodeVector &nv) { m_members.append(nv); }
+ [[nodiscard]] const Aggregate *aggregate() const { return m_aggregate; }
+ void setAggregate(Aggregate *t) { m_aggregate = t; }
private:
QString sortName(const Node *node, const QString *name = nullptr);
private:
- Style style_;
- Status status_;
- QString title_;
- QString divClass_;
- QString singular_;
- QString plural_;
+ Style m_style {};
+ Status m_status {};
+ QString m_title {};
+ QString m_divClass {};
+ QString m_singular {};
+ QString m_plural {};
- Aggregate *aggregate_;
- QStringList keys_;
- QStringList obsoleteKeys_;
- NodeVector members_;
- NodeVector obsoleteMembers_;
- NodeVector reimplementedMembers_;
- QList<QPair<Aggregate *, int>> inheritedMembers_;
- ClassKeysNodesList classKeysNodesList_;
+ Aggregate *m_aggregate { nullptr };
+ QStringList m_keys {};
+ QStringList m_obsoleteKeys {};
+ NodeVector m_members {};
+ NodeVector m_obsoleteMembers {};
+ NodeVector m_reimplementedMembers {};
+ QList<QPair<Aggregate *, int>> m_inheritedMembers {};
+ ClassKeysNodesList m_classKeysNodesList {};
- QMultiMap<QString, Node *> memberMap_;
- QMultiMap<QString, Node *> obsoleteMemberMap_;
- QMultiMap<QString, Node *> reimplementedMemberMap_;
- ClassMapList classMapList_;
+ QMultiMap<QString, Node *> m_memberMap {};
+ QMultiMap<QString, Node *> m_obsoleteMemberMap {};
+ QMultiMap<QString, Node *> m_reimplementedMemberMap {};
+ ClassMapList m_classMapList {};
};
typedef QList<Section> SectionVector;
@@ -213,23 +219,35 @@ public:
bool hasObsoleteMembers(SectionPtrVector *summary_spv, SectionPtrVector *details_spv) const;
- static Section &allMembersSection() { return allMembers_[0]; }
- SectionVector &sinceSections() { return sinceSections_; }
- SectionVector &stdSummarySections() { return stdSummarySections_; }
- SectionVector &stdDetailsSections() { return stdDetailsSections_; }
- SectionVector &stdCppClassSummarySections() { return stdCppClassSummarySections_; }
- SectionVector &stdCppClassDetailsSections() { return stdCppClassDetailsSections_; }
- SectionVector &stdQmlTypeSummarySections() { return stdQmlTypeSummarySections_; }
- SectionVector &stdQmlTypeDetailsSections() { return stdQmlTypeDetailsSections_; }
+ static Section &allMembersSection() { return s_allMembers[0]; }
+ SectionVector &sinceSections() { return s_sinceSections; }
+ SectionVector &stdSummarySections() { return s_stdSummarySections; }
+ SectionVector &stdDetailsSections() { return s_stdDetailsSections; }
+ SectionVector &stdCppClassSummarySections() { return s_stdCppClassSummarySections; }
+ SectionVector &stdCppClassDetailsSections() { return s_stdCppClassDetailsSections; }
+ SectionVector &stdQmlTypeSummarySections() { return s_stdQmlTypeSummarySections; }
+ SectionVector &stdQmlTypeDetailsSections() { return s_stdQmlTypeDetailsSections; }
- const SectionVector &stdSummarySections() const { return stdSummarySections_; }
- const SectionVector &stdDetailsSections() const { return stdDetailsSections_; }
- const SectionVector &stdCppClassSummarySections() const { return stdCppClassSummarySections_; }
- const SectionVector &stdCppClassDetailsSections() const { return stdCppClassDetailsSections_; }
- const SectionVector &stdQmlTypeSummarySections() const { return stdQmlTypeSummarySections_; }
- const SectionVector &stdQmlTypeDetailsSections() const { return stdQmlTypeDetailsSections_; }
+ [[nodiscard]] const SectionVector &stdSummarySections() const { return s_stdSummarySections; }
+ [[nodiscard]] const SectionVector &stdDetailsSections() const { return s_stdDetailsSections; }
+ [[nodiscard]] const SectionVector &stdCppClassSummarySections() const
+ {
+ return s_stdCppClassSummarySections;
+ }
+ [[nodiscard]] const SectionVector &stdCppClassDetailsSections() const
+ {
+ return s_stdCppClassDetailsSections;
+ }
+ [[nodiscard]] const SectionVector &stdQmlTypeSummarySections() const
+ {
+ return s_stdQmlTypeSummarySections;
+ }
+ [[nodiscard]] const SectionVector &stdQmlTypeDetailsSections() const
+ {
+ return s_stdQmlTypeDetailsSections;
+ }
- Aggregate *aggregate() const { return aggregate_; }
+ [[nodiscard]] Aggregate *aggregate() const { return m_aggregate; }
private:
void stdRefPageSwitch(SectionVector &v, Node *n, Node *t = nullptr);
@@ -240,16 +258,16 @@ private:
void initAggregate(SectionVector &v, Aggregate *aggregate);
private:
- Aggregate *aggregate_;
+ Aggregate *m_aggregate { nullptr };
- static SectionVector stdSummarySections_;
- static SectionVector stdDetailsSections_;
- static SectionVector stdCppClassSummarySections_;
- static SectionVector stdCppClassDetailsSections_;
- static SectionVector stdQmlTypeSummarySections_;
- static SectionVector stdQmlTypeDetailsSections_;
- static SectionVector sinceSections_;
- static SectionVector allMembers_;
+ static SectionVector s_stdSummarySections;
+ static SectionVector s_stdDetailsSections;
+ static SectionVector s_stdCppClassSummarySections;
+ static SectionVector s_stdCppClassDetailsSections;
+ static SectionVector s_stdQmlTypeSummarySections;
+ static SectionVector s_stdQmlTypeDetailsSections;
+ static SectionVector s_sinceSections;
+ static SectionVector s_allMembers;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/sharedcommentnode.h b/src/qdoc/sharedcommentnode.h
index af0dd69ab..33a85b3c0 100644
--- a/src/qdoc/sharedcommentnode.h
+++ b/src/qdoc/sharedcommentnode.h
@@ -50,12 +50,12 @@ public:
SharedCommentNode(QmlTypeNode *parent, int count, QString &group);
~SharedCommentNode() override { m_collective.clear(); }
- bool isPropertyGroup() const override
+ [[nodiscard]] bool isPropertyGroup() const override
{
return !name().isEmpty() && !m_collective.isEmpty()
&& (m_collective.at(0)->isQmlProperty() || m_collective.at(0)->isJsProperty());
}
- qsizetype count() const { return m_collective.size(); }
+ [[nodiscard]] qsizetype count() const { return m_collective.size(); }
void append(Node *node)
{
m_collective.append(node);
@@ -63,7 +63,7 @@ public:
setGenus(node->genus());
}
void sort() { std::sort(m_collective.begin(), m_collective.end(), Node::nodeNameLessThan); }
- const QList<Node *> &collective() const { return m_collective; }
+ [[nodiscard]] const QList<Node *> &collective() const { return m_collective; }
void setOverloadFlags();
void setRelatedNonmember(bool value) override;
Node *clone(Aggregate *parent) override;
diff --git a/src/qdoc/singleton.h b/src/qdoc/singleton.h
index c81cfc00b..ba6757652 100644
--- a/src/qdoc/singleton.h
+++ b/src/qdoc/singleton.h
@@ -44,8 +44,8 @@ public:
Singleton &operator=(const Singleton &) = delete;
static T &instance()
{
- static T instance;
- return instance;
+ static T s_instance {};
+ return s_instance;
}
protected:
diff --git a/src/qdoc/text.cpp b/src/qdoc/text.cpp
index da0fb1dee..aefa0b27a 100644
--- a/src/qdoc/text.cpp
+++ b/src/qdoc/text.cpp
@@ -34,14 +34,14 @@
QT_BEGIN_NAMESPACE
-Text::Text() : first(nullptr), last(nullptr) {}
+Text::Text() : m_first(nullptr), m_last(nullptr) { }
-Text::Text(const QString &str) : first(nullptr), last(nullptr)
+Text::Text(const QString &str) : m_first(nullptr), m_last(nullptr)
{
operator<<(str);
}
-Text::Text(const Text &text) : first(nullptr), last(nullptr)
+Text::Text(const Text &text) : m_first(nullptr), m_last(nullptr)
{
operator=(text);
}
@@ -73,17 +73,17 @@ Text &Text::operator<<(const QString &string)
Text &Text::operator<<(const Atom &atom)
{
if (atom.count() < 2) {
- if (first == nullptr) {
- first = new Atom(atom.type(), atom.string());
- last = first;
+ if (m_first == nullptr) {
+ m_first = new Atom(atom.type(), atom.string());
+ m_last = m_first;
} else
- last = new Atom(last, atom.type(), atom.string());
+ m_last = new Atom(m_last, atom.type(), atom.string());
} else {
- if (first == nullptr) {
- first = new Atom(atom.type(), atom.string(), atom.string(1));
- last = first;
+ if (m_first == nullptr) {
+ m_first = new Atom(atom.type(), atom.string(), atom.string(1));
+ m_last = m_first;
} else
- last = new Atom(last, atom.type(), atom.string(), atom.string(1));
+ m_last = new Atom(m_last, atom.type(), atom.string(), atom.string(1));
}
return *this;
}
@@ -95,11 +95,11 @@ Text &Text::operator<<(const Atom &atom)
*/
Text &Text::operator<<(const LinkAtom &atom)
{
- if (first == nullptr) {
- first = new LinkAtom(atom);
- last = first;
+ if (m_first == nullptr) {
+ m_first = new LinkAtom(atom);
+ m_last = m_first;
} else
- last = new LinkAtom(last, atom);
+ m_last = new LinkAtom(m_last, atom);
return *this;
}
@@ -115,27 +115,27 @@ Text &Text::operator<<(const Text &text)
void Text::stripFirstAtom()
{
- if (first != nullptr) {
- if (first == last)
- last = nullptr;
- Atom *oldFirst = first;
- first = first->next();
+ if (m_first != nullptr) {
+ if (m_first == m_last)
+ m_last = nullptr;
+ Atom *oldFirst = m_first;
+ m_first = m_first->next();
delete oldFirst;
}
}
void Text::stripLastAtom()
{
- if (last != nullptr) {
- Atom *oldLast = last;
- if (first == last) {
- first = nullptr;
- last = nullptr;
+ if (m_last != nullptr) {
+ Atom *oldLast = m_last;
+ if (m_first == m_last) {
+ m_first = nullptr;
+ m_last = nullptr;
} else {
- last = first;
- while (last->next() != oldLast)
- last = last->next();
- last->setNext(nullptr);
+ m_last = m_first;
+ while (m_last->next() != oldLast)
+ m_last = m_last->next();
+ m_last->setNext(nullptr);
}
delete oldLast;
}
@@ -248,13 +248,13 @@ Text Text::subText(const Atom *begin, const Atom *end)
void Text::clear()
{
- while (first != nullptr) {
- Atom *atom = first;
- first = first->next();
+ while (m_first != nullptr) {
+ Atom *atom = m_first;
+ m_first = m_first->next();
delete atom;
}
- first = nullptr;
- last = nullptr;
+ m_first = nullptr;
+ m_last = nullptr;
}
int Text::compare(const Text &text1, const Text &text2)
diff --git a/src/qdoc/text.h b/src/qdoc/text.h
index 64f54873e..f1942ffbd 100644
--- a/src/qdoc/text.h
+++ b/src/qdoc/text.h
@@ -43,8 +43,8 @@ public:
Text &operator=(const Text &text);
- Atom *firstAtom() { return first; }
- Atom *lastAtom() { return last; }
+ Atom *firstAtom() { return m_first; }
+ Atom *lastAtom() { return m_last; }
Text &operator<<(Atom::AtomType atomType);
Text &operator<<(const QString &string);
Text &operator<<(const Atom &atom);
@@ -53,11 +53,11 @@ public:
void stripFirstAtom();
void stripLastAtom();
- bool isEmpty() const { return first == nullptr; }
- bool contains(const QString &str) const;
- QString toString() const;
- const Atom *firstAtom() const { return first; }
- const Atom *lastAtom() const { return last; }
+ [[nodiscard]] bool isEmpty() const { return m_first == nullptr; }
+ [[nodiscard]] bool contains(const QString &str) const;
+ [[nodiscard]] QString toString() const;
+ [[nodiscard]] const Atom *firstAtom() const { return m_first; }
+ [[nodiscard]] const Atom *lastAtom() const { return m_last; }
Text subText(Atom::AtomType left, Atom::AtomType right, const Atom *from = nullptr,
bool inclusive = false) const;
void dump() const;
@@ -68,8 +68,8 @@ public:
static int compare(const Text &text1, const Text &text2);
private:
- Atom *first;
- Atom *last;
+ Atom *m_first { nullptr };
+ Atom *m_last { nullptr };
};
inline bool operator==(const Text &text1, const Text &text2)
diff --git a/src/qdoc/tokenizer.cpp b/src/qdoc/tokenizer.cpp
index 08c8acb00..c61b18eb8 100644
--- a/src/qdoc/tokenizer.cpp
+++ b/src/qdoc/tokenizer.cpp
@@ -144,65 +144,65 @@ static void insertKwordIntoHash(const char *s, int number)
Tokenizer::Tokenizer(const Location &loc, QFile &in)
{
init();
- yyIn = in.readAll();
- yyPos = 0;
+ m_in = in.readAll();
+ m_pos = 0;
start(loc);
}
-Tokenizer::Tokenizer(const Location &loc, QByteArray in) : yyIn(std::move(in))
+Tokenizer::Tokenizer(const Location &loc, QByteArray in) : m_in(std::move(in))
{
init();
- yyPos = 0;
+ m_pos = 0;
start(loc);
}
Tokenizer::~Tokenizer()
{
- delete[] yyLexBuf1;
- delete[] yyLexBuf2;
+ delete[] m_lexBuf1;
+ delete[] m_lexBuf2;
}
int Tokenizer::getToken()
{
- char *t = yyPrevLex;
- yyPrevLex = yyLex;
- yyLex = t;
+ char *t = m_prevLex;
+ m_prevLex = m_lex;
+ m_lex = t;
- while (yyCh != EOF) {
- yyTokLoc = yyCurLoc;
- yyLexLen = 0;
+ while (m_ch != EOF) {
+ m_tokLoc = m_curLoc;
+ m_lexLen = 0;
- if (isspace(yyCh)) {
+ if (isspace(m_ch)) {
do {
- yyCh = getChar();
- } while (isspace(yyCh));
- } else if (isalpha(yyCh) || yyCh == '_') {
+ m_ch = getChar();
+ } while (isspace(m_ch));
+ } else if (isalpha(m_ch) || m_ch == '_') {
do {
- yyCh = getChar();
- } while (isalnum(yyCh) || yyCh == '_');
+ m_ch = getChar();
+ } while (isalnum(m_ch) || m_ch == '_');
- int k = hashKword(yyLex, int(yyLexLen));
+ int k = hashKword(m_lex, int(m_lexLen));
for (;;) {
int i = kwordHashTable[k];
if (i == 0) {
return Tok_Ident;
} else if (i == -1) {
- if (!parsingMacro && ignoredTokensAndDirectives->contains(yyLex)) {
- if (ignoredTokensAndDirectives->value(yyLex)) { // it's a directive
+ if (!m_parsingMacro && ignoredTokensAndDirectives->contains(m_lex)) {
+ if (ignoredTokensAndDirectives->value(m_lex)) { // it's a directive
int parenDepth = 0;
- while (yyCh != EOF && (yyCh != ')' || parenDepth > 1)) {
- if (yyCh == '(')
+ while (m_ch != EOF && (m_ch != ')' || parenDepth > 1)) {
+ if (m_ch == '(')
++parenDepth;
- else if (yyCh == ')')
+ else if (m_ch == ')')
--parenDepth;
- yyCh = getChar();
+ m_ch = getChar();
}
- if (yyCh == ')')
- yyCh = getChar();
+ if (m_ch == ')')
+ m_ch = getChar();
}
break;
}
- } else if (strcmp(yyLex, kwords[i - 1]) == 0) {
+ } else if (strcmp(m_lex, kwords[i - 1]) == 0) {
int ret = (int)Tok_FirstKeyword + i - 1;
if (ret != Tok_typename)
return ret;
@@ -212,31 +212,31 @@ int Tokenizer::getToken()
if (++k == KwordHashTableSize)
k = 0;
}
- } else if (isdigit(yyCh)) {
+ } else if (isdigit(m_ch)) {
do {
- yyCh = getChar();
- } while (isalnum(yyCh) || yyCh == '.' || yyCh == '+' || yyCh == '-');
+ m_ch = getChar();
+ } while (isalnum(m_ch) || m_ch == '.' || m_ch == '+' || m_ch == '-');
return Tok_Number;
} else {
- switch (yyCh) {
+ switch (m_ch) {
case '!':
case '%':
- yyCh = getChar();
- if (yyCh == '=')
- yyCh = getChar();
+ m_ch = getChar();
+ if (m_ch == '=')
+ m_ch = getChar();
return Tok_SomeOperator;
case '"':
- yyCh = getChar();
+ m_ch = getChar();
- while (yyCh != EOF && yyCh != '"') {
- if (yyCh == '\\')
- yyCh = getChar();
- yyCh = getChar();
+ while (m_ch != EOF && m_ch != '"') {
+ if (m_ch == '\\')
+ m_ch = getChar();
+ m_ch = getChar();
}
- yyCh = getChar();
+ m_ch = getChar();
- if (yyCh == EOF)
- yyTokLoc.warning(
+ if (m_ch == EOF)
+ m_tokLoc.warning(
QStringLiteral("Unterminated C++ string literal"),
QStringLiteral("Maybe you forgot '/*!' at the beginning of the file?"));
else
@@ -245,260 +245,260 @@ int Tokenizer::getToken()
case '#':
return getTokenAfterPreprocessor();
case '&':
- yyCh = getChar();
+ m_ch = getChar();
/*
Removed check for '&&', only interpret '&=' as an operator.
'&&' is also used for an rvalue reference. QTBUG-32675
*/
- if (yyCh == '=') {
- yyCh = getChar();
+ if (m_ch == '=') {
+ m_ch = getChar();
return Tok_SomeOperator;
} else {
return Tok_Ampersand;
}
case '\'':
- yyCh = getChar();
+ m_ch = getChar();
/*
Allow empty character literal. QTBUG-25775
*/
- if (yyCh == '\'') {
- yyCh = getChar();
+ if (m_ch == '\'') {
+ m_ch = getChar();
break;
}
- if (yyCh == '\\')
- yyCh = getChar();
+ if (m_ch == '\\')
+ m_ch = getChar();
do {
- yyCh = getChar();
- } while (yyCh != EOF && yyCh != '\'');
+ m_ch = getChar();
+ } while (m_ch != EOF && m_ch != '\'');
- if (yyCh == EOF) {
- yyTokLoc.warning(QStringLiteral("Unterminated C++ character literal"));
+ if (m_ch == EOF) {
+ m_tokLoc.warning(QStringLiteral("Unterminated C++ character literal"));
} else {
- yyCh = getChar();
+ m_ch = getChar();
return Tok_Number;
}
break;
case '(':
- yyCh = getChar();
- if (yyNumPreprocessorSkipping == 0)
- yyParenDepth++;
- if (isspace(yyCh)) {
+ m_ch = getChar();
+ if (m_numPreprocessorSkipping == 0)
+ m_parenDepth++;
+ if (isspace(m_ch)) {
do {
- yyCh = getChar();
- } while (isspace(yyCh));
- yyLexLen = 1;
- yyLex[1] = '\0';
+ m_ch = getChar();
+ } while (isspace(m_ch));
+ m_lexLen = 1;
+ m_lex[1] = '\0';
}
- if (yyCh == '*') {
- yyCh = getChar();
+ if (m_ch == '*') {
+ m_ch = getChar();
return Tok_LeftParenAster;
}
return Tok_LeftParen;
case ')':
- yyCh = getChar();
- if (yyNumPreprocessorSkipping == 0)
- yyParenDepth--;
+ m_ch = getChar();
+ if (m_numPreprocessorSkipping == 0)
+ m_parenDepth--;
return Tok_RightParen;
case '*':
- yyCh = getChar();
- if (yyCh == '=') {
- yyCh = getChar();
+ m_ch = getChar();
+ if (m_ch == '=') {
+ m_ch = getChar();
return Tok_SomeOperator;
} else {
return Tok_Aster;
}
case '^':
- yyCh = getChar();
- if (yyCh == '=') {
- yyCh = getChar();
+ m_ch = getChar();
+ if (m_ch == '=') {
+ m_ch = getChar();
return Tok_SomeOperator;
} else {
return Tok_Caret;
}
case '+':
- yyCh = getChar();
- if (yyCh == '+' || yyCh == '=')
- yyCh = getChar();
+ m_ch = getChar();
+ if (m_ch == '+' || m_ch == '=')
+ m_ch = getChar();
return Tok_SomeOperator;
case ',':
- yyCh = getChar();
+ m_ch = getChar();
return Tok_Comma;
case '-':
- yyCh = getChar();
- if (yyCh == '-' || yyCh == '=') {
- yyCh = getChar();
- } else if (yyCh == '>') {
- yyCh = getChar();
- if (yyCh == '*')
- yyCh = getChar();
+ m_ch = getChar();
+ if (m_ch == '-' || m_ch == '=') {
+ m_ch = getChar();
+ } else if (m_ch == '>') {
+ m_ch = getChar();
+ if (m_ch == '*')
+ m_ch = getChar();
}
return Tok_SomeOperator;
case '.':
- yyCh = getChar();
- if (yyCh == '*') {
- yyCh = getChar();
- } else if (yyCh == '.') {
+ m_ch = getChar();
+ if (m_ch == '*') {
+ m_ch = getChar();
+ } else if (m_ch == '.') {
do {
- yyCh = getChar();
- } while (yyCh == '.');
+ m_ch = getChar();
+ } while (m_ch == '.');
return Tok_Ellipsis;
- } else if (isdigit(yyCh)) {
+ } else if (isdigit(m_ch)) {
do {
- yyCh = getChar();
- } while (isalnum(yyCh) || yyCh == '.' || yyCh == '+' || yyCh == '-');
+ m_ch = getChar();
+ } while (isalnum(m_ch) || m_ch == '.' || m_ch == '+' || m_ch == '-');
return Tok_Number;
}
return Tok_SomeOperator;
case '/':
- yyCh = getChar();
- if (yyCh == '/') {
+ m_ch = getChar();
+ if (m_ch == '/') {
do {
- yyCh = getChar();
- } while (yyCh != EOF && yyCh != '\n');
- } else if (yyCh == '*') {
+ m_ch = getChar();
+ } while (m_ch != EOF && m_ch != '\n');
+ } else if (m_ch == '*') {
bool metDoc = false; // empty doc is no doc
bool metSlashAsterBang = false;
bool metAster = false;
bool metAsterSlash = false;
- yyCh = getChar();
- if (yyCh == '!')
+ m_ch = getChar();
+ if (m_ch == '!')
metSlashAsterBang = true;
while (!metAsterSlash) {
- if (yyCh == EOF) {
- yyTokLoc.warning(QStringLiteral("Unterminated C++ comment"));
+ if (m_ch == EOF) {
+ m_tokLoc.warning(QStringLiteral("Unterminated C++ comment"));
break;
} else {
- if (yyCh == '*') {
+ if (m_ch == '*') {
metAster = true;
- } else if (metAster && yyCh == '/') {
+ } else if (metAster && m_ch == '/') {
metAsterSlash = true;
} else {
metAster = false;
- if (isgraph(yyCh))
+ if (isgraph(m_ch))
metDoc = true;
}
}
- yyCh = getChar();
+ m_ch = getChar();
}
if (metSlashAsterBang && metDoc)
return Tok_Doc;
- else if (yyParenDepth > 0)
+ else if (m_parenDepth > 0)
return Tok_Comment;
} else {
- if (yyCh == '=')
- yyCh = getChar();
+ if (m_ch == '=')
+ m_ch = getChar();
return Tok_SomeOperator;
}
break;
case ':':
- yyCh = getChar();
- if (yyCh == ':') {
- yyCh = getChar();
+ m_ch = getChar();
+ if (m_ch == ':') {
+ m_ch = getChar();
return Tok_Gulbrandsen;
} else {
return Tok_Colon;
}
case ';':
- yyCh = getChar();
+ m_ch = getChar();
return Tok_Semicolon;
case '<':
- yyCh = getChar();
- if (yyCh == '<') {
- yyCh = getChar();
- if (yyCh == '=')
- yyCh = getChar();
+ m_ch = getChar();
+ if (m_ch == '<') {
+ m_ch = getChar();
+ if (m_ch == '=')
+ m_ch = getChar();
return Tok_SomeOperator;
- } else if (yyCh == '=') {
- yyCh = getChar();
+ } else if (m_ch == '=') {
+ m_ch = getChar();
return Tok_SomeOperator;
} else {
return Tok_LeftAngle;
}
case '=':
- yyCh = getChar();
- if (yyCh == '=') {
- yyCh = getChar();
+ m_ch = getChar();
+ if (m_ch == '=') {
+ m_ch = getChar();
return Tok_SomeOperator;
} else {
return Tok_Equal;
}
case '>':
- yyCh = getChar();
- if (yyCh == '>') {
- yyCh = getChar();
- if (yyCh == '=')
- yyCh = getChar();
+ m_ch = getChar();
+ if (m_ch == '>') {
+ m_ch = getChar();
+ if (m_ch == '=')
+ m_ch = getChar();
return Tok_SomeOperator;
- } else if (yyCh == '=') {
- yyCh = getChar();
+ } else if (m_ch == '=') {
+ m_ch = getChar();
return Tok_SomeOperator;
} else {
return Tok_RightAngle;
}
case '?':
- yyCh = getChar();
+ m_ch = getChar();
return Tok_SomeOperator;
case '[':
- yyCh = getChar();
- if (yyNumPreprocessorSkipping == 0)
- yyBracketDepth++;
+ m_ch = getChar();
+ if (m_numPreprocessorSkipping == 0)
+ m_bracketDepth++;
return Tok_LeftBracket;
case '\\':
- yyCh = getChar();
- yyCh = getChar(); // skip one character
+ m_ch = getChar();
+ m_ch = getChar(); // skip one character
break;
case ']':
- yyCh = getChar();
- if (yyNumPreprocessorSkipping == 0)
- yyBracketDepth--;
+ m_ch = getChar();
+ if (m_numPreprocessorSkipping == 0)
+ m_bracketDepth--;
return Tok_RightBracket;
case '{':
- yyCh = getChar();
- if (yyNumPreprocessorSkipping == 0)
- yyBraceDepth++;
+ m_ch = getChar();
+ if (m_numPreprocessorSkipping == 0)
+ m_braceDepth++;
return Tok_LeftBrace;
case '}':
- yyCh = getChar();
- if (yyNumPreprocessorSkipping == 0)
- yyBraceDepth--;
+ m_ch = getChar();
+ if (m_numPreprocessorSkipping == 0)
+ m_braceDepth--;
return Tok_RightBrace;
case '|':
- yyCh = getChar();
- if (yyCh == '|' || yyCh == '=')
- yyCh = getChar();
+ m_ch = getChar();
+ if (m_ch == '|' || m_ch == '=')
+ m_ch = getChar();
return Tok_SomeOperator;
case '~':
- yyCh = getChar();
+ m_ch = getChar();
return Tok_Tilde;
case '@':
- yyCh = getChar();
+ m_ch = getChar();
return Tok_At;
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(QStringLiteral("Hostile character 0x%1 in C++ source")
- .arg((uchar)yyCh, 1, 16));
+ if (m_numPreprocessorSkipping == 0
+ && !(m_tokLoc.fileName().endsWith(".qdoc")
+ || m_tokLoc.fileName().endsWith(".js"))) {
+ m_tokLoc.warning(QStringLiteral("Hostile character 0x%1 in C++ source")
+ .arg((uchar)m_ch, 1, 16));
}
- yyCh = getChar();
+ m_ch = getChar();
}
}
}
- if (yyPreprocessorSkipping.count() > 1) {
- yyTokLoc.warning(QStringLiteral("Expected #endif before end of file"));
+ if (m_preprocessorSkipping.count() > 1) {
+ m_tokLoc.warning(QStringLiteral("Expected #endif before end of file"));
// clear it out or we get an infinite loop!
- while (!yyPreprocessorSkipping.isEmpty()) {
+ while (!m_preprocessorSkipping.isEmpty()) {
popSkipping();
}
}
- strcpy(yyLex, "end-of-input");
- yyLexLen = strlen(yyLex);
+ strcpy(m_lex, "end-of-input");
+ m_lexLen = strlen(m_lex);
return Tok_Eoi;
}
@@ -577,35 +577,35 @@ void Tokenizer::terminate()
void Tokenizer::init()
{
- yyLexBuf1 = new char[(int)yyLexBufSize];
- yyLexBuf2 = new char[(int)yyLexBufSize];
- yyPrevLex = yyLexBuf1;
- yyPrevLex[0] = '\0';
- yyLex = yyLexBuf2;
- yyLex[0] = '\0';
- yyLexLen = 0;
- yyPreprocessorSkipping.push(false);
- yyNumPreprocessorSkipping = 0;
- yyBraceDepth = 0;
- yyParenDepth = 0;
- yyBracketDepth = 0;
- yyCh = '\0';
- parsingMacro = false;
+ m_lexBuf1 = new char[(int)yyLexBufSize];
+ m_lexBuf2 = new char[(int)yyLexBufSize];
+ m_prevLex = m_lexBuf1;
+ m_prevLex[0] = '\0';
+ m_lex = m_lexBuf2;
+ m_lex[0] = '\0';
+ m_lexLen = 0;
+ m_preprocessorSkipping.push(false);
+ m_numPreprocessorSkipping = 0;
+ m_braceDepth = 0;
+ m_parenDepth = 0;
+ m_bracketDepth = 0;
+ m_ch = '\0';
+ m_parsingMacro = false;
}
void Tokenizer::start(const Location &loc)
{
- yyTokLoc = loc;
- yyCurLoc = loc;
- yyCurLoc.start();
- strcpy(yyPrevLex, "beginning-of-input");
- strcpy(yyLex, "beginning-of-input");
- yyLexLen = strlen(yyLex);
- yyBraceDepth = 0;
- yyParenDepth = 0;
- yyBracketDepth = 0;
- yyCh = '\0';
- yyCh = getChar();
+ m_tokLoc = loc;
+ m_curLoc = loc;
+ m_curLoc.start();
+ strcpy(m_prevLex, "beginning-of-input");
+ strcpy(m_lex, "beginning-of-input");
+ m_lexLen = strlen(m_lex);
+ m_braceDepth = 0;
+ m_parenDepth = 0;
+ m_bracketDepth = 0;
+ m_ch = '\0';
+ m_ch = getChar();
}
/*
@@ -615,9 +615,9 @@ void Tokenizer::start(const Location &loc)
*/
int Tokenizer::getTokenAfterPreprocessor()
{
- yyCh = getChar();
- while (isspace(yyCh) && yyCh != '\n')
- yyCh = getChar();
+ m_ch = getChar();
+ while (isspace(m_ch) && m_ch != '\n')
+ m_ch = getChar();
/*
#directive condition
@@ -625,19 +625,19 @@ int Tokenizer::getTokenAfterPreprocessor()
QString directive;
QString condition;
- while (isalpha(yyCh)) {
- directive += QChar(yyCh);
- yyCh = getChar();
+ while (isalpha(m_ch)) {
+ directive += QChar(m_ch);
+ m_ch = getChar();
}
if (!directive.isEmpty()) {
- while (yyCh != EOF && yyCh != '\n') {
- if (yyCh == '\\') {
- yyCh = getChar();
- if (yyCh == '\r')
- yyCh = getChar();
+ while (m_ch != EOF && m_ch != '\n') {
+ if (m_ch == '\\') {
+ m_ch = getChar();
+ if (m_ch == '\r')
+ m_ch = getChar();
}
- condition += QChar(yyCh);
- yyCh = getChar();
+ condition += QChar(m_ch);
+ m_ch = getChar();
}
condition.remove(*comment);
condition = condition.simplified();
@@ -681,7 +681,7 @@ int Tokenizer::getTokenAfterPreprocessor()
} else if (directive == QString("define")) {
auto match = versionX->match(condition);
if (match.hasMatch())
- yyVersion = match.captured(1);
+ m_version = match.captured(1);
}
}
@@ -692,7 +692,7 @@ int Tokenizer::getTokenAfterPreprocessor()
yyPrevLex. This way, we skip over the preprocessor
directive.
*/
- qstrcpy(yyLex, yyPrevLex);
+ qstrcpy(m_lex, m_prevLex);
/*
If getToken() meets another #, it will call
@@ -702,7 +702,7 @@ int Tokenizer::getTokenAfterPreprocessor()
the stack.
*/
tok = getToken();
- } while (yyNumPreprocessorSkipping > 0 && tok != Tok_Eoi);
+ } while (m_numPreprocessorSkipping > 0 && tok != Tok_Eoi);
return tok;
}
@@ -712,9 +712,9 @@ int Tokenizer::getTokenAfterPreprocessor()
*/
void Tokenizer::pushSkipping(bool skip)
{
- yyPreprocessorSkipping.push(skip);
+ m_preprocessorSkipping.push(skip);
if (skip)
- yyNumPreprocessorSkipping++;
+ m_numPreprocessorSkipping++;
}
/*
@@ -722,14 +722,14 @@ void Tokenizer::pushSkipping(bool skip)
*/
bool Tokenizer::popSkipping()
{
- if (yyPreprocessorSkipping.isEmpty()) {
- yyTokLoc.warning(QStringLiteral("Unexpected #elif, #else or #endif"));
+ if (m_preprocessorSkipping.isEmpty()) {
+ m_tokLoc.warning(QStringLiteral("Unexpected #elif, #else or #endif"));
return true;
}
- bool skip = yyPreprocessorSkipping.pop();
+ bool skip = m_preprocessorSkipping.pop();
if (skip)
- yyNumPreprocessorSkipping--;
+ m_numPreprocessorSkipping--;
return skip;
}
@@ -796,12 +796,12 @@ bool Tokenizer::isTrue(const QString &condition)
QString Tokenizer::lexeme() const
{
- return sourceDecoder(yyLex);
+ return sourceDecoder(m_lex);
}
QString Tokenizer::previousLexeme() const
{
- return sourceDecoder(yyPrevLex);
+ return sourceDecoder(m_prevLex);
}
QT_END_NAMESPACE
diff --git a/src/qdoc/tokenizer.h b/src/qdoc/tokenizer.h
index d333b85dd..3f2303b8f 100644
--- a/src/qdoc/tokenizer.h
+++ b/src/qdoc/tokenizer.h
@@ -110,14 +110,14 @@ public:
~Tokenizer();
int getToken();
- void setParsingFnOrMacro(bool macro) { parsingMacro = macro; }
+ void setParsingFnOrMacro(bool macro) { m_parsingMacro = macro; }
- const Location &location() const { return yyTokLoc; }
- QString previousLexeme() const;
- QString lexeme() const;
- QString version() const { return yyVersion; }
- int parenDepth() const { return yyParenDepth; }
- int bracketDepth() const { return yyBracketDepth; }
+ [[nodiscard]] const Location &location() const { return m_tokLoc; }
+ [[nodiscard]] QString previousLexeme() const;
+ [[nodiscard]] QString lexeme() const;
+ [[nodiscard]] QString version() const { return m_version; }
+ [[nodiscard]] int parenDepth() const { return m_parenDepth; }
+ [[nodiscard]] int bracketDepth() const { return m_bracketDepth; }
static void initialize();
static void terminate();
@@ -133,17 +133,17 @@ private:
*/
enum { yyLexBufSize = 524288 };
- int getch() { return yyPos == yyIn.size() ? EOF : yyIn[yyPos++]; }
+ int getch() { return m_pos == m_in.size() ? EOF : m_in[m_pos++]; }
inline int getChar()
{
- if (yyCh == EOF)
+ if (m_ch == EOF)
return EOF;
- if (yyLexLen < yyLexBufSize - 1) {
- yyLex[yyLexLen++] = (char)yyCh;
- yyLex[yyLexLen] = '\0';
+ if (m_lexLen < yyLexBufSize - 1) {
+ m_lex[m_lexLen++] = (char)m_ch;
+ m_lex[m_lexLen] = '\0';
}
- yyCurLoc.advance(QChar(yyCh));
+ m_curLoc.advance(QChar(m_ch));
int ch = getch();
if (ch == EOF)
return EOF;
@@ -157,26 +157,26 @@ private:
void pushSkipping(bool skip);
bool popSkipping();
- Location yyTokLoc;
- Location yyCurLoc;
- char *yyLexBuf1 {};
- char *yyLexBuf2 {};
- char *yyPrevLex {};
- char *yyLex {};
- size_t yyLexLen {};
- QStack<bool> yyPreprocessorSkipping;
- int yyNumPreprocessorSkipping {};
- int yyBraceDepth {};
- int yyParenDepth {};
- int yyBracketDepth {};
- int yyCh {};
-
- QString yyVersion;
- bool parsingMacro {};
+ Location m_tokLoc;
+ Location m_curLoc;
+ char *m_lexBuf1 { nullptr };
+ char *m_lexBuf2 { nullptr };
+ char *m_prevLex { nullptr };
+ char *m_lex { nullptr };
+ size_t m_lexLen {};
+ QStack<bool> m_preprocessorSkipping;
+ int m_numPreprocessorSkipping {};
+ int m_braceDepth {};
+ int m_parenDepth {};
+ int m_bracketDepth {};
+ int m_ch {};
+
+ QString m_version {};
+ bool m_parsingMacro {};
protected:
- QByteArray yyIn;
- int yyPos;
+ QByteArray m_in {};
+ int m_pos {};
};
QT_END_NAMESPACE
diff --git a/src/qdoc/topic.h b/src/qdoc/topic.h
index adfa46af9..a1db74ff3 100644
--- a/src/qdoc/topic.h
+++ b/src/qdoc/topic.h
@@ -34,18 +34,18 @@ struct Topic
{
public:
Topic() = default;
- Topic(QString &t, QString a) : topic(t), args(std::move(a)) {}
+ Topic(QString &t, QString a) : m_topic(t), m_args(std::move(a)) { }
~Topic() = default;
- bool isEmpty() const { return topic.isEmpty(); }
+ [[nodiscard]] bool isEmpty() const { return m_topic.isEmpty(); }
void clear()
{
- topic.clear();
- args.clear();
+ m_topic.clear();
+ m_args.clear();
}
- QString topic;
- QString args;
+ QString m_topic {};
+ QString m_args {};
};
typedef QList<Topic> TopicList;
diff --git a/src/qdoc/tree.cpp b/src/qdoc/tree.cpp
index 0227dff84..5b73bd717 100644
--- a/src/qdoc/tree.cpp
+++ b/src/qdoc/tree.cpp
@@ -69,14 +69,14 @@ QT_BEGIN_NAMESPACE
as it appears in the qdocconf file.
*/
Tree::Tree(const QString &camelCaseModuleName, QDocDatabase *qdb)
- : treeHasBeenAnalyzed_(false),
- camelCaseModuleName_(camelCaseModuleName),
- physicalModuleName_(camelCaseModuleName.toLower()),
- qdb_(qdb),
- root_(nullptr, QString())
+ : m_treeHasBeenAnalyzed(false),
+ m_camelCaseModuleName(camelCaseModuleName),
+ m_physicalModuleName(camelCaseModuleName.toLower()),
+ m_qdb(qdb),
+ m_root(nullptr, QString())
{
- root_.setPhysicalModuleName(physicalModuleName_);
- root_.setTree(this);
+ m_root.setPhysicalModuleName(m_physicalModuleName);
+ m_root.setTree(this);
}
/*!
@@ -95,11 +95,11 @@ Tree::Tree(const QString &camelCaseModuleName, QDocDatabase *qdb)
*/
Tree::~Tree()
{
- for (auto i = nodesByTargetRef_.begin(); i != nodesByTargetRef_.end(); ++i) {
+ for (auto i = m_nodesByTargetRef.begin(); i != m_nodesByTargetRef.end(); ++i) {
delete i.value();
}
- nodesByTargetRef_.clear();
- nodesByTargetTitle_.clear();
+ m_nodesByTargetRef.clear();
+ m_nodesByTargetTitle.clear();
}
/* API members */
@@ -182,7 +182,7 @@ Aggregate *Tree::findRelatesNode(const QStringList &path)
void Tree::addPropertyFunction(PropertyNode *property, const QString &funcName,
PropertyNode::FunctionRole funcRole)
{
- unresolvedPropertyMap[property].insert(funcRole, funcName);
+ m_unresolvedPropertyMap[property].insert(funcRole, funcName);
}
/*!
@@ -201,7 +201,7 @@ void Tree::resolveBaseClasses(Aggregate *n)
QList<RelatedClass> &bases = cn->baseClasses();
for (auto &base : bases) {
if (base.m_node == nullptr) {
- Node *n = qdb_->findClassNode(base.m_path);
+ Node *n = m_qdb->findClassNode(base.m_path);
/*
If the node for the base class was not found,
the reason might be that the subclass is in a
@@ -255,8 +255,8 @@ void Tree::resolvePropertyOverriddenFromPtrs(Aggregate *n)
*/
void Tree::resolveProperties()
{
- for (auto propEntry = unresolvedPropertyMap.constBegin();
- propEntry != unresolvedPropertyMap.constEnd(); ++propEntry) {
+ for (auto propEntry = m_unresolvedPropertyMap.constBegin();
+ propEntry != m_unresolvedPropertyMap.constEnd(); ++propEntry) {
PropertyNode *property = propEntry.key();
Aggregate *parent = property->parent();
QString getterName = (*propEntry)[PropertyNode::Getter];
@@ -283,15 +283,15 @@ void Tree::resolveProperties()
}
}
- for (auto propEntry = unresolvedPropertyMap.constBegin();
- propEntry != unresolvedPropertyMap.constEnd(); ++propEntry) {
+ for (auto propEntry = m_unresolvedPropertyMap.constBegin();
+ propEntry != m_unresolvedPropertyMap.constEnd(); ++propEntry) {
PropertyNode *property = propEntry.key();
// redo it to set the property functions
if (property->overriddenFrom())
property->setOverriddenFrom(property->overriddenFrom());
}
- unresolvedPropertyMap.clear();
+ m_unresolvedPropertyMap.clear();
}
/*!
@@ -302,7 +302,7 @@ void Tree::resolveProperties()
void Tree::resolveCppToQmlLinks()
{
- const NodeList &children = root_.childNodes();
+ const NodeList &children = m_root.childNodes();
for (auto *child : children) {
if (child->isQmlType() || child->isJsType()) {
auto *qcn = static_cast<QmlTypeNode *>(child);
@@ -322,14 +322,14 @@ void Tree::resolveCppToQmlLinks()
void Tree::resolveUsingClauses(Aggregate *parent)
{
if (!parent)
- parent = &root_;
+ parent = &m_root;
for (auto *child : parent->childNodes()) {
if (child->isClassNode()) {
auto *cn = static_cast<ClassNode *>(child);
QList<UsingClause> &usingClauses = cn->usingClauses();
for (auto &usingClause : usingClauses) {
if (usingClause.node() == nullptr) {
- const Node *n = qdb_->findFunctionNode(usingClause.signature(), cn, Node::CPP);
+ const Node *n = m_qdb->findFunctionNode(usingClause.signature(), cn, Node::CPP);
if (n != nullptr)
usingClause.setNode(n);
}
@@ -704,22 +704,22 @@ const Node *Tree::findEnumNode(const Node *node, const Node *aggregate, const QS
*/
QString Tree::getRef(const QString &target, const Node *node) const
{
- auto it = nodesByTargetTitle_.constFind(target);
- if (it != nodesByTargetTitle_.constEnd()) {
+ auto it = m_nodesByTargetTitle.constFind(target);
+ if (it != m_nodesByTargetTitle.constEnd()) {
do {
- if (it.value()->node_ == node)
- return it.value()->ref_;
+ if (it.value()->m_node == node)
+ return it.value()->m_ref;
++it;
- } while (it != nodesByTargetTitle_.constEnd() && it.key() == target);
+ } while (it != m_nodesByTargetTitle.constEnd() && it.key() == target);
}
QString key = Doc::canonicalTitle(target);
- it = nodesByTargetRef_.constFind(key);
- if (it != nodesByTargetRef_.constEnd()) {
+ it = m_nodesByTargetRef.constFind(key);
+ if (it != m_nodesByTargetRef.constEnd()) {
do {
- if (it.value()->node_ == node)
- return it.value()->ref_;
+ if (it.value()->m_node == node)
+ return it.value()->m_ref;
++it;
- } while (it != nodesByTargetRef_.constEnd() && it.key() == key);
+ } while (it != m_nodesByTargetRef.constEnd() && it.key() == key);
}
return QString();
}
@@ -734,8 +734,8 @@ void Tree::insertTarget(const QString &name, const QString &title, TargetRec::Ta
Node *node, int priority)
{
auto *target = new TargetRec(name, type, node, priority);
- nodesByTargetRef_.insert(name, target);
- nodesByTargetTitle_.insert(title, target);
+ m_nodesByTargetRef.insert(name, target);
+ m_nodesByTargetTitle.insert(title, target);
}
/*!
@@ -749,7 +749,7 @@ void Tree::resolveTargets(Aggregate *root)
if (!key.isEmpty()) {
if (key.contains(QChar(' ')))
key = Doc::canonicalTitle(key);
- QList<PageNode *> nodes = pageNodesByTitle_.values(key);
+ QList<PageNode *> nodes = m_pageNodesByTitle.values(key);
bool alreadyThere = false;
if (!nodes.empty()) {
for (const auto &node_ : nodes) {
@@ -762,7 +762,7 @@ void Tree::resolveTargets(Aggregate *root)
}
}
if (!alreadyThere)
- pageNodesByTitle_.insert(key, node);
+ m_pageNodesByTitle.insert(key, node);
}
}
@@ -774,8 +774,8 @@ void Tree::resolveTargets(Aggregate *root)
if (!ref.isEmpty() && !title.isEmpty()) {
QString key = Doc::canonicalTitle(title);
auto *target = new TargetRec(ref, TargetRec::Contents, child, 3);
- nodesByTargetRef_.insert(key, target);
- nodesByTargetTitle_.insert(title, target);
+ m_nodesByTargetRef.insert(key, target);
+ m_nodesByTargetTitle.insert(title, target);
}
}
}
@@ -786,8 +786,8 @@ void Tree::resolveTargets(Aggregate *root)
QString title = i->string();
if (!ref.isEmpty() && !title.isEmpty()) {
auto *target = new TargetRec(ref, TargetRec::Keyword, child, 1);
- nodesByTargetRef_.insert(Doc::canonicalTitle(title), target);
- nodesByTargetTitle_.insert(title, target);
+ m_nodesByTargetRef.insert(Doc::canonicalTitle(title), target);
+ m_nodesByTargetTitle.insert(title, target);
}
}
}
@@ -799,8 +799,8 @@ void Tree::resolveTargets(Aggregate *root)
if (!ref.isEmpty() && !title.isEmpty()) {
QString key = Doc::canonicalTitle(title);
auto *target = new TargetRec(ref, TargetRec::Target, child, 2);
- nodesByTargetRef_.insert(key, target);
- nodesByTargetTitle_.insert(title, target);
+ m_nodesByTargetRef.insert(key, target);
+ m_nodesByTargetTitle.insert(title, target);
}
}
}
@@ -821,49 +821,49 @@ const Node *Tree::findUnambiguousTarget(const QString &target, Node::Genus genus
QList<TargetRec *> bestTargetList;
QString key = target;
- for (auto it = nodesByTargetTitle_.find(key); it != nodesByTargetTitle_.constEnd(); ++it) {
+ for (auto it = m_nodesByTargetTitle.find(key); it != m_nodesByTargetTitle.constEnd(); ++it) {
if (it.key() != key)
break;
TargetRec *candidate = it.value();
if ((genus == Node::DontCare) || (genus & candidate->genus())) {
- if (!bestTarget || (candidate->priority_ < bestTarget->priority_)) {
+ if (!bestTarget || (candidate->m_priority < bestTarget->m_priority)) {
bestTarget = candidate;
bestTargetList.clear();
bestTargetList.append(candidate);
numBestTargets = 1;
- } else if (candidate->priority_ == bestTarget->priority_) {
+ } else if (candidate->m_priority == bestTarget->m_priority) {
bestTargetList.append(candidate);
++numBestTargets;
}
}
}
if (bestTarget) {
- ref = bestTarget->ref_;
- return bestTarget->node_;
+ ref = bestTarget->m_ref;
+ return bestTarget->m_node;
}
numBestTargets = 0;
bestTarget = nullptr;
key = Doc::canonicalTitle(target);
- for (auto it = nodesByTargetRef_.find(key); it != nodesByTargetRef_.constEnd(); ++it) {
+ for (auto it = m_nodesByTargetRef.find(key); it != m_nodesByTargetRef.constEnd(); ++it) {
if (it.key() != key)
break;
TargetRec *candidate = it.value();
if ((genus == Node::DontCare) || (genus & candidate->genus())) {
- if (!bestTarget || (candidate->priority_ < bestTarget->priority_)) {
+ if (!bestTarget || (candidate->m_priority < bestTarget->m_priority)) {
bestTarget = candidate;
bestTargetList.clear();
bestTargetList.append(candidate);
numBestTargets = 1;
- } else if (candidate->priority_ == bestTarget->priority_) {
+ } else if (candidate->m_priority == bestTarget->m_priority) {
bestTargetList.append(candidate);
++numBestTargets;
}
}
}
if (bestTarget) {
- ref = bestTarget->ref_;
- return bestTarget->node_;
+ ref = bestTarget->m_ref;
+ return bestTarget->m_node;
}
ref.clear();
@@ -877,10 +877,10 @@ const PageNode *Tree::findPageNodeByTitle(const QString &title) const
{
PageNodeMultiMap::const_iterator it;
if (title.contains(QChar(' ')))
- it = pageNodesByTitle_.constFind(Doc::canonicalTitle(title));
+ it = m_pageNodesByTitle.constFind(Doc::canonicalTitle(title));
else
- it = pageNodesByTitle_.constFind(title);
- if (it != pageNodesByTitle_.constEnd()) {
+ it = m_pageNodesByTitle.constFind(title);
+ if (it != m_pageNodesByTitle.constEnd()) {
/*
Reporting all these duplicate section titles is probably
overkill. We should report the duplicate file and let
@@ -888,14 +888,14 @@ const PageNode *Tree::findPageNodeByTitle(const QString &title) const
*/
PageNodeMultiMap::const_iterator j = it;
++j;
- if (j != pageNodesByTitle_.constEnd() && j.key() == it.key()) {
- while (j != pageNodesByTitle_.constEnd()) {
+ if (j != m_pageNodesByTitle.constEnd() && j.key() == it.key()) {
+ while (j != m_pageNodesByTitle.constEnd()) {
if (j.key() == it.key() && j.value()->url().isEmpty()) {
break; // Just report one duplicate for now.
}
++j;
}
- if (j != pageNodesByTitle_.cend()) {
+ if (j != m_pageNodesByTitle.cend()) {
it.value()->location().warning("This page title exists in more than one file: "
+ title);
j.value()->location().warning("[It also exists here]");
@@ -947,13 +947,13 @@ CNMap *Tree::getCollectionMap(Node::NodeType type)
{
switch (type) {
case Node::Group:
- return &groups_;
+ return &m_groups;
case Node::Module:
- return &modules_;
+ return &m_modules;
case Node::QmlModule:
- return &qmlModules_;
+ return &m_qmlModules;
case Node::JsModule:
- return &jsModules_;
+ return &m_jsModules;
default:
break;
}
@@ -1176,8 +1176,8 @@ CollectionNode *Tree::addToJsModule(const QString &name, Node *node)
*/
void Tree::insertQmlType(const QString &key, QmlTypeNode *n)
{
- if (!qmlTypeMap_.contains(key))
- qmlTypeMap_.insert(key, n);
+ if (!m_qmlTypeMap.contains(key))
+ m_qmlTypeMap.insert(key, n);
}
/*!
@@ -1258,7 +1258,7 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path, const Parame
const FunctionNode *FN = fn;
while (FN->isPrivate() && !FN->overridesThis().isEmpty()) {
QStringList path = FN->overridesThis().split("::");
- FN = qdb_->findFunctionNode(path, parameters, relative, genus);
+ FN = m_qdb->findFunctionNode(path, parameters, relative, genus);
if (FN == nullptr)
break;
if (!FN->isPrivate())
@@ -1331,8 +1331,8 @@ void Tree::addToDontDocumentMap(QString &arg)
if (sl.isEmpty())
return;
for (const QString &s : sl) {
- if (!dontDocumentMap_.contains(s))
- dontDocumentMap_.insert(s, nullptr);
+ if (!m_dontDocumentMap.contains(s))
+ m_dontDocumentMap.insert(s, nullptr);
}
}
@@ -1351,7 +1351,7 @@ void Tree::addToDontDocumentMap(QString &arg)
*/
void Tree::markDontDocumentNodes()
{
- for (auto it = dontDocumentMap_.begin(); it != dontDocumentMap_.end(); ++it) {
+ for (auto it = m_dontDocumentMap.begin(); it != m_dontDocumentMap.end(); ++it) {
Aggregate *node = findAggregate(it.key());
if (node != nullptr)
node->setStatus(Node::DontDocument);
diff --git a/src/qdoc/tree.h b/src/qdoc/tree.h
index 274551488..850055eaf 100644
--- a/src/qdoc/tree.h
+++ b/src/qdoc/tree.h
@@ -52,20 +52,20 @@ public:
enum TargetType { Unknown, Target, Keyword, Contents, Class, Function, Page, Subtitle };
TargetRec(QString name, TargetRec::TargetType type, Node *node, int priority)
- : node_(node), ref_(std::move(name)), priority_(priority)
+ : m_node(node), m_ref(std::move(name)), m_priority(priority)
{
// Discard the dedicated ref for keywords - they always
// link to the top of the QDoc comment they appear in
if (type == Keyword)
- ref_.clear();
+ m_ref.clear();
}
- bool isEmpty() const { return ref_.isEmpty(); }
- Node::Genus genus() const { return (node_ ? node_->genus() : Node::DontCare); }
+ [[nodiscard]] bool isEmpty() const { return m_ref.isEmpty(); }
+ [[nodiscard]] Node::Genus genus() const { return (m_node ? m_node->genus() : Node::DontCare); }
- Node *node_;
- QString ref_;
- int priority_;
+ Node *m_node { nullptr };
+ QString m_ref {};
+ int m_priority {};
};
struct TargetLoc
@@ -93,21 +93,21 @@ private: // Note the constructor and destructor are private.
~Tree();
public: // Of necessity, a few public functions remain.
- const QString &camelCaseModuleName() const { return camelCaseModuleName_; }
- const QString &physicalModuleName() const { return physicalModuleName_; }
- const QString &indexFileName() const { return indexFileName_; }
- const QString &indexTitle() const { return indexTitle_; }
- void setIndexTitle(const QString &t) { indexTitle_ = t; }
- NodeList &proxies() { return proxies_; }
- void appendProxy(ProxyNode *t) { proxies_.append(t); }
+ [[nodiscard]] const QString &camelCaseModuleName() const { return m_camelCaseModuleName; }
+ [[nodiscard]] const QString &physicalModuleName() const { return m_physicalModuleName; }
+ [[nodiscard]] const QString &indexFileName() const { return m_indexFileName; }
+ [[nodiscard]] const QString &indexTitle() const { return m_indexTitle; }
+ void setIndexTitle(const QString &t) { m_indexTitle = t; }
+ NodeList &proxies() { return m_proxies; }
+ void appendProxy(ProxyNode *t) { m_proxies.append(t); }
void addToDontDocumentMap(QString &arg);
void markDontDocumentNodes();
private: // The rest of the class is private.
Aggregate *findAggregate(const QString &name);
- Node *findNodeForInclude(const QStringList &path) const;
+ [[nodiscard]] Node *findNodeForInclude(const QStringList &path) const;
ClassNode *findClassNode(const QStringList &path, const Node *start = nullptr) const;
- NamespaceNode *findNamespaceNode(const QStringList &path) const;
+ [[nodiscard]] 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,
@@ -121,7 +121,8 @@ private: // The rest of the class is private.
const Node *findNode(const QStringList &path, const Node *relative, int flags,
Node::Genus genus) const;
- Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch)() const) const;
+ [[nodiscard]] Node *findNodeByNameAndType(const QStringList &path,
+ bool (Node::*isMatch)() const) const;
Aggregate *findRelatesNode(const QStringList &path);
const Node *findEnumNode(const Node *node, const Node *aggregate, const QStringList &path, int offset) const;
QString getRef(const QString &target, const Node *node) const;
@@ -129,7 +130,7 @@ private: // The rest of the class is private.
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;
+ [[nodiscard]] const PageNode *findPageNodeByTitle(const QString &title) const;
void addPropertyFunction(PropertyNode *property, const QString &funcName,
PropertyNode::FunctionRole funcRole);
@@ -139,17 +140,17 @@ private: // The rest of the class is private.
void resolveCppToQmlLinks();
void resolveUsingClauses(Aggregate *parent = nullptr);
void removePrivateAndInternalBases(NamespaceNode *rootNode);
- NamespaceNode *root() { return &root_; }
- const NamespaceNode *root() const { return &root_; }
+ NamespaceNode *root() { return &m_root; }
+ [[nodiscard]] const NamespaceNode *root() const { return &m_root; }
ClassList allBaseClasses(const ClassNode *classe) const;
QString refForAtom(const Atom *atom);
CNMap *getCollectionMap(Node::NodeType type);
- const CNMap &groups() const { return groups_; }
- const CNMap &modules() const { return modules_; }
- const CNMap &qmlModules() const { return qmlModules_; }
- const CNMap &jsModules() const { return jsModules_; }
+ [[nodiscard]] const CNMap &groups() const { return m_groups; }
+ [[nodiscard]] const CNMap &modules() const { return m_modules; }
+ [[nodiscard]] const CNMap &qmlModules() const { return m_qmlModules; }
+ [[nodiscard]] const CNMap &jsModules() const { return m_jsModules; }
CollectionNode *getCollection(const QString &name, Node::NodeType type);
CollectionNode *findCollection(const QString &name, Node::NodeType type);
@@ -175,38 +176,44 @@ private: // The rest of the class is private.
CollectionNode *addToQmlModule(const QString &name, Node *node);
CollectionNode *addToJsModule(const QString &name, Node *node);
- QmlTypeNode *lookupQmlType(const QString &name) const { return qmlTypeMap_.value(name); }
- Aggregate *lookupQmlBasicType(const QString &name) const { return qmlTypeMap_.value(name); }
+ [[nodiscard]] QmlTypeNode *lookupQmlType(const QString &name) const
+ {
+ return m_qmlTypeMap.value(name);
+ }
+ [[nodiscard]] Aggregate *lookupQmlBasicType(const QString &name) const
+ {
+ return m_qmlTypeMap.value(name);
+ }
void insertQmlType(const QString &key, QmlTypeNode *n);
- void addExampleNode(ExampleNode *n) { exampleNodeMap_.insert(n->title(), n); }
- ExampleNodeMap &exampleNodeMap() { return exampleNodeMap_; }
- void setIndexFileName(const QString &t) { indexFileName_ = t; }
+ void addExampleNode(ExampleNode *n) { m_exampleNodeMap.insert(n->title(), n); }
+ ExampleNodeMap &exampleNodeMap() { return m_exampleNodeMap; }
+ void setIndexFileName(const QString &t) { m_indexFileName = t; }
- bool treeHasBeenAnalyzed() const { return treeHasBeenAnalyzed_; }
- void setTreeHasBeenAnalyzed() { treeHasBeenAnalyzed_ = true; }
+ [[nodiscard]] bool treeHasBeenAnalyzed() const { return m_treeHasBeenAnalyzed; }
+ void setTreeHasBeenAnalyzed() { m_treeHasBeenAnalyzed = true; }
FunctionNode *findFunctionNodeForTag(const QString &tag, Aggregate *parent = nullptr);
FunctionNode *findMacroNode(const QString &t, const Aggregate *parent = nullptr);
private:
- bool treeHasBeenAnalyzed_;
- QString camelCaseModuleName_;
- QString physicalModuleName_;
- QString indexFileName_;
- QString indexTitle_;
- QDocDatabase *qdb_;
- NamespaceNode root_;
- PropertyMap unresolvedPropertyMap;
- PageNodeMultiMap pageNodesByTitle_;
- TargetMap nodesByTargetRef_;
- TargetMap nodesByTargetTitle_;
- CNMap groups_;
- CNMap modules_;
- CNMap qmlModules_;
- CNMap jsModules_;
- QmlTypeMap qmlTypeMap_;
- ExampleNodeMap exampleNodeMap_;
- NodeList proxies_;
- NodeMap dontDocumentMap_;
+ bool m_treeHasBeenAnalyzed {};
+ QString m_camelCaseModuleName {};
+ QString m_physicalModuleName {};
+ QString m_indexFileName {};
+ QString m_indexTitle {};
+ QDocDatabase *m_qdb { nullptr };
+ NamespaceNode m_root;
+ PropertyMap m_unresolvedPropertyMap {};
+ PageNodeMultiMap m_pageNodesByTitle {};
+ TargetMap m_nodesByTargetRef {};
+ TargetMap m_nodesByTargetTitle {};
+ CNMap m_groups {};
+ CNMap m_modules {};
+ CNMap m_qmlModules {};
+ CNMap m_jsModules {};
+ QmlTypeMap m_qmlTypeMap {};
+ ExampleNodeMap m_exampleNodeMap {};
+ NodeList m_proxies {};
+ NodeMap m_dontDocumentMap {};
};
QT_END_NAMESPACE
diff --git a/src/qdoc/usingclause.h b/src/qdoc/usingclause.h
index 911b6a432..3311aceac 100644
--- a/src/qdoc/usingclause.h
+++ b/src/qdoc/usingclause.h
@@ -42,12 +42,12 @@ struct UsingClause
{
UsingClause() = default;
explicit UsingClause(QString signature) : m_signature(std::move(signature)) { }
- const QString &signature() const { return m_signature; }
- const Node *node() const { return m_node; }
+ [[nodiscard]] const QString &signature() const { return m_signature; }
+ [[nodiscard]] const Node *node() const { return m_node; }
void setNode(const Node *n) { m_node = n; }
const Node *m_node { nullptr };
- QString m_signature;
+ QString m_signature {};
};
QT_END_NAMESPACE
diff --git a/src/qdoc/utilities.h b/src/qdoc/utilities.h
index eb5abedeb..f820c39bd 100644
--- a/src/qdoc/utilities.h
+++ b/src/qdoc/utilities.h
@@ -44,7 +44,7 @@ bool debugging();
QString separator(qsizetype wordPosition, qsizetype numberOfWords);
QString comma(qsizetype wordPosition, qsizetype numberOfWords);
-};
+}
QT_END_NAMESPACE
diff --git a/src/qdoc/variablenode.h b/src/qdoc/variablenode.h
index a197c33a6..3a63af66c 100644
--- a/src/qdoc/variablenode.h
+++ b/src/qdoc/variablenode.h
@@ -46,10 +46,10 @@ public:
void setRightType(const QString &rightType) { m_rightType = rightType; }
void setStatic(bool b) { m_static = b; }
- const QString &leftType() const { return m_leftType; }
- const QString &rightType() const { return m_rightType; }
- QString dataType() const { return m_leftType + m_rightType; }
- bool isStatic() const override { return m_static; }
+ [[nodiscard]] const QString &leftType() const { return m_leftType; }
+ [[nodiscard]] const QString &rightType() const { return m_rightType; }
+ [[nodiscard]] QString dataType() const { return m_leftType + m_rightType; }
+ [[nodiscard]] bool isStatic() const override { return m_static; }
Node *clone(Aggregate *parent) override;
private:
diff --git a/src/qdoc/webxmlgenerator.h b/src/qdoc/webxmlgenerator.h
index 0b3c7beb2..b5119891b 100644
--- a/src/qdoc/webxmlgenerator.h
+++ b/src/qdoc/webxmlgenerator.h
@@ -57,7 +57,7 @@ protected:
void generatePageNode(PageNode *pn, CodeMarker *marker) override;
void generateDocumentation(Node *node) override;
void generateExampleFilePage(const Node *en, const QString &file, CodeMarker *marker) override;
- QString fileExtension() const override;
+ [[nodiscard]] QString fileExtension() const override;
virtual const Atom *addAtomElements(QXmlStreamWriter &writer, const Atom *atom,
const Node *relative, CodeMarker *marker);