Tidy up some xml structures.
This commit is contained in:
parent
875cdc84ff
commit
8771b721d1
31 changed files with 885 additions and 563 deletions
|
@ -7,26 +7,29 @@
|
|||
class XmlElement
|
||||
{
|
||||
protected:
|
||||
std::string mTagName;
|
||||
std::vector<XmlAttributePtr> mAttributes;
|
||||
std::vector<std::shared_ptr<XmlElement> > mChildren;
|
||||
std::string mText;
|
||||
std::string mTagName;
|
||||
std::vector<XmlAttributeUPtr> mAttributes;
|
||||
std::vector<std::unique_ptr<XmlElement> > mChildren;
|
||||
std::string mText;
|
||||
|
||||
public:
|
||||
XmlElement(const std::string& tagName);
|
||||
virtual ~XmlElement() = default;
|
||||
XmlElement(const std::string& tagName);
|
||||
virtual ~XmlElement() = default;
|
||||
|
||||
static std::shared_ptr<XmlElement> Create(const std::string& tagName);
|
||||
static std::unique_ptr<XmlElement> Create(const std::string& tagName);
|
||||
|
||||
void AddChild(std::shared_ptr<XmlElement> child);
|
||||
std::string GetTagName() const;
|
||||
std::string GetText() const;
|
||||
void SetText(const std::string& text);
|
||||
void AddAttribute(XmlAttributeUPtr attribute);
|
||||
void AddChild(std::unique_ptr<XmlElement> child);
|
||||
|
||||
void AddAttribute(XmlAttributePtr attribute);
|
||||
XmlAttributePtr GetAttribute(const std::string& attribute) const;
|
||||
std::size_t GetNumAttributes() const;
|
||||
std::vector<XmlAttributePtr> GetAttributes();
|
||||
std::string GetTagName() const;
|
||||
std::string GetText() const;
|
||||
XmlAttribute* GetAttribute(const std::string& attribute) const;
|
||||
XmlAttribute* GetAttribute(std::size_t index) const;
|
||||
std::size_t GetNumAttributes() const;
|
||||
|
||||
void SetText(const std::string& text);
|
||||
void SetTagName(const std::string& tagName);
|
||||
};
|
||||
|
||||
using XmlElementPtr = std::shared_ptr<XmlElement>;
|
||||
using XmlElementUPtr = std::unique_ptr<XmlElement>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue