ArKanjo 0.5.1
A tool for find code duplicated functions in codebases
function_storage.cpp
Go to the documentation of this file.
3
4fs::path FunctionStorage::build_source_path(const Path& path) const {
5 auto& cfg = Config::config();
6 return cfg.base_path / cfg.name_container / cfg.source_path / path.value();
7}
8
9fs::path FunctionStorage::build_header_path(const Path& path) const {
10 auto& cfg = Config::config();
11 return cfg.base_path / cfg.name_container / cfg.header_path / path.value();
12}
13
14fs::path FunctionStorage::build_info_path(const Path& path) const {
15 auto& cfg = Config::config();
16 fs::path p = cfg.base_path / cfg.name_container / cfg.info_path / path.value();
17 p.replace_extension(JSON_EXTENSION);
18 return p;
19}
20
22 auto& cfg = Config::config();
23 return cfg.base_path / cfg.name_container / cfg.similarity_path;
24}
25
27 const fs::path type_path, const fs::path& relative_path, const std::string& function_name
28) const {
29 auto& cfg = Config::config();
30 fs::path base = cfg.base_path / cfg.name_container / type_path;
31
32 std::string ext;
33 if (type_path == cfg.info_path) {
34 ext = "json";
35 } else {
36 ext = relative_path.extension().string();
37 if (!ext.empty() && ext[0] == '.')
38 ext.erase(0, 1);
39 }
40
41 return base / relative_path / (function_name + "." + ext);
42}
static Config & config()
Gets the singleton configuration instance.
Definition: config.cpp:68
fs::path build_header_path(const Path &path) const
Builds header file path.
fs::path build_source_path(const Path &path) const
Builds source file path.
fs::path build_output_path(const fs::path type_path, const fs::path &relative_path, const std::string &function_name) const
Builds file path for a function.
fs::path build_similarity_path() const
Builds similarity file path.
fs::path build_info_path(const Path &path) const
Builds metadata file path.
Represents a logical path to a function in the codebase.
Definition: path.hpp:26
const fs::path & value() const
Gets the underlying filesystem path.
Definition: path.cpp:7
Configuration management interface.
Provides access to function storage locations.