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"
16 static inline void ltrim(std::string& s)
18 s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](
unsigned char ch) {
19 return !std::isspace(ch);
23 static inline void rtrim(std::string& s)
25 s.erase(std::find_if(s.rbegin(), s.rend(), [](
unsigned char ch) {
26 return !std::isspace(ch);
36 bool iequals(
const std::string& a,
const std::string& b)
38 size_t aLen = a.size();
39 if (b.size() != aLen)
return false;
41 for (
size_t i = 0; i < aLen; ++i) {
42 if (tolower(a[i]) != tolower(b[i]))
return false;
47 size_t splitList(
const std::string& sline,
const char delimiter, std::vector<std::string>& args)
49 std::istringstream f(sline);
51 while (getline(f, s, delimiter)) {
58 int loadInt(
const std::string& str,
bool as_hex=
false)
63 ss << (as_hex ? std::hex : std::dec) << str;
78 if (val == 0)
return false;
84 return (val) ?
"True":
"False";
95 size_t found = str.find_first_of(
";#");
96 if (found != std::string::npos) {
103 using namespace util;
105 std::vector<std::string> args;
108 if (args.size() < 2) {
111 bool isFilled =
false;
112 std::string valName = args[0];
113 std::string valStr = args[1];
130 this->
tcpip = loadBoolean(valStr, this->
tcpip);
142 std::ifstream myfile(filename.c_str());
143 if (!myfile.is_open()) {
146 const size_t MAX_LINE = 300;
147 char line[MAX_LINE] = { 0 };
148 bool filledAny =
false;
150 while (!myfile.eof()) {
151 myfile.getline(line, MAX_LINE);
152 std::string lineStr = line;
165 using namespace util;
166 std::ofstream myfile(filename.c_str());
167 if (!myfile.is_open()) {
#define WATCH_PROCESS_START
void trim(std::string &s)
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)
int loadInt(const std::string &str, bool as_hex=false)
bool loadBoolean(const std::string &str, bool defaultVal)
void stripComments(std::string &str)
bool loadIni(const std::string &fileName)
bool fillSettings(std::string line)
bool saveIni(const std::string &fileName)