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: 2022-07-03
  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/kv/KvDocument.hpp>
  14. #include <ls_std/io/File.hpp>
  15. #include <memory>
  16. #include <ls_std/os/dynamic_goal.hpp>
  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 = default;
  24. // implementation
  25. ls::std::core::type::byte_field read() override;
  26. // additional functionality
  27. ::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