2 #include "common/common.hpp" 3 #include "nlohmann/json_fwd.hpp" 9 void save_json_to_file(
const std::string &filename,
const json &j);
10 int orientation_to_angle(Orientation o);
11 std::string get_exe_dir();
12 std::string coord_to_string(
const Coordf &c,
bool delta =
false);
13 std::string dim_to_string(int64_t x,
bool with_sign =
true);
14 std::string angle_to_string(
int angle,
bool pos_only =
true);
16 int64_t round_multiple(int64_t x, int64_t mul);
18 template <
typename T,
typename U> std::vector<T> dynamic_cast_vector(
const std::vector<U> &cin)
21 out.reserve(cin.size());
22 std::transform(cin.begin(), cin.end(), std::back_inserter(out), [](
auto x) {
return dynamic_cast<T
>(x); });
26 template <
typename Map,
typename F>
static void map_erase_if(Map &m, F pred)
28 for (
typename Map::iterator i = m.begin(); (i = std::find_if(i, m.end(), pred)) != m.end(); m.erase(i++))
32 bool endswith(
const std::string &haystack,
const std::string &needle);
34 template <
typename T>
int sgn(T val)
36 return (T(0) < val) - (val < T(0));
39 int strcmp_natural(
const std::string &a,
const std::string &b);
40 void create_config_dir();
41 std::string get_config_dir();
43 void replace_backslash(std::string &path);
44 json json_from_resource(
const std::string &rsrc);
a class to store JSON values
Definition: json.hpp:161
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61