2 #include "common/common.hpp" 3 #include "nlohmann/json_fwd.hpp" 10 void save_json_to_file(
const std::string &filename,
const json &j);
11 json load_json_from_file(
const std::string &filename);
12 int orientation_to_angle(Orientation o);
13 std::string get_exe_dir();
14 void allow_set_foreground_window(
int pid);
15 std::string coord_to_string(
const Coordf &c,
bool delta =
false);
16 std::string dim_to_string(int64_t x,
bool with_sign =
true);
17 std::string angle_to_string(
int angle,
bool pos_only =
true);
19 int64_t round_multiple(int64_t x, int64_t mul);
21 template <
typename T,
typename U> std::vector<T> dynamic_cast_vector(
const std::vector<U> &cin)
24 out.reserve(cin.size());
25 std::transform(cin.begin(), cin.end(), std::back_inserter(out), [](
auto x) {
return dynamic_cast<T
>(x); });
29 template <
typename Map,
typename F>
static void map_erase_if(Map &m, F pred)
31 for (
typename Map::iterator i = m.begin(); (i = std::find_if(i, m.end(), pred)) != m.end(); m.erase(i++))
35 bool endswith(
const std::string &haystack,
const std::string &needle);
37 template <
typename T>
int sgn(T val)
39 return (T(0) < val) - (val < T(0));
42 int strcmp_natural(
const std::string &a,
const std::string &b);
43 void create_config_dir();
44 std::string get_config_dir();
46 void replace_backslash(std::string &path);
47 json json_from_resource(
const std::string &rsrc);
48 bool compare_files(
const std::string &filename_a,
const std::string &filename_b);
49 void find_files_recursive(
const std::string &base_path, std::function<
void(
const std::string &)> cb,
50 const std::string &path =
"");
52 Color color_from_json(
const json &j);
53 json color_to_json(
const Color &c);
a class to store JSON values
Definition: json.hpp:161
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61