SerializableSectionPairDocument.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-16
  6. * Changed: 2023-05-19
  7. *
  8. * */
  9. #ifndef LS_STD_SERIALIZABLE_SECTION_PAIR_DOCUMENT_HPP
  10. #define LS_STD_SERIALIZABLE_SECTION_PAIR_DOCUMENT_HPP
  11. #include "SerializableSectionPairParameter.hpp"
  12. #include <ls-std/core/Class.hpp>
  13. #include <ls-std/core/interface/ISerializable.hpp>
  14. #include <ls-std/os/dynamic-goal.hpp>
  15. #include <memory>
  16. #include <string_view>
  17. namespace ls::std::io
  18. {
  19. class LS_STD_DYNAMIC_GOAL SerializableSectionPairDocument : public ls::std::core::interface_type::ISerializable, public ls::std::core::Class
  20. {
  21. public:
  22. explicit SerializableSectionPairDocument(const ls::std::io::SerializableSectionPairParameter &_parameter);
  23. ~SerializableSectionPairDocument() noexcept override;
  24. [[nodiscard]] ::std::shared_ptr<ls::std::core::Class> getValue() const;
  25. [[nodiscard]] ls::std::core::type::byte_field marshal() override;
  26. void unmarshal(const ls::std::core::type::byte_field &_data) override;
  27. private:
  28. ls::std::io::SerializableSectionPairParameter parameter{};
  29. [[nodiscard]] ls::std::core::type::byte_field _getCurrentRow(size_t _iterations, ::std::string_view _serializedDocument) const;
  30. [[nodiscard]] ls::std::core::type::byte_field _getNextSerializedSection(const ls::std::core::type::byte_field &_serializedDocument) const;
  31. [[nodiscard]] bool _isNotNewSection(::std::string_view _currentRow) const;
  32. void _addSection(const ls::std::core::type::byte_field &_serializedSection) const;
  33. };
  34. }
  35. #endif