summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2015-01-28 09:54:49 +0100
committerMartin Smith <martin.smith@digia.com>2015-02-20 07:11:09 +0000
commit765a8343d74a7cf9cae8e5da52946734d8ad2e30 (patch)
tree4596a1231c3659677db0278289394fce2cc51fbd /src/tools
parentfd18d13612dd74ddd8747fd28905ad791eb4f4ff (diff)
qdoc: Reduce size of Node class
The Node class represents every entity to be documented. By changing some of its data members from enum to uchar, it's size has been reduced from 176 bytes to 160 bytes. Change-Id: Idd43866a435f1b0f1ac932870597631b5bbde523 Task-number: QTBUG-43715 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/qdoc/node.cpp44
-rw-r--r--src/tools/qdoc/node.h38
2 files changed, 41 insertions, 41 deletions
diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp
index b00276a58c..e34119b5e6 100644
--- a/src/tools/qdoc/node.cpp
+++ b/src/tools/qdoc/node.cpp
@@ -206,11 +206,11 @@ void Node::setDoc(const Doc& doc, bool replace)
parent's child list.
*/
Node::Node(Type type, InnerNode *parent, const QString& name)
- : nodeType_(type),
- access_(Public),
- safeness_(UnspecifiedSafeness),
- pageType_(NoPageType),
- status_(Commendable),
+ : nodeType_((unsigned char) type),
+ access_((unsigned char) Public),
+ safeness_((unsigned char) UnspecifiedSafeness),
+ pageType_((unsigned char) NoPageType),
+ status_((unsigned char) Commendable),
indexNodeFlag_(false),
parent_(parent),
relatesTo_(0),
@@ -279,14 +279,14 @@ Node::Node(Type type, InnerNode *parent, const QString& name)
*/
QString Node::pageTypeString() const
{
- return pageTypeString(pageType_);
+ return pageTypeString((PageType) pageType_);
}
/*!
Returns the page type \a t as a string, for use as an
attribute value in XML or HTML.
*/
-QString Node::pageTypeString(unsigned t)
+QString Node::pageTypeString(unsigned char t)
{
switch ((PageType)t) {
case Node::ApiPage:
@@ -323,7 +323,7 @@ QString Node::nodeTypeString() const
Returns the node type \a t as a string for use as an
attribute value in XML or HTML.
*/
-QString Node::nodeTypeString(unsigned t)
+QString Node::nodeTypeString(unsigned char t)
{
switch ((Type)t) {
case Namespace:
@@ -383,7 +383,7 @@ QString Node::nodeSubtypeString() const
attribute value in XML or HTML. This is only useful
in the case where the node type is Document.
*/
-QString Node::nodeSubtypeString(unsigned t)
+QString Node::nodeSubtypeString(unsigned char t)
{
switch ((SubType)t) {
case Example:
@@ -413,21 +413,21 @@ QString Node::nodeSubtypeString(unsigned t)
void Node::setPageType(const QString& t)
{
if ((t == "API") || (t == "api"))
- pageType_ = ApiPage;
+ pageType_ = (unsigned char) ApiPage;
else if (t == "howto")
- pageType_ = HowToPage;
+ pageType_ = (unsigned char) HowToPage;
else if (t == "overview")
- pageType_ = OverviewPage;
+ pageType_ = (unsigned char) OverviewPage;
else if (t == "tutorial")
- pageType_ = TutorialPage;
+ pageType_ = (unsigned char) TutorialPage;
else if (t == "faq")
- pageType_ = FAQPage;
+ pageType_ = (unsigned char) FAQPage;
else if (t == "article")
- pageType_ = ArticlePage;
+ pageType_ = (unsigned char) ArticlePage;
else if (t == "example")
- pageType_ = ExamplePage;
+ pageType_ = (unsigned char) ExamplePage;
else if (t == "ditamap")
- pageType_ = DitaMapPage;
+ pageType_ = (unsigned char) DitaMapPage;
}
/*! Converts the boolean value \a b to an enum representation
@@ -502,7 +502,7 @@ void Node::setSince(const QString &since)
*/
QString Node::accessString() const
{
- switch (access_) {
+ switch ((Access) access_) {
case Protected:
return "protected";
case Private:
@@ -578,9 +578,9 @@ Node::Status Node::inheritedStatus() const
*/
Node::ThreadSafeness Node::threadSafeness() const
{
- if (parent_ && safeness_ == parent_->inheritedThreadSafeness())
+ if (parent_ && (ThreadSafeness) safeness_ == parent_->inheritedThreadSafeness())
return UnspecifiedSafeness;
- return safeness_;
+ return (ThreadSafeness) safeness_;
}
/*!
@@ -590,9 +590,9 @@ Node::ThreadSafeness Node::threadSafeness() const
*/
Node::ThreadSafeness Node::inheritedThreadSafeness() const
{
- if (parent_ && safeness_ == UnspecifiedSafeness)
+ if (parent_ && (ThreadSafeness) safeness_ == UnspecifiedSafeness)
return parent_->inheritedThreadSafeness();
- return safeness_;
+ return (ThreadSafeness) safeness_;
}
#if 0
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h
index 610ab0875e..671aedfd1e 100644
--- a/src/tools/qdoc/node.h
+++ b/src/tools/qdoc/node.h
@@ -171,22 +171,22 @@ public:
bool hasFileNameBase() const { return !fileNameBase_.isEmpty(); }
void setFileNameBase(const QString& t) { fileNameBase_ = t; }
- void setAccess(Access access) { access_ = access; }
+ void setAccess(Access access) { access_ = (unsigned char) access; }
void setLocation(const Location& location) { loc_ = location; }
void setDoc(const Doc& doc, bool replace = false);
void setStatus(Status status) {
- if (status_ == Obsolete && status == Deprecated)
+ if (status_ == (unsigned char) Obsolete && status == Deprecated)
return;
- status_ = status;
+ status_ = (unsigned char) status;
}
- void setThreadSafeness(ThreadSafeness safeness) { safeness_ = safeness; }
+ void setThreadSafeness(ThreadSafeness safeness) { safeness_ = (unsigned char) safeness; }
void setSince(const QString &since);
void setRelates(InnerNode* pseudoParent);
void setPhysicalModuleName(const QString &name) { physicalModuleName_ = name; }
void setUrl(const QString& url) { url_ = url; }
void setTemplateStuff(const QString &templateStuff) { templateStuff_ = templateStuff; }
void setReconstitutedBrief(const QString &t) { reconstitutedBrief_ = t; }
- void setPageType(PageType t) { pageType_ = t; }
+ void setPageType(PageType t) { pageType_ = (unsigned char) t; }
void setPageType(const QString& t);
void setParent(InnerNode* n) { parent_ = n; }
void setIndexNodeFlag() { indexNodeFlag_ = true; }
@@ -245,7 +245,7 @@ public:
virtual Tree* tree() const;
virtual void findChildren(const QString& , NodeList& nodes) const { nodes.clear(); }
bool isIndexNode() const { return indexNodeFlag_; }
- Type type() const { return nodeType_; }
+ Type type() const { return (Type) nodeType_; }
virtual SubType subType() const { return NoSubType; }
bool match(const NodeTypeList& types) const;
InnerNode* parent() const { return parent_; }
@@ -264,21 +264,21 @@ public:
const QMap<LinkType, QPair<QString,QString> >& links() const { return linkMap_; }
void setLink(LinkType linkType, const QString &link, const QString &desc);
- Access access() const { return access_; }
- bool isPrivate() const { return access_ == Private; }
+ Access access() const { return (Access) access_; }
+ bool isPrivate() const { return (Access) access_ == Private; }
QString accessString() const;
const Location& location() const { return loc_; }
const Doc& doc() const { return doc_; }
bool hasDoc() const { return !doc_.isEmpty(); }
- Status status() const { return status_; }
+ Status status() const { return (Status) status_; }
Status inheritedStatus() const;
- bool isObsolete() const { return (status_ == Obsolete); }
+ bool isObsolete() const { return (status_ == (unsigned char) Obsolete); }
ThreadSafeness threadSafeness() const;
ThreadSafeness inheritedThreadSafeness() const;
QString since() const { return since_; }
QString templateStuff() const { return templateStuff_; }
const QString& reconstitutedBrief() const { return reconstitutedBrief_; }
- PageType pageType() const { return pageType_; }
+ PageType pageType() const { return (PageType) pageType_; }
QString pageTypeString() const;
QString nodeTypeString() const;
QString nodeSubtypeString() const;
@@ -311,9 +311,9 @@ public:
static FlagValue toFlagValue(bool b);
static bool fromFlagValue(FlagValue fv, bool defaultValue);
- static QString pageTypeString(unsigned t);
- static QString nodeTypeString(unsigned t);
- static QString nodeSubtypeString(unsigned t);
+ static QString pageTypeString(unsigned char t);
+ static QString nodeTypeString(unsigned char t);
+ static QString nodeSubtypeString(unsigned char t);
static int incPropertyGroupCount();
static void clearPropertyGroupCount();
static void initialize();
@@ -324,11 +324,11 @@ protected:
private:
- Type nodeType_;
- Access access_;
- ThreadSafeness safeness_;
- PageType pageType_;
- Status status_;
+ unsigned char nodeType_;
+ unsigned char access_;
+ unsigned char safeness_;
+ unsigned char pageType_;
+ unsigned char status_;
bool indexNodeFlag_;
InnerNode* parent_;