Initial commit.
This commit is contained in:
commit
59c6161fdb
134 changed files with 4751 additions and 0 deletions
32
src/web/xml/XmlElement.h
Normal file
32
src/web/xml/XmlElement.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "XmlAttribute.h"
|
||||
|
||||
class XmlElement
|
||||
{
|
||||
protected:
|
||||
std::string mTagName;
|
||||
std::vector<XmlAttributePtr> mAttributes;
|
||||
std::vector<std::shared_ptr<XmlElement> > mChildren;
|
||||
std::string mText;
|
||||
|
||||
public:
|
||||
XmlElement(const std::string& tagName);
|
||||
virtual ~XmlElement() = default;
|
||||
|
||||
static std::shared_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(XmlAttributePtr attribute);
|
||||
XmlAttributePtr GetAttribute(const std::string& attribute) const;
|
||||
std::size_t GetNumAttributes() const;
|
||||
std::vector<XmlAttributePtr> GetAttributes();
|
||||
};
|
||||
|
||||
using XmlElementPtr = std::shared_ptr<XmlElement>;
|
Loading…
Add table
Add a link
Reference in a new issue