#ifndef _UTILS_HPP_ #define _UTILS_HPP_ #include #include #include #include #include #include struct less_str { bool operator()(const char *lh, const char *rh) const { return strcmp(lh, rh)<0; } }; typedef std::map Str2StrTable; extern void replace(const Str2StrTable& replace_table, const char *str, std::string& res); extern bool make_directory(const std::string& dir); inline void tolower(std::string& str) { std::transform(str.begin(), str.end(), str.begin(), g_ascii_tolower); } inline bool is_file_exist(const std::string& file) { return g_file_test(file.c_str(), G_FILE_TEST_EXISTS); } extern std::vector split(const std::string& str, char sep); extern std::string& strip(std::string& str); extern const char *b64_encode(guint32 val); extern guint32 b64_decode(const char *val); extern void copy_file(const std::string& from, const std::string& to); #endif//!_UTILS_HPP_