From ed6658c2c82e2d91f34d57e88b61648fb301baf4 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Tue, 17 Dec 2019 06:44:19 +0100 Subject: clang-format QDoc This patch is the result of formatting all of QDoc's source with clang-format. The clang-format style is from the qt5 super repo's _clang-format definition. The purpose is unify the style across the code, to avoid spending too much time on style related issues in reviews and cleanup patches. Future changes to QDoc can benefit from using git-clang-format in combination with the git commit hook provided in qtrepotools.git as mentioned in this email to the dev list: https://lists.qt-project.org/pipermail/development/2019-October/037682.html Change-Id: I8af6a051c8334b5f35862a4dcd3becce8ac500c2 Reviewed-by: Martin Smith --- src/qdoc/atom.h | 80 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 35 deletions(-) (limited to 'src/qdoc/atom.h') diff --git a/src/qdoc/atom.h b/src/qdoc/atom.h index 9ad1d2b7a..f7cb0b654 100644 --- a/src/qdoc/atom.h +++ b/src/qdoc/atom.h @@ -134,20 +134,14 @@ public: friend class LinkAtom; - Atom(const QString &string) - : next_(nullptr), type_(Link) - { - strs << string; - } + Atom(const QString &string) : next_(nullptr), type_(Link) { strs << string; } - Atom(AtomType type, const QString &string = "") - : next_(nullptr), type_(type) + Atom(AtomType type, const QString &string = "") : next_(nullptr), type_(type) { strs << string; } - Atom(AtomType type, const QString &p1, const QString &p2) - : next_(nullptr), type_(type) + Atom(AtomType type, const QString &p1, const QString &p2) : next_(nullptr), type_(type) { strs << p1; if (!p2.isEmpty()) @@ -170,7 +164,7 @@ public: previous->next_ = this; } - virtual ~Atom() { } + virtual ~Atom() {} void appendChar(QChar ch) { strs[0] += ch; } void appendString(const QString &string) { strs[0] += string; } @@ -196,7 +190,7 @@ public: virtual Tree *domain() { return nullptr; } virtual Node::NodeType goal() { return Node::NoType; } virtual const QString &error() { return noError_; } - virtual void resolveSquareBracketParams() { } + virtual void resolveSquareBracketParams() {} protected: static QString noError_; @@ -211,13 +205,29 @@ public: LinkAtom(const QString &p1, const QString &p2); LinkAtom(const LinkAtom &t); LinkAtom(Atom *previous, const LinkAtom &t); - ~LinkAtom() override { } + ~LinkAtom() override {} bool isLinkAtom() const override { return true; } - Node::Genus genus() override { resolveSquareBracketParams(); return genus_; } - bool specifiesDomain() override { resolveSquareBracketParams(); return (domain_ != nullptr); } - Tree *domain() override { resolveSquareBracketParams(); return domain_; } - Node::NodeType goal() override { resolveSquareBracketParams(); return goal_; } + Node::Genus genus() override + { + resolveSquareBracketParams(); + return genus_; + } + bool specifiesDomain() override + { + resolveSquareBracketParams(); + return (domain_ != nullptr); + } + Tree *domain() override + { + resolveSquareBracketParams(); + return domain_; + } + Node::NodeType goal() override + { + resolveSquareBracketParams(); + return goal_; + } const QString &error() override { return error_; } void resolveSquareBracketParams() override; @@ -230,26 +240,26 @@ protected: QString squareBracketParams_; }; -#define ATOM_FORMATTING_BOLD "bold" -#define ATOM_FORMATTING_INDEX "index" -#define ATOM_FORMATTING_ITALIC "italic" -#define ATOM_FORMATTING_LINK "link" -#define ATOM_FORMATTING_PARAMETER "parameter" -#define ATOM_FORMATTING_SPAN "span " -#define ATOM_FORMATTING_SUBSCRIPT "subscript" -#define ATOM_FORMATTING_SUPERSCRIPT "superscript" -#define ATOM_FORMATTING_TELETYPE "teletype" -#define ATOM_FORMATTING_UICONTROL "uicontrol" -#define ATOM_FORMATTING_UNDERLINE "underline" +#define ATOM_FORMATTING_BOLD "bold" +#define ATOM_FORMATTING_INDEX "index" +#define ATOM_FORMATTING_ITALIC "italic" +#define ATOM_FORMATTING_LINK "link" +#define ATOM_FORMATTING_PARAMETER "parameter" +#define ATOM_FORMATTING_SPAN "span " +#define ATOM_FORMATTING_SUBSCRIPT "subscript" +#define ATOM_FORMATTING_SUPERSCRIPT "superscript" +#define ATOM_FORMATTING_TELETYPE "teletype" +#define ATOM_FORMATTING_UICONTROL "uicontrol" +#define ATOM_FORMATTING_UNDERLINE "underline" -#define ATOM_LIST_BULLET "bullet" -#define ATOM_LIST_TAG "tag" -#define ATOM_LIST_VALUE "value" -#define ATOM_LIST_LOWERALPHA "loweralpha" -#define ATOM_LIST_LOWERROMAN "lowerroman" -#define ATOM_LIST_NUMERIC "numeric" -#define ATOM_LIST_UPPERALPHA "upperalpha" -#define ATOM_LIST_UPPERROMAN "upperroman" +#define ATOM_LIST_BULLET "bullet" +#define ATOM_LIST_TAG "tag" +#define ATOM_LIST_VALUE "value" +#define ATOM_LIST_LOWERALPHA "loweralpha" +#define ATOM_LIST_LOWERROMAN "lowerroman" +#define ATOM_LIST_NUMERIC "numeric" +#define ATOM_LIST_UPPERALPHA "upperalpha" +#define ATOM_LIST_UPPERROMAN "upperroman" QT_END_NAMESPACE -- cgit v1.2.1 From a18457ab5310b60290b4655f51aec859e7b3bc8a Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Thu, 19 Dec 2019 18:56:48 +0100 Subject: QDoc: clean up ctor/dtor in Atom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make calling code specify Atom type, remove superfluous ctor. * Move default initialization from initialization list to in-class for member that initializes the same in all ctors. * Move initialization from ctor body to initialization list. * Mark trivial dtor default. Change-Id: I5e4a9e5cdcf0b9f3ba68b53dcab34c2ab77b415d Reviewed-by: Topi Reiniƶ --- src/qdoc/atom.h | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/qdoc/atom.h') diff --git a/src/qdoc/atom.h b/src/qdoc/atom.h index f7cb0b654..6b37618e8 100644 --- a/src/qdoc/atom.h +++ b/src/qdoc/atom.h @@ -134,37 +134,29 @@ public: friend class LinkAtom; - Atom(const QString &string) : next_(nullptr), type_(Link) { strs << string; } + Atom(AtomType type, const QString &string = "") : type_(type), strs(string) {} - Atom(AtomType type, const QString &string = "") : next_(nullptr), type_(type) + Atom(AtomType type, const QString &p1, const QString &p2) : type_(type), strs(p1) { - strs << string; - } - - Atom(AtomType type, const QString &p1, const QString &p2) : next_(nullptr), type_(type) - { - strs << p1; if (!p2.isEmpty()) strs << p2; } - Atom(Atom *previous, AtomType type, const QString &string = "") - : next_(previous->next_), type_(type) + Atom(Atom *previous, AtomType type, const QString &string) + : next_(previous->next_), type_(type), strs(string) { - strs << string; previous->next_ = this; } Atom(Atom *previous, AtomType type, const QString &p1, const QString &p2) - : next_(previous->next_), type_(type) + : next_(previous->next_), type_(type), strs(p1) { - strs << p1; if (!p2.isEmpty()) strs << p2; previous->next_ = this; } - virtual ~Atom() {} + virtual ~Atom() = default; void appendChar(QChar ch) { strs[0] += ch; } void appendString(const QString &string) { strs[0] += string; } @@ -194,7 +186,7 @@ public: protected: static QString noError_; - Atom *next_; + Atom *next_ = nullptr; AtomType type_; QStringList strs; }; -- cgit v1.2.1