StorableFile.hpp 837 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: 2020-08-19
  7. *
  8. * */
  9. #ifndef STORABLE_FILE_HPP
  10. #define 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::string getContent();
  21. void load() override;
  22. void reset(const std::string& _path);
  23. void save() override;
  24. void setContent(const std::string& _content);
  25. private:
  26. std::string content {};
  27. std::shared_ptr<ls_std::File> file {};
  28. void _init(const std::string& _path);
  29. };
  30. }
  31. #endif