KVReader.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-12-25
  6. * Changed: 2021-04-23
  7. *
  8. * */
  9. #ifndef LS_STD_KV_READER_HPP
  10. #define LS_STD_KV_READER_HPP
  11. #include <ls_std/base/Class.hpp>
  12. #include <ls_std/io/IReader.hpp>
  13. #include <ls_std/io/kv/KVDocument.hpp>
  14. #include <ls_std/io/File.hpp>
  15. #include <memory>
  16. namespace ls_std
  17. {
  18. class KVReader : public ls_std::Class, public ls_std::IReader
  19. {
  20. public:
  21. explicit KVReader(const std::shared_ptr<ls_std::KVDocument> &_document, const std::string &_absolutePath);
  22. ~KVReader() override = default;
  23. // implementation
  24. ls_std::byte_field read() override;
  25. // additional functionality
  26. std::shared_ptr<ls_std::KVDocument> getDocument();
  27. void setDocument(const std::shared_ptr<ls_std::KVDocument> &_document);
  28. void setFile(const ls_std::File &_kvFile);
  29. private:
  30. std::shared_ptr<ls_std::KVDocument> document{};
  31. ls_std::File kvFile;
  32. void _assignDocument(const std::shared_ptr<ls_std::KVDocument> &_document);
  33. void _assignFile(ls_std::File _kvFile);
  34. };
  35. }
  36. #endif