Initial commit.

This commit is contained in:
jmsgrogan 2020-05-02 08:31:03 +01:00
commit 59c6161fdb
134 changed files with 4751 additions and 0 deletions

32
src/web/xml/XmlElement.h Normal file
View 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>;