IXmlNode

Never use IXmlNode directly - instead use reference counted XmlNodeRef. More...

#include

Public Member Functions

virtual XmlNodeRef createNode (const char *tag)=0
Creates new XML node.
virtual void AddRef ()
Reference counting.
virtual void Release ()
When ref count reaches zero, the XML node dies.
virtual int GetRefCount () const
virtual const char * getTag () const =0
Get XML node tag.
virtual void setTag (const char *tag)=0
Sets XML node tag.
virtual bool isTag (const char *tag) const =0
Return true if a given tag equal to node tag.
virtual int getNumAttributes () const =0
Get XML Node attributes.
virtual bool getAttributeByIndex (int index, const char **key, const char **value)=0
Return attribute key and value by attribute index.
virtual void copyAttributes (XmlNodeRef fromNode)=0
Copy attributes to this node from a given node.
virtual const char * getAttr (const char *key) const =0
Get XML Node attribute for specified key.
virtual bool getAttr (const char *key, const char **value) const =0
virtual bool haveAttr (const char *key) const =0
Checks if attributes with specified key exist.
virtual void addChild (const XmlNodeRef &node)=0
Add new child node.
virtual XmlNodeRef newChild (const char *tagName)=0
Create new xml node and add it to childs list.
virtual void removeChild (const XmlNodeRef &node)=0
Remove child node.
virtual void insertChild (int nIndex, const XmlNodeRef &node)=0
Insert child node.
virtual void replaceChild (int nIndex, const XmlNodeRef &fromNode)=0
virtual void removeAllChilds ()=0
Remove all child nodes.
virtual int getChildCount () const =0
Get number of child XML nodes.
virtual XmlNodeRef getChild (int i) const =0
Get XML Node child nodes.
virtual XmlNodeRef findChild (const char *tag) const =0
Find node with specified tag.
virtual XmlNodeRef getParent () const =0
Get parent XML node.
virtual void setParent (const XmlNodeRef &inRef)=0
Set parent XML node.
virtual const char * getContent () const =0
Return content of this node.
virtual void setContent (const char *str)=0
Set content of this node.
virtual XmlNodeRef clone ()=0
Deep clone of this and all child xml nodes.
virtual int getLine () const =0
Return line number for XML tag.
virtual void setLine (int line)=0
Set line number in xml.
virtual IXmlStringData * getXMLData (int nReserveMem=0) const =0
virtual XmlString getXML (int level=0) const =0
Returns XML of this node and sub nodes.
virtual bool saveToFile (const char *fileName)=0
virtual void delAttr (const char *key)=0
Delete attribute.
virtual void removeAllAttributes ()=0
Remove all node attributes.
virtual void setAttr (const char *key, const CryGUID &value)=0
virtual bool getAttr (const char *key, CryGUID &value) const =0
virtual void setAttr (const char *key, const char *value)=0
virtual void setAttr (const char *key, int value)=0
virtual void setAttr (const char *key, unsigned int value)=0
virtual void setAttr (const char *key, int64 value)=0
virtual void setAttr (const char *key, uint64 value, bool useHexFormat=true)=0
virtual void setAttr (const char *key, float value)=0
virtual void setAttr (const char *key, double value)=0
virtual void setAttr (const char *key, const Vec2 &value)=0
virtual void setAttr (const char *key, const Vec2d &value)=0
virtual void setAttr (const char *key, const Ang3 &value)=0
virtual void setAttr (const char *key, const Vec3 &value)=0
virtual void setAttr (const char *key, const Vec4 &value)=0
virtual void setAttr (const char *key, const Vec3d &value)=0
virtual void setAttr (const char *key, const Quat &value)=0
virtual bool getAttr (const char *key, int &value) const =0
virtual bool getAttr (const char *key, unsigned int &value) const =0
virtual bool getAttr (const char *key, int64 &value) const =0
virtual bool getAttr (const char *key, uint64 &value, bool useHexFormat=true) const =0
virtual bool getAttr (const char *key, float &value) const =0
virtual bool getAttr (const char *key, double &value) const =0
virtual bool getAttr (const char *key, Vec2 &value) const =0
virtual bool getAttr (const char *key, Vec2d &value) const =0
virtual bool getAttr (const char *key, Ang3 &value) const =0
virtual bool getAttr (const char *key, Vec3 &value) const =0
virtual bool getAttr (const char *key, Vec4 &value) const =0
virtual bool getAttr (const char *key, Vec3d &value) const =0
virtual bool getAttr (const char *key, Quat &value) const =0
virtual bool getAttr (const char *key, bool &value) const =0
virtual bool getAttr (const char *key, XmlString &value) const =0
virtual bool getAttr (const char *key, ColorB &value) const =0
virtual void GetMemoryUsage (ICrySizer *pSizer) const =0
Collect all allocated memory.
virtual void shareChildren (const XmlNodeRef &fromNode)=0
virtual void deleteChildAt (int nIndex)=0
Remove child node at known position.
virtual XmlString getXMLUnsafe (int level, char *tmpBuffer, uint32 sizeOfTmpBuffer) const
Return XML of this node and sub nodes into tmpBuffer without XML checks (much faster).
virtual bool saveToFile (const char *fileName, size_t chunkSizeBytes, FILE *file=NULL)=0
Save in small memory chunks.
bool getAttr (const char *key, long &value) const
bool getAttr (const char *key, unsigned long &value) const
void setAttr (const char *key, unsigned long value)
void setAttr (const char *key, long value)
bool getAttr (const char *key, unsigned short &value) const
bool getAttr (const char *key, unsigned char &value) const
bool getAttr (const char *key, short &value) const
bool getAttr (const char *key, char &value) const

Protected Member Functions

virtual void DeleteThis ()=0

Protected Attributes

int m_nRefCount

Friends

class XmlNodeRef

Detailed Description

Never use IXmlNode directly - instead use reference counted XmlNodeRef.

Member Function Documentation

◆ getAttr() [1/3]

virtual bool IXmlNode::getAttr ( const char * key,
const char ** value
) const
pure virtual

Gets XML Node attribute for specified key.

Returns
true if the attribute exists, false otherwise.

◆ getAttr() [2/3]

virtual bool IXmlNode::getAttr ( const char * key,
int & value
) const
pure virtual

Get attribute value of node.

◆ getAttr() [3/3]

bool IXmlNode::getAttr ( const char * key,
long & value
) const
inline

Inline Helpers.

◆ getXMLData()

virtual IXmlStringData* IXmlNode::getXMLData ( int nReserveMem = 0) const
pure virtual

Return XML of this node and sub nodes.

Note
IXmlStringData pointer must be release when string is not needed anymore.
See also
IXmlStringData

◆ replaceChild()

virtual void IXmlNode::replaceChild ( int nIndex,
const XmlNodeRef & fromNode
)
pure virtual

Replaces a specified child with the passed one. Not supported by all node implementations.

◆ setAttr()

virtual void IXmlNode::setAttr ( const char * key,
const char * value
)
pure virtual

Set new XML Node attribute (or override attribute with same key).

◆ shareChildren()

virtual void IXmlNode::shareChildren ( const XmlNodeRef & fromNode)
pure virtual

Copy children to this node from a given node. Children are reference copied (shallow copy) and the children's parent is NOT set to this node, but left with its original parent (which is still the parent).