KVReader.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-12-25
  6. * Changed: 2020-12-25
  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. class KVReader : public ls_std::Class, public ls_std::IReader {
  18. public:
  19. explicit KVReader(const std::shared_ptr<ls_std::KVDocument>& _document, const std::string& _absolutePath);
  20. ~KVReader() override = default;
  21. // implementation
  22. ls_std::byte_field read() override;
  23. // additional functionality
  24. std::shared_ptr<ls_std::KVDocument> getDocument();
  25. void setDocument(const std::shared_ptr<ls_std::KVDocument>& _document);
  26. void setFile(const ls_std::File& _kvFile);
  27. private:
  28. std::shared_ptr<ls_std::KVDocument> document {};
  29. ls_std::File kvFile;
  30. void _assignDocument(const std::shared_ptr<ls_std::KVDocument>& _document);
  31. void _assignFile(ls_std::File _kvFile);
  32. };
  33. }
  34. #endif