StorableFile.hpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-19
  6. * Changed: 2023-05-19
  7. *
  8. * */
  9. #ifndef LS_STD_STORABLE_FILE_HPP
  10. #define LS_STD_STORABLE_FILE_HPP
  11. #include "File.hpp"
  12. #include <ls-std/core/interface/IStorable.hpp>
  13. #include <ls-std/os/dynamic-goal.hpp>
  14. #include <memory>
  15. #include <string>
  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() noexcept override;
  23. [[nodiscard]] ::std::shared_ptr<ls::std::io::File> getFile() const;
  24. [[nodiscard]] 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