12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2020-09-23
- * Changed: 2022-05-11
- *
- * */
- #include <ls_std/io/xml/XmlAttribute.hpp>
- #include <ls_std/core/exception/IllegalArgumentException.hpp>
- ls::std::io::XmlAttribute::XmlAttribute(const ::std::string& _name) : ls::std::core::Class("XmlAttribute")
- {
- this->_assignName(_name);
- }
- std::string ls::std::io::XmlAttribute::getName()
- {
- return this->name;
- }
- std::string ls::std::io::XmlAttribute::getValue()
- {
- return this->value;
- }
- void ls::std::io::XmlAttribute::setName(const ::std::string& _name)
- {
- this->_assignName(_name);
- }
- void ls::std::io::XmlAttribute::setValue(const ::std::string& _value)
- {
- this->_assignValue(_value);
- }
- std::string ls::std::io::XmlAttribute::toXml()
- {
- return this->name + "=\"" + this->value + "\"";
- }
- void ls::std::io::XmlAttribute::_assignName(const ::std::string &_name)
- {
- if (_name.empty())
- {
- throw ls::std::core::IllegalArgumentException{};
- }
- this->name = _name;
- }
- void ls::std::io::XmlAttribute::_assignValue(const ::std::string &_value)
- {
- if (_value.empty())
- {
- throw ls::std::core::IllegalArgumentException{};
- }
- this->value = _value;
- }
|