diff --git a/src/ini_reader.h b/src/ini_reader.h index dc067b4..6cff585 100644 --- a/src/ini_reader.h +++ b/src/ini_reader.h @@ -123,7 +123,7 @@ public: if(parsed) return GetErrorString(last_error); else - return "line " + std::__cxx11::to_string(last_error_index) + ": " + GetErrorString(last_error); + return "line " + std::to_string(last_error_index) + ": " + GetErrorString(last_error); } /** @@ -639,7 +639,7 @@ public: */ int SetDouble(std::string section, std::string itemName, double itemVal) { - return Set(section, itemName, std::__cxx11::to_string(itemVal)); + return Set(section, itemName, std::to_string(itemVal)); } /** @@ -655,7 +655,7 @@ public: */ int SetLong(std::string section, std::string itemName, long itemVal) { - return Set(section, itemName, std::__cxx11::to_string(itemVal)); + return Set(section, itemName, std::to_string(itemVal)); } /** @@ -673,7 +673,7 @@ public: { std::string data; for(auto &x : Array) - data += std::__cxx11::to_string(x) + separator; + data += std::to_string(x) + separator; data = data.substr(0, data.size() - separator.size()); return Set(section, itemName, data); } diff --git a/src/main.cpp b/src/main.cpp index 9926a60..12b86cc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,7 @@ //common settings std::string pref_path = "pref.ini"; +bool generator_mode = false; string_array def_exclude_remarks, def_include_remarks, rulesets; std::vector ruleset_content_array; std::string listen_address = "127.0.0.1", default_url, managed_config_prefix; diff --git a/src/misc.h b/src/misc.h index 0fb2330..1a9de42 100644 --- a/src/misc.h +++ b/src/misc.h @@ -82,14 +82,11 @@ template static inline void eraseElements(T &target) #ifndef HAVE_TO_STRING namespace std { - namespace __cxx11 + template std::string to_string(const T& n) { - template std::string to_string(const T& n) - { - std::ostringstream ss; - ss << n; - return ss.str(); - } + std::ostringstream ss; + ss << n; + return ss.str(); } } #endif // HAVE_TO_STRING diff --git a/src/subexport.cpp b/src/subexport.cpp index 8aaf2a9..71daf18 100644 --- a/src/subexport.cpp +++ b/src/subexport.cpp @@ -789,7 +789,7 @@ std::string netchToSurge(std::vector &nodes, std::string &base_conf, s while(std::count(remarks_list.begin(), remarks_list.end(), remark) > 0) remark = x.remarks = x.remarks + "$"; hostname = GetMember(json, "Hostname"); - port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port"))); + port = std::to_string((unsigned short)stoi(GetMember(json, "Port"))); username = GetMember(json, "Username"); password = GetMember(json, "Password"); method = GetMember(json, "EncryptMethod"); @@ -839,7 +839,7 @@ std::string netchToSurge(std::vector &nodes, std::string &base_conf, s obfs = GetMember(json, "OBFS"); obfsparam = GetMember(json, "OBFSParam"); proxy = "external, exec=\"" + ext.surge_ssr_path + "\", args=\""; - string_array args = {"-l", std::__cxx11::to_string(local_port), "-s", hostname, "-p", port, "-m", method, "-k", password, "-o", obfs, "-O", protocol}; + string_array args = {"-l", std::to_string(local_port), "-s", hostname, "-p", port, "-m", method, "-k", password, "-o", obfs, "-O", protocol}; if(obfsparam.size()) { args.emplace_back("-g"); @@ -855,8 +855,8 @@ std::string netchToSurge(std::vector &nodes, std::string &base_conf, s return std::move(a) + "\", args=\"" + std::move(b); }); //std::string ipaddr = (isIPv4(hostname) || isIPv6(hostname)) ? hostname : hostnameToIPAddr(hostname); - //proxy += "\", local-port=" + std::__cxx11::to_string(local_port) + ", addresses=" + ipaddr; - proxy += "\", local-port=" + std::__cxx11::to_string(local_port); + //proxy += "\", local-port=" + std::to_string(local_port) + ", addresses=" + ipaddr; + proxy += "\", local-port=" + std::to_string(local_port); local_port++; } else if(x.linkType == SPEEDTEST_MESSAGE_FOUNDSOCKS) @@ -947,7 +947,7 @@ std::string netchToSurge(std::vector &nodes, std::string &base_conf, s return std::move(a) + "," + std::move(b); }); if(vArray[1] == "url-test" || vArray[1] == "fallback") - proxy += ",url=" + url + ",interval=" + std::__cxx11::to_string(interval); + proxy += ",url=" + url + ",interval=" + std::to_string(interval); ini.Set("{NONAME}", vArray[0] + " = " + proxy); //insert order } @@ -990,7 +990,7 @@ std::string netchToSS(std::vector &nodes, extra_settings &ext) remark = x.remarks; hostname = GetMember(json, "Hostname"); - port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port"))); + port = std::to_string((unsigned short)stoi(GetMember(json, "Port"))); password = GetMember(json, "Password"); method = GetMember(json, "EncryptMethod"); plugin = GetMember(json, "Plugin"); @@ -1057,7 +1057,7 @@ std::string netchToSSR(std::vector &nodes, extra_settings &ext) remark = x.remarks; hostname = GetMember(json, "Hostname"); - port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port"))); + port = std::to_string((unsigned short)stoi(GetMember(json, "Port"))); password = GetMember(json, "Password"); method = GetMember(json, "EncryptMethod"); protocol = GetMember(json, "Protocol"); @@ -1118,7 +1118,7 @@ std::string netchToVMess(std::vector &nodes, extra_settings &ext) remark = x.remarks; hostname = GetMember(json, "Hostname"); - port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port"))); + port = std::to_string((unsigned short)stoi(GetMember(json, "Port"))); method = GetMember(json, "EncryptMethod"); id = GetMember(json, "UserID"); aid = GetMember(json, "AlterID"); @@ -1181,7 +1181,7 @@ std::string netchToQuan(std::vector &nodes, extra_settings &ext) remark = x.remarks; hostname = GetMember(json, "Hostname"); - port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port"))); + port = std::to_string((unsigned short)stoi(GetMember(json, "Port"))); method = GetMember(json, "EncryptMethod"); password = GetMember(json, "Password"); @@ -1274,7 +1274,7 @@ std::string netchToQuanX(std::vector &nodes, extra_settings &ext) remark = x.remarks; hostname = GetMember(json, "Hostname"); - port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port"))); + port = std::to_string((unsigned short)stoi(GetMember(json, "Port"))); method = GetMember(json, "EncryptMethod"); switch(x.linkType) @@ -1498,7 +1498,7 @@ void netchToMellow(std::vector &nodes, INIReader &ini, std::vector 0) remark = x.remarks = x.remarks + "$"; hostname = GetMember(json, "Hostname"); - port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port"))); + port = std::to_string((unsigned short)stoi(GetMember(json, "Port"))); username = GetMember(json, "Username"); password = GetMember(json, "Password"); method = GetMember(json, "EncryptMethod"); diff --git a/src/webget.cpp b/src/webget.cpp index 0bec195..c321208 100644 --- a/src/webget.cpp +++ b/src/webget.cpp @@ -49,7 +49,7 @@ std::string curlGet(std::string url, std::string proxy) std::string buildSocks5ProxyString(std::string addr, int port, std::string username, std::string password) { std::string authstr = username != "" && password != "" ? username + ":" + password + "@" : ""; - std::string proxystr = "socks5://" + authstr + addr + ":" + std::__cxx11::to_string(port); + std::string proxystr = "socks5://" + authstr + addr + ":" + std::to_string(port); return proxystr; }