blob: 26f402766525e8e1bf2a5ba414c601580bd1f0ed [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;
Patrick Williams583ba442025-02-03 14:28:19 -050024 virtual std::optional<nlohmann::json> load(
25 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