StorableFile.hpp 830 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-19
  6. * Changed: 2021-04-23
  7. *
  8. * */
  9. #ifndef LS_STD_STORABLE_FILE_HPP
  10. #define LS_STD_STORABLE_FILE_HPP
  11. #include <string>
  12. #include <memory>
  13. #include "IStorable.hpp"
  14. #include "File.hpp"
  15. namespace ls_std
  16. {
  17. class StorableFile : public IStorable
  18. {
  19. public:
  20. explicit StorableFile(const std::string &_path);
  21. ~StorableFile() = default;
  22. std::shared_ptr<ls_std::File> getFile();
  23. ls_std::byte_field load() override;
  24. void reset(const std::string &_path);
  25. void save(const ls_std::byte_field &_data) override;
  26. private:
  27. std::shared_ptr<ls_std::File> file{};
  28. void _init(const std::string &_path);
  29. };
  30. }
  31. #endif