#include <XmlNode.h>
Public Member Functions | |
| XmlNode (XmlDoc *doc, TiXmlElement *element) | |
| const std::string | GetName () const |
| XmlNode * | GetNextSibling () const |
| XmlNode * | GetNextSibling (const std::string &nodeName) const |
| XmlNode * | GetPrevSibling () const |
| XmlNode * | GetPrevSibling (const std::string &nodeName) const |
| XmlNode * | GetFirstChild () const |
| XmlNode * | GetFirstChild (const std::string &nodeName) const |
| XmlNode * | CreateChild (const std::string &nodeName) |
| XmlNode * | GetParent () const |
| const Variant | GetAttribute (const std::string &name) const |
| void | SetAttribute (const std::string &name, Variant value) |
| const tPropertyBagPtr & | GetAttributes () const |
Private Member Functions | |
| void | BuildAttributes () |
Private Attributes | |
| XmlDoc * | mDoc |
| TiXmlElement * | mElement |
| tPropertyBagPtr | mAttributes |
Friends | |
| bool | operator== (const XmlNode &a, const XmlNode &b) |
| bool | operator!= (const XmlNode &a, const XmlNode &b) |
| bool | operator== (const XmlNode &a, const void *b) |
| bool | operator!= (const XmlNode &a, const void *b) |
Definition at line 46 of file XmlNode.h.
| XmlNode::XmlNode | ( | XmlDoc * | doc, | |
| TiXmlElement * | element | |||
| ) |
Definition at line 41 of file XmlNode.cpp.
References BuildAttributes(), mDoc, mElement, and PCCE_CHECK.
00041 : mDoc(doc), mElement(element), mAttributes(new PropertyBag()) { 00042 PCCE_CHECK(mDoc != NULL, "XmlNode: Doc is NULL"); 00043 PCCE_CHECK(mElement != NULL, "XmlNode: Element is NULL"); 00044 BuildAttributes(); 00045 }
| const std::string XmlNode::GetName | ( | ) | const |
Definition at line 47 of file XmlNode.cpp.
References mElement.
00047 { 00048 return mElement->ValueStr(); 00049 }
| XmlNode * XmlNode::GetNextSibling | ( | ) | const |
Definition at line 51 of file XmlNode.cpp.
References mDoc, mElement, and pcce::XmlDoc::NodeFromElement().
00051 { 00052 TiXmlElement* element = mElement->NextSiblingElement(); 00053 if (element == NULL) { 00054 return NULL; 00055 } else { 00056 return mDoc->NodeFromElement(element); 00057 } 00058 }
| XmlNode* pcce::XmlNode::GetNextSibling | ( | const std::string & | nodeName | ) | const |
| XmlNode * XmlNode::GetPrevSibling | ( | ) | const |
Definition at line 69 of file XmlNode.cpp.
References mDoc, mElement, and pcce::XmlDoc::NodeFromElement().
00069 { 00070 TiXmlNode* node = mElement->PreviousSibling(); 00071 if (node == NULL) { 00072 return NULL; 00073 } else { 00074 return mDoc->NodeFromElement(node->ToElement()); 00075 } 00076 }
| XmlNode* pcce::XmlNode::GetPrevSibling | ( | const std::string & | nodeName | ) | const |
| XmlNode * XmlNode::GetFirstChild | ( | ) | const |
Definition at line 87 of file XmlNode.cpp.
References mDoc, mElement, and pcce::XmlDoc::NodeFromElement().
00087 { 00088 TiXmlElement* element = mElement->FirstChildElement(); 00089 if (element == NULL) { 00090 return NULL; 00091 } else { 00092 return mDoc->NodeFromElement(element); 00093 } 00094 }
| XmlNode* pcce::XmlNode::GetFirstChild | ( | const std::string & | nodeName | ) | const |
| XmlNode* pcce::XmlNode::CreateChild | ( | const std::string & | nodeName | ) |
| XmlNode * XmlNode::GetParent | ( | ) | const |
Definition at line 113 of file XmlNode.cpp.
References mDoc, mElement, and pcce::XmlDoc::NodeFromElement().
00113 { 00114 TiXmlNode* node = mElement->Parent(); 00115 if (node == NULL) { 00116 return NULL; 00117 } else { 00118 return mDoc->NodeFromElement(node->ToElement()); 00119 } 00120 }
| const Variant pcce::XmlNode::GetAttribute | ( | const std::string & | name | ) | const |
Referenced by pcce::XmlSerializeNode::Value(), and pcce::SoundResourceFactory::vCreateResource().
| void XmlNode::SetAttribute | ( | const std::string & | name, | |
| Variant | value | |||
| ) |
Definition at line 128 of file XmlNode.cpp.
References pcce::Variant::AsString(), mAttributes, and mElement.
00128 { 00129 mAttributes->AddProperty(name); 00130 mAttributes->SetValue(name, value); 00131 mElement->SetAttribute(name, value.AsString()); 00132 }
| const tPropertyBagPtr & XmlNode::GetAttributes | ( | ) | const |
Definition at line 134 of file XmlNode.cpp.
References mAttributes.
00134 { 00135 return mAttributes; 00136 }
| void XmlNode::BuildAttributes | ( | ) | [private] |
Definition at line 138 of file XmlNode.cpp.
References mAttributes, mElement, and PCCE_CHECK.
Referenced by XmlNode().
00138 { 00139 for (const TiXmlAttribute* a = mElement->FirstAttribute(); a != NULL; a = a->Next()) { 00140 string name = a->NameTStr(); 00141 PCCE_CHECK(!mAttributes->HasProperty(name), "XmlNode has duplicate attribute names"); 00142 mAttributes->AddProperty(name); 00143 mAttributes->SetValue(name, a->ValueStr()); 00144 } 00145 }
| bool operator== | ( | const XmlNode & | a, | |
| const void * | b | |||
| ) | [friend] |
| bool operator!= | ( | const XmlNode & | a, | |
| const void * | b | |||
| ) | [friend] |
XmlDoc* pcce::XmlNode::mDoc [private] |
Definition at line 75 of file XmlNode.h.
Referenced by GetFirstChild(), GetNextSibling(), GetParent(), GetPrevSibling(), and XmlNode().
TiXmlElement* pcce::XmlNode::mElement [private] |
Definition at line 76 of file XmlNode.h.
Referenced by BuildAttributes(), GetFirstChild(), GetName(), GetNextSibling(), GetParent(), GetPrevSibling(), pcce::operator!=(), pcce::operator==(), SetAttribute(), and XmlNode().
tPropertyBagPtr pcce::XmlNode::mAttributes [private] |
Definition at line 77 of file XmlNode.h.
Referenced by BuildAttributes(), GetAttributes(), and SetAttribute().
1.5.5