blob: 491d4d9781e754486e2d6adee12d3b075a0aa0c8 [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;
Wludzik, Jozefe2362792020-10-27 17:23:55 +010023 virtual bool exist(const FilePath& path) const = 0;
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020024 virtual std::optional<nlohmann::json>
25 load(const FilePath& subPath) const = 0;
Wludzik, Jozefe2362792020-10-27 17:23:55 +010026 virtual std::vector<FilePath> list() const = 0;
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020027};
28
29} // namespace interfaces