SectionPairRow.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-08
  6. * Changed: 2023-02-22
  7. *
  8. * */
  9. #ifndef LS_STD_SECTION_PAIR_ROW_HPP
  10. #define LS_STD_SECTION_PAIR_ROW_HPP
  11. #include <ls-std/core/Class.hpp>
  12. #include <ls-std/core/interface/ISerializable.hpp>
  13. #include <ls-std/io/section-pair/SectionPairRowEnumType.hpp>
  14. #include <ls-std/io/section-pair/SectionPairTypes.hpp>
  15. #include <ls-std/io/section-pair/model/SectionPairRowValue.hpp>
  16. #include <ls-std/os/dynamic-goal.hpp>
  17. #include <memory>
  18. #include <string>
  19. namespace ls::std::io
  20. {
  21. class LS_STD_DYNAMIC_GOAL SectionPairRow : public ::std::enable_shared_from_this<SectionPairRow>, public ls::std::core::Class, public ls::std::core::interface_type::ISerializable
  22. {
  23. public:
  24. explicit SectionPairRow(const ls::std::io::section_pair_identifier &_key, const ls::std::io::SectionPairRowEnumType &_type);
  25. ~SectionPairRow() noexcept override;
  26. [[nodiscard]] ls::std::io::section_pair_identifier getKey();
  27. [[nodiscard]] ::std::shared_ptr<ls::std::io::SectionPairRowValue> getValue();
  28. [[nodiscard]] bool isList();
  29. [[nodiscard]] bool isSingleValue();
  30. [[nodiscard]] ls::std::core::type::byte_field marshal() override;
  31. void reserveNewLine(const ::std::string &_reservedNewLine);
  32. void setKey(const ls::std::io::section_pair_identifier &_key);
  33. void unmarshal(const ls::std::core::type::byte_field &_data) override;
  34. private:
  35. ls::std::io::section_pair_identifier key{};
  36. ::std::string reservedNewLine{};
  37. ::std::shared_ptr<ls::std::core::interface_type::ISerializable> serializable{};
  38. ::std::shared_ptr<ls::std::io::SectionPairRowValue> value{};
  39. void _createSerializable();
  40. void _initValue(const ls::std::io::SectionPairRowEnumType &_type);
  41. void _setKey(const ls::std::io::section_pair_identifier &_key);
  42. };
  43. }
  44. #endif