Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <boost/serialization/strong_typedef.hpp> |
| 4 | #include <nlohmann/json.hpp> |
| 5 | |
| 6 | #include <filesystem> |
| 7 | #include <optional> |
| 8 | #include <string> |
| 9 | |
| 10 | namespace interfaces |
| 11 | { |
| 12 | |
| 13 | class JsonStorage |
| 14 | { |
| 15 | public: |
| 16 | BOOST_STRONG_TYPEDEF(std::filesystem::path, FilePath) |
| 17 | BOOST_STRONG_TYPEDEF(std::filesystem::path, DirectoryPath) |
| 18 | |
| 19 | virtual ~JsonStorage() = default; |
| 20 | |
| 21 | virtual void store(const FilePath& subPath, const nlohmann::json& data) = 0; |
| 22 | virtual bool remove(const FilePath& subPath) = 0; |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 23 | virtual bool exist(const FilePath& path) const = 0; |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 24 | virtual std::optional<nlohmann::json> |
| 25 | load(const FilePath& subPath) const = 0; |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 26 | virtual std::vector<FilePath> list() const = 0; |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | } // namespace interfaces |