StorableFile.hpp 829 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-19
  6. * Changed: 2020-11-06
  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. class StorableFile : public IStorable {
  17. public:
  18. explicit StorableFile(const std::string& _path);
  19. ~StorableFile() = default;
  20. std::shared_ptr<ls_std::File> getFile();
  21. ls_std::byte_field load() override;
  22. void reset(const std::string& _path);
  23. void save(const ls_std::byte_field& _data) override;
  24. private:
  25. std::shared_ptr<ls_std::File> file {};
  26. void _init(const std::string& _path);
  27. };
  28. }
  29. #endif