KvFileReader.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-12-25
  6. * Changed: 2023-02-06
  7. *
  8. * */
  9. #ifndef LS_STD_KV_FILE_READER_HPP
  10. #define LS_STD_KV_FILE_READER_HPP
  11. #include <ls-std/core/Class.hpp>
  12. #include <ls-std/core/interface/IReader.hpp>
  13. #include <ls-std/io/File.hpp>
  14. #include <ls-std/io/kv/KvDocument.hpp>
  15. #include <ls-std/os/dynamic-goal.hpp>
  16. #include <memory>
  17. namespace ls::std::io
  18. {
  19. class LS_STD_DYNAMIC_GOAL KvFileReader : public ls::std::core::Class, public ls::std::core::interface_type::IReader
  20. {
  21. public:
  22. explicit KvFileReader(const ::std::shared_ptr<ls::std::io::KvDocument> &_document, const ::std::string &_absolutePath);
  23. ~KvFileReader() override;
  24. // implementation
  25. ls::std::core::type::byte_field read() override; // nodiscard is optional here
  26. // additional functionality
  27. [[nodiscard]] ::std::shared_ptr<ls::std::io::KvDocument> getDocument();
  28. void setDocument(const ::std::shared_ptr<ls::std::io::KvDocument> &_document);
  29. void setFile(const ls::std::io::File &_kvFile);
  30. private:
  31. ::std::shared_ptr<ls::std::io::KvDocument> document{};
  32. ls::std::io::File kvFile;
  33. void _assignDocument(const ::std::shared_ptr<ls::std::io::KvDocument> &_document);
  34. void _assignFile(ls::std::io::File _kvFile);
  35. };
  36. }
  37. #endif