16 #ifndef __OMNETPP_CXMLELEMENT_H 17 #define __OMNETPP_CXMLELEMENT_H 22 #include "simkerneldefs.h" 33 typedef std::vector<cXMLElement*> cXMLElementList;
38 typedef std::map<std::string,std::string> cXMLAttributeMap;
75 friend class cXMLElementDescriptor;
90 virtual bool resolve(
const char *paramname, std::string& value) = 0;
95 const char *ename =
nullptr;
96 const char *value =
nullptr;
97 const char **attrs =
nullptr;
103 const char *filename =
nullptr;
108 void doGetElementsByTagName(
const char *tagname, cXMLElementList& list)
const;
118 virtual void setSourceLocation(
const char *fname,
int line);
121 virtual void setNodeValue(
const char *s);
124 virtual void setNodeValue(
const char *s,
int len);
127 virtual void appendNodeValue(
const char *s,
int len);
133 virtual void setAttribute(
const char *attr,
const char *value);
136 virtual void setAttributes(
const char **attrs);
155 const char **findAttr(
const char *attr)
const;
156 const char **addAttr(
const char *attr);
157 static const char *getPooledName(
const char *s);
158 static const char *makeValue(
const char *s);
159 static void freeValue(
const char *s);
160 virtual void print(std::ostream& os,
int indentLevel)
const;
163 int getNumAttrs()
const;
164 const char *getAttrName(
int index)
const;
165 const char *getAttrValue(
int index)
const;
166 std::string getAttrDesc(
int index)
const;
167 int getNumChildren()
const;
176 virtual const char *
getName()
const override {
return getTagName();}
181 virtual std::string str()
const override;
196 virtual void forEachChild(
cVisitor *v)
override;
205 virtual const char *getTagName()
const;
221 virtual const char *getSourceLocation()
const;
227 virtual const char *getNodeValue()
const;
233 virtual const char *getAttribute(
const char *attr)
const;
238 virtual bool hasAttributes()
const;
243 virtual cXMLAttributeMap getAttributes()
const;
248 virtual std::string getXML()
const;
261 virtual bool hasChildren()
const;
303 virtual cXMLElement *getFirstChildWithTag(
const char *tagname)
const;
319 virtual cXMLElement *getNextSiblingWithTag(
const char *tagname)
const;
324 virtual cXMLElementList getChildren()
const;
329 virtual cXMLElementList getChildrenByTagName(
const char *tagname)
const;
335 virtual cXMLElementList getElementsByTagName(
const char *tagname)
const;
346 virtual cXMLElement *getFirstChildWithAttribute(
const char *tagname,
const char *attr,
const char *attrvalue=
nullptr)
const;
353 virtual cXMLElement *getElementById(
const char *idattrvalue)
const;
401 virtual bool resolve(
const char *paramname, std::string& value)
override;
413 typedef std::map<std::string,std::string> StringMap;
418 virtual bool resolve(
const char *paramname, std::string& value)
override;
Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members...
Definition: cobject.h:58
Represents an XML element in an XML configuration file.
Definition: cxmlelement.h:73
A parameter resolver class for cXMLElement cXMLElement::getElementByPath().
Definition: cxmlelement.h:395
virtual const char * getName() const override
Definition: cxmlelement.h:176
virtual int getSourceLineNumber() const
Definition: cxmlelement.h:215
virtual cObject * getOwner() const override
Definition: cxmlelement.h:186
This class represents modules in the simulation.
Definition: cmodule.h:47
Base class for classes that resolve parameters ($PARAM) that occur in in XPath expressions to their v...
Definition: cxmlelement.h:82
virtual const char * getSourceFileName() const
Definition: cxmlelement.h:210
A parameter resolver class for cXMLElement::getElementByPath().
Definition: cxmlelement.h:410
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
Utility class, to make it impossible to call the operator= and copy constructor of any class derived ...
Definition: cobject.h:311
Definition: cabstracthistogram.h:21