mirror of
https://github.com/sebastiandine/Card-Collection-Manager-3.git
synced 2026-08-28 17:01:02 +00:00
55ace147bc
* initial development * pipeline * pipeline * pipeline * pipeline * pipeline * pipeline * pipeline * pipeline * pipeline * pipeline * pipeline * pipeline * pipeline * pipeline * ci/cd * ci/cd * ci/cd * ci/cd * ci/cd * ci/cd * ci/cd * pokemon * pokemon * pokemon * pokemon * pokemon * pokemon * improvements * improvements * ci/cd * ci/cd * improvements * improvements * improvements * improvements * improvements * improvements * improvements * improvements * improvements --------- Co-authored-by: sdine <sdine@sdine.com>
33 lines
840 B
C++
33 lines
840 B
C++
#pragma once
|
|
|
|
// JsonSetRepository: persists vector<Set> to `<dataStorage>/<game>/sets.json`.
|
|
|
|
#include "ccm/games/IGameModule.hpp"
|
|
#include "ccm/ports/IFileSystem.hpp"
|
|
#include "ccm/ports/ISetRepository.hpp"
|
|
#include "ccm/services/ConfigService.hpp"
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
namespace ccm {
|
|
|
|
class JsonSetRepository final : public ISetRepository {
|
|
public:
|
|
using DirNameFn = std::function<std::string(Game)>;
|
|
|
|
JsonSetRepository(IFileSystem& fs, ConfigService& config, DirNameFn dirName);
|
|
|
|
Result<std::vector<Set>> load(Game game) override;
|
|
Result<void> save(Game game, const std::vector<Set>& sets) override;
|
|
|
|
private:
|
|
IFileSystem& fs_;
|
|
ConfigService& config_;
|
|
DirNameFn dirName_;
|
|
|
|
[[nodiscard]] std::filesystem::path setsPath(Game game) const;
|
|
};
|
|
|
|
} // namespace ccm
|