8#define WATCH_PROCESS_START "WATCH_PROCESS_START"
9#define WATCH_IMG_LOAD "WATCH_IMG_LOAD"
10#define WATCH_ALLOCATION "WATCH_ALLOCATION"
11#define WATCH_TCP_IP "WATCH_TCP_IP"
12#define WATCH_OBJ_MGR "WATCH_OBJ_MGR"
18 static inline void ltrim(std::string& s)
21 if (startpos != std::string::npos) {
22 s = s.substr(startpos);
26 static inline void rtrim(std::string& s)
29 if (endpos != std::string::npos) {
30 s = s.substr(0, endpos + 1);
34 std::string
trim(std::string& s)
41 bool iequals(
const std::string& a,
const std::string& b)
43 size_t aLen = a.size();
44 if (b.size() != aLen)
return false;
46 for (
size_t i = 0; i < aLen; ++i) {
47 if (tolower(a[i]) != tolower(b[i]))
return false;
52 size_t splitList(
const std::string& sline,
const char delimiter, std::vector<std::string>& args)
54 std::istringstream f(sline);
56 while (getline(f, s, delimiter)) {
63 int loadInt(
const std::string& str,
bool as_hex=
false)
68 ss << (as_hex ? std::hex : std::dec) << str;
83 if (val == 0)
return false;
89 return (val) ?
"True":
"False";
100 size_t found = str.find_first_of(
";#");
101 if (found != std::string::npos) {
108 using namespace util;
110 std::vector<std::string> args;
113 if (args.size() < 2) {
116 bool isFilled =
false;
117 std::string valName = args[0];
118 std::string valStr = args[1];
147 std::ifstream myfile(filename.c_str());
148 if (!myfile.is_open()) {
151 const size_t MAX_LINE = 300;
152 char line[MAX_LINE] = { 0 };
153 bool filledAny =
false;
155 while (!myfile.eof()) {
156 myfile.getline(line, MAX_LINE);
157 std::string lineStr = line;
170 using namespace util;
171 std::ofstream myfile(filename.c_str());
172 if (!myfile.is_open()) {
#define WATCH_PROCESS_START
size_t splitList(const std::string &sline, const char delimiter, std::vector< std::string > &args)
std::string booleanToStr(bool val)
bool iequals(const std::string &a, const std::string &b)
std::string trim(std::string &s)
int loadInt(const std::string &str, bool as_hex=false)
bool loadBoolean(const std::string &str, bool defaultVal)
bool fillSettings(const std::string &line)
void stripComments(std::string &str)
bool loadIni(const std::string &fileName)
bool saveIni(const std::string &fileName)