#include <PhxXmlDescription.h>
Public Types | |
|
typedef std::set< AttribSpec, AttribSpecComp > | AttribSpecSet |
| A typedef for a set of AttribSpec's. | |
Public Member Functions | |
| XmlDescriptionNode (XmlNode *node) | |
| Constructs a description node from an existing XmlNode. | |
| XmlDescriptionNode (const String &descType) | |
| Constructs a description node that is empty. | |
| XmlDescriptionNode (const XmlDescriptionNode &node) | |
| Copy constructor to copy a node. | |
| const XmlDescriptionNode & | operator= (const XmlDescriptionNode &rhs) |
| Assignment operator allowing nodes to be copied. | |
| const String & | type (void) const |
| Gets the node type (i.e., the tag). | |
| void | type (const String &type) |
| Sets the node type (tag). | |
| void | file (const String &file) |
| Sets the file attribute value. | |
| const String & | file (void) const |
| Gets the file attribute value. | |
| uint32_t | attributeCount (void) const |
| Gets the number of attributes attached to this node. | |
| AttribSpecSet | attributes (const String &name="") const |
| Returns a std::vector containing all of the AttribSpec structures which have associated attribute values. | |
| XmlDescriptionNode * | childAttribute (const AttribSpec &attrib) |
| Retrieves the child node that is keyed by the "name" and "index" fields specified in the given AttribSpec. | |
| const XmlDescriptionNode * | childAttribute (const AttribSpec &attrib) const |
| XmlDescriptionNode | childAttributeSubstitute (const AttribSpec &attrib) const |
| Recursively loads description nodes until the child node referenced by the file() attribute is found. | |
| void | childAttribute (const AttribSpec &attrib, const XmlDescriptionNode *node) |
| Sets the child node for the given attribute name and index (specified by an AttribSpec). | |
| void | childAttribute (const AttribSpec &attrib, const XmlDescriptionNode &node) |
| Same as childAttribute(const AttribSpec&, const XmlDescriptionNode*) but takes const-reference as the attribute value. | |
| String | stringAttributeDefault (const AttribSpec &attrib, const String &defaultValue="") const |
| Retrieves the value of the attribute with name given, parsed as a string. | |
| String | stringAttribute (const AttribSpec &attrib) const |
| Retrieves the value of the attribute with name given. | |
| void | stringAttribute (const AttribSpec &attrib, const String &value) |
| Sets the attribute 'name' as a string. | |
| float | floatAttribute (const AttribSpec &attrib) const |
| double | doubleAttribute (const AttribSpec &attrib) const |
| uint64_t | uint64Attribute (const AttribSpec &attrib) const |
| uint32_t | uint32Attribute (const AttribSpec &attrib) const |
| uint16_t | uint16Attribute (const AttribSpec &attrib) const |
| uint8_t | uint8Attribute (const AttribSpec &attrib) const |
| int64_t | int64Attribute (const AttribSpec &attrib) const |
| int32_t | int32Attribute (const AttribSpec &attrib) const |
| int16_t | int16Attribute (const AttribSpec &attrib) const |
| int8_t | int8Attribute (const AttribSpec &attrib) const |
| bool | boolAttribute (const AttribSpec &attrib) const |
| float | floatAttributeDefault (const AttribSpec &attrib, float defaultValue) const |
| double | doubleAttributeDefault (const AttribSpec &attrib, double defaultValue) const |
| uint64_t | uint64AttributeDefault (const AttribSpec &attrib, uint64_t defaultValue) const |
| uint32_t | uint32AttributeDefault (const AttribSpec &attrib, uint32_t defaultValue) const |
| uint16_t | uint16AttributeDefault (const AttribSpec &attrib, uint16_t defaultValue) const |
| uint8_t | uint8AttributeDefault (const AttribSpec &attrib, uint8_t defaultValue) const |
| int64_t | int64AttributeDefault (const AttribSpec &attrib, int64_t defaultValue) const |
| int32_t | int32AttributeDefault (const AttribSpec &attrib, int32_t defaultValue) const |
| int16_t | int16AttributeDefault (const AttribSpec &attrib, int16_t defaultValue) const |
| int8_t | int8AttributeDefault (const AttribSpec &attrib, int8_t defaultValue) const |
| bool | boolAttributeDefault (const AttribSpec &attrib, bool defaultValue) const |
| void | floatAttribute (const AttribSpec &attrib, float value) |
| void | doubleAttribute (const AttribSpec &attrib, double value) |
| void | uint64Attribute (const AttribSpec &attrib, uint64_t value) |
| void | uint32Attribute (const AttribSpec &attrib, uint32_t value) |
| void | uint16Attribute (const AttribSpec &attrib, uint16_t value) |
| void | uint8Attribute (const AttribSpec &attrib, uint8_t value) |
| void | int64Attribute (const AttribSpec &attrib, int64_t value) |
| void | int32Attribute (const AttribSpec &attrib, int32_t value) |
| void | int16Attribute (const AttribSpec &attrib, int16_t value) |
| void | int8Attribute (const AttribSpec &attrib, int8_t value) |
| void | boolAttribute (const AttribSpec &attrib, bool value) |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const XmlDescriptionNode &node) |
| Operator to print XmlDescriptionNode to ostream. | |
Classes | |
| class | AttribSpec |
| Attributes in a description can either be a singleton or a collection. This AttribSpec structure allows one to specify an attribute by name, or name and selector (for collections) to XmlDescriptionNode APIs. More... | |
| struct | AttribSpecComp |
The XmlDocument and XmlNode class provide a level of detail not necessary for Description values. Descriptions also need to be able to pass XmlNode's by value and often make copies without the presence of an owning document (and hence no definition of encoding, a DTD, etc.) This is not possible using the XmlNode class directly, and thus we trade away the XmlDocument/XmlNode classes' power and generality for flexibility and specificity by using this class instead of XmlNode.
|
|
Constructs a description node from an existing XmlNode. This clones the entire node and all of its children.
|
|
|
Constructs a description node that is empty.
|
|
|
Copy constructor to copy a node.
|
|
|
Gets the number of attributes attached to this node. This is the total number of child elements, including ATTRIB elements and child XML nodes. |
|
|
Returns a std::vector containing all of the AttribSpec structures which have associated attribute values. Since clients will often not know the value of the selector for many of their collection attributes (or for that matter, how many attributes are in the collection), they may use this method to get a list of the existing attributes and then iterate through the list, checking for known attributes with valid selectors before querying the attribute value.
|
|
||||||||||||
|
Same as childAttribute(const AttribSpec&, const XmlDescriptionNode*) but takes const-reference as the attribute value. This syntax is somewhat more convenient/efficient for certain situations, as it allows the client to pass a temporary.
|
|
||||||||||||
|
Sets the child node for the given attribute name and index (specified by an AttribSpec). The node given here is copied. The pointer parameter remains the responsbility of the client.
|
|
|
Retrieves the child node that is keyed by the "name" and "index" fields specified in the given AttribSpec. This returns the child node precisely as it appears in the XML file, including its file() attribute (which specifies the file whose content should be used in lieu of this node's content). In the case that file() != "", the client should honor the file author's request and attempt to use the referenced file instead. Use childAttributeSubstitute() to retrieve the ultimately referenced node automatically (this is the typical call used by simulator components). However, some editors may wish to view/modify the exact XML data, in which case this method may be more appropriate.
|
|
|
Recursively loads description nodes until the child node referenced by the file() attribute is found. If the requested node has a file() parameter value, then the contents of the specified file will be loaded and parsed. If the parsed node also specifies a file() attribute, then the substitution is performed and continues recursively. When the final content is located (i.e., a node is parsed with file() == "") the substitution stops and that node is returned as the child of this node. Of course, if the child node has file() == "" already, a copy of the child is returned. If the substitution is not desired (i.e., you want the verbatim content of the node, including its file() attribute), then request the child node via childAttribute().
|
|
|
Gets the file attribute value.
|
|
|
Sets the file attribute value. The file attribute is an optional value that specifies an external file whose content should be used in lieu of other content in this node. That is, all content in the node should be ignored if file() != "". By default, childAttribute() will automatically perform this substitution (returning instead the content from the other file).
|
|
|
Assignment operator allowing nodes to be copied.
|
|
||||||||||||
|
Sets the attribute 'name' as a string.
|
|
|
Retrieves the value of the attribute with name given.
|
|
||||||||||||
|
Retrieves the value of the attribute with name given, parsed as a string.
|
|
|
Sets the node type (tag).
|
1.4.2