StorableFile.hpp 992 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-19
  6. * Changed: 2022-07-03
  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. #include <ls_std/os/dynamic_goal.hpp>
  16. namespace ls::std::io
  17. {
  18. class LS_STD_DYNAMIC_GOAL StorableFile : public ls::std::core::interface_type::IStorable
  19. {
  20. public:
  21. explicit StorableFile(const ::std::string &_path);
  22. ~StorableFile() = default;
  23. ::std::shared_ptr<ls::std::io::File> getFile();
  24. ls::std::core::type::byte_field load() override;
  25. void reset(const ::std::string &_path);
  26. void save(const ls::std::core::type::byte_field &_data) override;
  27. private:
  28. ::std::shared_ptr<ls::std::io::File> file{};
  29. void _init(const ::std::string &_path);
  30. };
  31. }
  32. #endif