Defined in file: hzDocument.h
The hzAttrset class is really an convenient attribute iterator. The tag attributes are stored in the host document in a one-to-many map between tag uids and attribute, rather than in a list held by the host tag. Given this arrangement, iteration of tag attributes would normally require a first and a last position within the map, as well as another variable to iterate between the two. In previous version of the HadronZoo library, each tag had an attribute pointer and each attribute had a next pointer. Attributes could be iterated by control loops of the form:- for (attr = first_attr ; attr ; attr = attr->next) {} The objective of the attribute iterator is to achieve a similar interface. The hzAttrset is initialized to a tag (node) which in turn points to the host document. The initialization does a lookup in the document map and the Valid() method returns true if there is an attribute. The Advance() method moves on to the next attribut in the tag so:- for (attrset = node ; attrset.Valid() ; attrset.Advance()) {}
Constructors/Detructors
| hzAttrset* | hzAttrset | (hzAttrset&) | |
| hzAttrset* | hzAttrset | (void) | m_pHostNode = 0 ; |
| void | ~hzAttrset | (void) |
Public Methods:
| void | Advance | (void) | Advance the iterator |
| const char* | Name | (void) | Return the attribute name |
| bool | NameEQ | (const char* cstr) | Confirm or deny that the current attribute name equals the supplied null terminated string |
| bool | ValEQ | (const char* cstr) | Confirm or deny that the current attribute value equals the supplied null terminated string |
| bool | Valid | (void) | |
| const char* | Value | (void) | Return the attribute name |
Overloaded operators:
| hzAttrset& | operator= | (hzAttrset&) | |
| hzAttrset& | operator= | (hzXmlNode* pNode) | |
| hzAttrset& | operator= | (hzHtmElem* pNode) |
Member Variables:
| int32_t | m_Current | Current attribute for the tag in the map | |
| int32_t | m_Final | Last attribute for the tag in the document 1:many map of tag ids to attrs | |
| uint32_t | m_NodeUid | Node Uid (key to node/attr map) | |
| hzPair | m_Pair | Name/value pair | |
| int32_t | m_Start | First attribute for the tag in the document 1:many map of tag ids to attrs | |
| hzDocument* | m_pHostDoc | This is needed for the node's uid and the document hosting the map |