Initial commit.
This commit is contained in:
commit
59c6161fdb
134 changed files with 4751 additions and 0 deletions
61
src/web/xml/XmlElement.cpp
Normal file
61
src/web/xml/XmlElement.cpp
Normal file
|
@ -0,0 +1,61 @@
|
|||
#include "XmlElement.h"
|
||||
|
||||
|
||||
XmlElement::XmlElement(const std::string& tagName)
|
||||
: mTagName(tagName),
|
||||
mChildren()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::shared_ptr<XmlElement> XmlElement::Create(const std::string& tagName)
|
||||
{
|
||||
return std::make_shared<XmlElement>(tagName);
|
||||
}
|
||||
|
||||
void XmlElement::AddChild(std::shared_ptr<XmlElement> child)
|
||||
{
|
||||
mChildren.push_back(child);
|
||||
}
|
||||
|
||||
std::string XmlElement::GetTagName() const
|
||||
{
|
||||
return mTagName;
|
||||
}
|
||||
|
||||
std::string XmlElement::GetText() const
|
||||
{
|
||||
return mText;
|
||||
}
|
||||
|
||||
void XmlElement::SetText(const std::string& text)
|
||||
{
|
||||
mText = text;
|
||||
}
|
||||
|
||||
void XmlElement::AddAttribute(XmlAttributePtr attribute)
|
||||
{
|
||||
mAttributes.push_back(attribute);
|
||||
}
|
||||
|
||||
XmlAttributePtr XmlElement::GetAttribute(const std::string& attributeName) const
|
||||
{
|
||||
for(const auto& attribute : mAttributes)
|
||||
{
|
||||
if(attribute->GetName() == attributeName)
|
||||
{
|
||||
return attribute;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::size_t XmlElement::GetNumAttributes() const
|
||||
{
|
||||
return mAttributes.size();
|
||||
}
|
||||
|
||||
std::vector<XmlAttributePtr> XmlElement::GetAttributes()
|
||||
{
|
||||
return mAttributes;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue