XmlAttribute.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Co-Author: Claude Sonnet 4.6 (LLM)
  4. * Company: Lynar Studios
  5. * E-Mail: webmaster@lynarstudios.com
  6. * Created: 2020-09-23
  7. * Changed: 2026-06-23
  8. *
  9. * */
  10. #include <ls-std/core/evaluator/EmptyStringArgumentEvaluator.hpp>
  11. #include <ls-std/io/xml/XmlAttribute.hpp>
  12. using ls::standard::core::Class;
  13. using ls::standard::core::EmptyStringArgumentEvaluator;
  14. using ls::standard::io::XmlAttribute;
  15. using std::string;
  16. XmlAttribute::XmlAttribute(const string &_name) : Class("XmlAttribute")
  17. {
  18. this->_assignName(_name);
  19. }
  20. XmlAttribute::~XmlAttribute() noexcept = default;
  21. string XmlAttribute::getName() const
  22. {
  23. return this->name;
  24. }
  25. string XmlAttribute::getValue() const
  26. {
  27. return this->value;
  28. }
  29. void XmlAttribute::setName(const string &_name)
  30. {
  31. this->_assignName(_name);
  32. }
  33. void XmlAttribute::setValue(const string &_value)
  34. {
  35. this->_assignValue(_value);
  36. }
  37. string XmlAttribute::toXml() const
  38. {
  39. return this->name + "=\"" + this->value + "\"";
  40. }
  41. void XmlAttribute::_assignName(const string &_name)
  42. {
  43. EmptyStringArgumentEvaluator{_name, "xml attribute name is empty!"}.evaluate();
  44. this->name = _name;
  45. }
  46. void XmlAttribute::_assignValue(const string &_value)
  47. {
  48. EmptyStringArgumentEvaluator{_value, "xml attribute value is empty!"}.evaluate();
  49. this->value = _value;
  50. }