#include <nedelement.h>
Inheritance diagram for NEDElement::
Public Methods | |
Constructor, destructor | |
NEDElement () | |
NEDElement (NEDElement *parent) | |
virtual | ~NEDElement () |
Common properties | |
virtual const char* | getTagName () const=0 |
virtual int | getTagCode () const=0 |
virtual long | getId () const |
virtual void | setId (long id) |
virtual const char* | getSourceLocation () const |
virtual void | setSourceLocation (const char *loc) |
Generic access to attributes (Methods have to be redefined in subclasses!) | |
virtual void | applyDefaults () |
virtual int | getNumAttributes () const=0 |
virtual const char* | getAttributeName (int k) const=0 |
virtual int | lookupAttribute (const char *attr) const |
virtual const char* | getAttribute (int k) const=0 |
virtual const char* | getAttribute (const char *attr) const |
virtual void | setAttribute (int k, const char *value)=0 |
virtual void | setAttribute (const char *attr, const char *value) |
virtual const char* | getAttributeDefault (int k) const=0 |
virtual const char* | getAttributeDefault (const char *attr) const |
Generic access to children and siblings | |
virtual NEDElement* | getParent () const |
virtual NEDElement* | getFirstChild () const |
virtual NEDElement* | getLastChild () const |
virtual NEDElement* | getNextSibling () const |
virtual void | appendChild (NEDElement *node) |
virtual void | insertChildBefore (NEDElement *where, NEDElement *newnode) |
virtual NEDElement* | removeChild (NEDElement *node) |
virtual NEDElement* | getFirstChildWithTag (int tagcode) const |
virtual NEDElement* | getNextSiblingWithTag (int tagcode) const |
virtual int | getNumChildren () const |
virtual int | getNumChildrenWithTag (int tagcode) const |
Static Protected Methods | |
bool | stringToBool (const char *s) |
const char* | boolToString (bool b) |
int | stringToEnum (const char *s, const char *vals[], int nums[], int n) |
const char* | enumToString (int b, const char *vals[], int nums[], int n) |
|
Constructor |
|
Constructor. Takes parent element. |
|
Destructor. Destroys children too. |
|
Appends the given element at the end of the child element list. The node pointer passed should not be NULL. |
|
Sets every attribute to its default value (as returned by getAttributeDefault()). Attributes without a default value are not affected. This method is called from the constructors of derived classes. |
|
Returns the value of the attribute with the given name. Relies on lookupAttribute() and getAttribute(). It returns NULL if the given attribute is not found. |
|
Pure virtual method, it should be redefined in subclasses to return the value of the kth attribute (i.e. the attribute with the name getAttributeName(k)). It should return NULL if k is out of range (i.e. negative or greater than getNumAttributes()). Reimplemented in NedFilesNode, NedFileNode, ImportNode, ImportedFileNode, ChannelNode, ChannelAttrNode, NetworkNode, SimpleModuleNode, CompoundModuleNode, ParamsNode, ParamNode, GatesNode, GateNode, MachinesNode, MachineNode, SubmodulesNode, SubmoduleNode, SubstparamsNode, SubstparamNode, GatesizesNode, GatesizeNode, SubstmachinesNode, SubstmachineNode, ConnectionsNode, ConnectionNode, ConnAttrNode, ForLoopNode, LoopVarNode, DisplayStringNode, ExpressionNode, OperatorNode, FunctionNode, ParamRefNode, IdentNode, ConstNode, CppincludeNode, CppStructNode, CppCobjectNode, CppNoncobjectNode, EnumNode, EnumFieldsNode, EnumFieldNode, MessageNode, ClassNode, StructNode, FieldsNode, FieldNode, PropertiesNode, PropertyNode, and UnknownNode. |
|
Returns the default value of the given attribute, as defined in the DTD. Relies on lookupAttribute() and getAttributeDefault(). It returns NULL if the given attribute is not found. |
|
Pure virtual method, it should be redefined in subclasses to return the default value of the kth attribute, as defined in the DTD. It should return NULL if k is out of range (i.e. negative or greater than getNumAttributes()). Reimplemented in NedFilesNode, NedFileNode, ImportNode, ImportedFileNode, ChannelNode, ChannelAttrNode, NetworkNode, SimpleModuleNode, CompoundModuleNode, ParamsNode, ParamNode, GatesNode, GateNode, MachinesNode, MachineNode, SubmodulesNode, SubmoduleNode, SubstparamsNode, SubstparamNode, GatesizesNode, GatesizeNode, SubstmachinesNode, SubstmachineNode, ConnectionsNode, ConnectionNode, ConnAttrNode, ForLoopNode, LoopVarNode, DisplayStringNode, ExpressionNode, OperatorNode, FunctionNode, ParamRefNode, IdentNode, ConstNode, CppincludeNode, CppStructNode, CppCobjectNode, CppNoncobjectNode, EnumNode, EnumFieldsNode, EnumFieldNode, MessageNode, ClassNode, StructNode, FieldsNode, FieldNode, PropertiesNode, PropertyNode, and UnknownNode. |
|
Pure virtual method, it should be redefined in subclasses to return the name of the kth attribute as defined in the DTD. It should return NULL if k is out of range (i.e. negative or greater than getNumAttributes()). Reimplemented in NedFilesNode, NedFileNode, ImportNode, ImportedFileNode, ChannelNode, ChannelAttrNode, NetworkNode, SimpleModuleNode, CompoundModuleNode, ParamsNode, ParamNode, GatesNode, GateNode, MachinesNode, MachineNode, SubmodulesNode, SubmoduleNode, SubstparamsNode, SubstparamNode, GatesizesNode, GatesizeNode, SubstmachinesNode, SubstmachineNode, ConnectionsNode, ConnectionNode, ConnAttrNode, ForLoopNode, LoopVarNode, DisplayStringNode, ExpressionNode, OperatorNode, FunctionNode, ParamRefNode, IdentNode, ConstNode, CppincludeNode, CppStructNode, CppCobjectNode, CppNoncobjectNode, EnumNode, EnumFieldsNode, EnumFieldNode, MessageNode, ClassNode, StructNode, FieldsNode, FieldNode, PropertiesNode, PropertyNode, and UnknownNode. |
|
Returns pointer to the first child element, or NULL if this element has no children. |
|
Returns pointer to the first child element with the given tag code, or NULL if this element has no such children. |
|
Returns a unique id, originally set by the contructor. |
|
Returns pointer to the last child element, or NULL if this element has no children. |
|
Returns pointer to the next sibling of this element (i.e. the next child in the parent element). Return NULL if there're no subsequent elements. getFirstChild() and getNextSibling() can be used to loop through the child list:
for (NEDElement *child=node->getFirstChild(); child; child = child->getNextSibling()) { ... } |
|
Returns pointer to the next sibling of this element with the given tag code. Return NULL if there're no such subsequent elements. getFirstChildWithTag() and getNextSiblingWithTag() are a convient way to loop through elements with a certain tag code in the child list:
for (NEDElement *child=node->getFirstChildWithTag(tagcode); child; child = child->getNextSiblingWithTag(tagcode)) { ... } |
|
Pure virtual method, it should be redefined in subclasses to return the number of attributes defined in the DTD. Reimplemented in NedFilesNode, NedFileNode, ImportNode, ImportedFileNode, ChannelNode, ChannelAttrNode, NetworkNode, SimpleModuleNode, CompoundModuleNode, ParamsNode, ParamNode, GatesNode, GateNode, MachinesNode, MachineNode, SubmodulesNode, SubmoduleNode, SubstparamsNode, SubstparamNode, GatesizesNode, GatesizeNode, SubstmachinesNode, SubstmachineNode, ConnectionsNode, ConnectionNode, ConnAttrNode, ForLoopNode, LoopVarNode, DisplayStringNode, ExpressionNode, OperatorNode, FunctionNode, ParamRefNode, IdentNode, ConstNode, CppincludeNode, CppStructNode, CppCobjectNode, CppNoncobjectNode, EnumNode, EnumFieldsNode, EnumFieldNode, MessageNode, ClassNode, StructNode, FieldsNode, FieldNode, PropertiesNode, PropertyNode, and UnknownNode. |
|
Returns the number of child elements. |
|
Returns the number of child elements with the given tag code. |
|
Returns the parent element, or NULL if this element has no parent. |
|
Returns a string containing a file/line position showing where this element originally came from. |
|
Overridden in subclasses to return the numeric code (NED_xxx) of the XML element the class represents. Reimplemented in NedFilesNode, NedFileNode, ImportNode, ImportedFileNode, ChannelNode, ChannelAttrNode, NetworkNode, SimpleModuleNode, CompoundModuleNode, ParamsNode, ParamNode, GatesNode, GateNode, MachinesNode, MachineNode, SubmodulesNode, SubmoduleNode, SubstparamsNode, SubstparamNode, GatesizesNode, GatesizeNode, SubstmachinesNode, SubstmachineNode, ConnectionsNode, ConnectionNode, ConnAttrNode, ForLoopNode, LoopVarNode, DisplayStringNode, ExpressionNode, OperatorNode, FunctionNode, ParamRefNode, IdentNode, ConstNode, CppincludeNode, CppStructNode, CppCobjectNode, CppNoncobjectNode, EnumNode, EnumFieldsNode, EnumFieldNode, MessageNode, ClassNode, StructNode, FieldsNode, FieldNode, PropertiesNode, PropertyNode, and UnknownNode. |
|
Overridden in subclasses to return the name of the XML element the class represents. Reimplemented in NedFilesNode, NedFileNode, ImportNode, ImportedFileNode, ChannelNode, ChannelAttrNode, NetworkNode, SimpleModuleNode, CompoundModuleNode, ParamsNode, ParamNode, GatesNode, GateNode, MachinesNode, MachineNode, SubmodulesNode, SubmoduleNode, SubstparamsNode, SubstparamNode, GatesizesNode, GatesizeNode, SubstmachinesNode, SubstmachineNode, ConnectionsNode, ConnectionNode, ConnAttrNode, ForLoopNode, LoopVarNode, DisplayStringNode, ExpressionNode, OperatorNode, FunctionNode, ParamRefNode, IdentNode, ConstNode, CppincludeNode, CppStructNode, CppCobjectNode, CppNoncobjectNode, EnumNode, EnumFieldsNode, EnumFieldNode, MessageNode, ClassNode, StructNode, FieldsNode, FieldNode, PropertiesNode, PropertyNode, and UnknownNode. |
|
Inserts the given element just before the specified child element in the child element list. The where element must be a child of this element. The node pointer passed should not be NULL. |
|
Returns the index of the given attribute. It returns -1 if the attribute is not found. Relies on getNumAttributes() and getAttributeName(). |
|
Removes the given element from the child element list. The pointer passed should be a child of this element. |
|
Sets the value of the attribute with the given name. Relies on lookupAttribute() and setAttribute(). If the given attribute is not found, the call has no effect. |
|
Pure virtual method, it should be redefined in subclasses to set the value of the kth attribute (i.e. the attribute with the name getAttributeName(k)). If k is out of range (i.e. negative or greater than getNumAttributes()), the call should be ignored. Reimplemented in NedFilesNode, NedFileNode, ImportNode, ImportedFileNode, ChannelNode, ChannelAttrNode, NetworkNode, SimpleModuleNode, CompoundModuleNode, ParamsNode, ParamNode, GatesNode, GateNode, MachinesNode, MachineNode, SubmodulesNode, SubmoduleNode, SubstparamsNode, SubstparamNode, GatesizesNode, GatesizeNode, SubstmachinesNode, SubstmachineNode, ConnectionsNode, ConnectionNode, ConnAttrNode, ForLoopNode, LoopVarNode, DisplayStringNode, ExpressionNode, OperatorNode, FunctionNode, ParamRefNode, IdentNode, ConstNode, CppincludeNode, CppStructNode, CppCobjectNode, CppNoncobjectNode, EnumNode, EnumFieldsNode, EnumFieldNode, MessageNode, ClassNode, StructNode, FieldsNode, FieldNode, PropertiesNode, PropertyNode, and UnknownNode. |
|
Unique id assigned by the constructor can be overwritten here. |
|
Sets location string (a string containing a file/line position showing where this element originally came from). Called by the (NED/XML) parser. |