mirror of
https://github.com/sebastiandine/Card-Collection-Manager-3.git
synced 2026-08-29 01:08:49 +00:00
major: initial release
* 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>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
// IFileSystem - filesystem operations the services need, expressed as a
|
||||
// narrow port. Real implementation is `StdFileSystem` (over <filesystem>).
|
||||
// In-memory implementation can be plugged in for tests.
|
||||
|
||||
#include "ccm/util/Result.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ccm {
|
||||
|
||||
class IFileSystem {
|
||||
public:
|
||||
virtual ~IFileSystem() = default;
|
||||
|
||||
[[nodiscard]] virtual bool exists(const std::filesystem::path& p) const = 0;
|
||||
[[nodiscard]] virtual bool isDirectory(const std::filesystem::path& p) const = 0;
|
||||
|
||||
virtual Result<void> ensureDirectory(const std::filesystem::path& p) = 0;
|
||||
virtual Result<std::string> readText(const std::filesystem::path& p) = 0;
|
||||
virtual Result<void> writeText(const std::filesystem::path& p, std::string_view contents) = 0;
|
||||
virtual Result<void> copyFile(const std::filesystem::path& from,
|
||||
const std::filesystem::path& to,
|
||||
bool overwrite) = 0;
|
||||
virtual Result<void> remove(const std::filesystem::path& p) = 0;
|
||||
virtual Result<std::vector<std::filesystem::path>> listDirectory(
|
||||
const std::filesystem::path& p) = 0;
|
||||
};
|
||||
|
||||
} // namespace ccm
|
||||
Reference in New Issue
Block a user