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; 23 virtual bool exist(const FilePath& path) const = 0; 24 virtual std::optional<nlohmann::json> 25 load(const FilePath& subPath) const = 0; 26 virtual std::vector<FilePath> list() const = 0; 27 }; 28 29 } // namespace interfaces 30