| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Co-Author: Claude Sonnet 4.6 (LLM)
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2020-09-29
- * Changed: 2026-06-23
- *
- * */
- #include <ls-std/io/xml/XmlDeclaration.hpp>
- using ls::standard::core::Class;
- using ls::standard::io::XmlAttribute;
- using ls::standard::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;
- }
|