KvFileReader.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-12-25
  6. * Changed: 2022-05-19
  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. namespace ls
  17. {
  18. namespace std
  19. {
  20. namespace io
  21. {
  22. class KvFileReader : public ls::std::core::Class, public ls::std::core::interface_type::IReader
  23. {
  24. public:
  25. explicit KvFileReader(const ::std::shared_ptr<ls::std::io::KvDocument> &_document, const ::std::string &_absolutePath);
  26. ~KvFileReader() override = default;
  27. // implementation
  28. ls::std::core::type::byte_field read() override;
  29. // additional functionality
  30. ::std::shared_ptr<ls::std::io::KvDocument> getDocument();
  31. void setDocument(const ::std::shared_ptr<ls::std::io::KvDocument> &_document);
  32. void setFile(const ls::std::io::File &_kvFile);
  33. private:
  34. ::std::shared_ptr<ls::std::io::KvDocument> document{};
  35. ls::std::io::File kvFile;
  36. void _assignDocument(const ::std::shared_ptr<ls::std::io::KvDocument> &_document);
  37. void _assignFile(ls::std::io::File _kvFile);
  38. };
  39. }
  40. }
  41. }
  42. #endif