00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _PCCE_XMLNODE_H_
00033 #define _PCCE_XMLNODE_H_
00034
00035 #include <string>
00036 #include <list>
00037 #include "PropertyBag.h"
00038
00039 class TiXmlElement;
00040
00041 namespace pcce {
00042
00043 class Variant;
00044 class XmlDoc;
00045
00046 class XmlNode {
00047 public:
00048 XmlNode(XmlDoc* doc, TiXmlElement* element);
00049
00050 const std::string GetName() const;
00051
00052 XmlNode* GetNextSibling() const;
00053 XmlNode* GetNextSibling(const std::string& nodeName) const;
00054
00055 XmlNode* GetPrevSibling() const;
00056 XmlNode* GetPrevSibling(const std::string& nodeName) const;
00057
00058 XmlNode* GetFirstChild() const;
00059 XmlNode* GetFirstChild(const std::string& nodeName) const;
00060
00061 XmlNode* CreateChild(const std::string& nodeName);
00062
00063 XmlNode* GetParent() const;
00064
00065 const Variant GetAttribute(const std::string& name) const;
00066 void SetAttribute(const std::string& name, Variant value);
00067 const tPropertyBagPtr& GetAttributes() const;
00068
00069 friend inline bool operator==(const XmlNode& a, const XmlNode& b);
00070 friend inline bool operator!=(const XmlNode& a, const XmlNode& b);
00071 friend inline bool operator==(const XmlNode& a, const void* b);
00072 friend inline bool operator!=(const XmlNode& a, const void* b);
00073
00074 private:
00075 XmlDoc* mDoc;
00076 TiXmlElement* mElement;
00077 tPropertyBagPtr mAttributes;
00078
00079 void BuildAttributes();
00080 };
00081
00082 inline bool operator==(const XmlNode& a, const XmlNode& b) {
00083 return a.mElement == b.mElement;
00084 }
00085
00086 inline bool operator!=(const XmlNode& a, const XmlNode& b) {
00087 return a.mElement != b.mElement;
00088 }
00089
00090 inline bool operator==(const XmlNode& a, const void* b) {
00091 return a.mElement == b;
00092 }
00093
00094 inline bool operator!=(const XmlNode& a, const void* b) {
00095 return a.mElement != b;
00096 }
00097
00098 }
00099
00100 #endif