#ifndef COMMON_H_ #define COMMON_H_ #include #include #include #include "json.hpp" bool read_config(nlohmann::json& cfg, std::ostream* log = &std::cout); bool path_exists(const std::string& path); std::string build_fname(const std::string& main_path, const std::string& folder, const std::string& fname); std::string i_to_str(int i, int size, char fill = '0'); void json_extract(const nlohmann::json& j, const std::string& key, std::string& out); void json_extract(const nlohmann::json& j, const std::string& key, uint16_t& out); void json_extract(const nlohmann::json& j, const std::string& key, bool& out); bool ensure_folder(const std::string& main_path, const std::string& folder); std::string trim_whitespace(const std::string& s); std::string clean_filename(const std::string& s); bool exec_cmd(const std::string& cmd); #endif // COMMON_H_