| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2020-09-29
- * Changed: 2025-12-21
- *
- * */
- #include <ls-std/io/xml/XmlDeclaration.hpp>
- using ls::std::core::Class;
- using ls::std::io::XmlAttribute;
- using ls::std::io::XmlDeclaration;
- using std::string;
- XmlDeclaration::XmlDeclaration(const string &_version) : Class("XmlDeclaration")
- {
- this->version.setValue(_version);
- }
- XmlDeclaration::~XmlDeclaration() noexcept = default;
- string XmlDeclaration::getEncoding() const
- {
- return this->encoding.getValue();
- }
- string XmlDeclaration::getStandalone() const
- {
- return this->standalone.getValue();
- }
- string XmlDeclaration::getVersion() const
- {
- return this->version.getValue();
- }
- void XmlDeclaration::setEncoding(const string &_encoding)
- {
- this->encoding.setValue(_encoding);
- }
- void XmlDeclaration::setStandalone(const string &_standalone)
- {
- this->standalone.setValue(_standalone);
- }
- void XmlDeclaration::setVersion(const string &_version)
- {
- this->version.setValue(_version);
- }
- string XmlDeclaration::toXml() const
- {
- string declaration = "<?xml";
- declaration += _toXmlAttribute(this->version);
- declaration += _toXmlAttribute(this->encoding);
- declaration += _toXmlAttribute(this->standalone);
- return declaration + " ?>";
- }
- string XmlDeclaration::_toXmlAttribute(const XmlAttribute &_attribute)
- {
- string xmlString{};
- if (!_attribute.getValue().empty())
- {
- xmlString = " " + _attribute.toXml();
- }
- return xmlString;
- }
|