KvFileReader.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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-01
  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
  18. {
  19. namespace std
  20. {
  21. namespace io
  22. {
  23. class DYNAMIC_GOAL KvFileReader : public ls::std::core::Class, public ls::std::core::interface_type::IReader
  24. {
  25. public:
  26. explicit KvFileReader(const ::std::shared_ptr<ls::std::io::KvDocument> &_document, const ::std::string &_absolutePath);
  27. ~KvFileReader() override = default;
  28. // implementation
  29. ls::std::core::type::byte_field read() override;
  30. // additional functionality
  31. ::std::shared_ptr<ls::std::io::KvDocument> getDocument();
  32. void setDocument(const ::std::shared_ptr<ls::std::io::KvDocument> &_document);
  33. void setFile(const ls::std::io::File &_kvFile);
  34. private:
  35. ::std::shared_ptr<ls::std::io::KvDocument> document{};
  36. ls::std::io::File kvFile;
  37. void _assignDocument(const ::std::shared_ptr<ls::std::io::KvDocument> &_document);
  38. void _assignFile(ls::std::io::File _kvFile);
  39. };
  40. }
  41. }
  42. }
  43. #endif