ArKanjo 0.5.1
A tool for find code duplicated functions in codebases
preprocess_state.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4#include <string>
5#include <nlohmann/json.hpp>
6
7namespace fs = std::filesystem;
8
10
12 fs::path path;
13 std::string finished_time;
14 std::string version;
15 std::uintmax_t size;
16};
17
18inline void to_json(json& j, const PreprocessRunParams& d) {
19 j = {
20 {"path", d.path.string()},
21 {"finished_time", d.finished_time},
22 {"version", d.version},
23 {"size", d.size},
24 };
25}
26
27inline void from_json(const json& j, PreprocessRunParams& d) {
28 d.path = j.value("path", "");
29 d.finished_time = j.value("finished_time", "");
30 d.version = j.value("version","");
31 d.size = j.value("size", 0);
32}
33
35protected:
36 static constexpr const char* CONFIG_PATH = "config.json";
37
38public:
44 static void save_current_run_params(const fs::path& path, const fs::path& cache_path);
45
50
51 static bool is_cache_compatible(const std::string& cache_version);
52};
static PreprocessRunParams read_current_run_params()
read preprocessing parameters runs
static void save_current_run_params(const fs::path &path, const fs::path &cache_path)
Saves preprocessing parameters for future runs.
static bool is_cache_compatible(const std::string &cache_version)
static constexpr const char * CONFIG_PATH
Configuration file path.
nlohmann::json json
void to_json(json &j, const PreprocessRunParams &d)
void from_json(const json &j, PreprocessRunParams &d)
nlohmann::json json
std::uintmax_t size
Size of the preprocess output.
fs::path path
Path of the current preprocess.
std::string finished_time
Timing information for when preprocessing finished.
std::string version
Version of the current preprocess.