StorableFile.hpp 1.0 KB

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