SerializableSectionPairRowSingleValue.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-11
  6. * Changed: 2023-02-17
  7. *
  8. * */
  9. #include <ls-std/core/evaluator/EmptyStringArgumentEvaluator.hpp>
  10. #include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
  11. #include <ls-std/io/NewLine.hpp>
  12. #include <ls-std/io/section-pair/model/SectionPairRowSingleValue.hpp>
  13. #include <ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.hpp>
  14. ls::std::io::SerializableSectionPairRowSingleValue::SerializableSectionPairRowSingleValue(const ::std::shared_ptr<ls::std::core::Class> &_value) : ls::std::core::Class("SerializableSectionPairRowSingleValue")
  15. {
  16. this->_setValue(_value);
  17. }
  18. ls::std::io::SerializableSectionPairRowSingleValue::~SerializableSectionPairRowSingleValue() = default;
  19. ::std::shared_ptr<ls::std::core::Class> ls::std::io::SerializableSectionPairRowSingleValue::getValue()
  20. {
  21. return this->value;
  22. }
  23. ls::std::core::type::byte_field ls::std::io::SerializableSectionPairRowSingleValue::marshal()
  24. {
  25. return ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowSingleValue>(this->value)->get() + ls::std::io::NewLine::get();
  26. }
  27. void ls::std::io::SerializableSectionPairRowSingleValue::unmarshal(const ls::std::core::type::byte_field &_data)
  28. {
  29. ls::std::core::EmptyStringArgumentEvaluator{_data}.evaluate();
  30. ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowSingleValue>(this->value)->set(_data);
  31. }
  32. void ls::std::io::SerializableSectionPairRowSingleValue::_setValue(const ::std::shared_ptr<ls::std::core::Class> &_value)
  33. {
  34. ls::std::core::NullPointerArgumentEvaluator{_value, "model reference for SerializableSectionPairRowSingleValue is null!"}.evaluate();
  35. this->value = _value;
  36. }