blob: badd93852dfd142c161c4467587d5006ece3c7a7 [file] [log] [blame]
Krzysztof Grobelny73da6902020-09-24 13:42:04 +02001#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
10namespace interfaces
11{
12
13class 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 std::optional<nlohmann::json>
24 load(const FilePath& subPath) const = 0;
25 virtual std::vector<FilePath>
26 list(const DirectoryPath& subDirectory) const = 0;
27};
28
29} // namespace interfaces