From 55e7094204ed50887ae99d7141a44e43965dbe43 Mon Sep 17 00:00:00 2001 From: jez Date: Mon, 9 Mar 2009 22:52:34 +0000 Subject: [PATCH] whitespace changes --- include/Taggle/impl/Element.hpp | 262 ++++++++++++++++---------------- 1 file changed, 131 insertions(+), 131 deletions(-) diff --git a/include/Taggle/impl/Element.hpp b/include/Taggle/impl/Element.hpp index bac6003c..26db8cbc 100755 --- a/include/Taggle/impl/Element.hpp +++ b/include/Taggle/impl/Element.hpp @@ -12,21 +12,21 @@ namespace SAX { /** -The internal representation of an actual element (not an element type). -An Element has an element type, attributes, and a successor Element -for use in constructing stacks and queues of Elements. -@see ElementType -@see AttributesImpl - -Based on code from John Cowan's super TagSoup package + The internal representation of an actual element (not an element type). + An Element has an element type, attributes, and a successor Element + for use in constructing stacks and queues of Elements. + @see ElementType + @see AttributesImpl + + Based on code from John Cowan's super TagSoup package */ class Element { private: ElementType* type_; // type of element AttributesImpl atts_; // attributes of element - const Element* next_; // successor of element - bool preclosed_; // this element has been preclosed + const Element* next_; // successor of element + bool preclosed_; // this element has been preclosed public: static const Element Null; @@ -49,18 +49,18 @@ public: next_ = new Element(*rhs.next_); } // Element - /** - Return an Element from a specified ElementType. - @param type The element type of the newly constructed element - @param defaultAttributes True if default attributes are wanted - */ + /** + Return an Element from a specified ElementType. + @param type The element type of the newly constructed element + @param defaultAttributes True if default attributes are wanted + */ Element(ElementType& type, bool defaultAttributes) : type_(&type), atts_(), next_(0), preclosed_(false) { - if (defaultAttributes) + if (defaultAttributes) atts_ = type.atts(); } // Element @@ -86,9 +86,9 @@ public: bool operator==(const Element& rhs) const { - bool ok = (type_ == rhs.type_) && - (atts_ == rhs.atts_) && - (preclosed_ == rhs.preclosed_); + bool ok = (type_ == rhs.type_) && + (atts_ == rhs.atts_) && + (preclosed_ == rhs.preclosed_); if(!ok) return false; @@ -107,191 +107,191 @@ public: return !(*this == rhs); } // operator!= - /** - Return the element type. - @return The element type. - */ - const ElementType& type() const + /** + Return the element type. + @return The element type. + */ + const ElementType& type() const { return *type_; } // type - /** - Return the attributes as an AttributesImpl object. - Returning an AttributesImpl makes the attributes mutable. - @return The attributes - @see AttributesImpl - */ + /** + Return the attributes as an AttributesImpl object. + Returning an AttributesImpl makes the attributes mutable. + @return The attributes + @see AttributesImpl + */ const AttributesImpl& atts() const { return atts_; } // atts - /** - Return the next element in an element stack or queue. - @return The next element - */ - Element next() const + /** + Return the next element in an element stack or queue. + @return The next element + */ + Element next() const { if(!next_) return Null; return *next_; } // next - - /** - Change the next element in an element stack or queue. - @param next The new next element - */ - void setNext(const Element& next) + + /** + Change the next element in an element stack or queue. + @param next The new next element + */ + void setNext(const Element& next) { if(next_ && (*next_ != Null)) delete next_; next_ = new Element(next); } // setNext - /** - Return the name of the element's type. - Convenience method. - @return The element type name - */ - std::string name() const + /** + Return the name of the element's type. + Convenience method. + @return The element type name + */ + std::string name() const { return type_->name(); } // name - /** - Return the namespace name of the element's type. - Convenience method. - @return The element type namespace name - */ - std::string namespaceName() const + /** + Return the namespace name of the element's type. + Convenience method. + @return The element type namespace name + */ + std::string namespaceName() const { return type_->namespaceName(); } // namespaceName - /** - Return the local name of the element's type. - Convenience method. - @return The element type local name - */ + /** + Return the local name of the element's type. + Convenience method. + @return The element type local name + */ std::string localName() const { return type_->localName(); } // localName - /** - Return the content model vector of the element's type. - Convenience method. - @return The content model vector - */ - int model() const + /** + Return the content model vector of the element's type. + Convenience method. + @return The content model vector + */ + int model() const { return type_->model(); } // model - /** - Return the member-of vector of the element's type. - Convenience method. - @return The member-of vector - */ - int memberOf() const + /** + Return the member-of vector of the element's type. + Convenience method. + @return The member-of vector + */ + int memberOf() const { return type_->memberOf(); } // memberOf - /** - Return the flags vector of the element's type. - Convenience method. - @return The flags vector - */ - int flags() const + /** + Return the flags vector of the element's type. + Convenience method. + @return The flags vector + */ + int flags() const { return type_->flags(); } // flags - /** - Return the parent element type of the element's type. - Convenience method. - @return The parent element type - */ - ElementType& parent() const + /** + Return the parent element type of the element's type. + Convenience method. + @return The parent element type + */ + ElementType& parent() const { return type_->parent(); } // parent - /** - Return true if the type of this element can contain the type of - another element. - Convenience method. - @param other The other element - */ - bool canContain(const Element& other) const + /** + Return true if the type of this element can contain the type of + another element. + Convenience method. + @param other The other element + */ + bool canContain(const Element& other) const { - return type_->canContain(*(other.type_)); + return type_->canContain(*(other.type_)); } // canContain - /** - Set an attribute and its value into this element. - @param name The attribute name (Qname) - @param type The attribute type - @param value The attribute value - */ - void setAttribute(const std::string& name, const std::string& type, const std::string& value) + /** + Set an attribute and its value into this element. + @param name The attribute name (Qname) + @param type The attribute type + @param value The attribute value + */ + void setAttribute(const std::string& name, const std::string& type, const std::string& value) { - type_->setAttribute(atts_, name, type, value); + type_->setAttribute(atts_, name, type, value); } // setAttribute - - /** - Make this element anonymous. - Remove any id or name attribute present - in the element's attributes. - */ - void anonymize() + + /** + Make this element anonymous. + Remove any id or name attribute present + in the element's attributes. + */ + void anonymize() { - for (int i = atts_.getLength() - 1; i >= 0; i--) + for (int i = atts_.getLength() - 1; i >= 0; i--) { - if((atts_.getType(i) == "ID") || - (atts_.getQName(i) == "name")) + if((atts_.getType(i) == "ID") || + (atts_.getQName(i) == "name")) { - atts_.removeAttribute(i); + atts_.removeAttribute(i); } } // for ... } // anonymize - /** - Clean the attributes of this element. - Attributes with null name (the name was ill-formed) - or null value (the attribute was present in the element type but - not in this actual element) are removed. - */ - void clean() + /** + Clean the attributes of this element. + Attributes with null name (the name was ill-formed) + or null value (the attribute was present in the element type but + not in this actual element) are removed. + */ + void clean() { - for (int i = atts_.getLength() - 1; i >= 0; i--) + for (int i = atts_.getLength() - 1; i >= 0; i--) { - const std::string& name = atts_.getLocalName(i); - if (atts_.getValue(i) == "" || name == "" || name.length() == 0) + const std::string& name = atts_.getLocalName(i); + if (atts_.getValue(i) == "" || name == "" || name.length() == 0) { - atts_.removeAttribute(i); - continue; + atts_.removeAttribute(i); + continue; } // if ... } // for ... } // clean - /** - Force this element to preclosed status, meaning that an end-tag has - been seen but the element cannot yet be closed for structural reasons. - */ - void preclose() + /** + Force this element to preclosed status, meaning that an end-tag has + been seen but the element cannot yet be closed for structural reasons. + */ + void preclose() { - preclosed_ = true; + preclosed_ = true; } // preclose - /** - Return true if this element has been preclosed. - */ - bool isPreclosed() const + /** + Return true if this element has been preclosed. + */ + bool isPreclosed() const { - return preclosed_; + return preclosed_; } // isPreclosed }; // class Element