SectionPairRowSingleValue.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-10
  6. * Changed: 2023-02-11
  7. *
  8. * */
  9. #include <ls-std/core/evaluator/EmptyStringArgumentEvaluator.hpp>
  10. #include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
  11. #include <ls-std/core/evaluator/NullPointerEvaluator.hpp>
  12. #include <ls-std/io/section-pair/evaluator/SectionPairRowValueArgumentEvaluator.hpp>
  13. #include <ls-std/io/section-pair/model/SectionPairRowSingleValue.hpp>
  14. ls::std::io::SectionPairRowSingleValue::SectionPairRowSingleValue(const ls::std::io::section_pair_row_value &_value) : ls::std::core::Class("SectionPairRowSingleValue"), ls::std::io::SectionPairRowValue(ls::std::io::SECTION_PAIR_ROW_SINGLE_VALUE)
  15. {
  16. this->_set(_value);
  17. }
  18. ls::std::io::SectionPairRowSingleValue::~SectionPairRowSingleValue() = default;
  19. ls::std::io::section_pair_row_value ls::std::io::SectionPairRowSingleValue::get()
  20. {
  21. return this->value;
  22. }
  23. ls::std::io::SectionPairRowEnumType ls::std::io::SectionPairRowSingleValue::getType()
  24. {
  25. return this->type;
  26. }
  27. ls::std::core::type::byte_field ls::std::io::SectionPairRowSingleValue::marshal()
  28. {
  29. ::std::string message = "member \"serializable\" for marshal attempt is null!";
  30. ls::std::core::NullPointerEvaluator{::std::reinterpret_pointer_cast<void>(this->serializable), message}.evaluate();
  31. return this->serializable->marshal();
  32. }
  33. void ls::std::io::SectionPairRowSingleValue::set(const ls::std::io::section_pair_row_value &_value)
  34. {
  35. this->_set(_value);
  36. }
  37. void ls::std::io::SectionPairRowSingleValue::setSerializable(const ::std::shared_ptr<ls::std::core::interface_type::ISerializable> &_serializable)
  38. {
  39. ls::std::core::NullPointerArgumentEvaluator{_serializable}.evaluate();
  40. this->serializable = _serializable;
  41. }
  42. void ls::std::io::SectionPairRowSingleValue::unmarshal(const ls::std::core::type::byte_field &_data)
  43. {
  44. ::std::string message = "member \"serializable\" for unmarshal attempt is null!";
  45. ls::std::core::NullPointerEvaluator{::std::reinterpret_pointer_cast<void>(this->serializable), message}.evaluate();
  46. this->serializable->unmarshal(_data);
  47. }
  48. void ls::std::io::SectionPairRowSingleValue::_set(const ls::std::io::section_pair_row_value &_value)
  49. {
  50. ls::std::core::EmptyStringArgumentEvaluator{_value}.evaluate();
  51. ls::std::io::SectionPairRowValueArgumentEvaluator(_value, "section pair single value \"" + _value + "\" contains invalid characters!").evaluate();
  52. this->value = _value;
  53. }