SectionPairFileReader.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Co-Author: Claude Sonnet 4.6 (LLM)
  4. * Company: Lynar Studios
  5. * E-Mail: webmaster@lynarstudios.com
  6. * Created: 2023-02-21
  7. * Changed: 2026-06-24
  8. *
  9. * */
  10. #ifndef LS_STD_SECTION_PAIR_FILE_READER_HPP
  11. #define LS_STD_SECTION_PAIR_FILE_READER_HPP
  12. #include "SectionPairFileReaderParameter.hpp"
  13. #include <ls-std/core/Class.hpp>
  14. #include <ls-std/core/interface/IReader.hpp>
  15. #include <ls-std/os/dynamic-goal.hpp>
  16. #include <memory>
  17. /*
  18. * @doc: class(name: 'SectionPairFileReader', package: 'io')
  19. * @doc: io.SectionPairFileReader.description('This class reads a Section Pair file and writes it to a Section Pair document instance.')
  20. * */
  21. namespace ls::standard::io
  22. {
  23. class LS_STD_DYNAMIC_GOAL SectionPairFileReader : public ls::standard::core::Class, public ls::standard::core::interface_type::IReader
  24. {
  25. public:
  26. explicit SectionPairFileReader(const ls::standard::io::SectionPairFileReaderParameter &_parameter);
  27. ~SectionPairFileReader() noexcept override;
  28. [[nodiscard]] ::std::shared_ptr<ls::standard::io::SectionPairDocument> getDocument() const;
  29. ls::standard::core::type::byte_field read() override; // nodiscard is optional here
  30. private:
  31. ls::standard::io::SectionPairFileReaderParameter parameter{};
  32. void _checkFileExtension() const;
  33. void _createDocument();
  34. void _createFileExistenceEvaluator();
  35. void _createReader();
  36. [[nodiscard]] static ::std::string _detectNewLine(const ls::standard::core::type::byte_field &_data);
  37. };
  38. }
  39. #endif