strvector stdstr::Tokenize(char delimiter) const { strvector tokens; stdstr::size_type lastPos = find_first_not_of(delimiter, 0); stdstr::size_type pos = find_first_of(delimiter, lastPos); while (stdstr::npos != pos || stdstr::npos != lastPos) { tokens.push_back(substr(lastPos, pos - lastPos)); lastPos = find_first_not_of(delimiter, pos); pos = find_first_of(delimiter, lastPos); } return tokens; }
std::list<ZString> ZString::split( const ZString& delim ) { std::list<ZString> tokens; size_type left = find_first_not_of( delim, 0 ); size_type right = find_first_of( delim, left ); while ( left != npos || right != npos ) { tokens.push_back( substr( left, right - left ) ); left = find_first_not_of( delim, right ); right = find_first_of( delim, left ); } return tokens; }
bool libsinsp::container_engine::mesos::match(sinsp_threadinfo* tinfo, sinsp_container_info* container_info) { for(auto it = tinfo->m_cgroups.begin(); it != tinfo->m_cgroups.end(); ++it) { string cgroup = it->second; size_t pos; pos = cgroup.find("/mesos/"); if(pos != string::npos) { // It should match `/mesos/a9f41620-b165-4d24-abe0-af0af92e7b20` auto id = cgroup.substr(pos + sizeof("/mesos/") - 1); if(id.size() == 36 && id.find_first_not_of("0123456789abcdefABCDEF-") == string::npos) { container_info->m_type = CT_MESOS; container_info->m_id = move(id); // Consider a mesos container valid only if we find the mesos_task_id // this will exclude from the container itself the mesos-executor // but makes sure that we have task_id parsed properly. Otherwise what happens // is that we'll create a mesos container struct without a mesos_task_id // and for all other processes we'll use it return set_mesos_task_id(container_info, tinfo); } } } return false; }
void http_net::check_header(decltype(receive_store)::const_iterator header_end_iter) { auto line = receive_store.begin(); // first line contains status code const size_t space_1 = line->find(" ")+1; const size_t space_2 = line->find(" ", space_1); status_code = (HTTP_STATUS)strtoul(line->substr(space_1, space_2 - space_1).c_str(), nullptr, 10); if(status_code != HTTP_STATUS::CODE_200 && !continue_on_error_status) { receive_cb(this, status_code, server_name, page_data); this->set_thread_should_finish(); return; } // continue ... for(line++; line != header_end_iter; line++) { if(line->find("Transfer-Encoding:") == 0) { if(line->find("chunked") != string::npos) { packet_type = http_net::PACKET_TYPE::CHUNKED; } } else if(line->find("Content-Length:") == 0) { // ignore content length if a chunked transfer-encoding was already specified (rfc2616 4.4.3) if(packet_type != http_net::PACKET_TYPE::CHUNKED) { packet_type = http_net::PACKET_TYPE::NORMAL; const size_t cl_space = line->find(" ") + 1; size_t non_digit = line->find_first_not_of("0123456789", cl_space); if(non_digit == string::npos) non_digit = line->size(); content_length = (size_t)strtoull(line->substr(cl_space, non_digit - cl_space).c_str(), nullptr, 10); } } } }
CL_StringData8::size_type CL_StringData8::find_first_not_of(const char *s, size_type pos) const { size_type len = 0; while (s[len] != 0) len++; return find_first_not_of(s, pos, len); }
stdstr & stdstr::Trim(const char * chars2remove) { if (!empty()) { std::string::size_type pos = find_first_not_of(chars2remove); if (pos != std::string::npos) { erase(0, pos); } else { erase(begin(), end()); // make empty } pos = find_last_not_of(chars2remove); if (pos != std::string::npos) { erase(pos + 1); } else { erase(begin(), end()); // make empty } } return *this; }
size_t DwString::find_first_not_of(const char *aCstr, size_t aPos) const { assert(aCstr != 0); if(aCstr == 0) return (size_t) - 1; size_t len = strlen(aCstr); return find_first_not_of(aCstr, aPos, len); }
const pstring_t<F> pstring_t<F>::ltrim(const pstring_t &ws) const { int f = find_first_not_of(ws); if (f>=0) return substr(f); else return ""; }
//++ // Details: Check if *this string is a hexadecimal number. // Type: Method. // Args: None. // Return: bool - True = yes number, false not a number. // Throws: None. //-- bool CMIUtilString::IsHexadecimalNumber() const { // Compare '0x..' prefix if ((strncmp(c_str(), "0x", 2) != 0) && (strncmp(c_str(), "0X", 2) != 0)) return false; // Skip '0x..' prefix const size_t nPos = find_first_not_of("01234567890ABCDEFabcedf", 2); return nPos == std::string::npos; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::string RifEclipseUserDataParserTools::trimString(const std::string& s) { auto sCopy = s.substr(0, s.find_last_not_of(' ') + 1); if (sCopy.size() > 0) { sCopy = sCopy.substr(sCopy.find_first_not_of(' ')); } return sCopy; }
//++ // Details: Check if *this string is a decimal number. // Type: Method. // Args: None. // Return: bool - True = yes number, false not a number. // Throws: None. //-- bool CMIUtilString::IsNumber() const { if (empty()) return false; if ((at(0) == '-') && (length() == 1)) return false; const size_t nPos = find_first_not_of("-.0123456789"); return nPos == std::string::npos; }
/// <summary> /// Checks this instance to see if either there is a winner or if the board is still playable. /// </summary> /// <returns>True if there is a winner or the board is no longer playable</returns> bool CBoard::Check() { if (_is_finished) return _is_finished; // 1st row auto sub = _current_state.substr(0, 3); if (sub.find(SPACE) == std::string::npos && sub.find_first_not_of(sub[0]) == std::string::npos) _winner = sub[0]; // 2nd row sub = _current_state.substr(3, 3); if (sub.find(SPACE) == std::string::npos && sub.find_first_not_of(sub[0]) == std::string::npos) _winner = sub[0]; // 3rd row sub = _current_state.substr(6, 3); if (sub.find(SPACE) == std::string::npos && sub.find_first_not_of(sub[0]) == std::string::npos) _winner = sub[0]; // 1st col sub = _current_state.substr(0, 1) + _current_state.substr(3, 1) + _current_state.substr(6, 1); if (sub.find(SPACE) == std::string::npos && sub.find_first_not_of(sub[0]) == std::string::npos) _winner = sub[0]; // 2nd col sub = _current_state.substr(1, 1) + _current_state.substr(4, 1) + _current_state.substr(7, 1); if (sub.find(SPACE) == std::string::npos && sub.find_first_not_of(sub[0]) == std::string::npos) _winner = sub[0]; // 3rd col sub = _current_state.substr(2, 1) + _current_state.substr(5, 1) + _current_state.substr(8, 1); if (sub.find(SPACE) == std::string::npos && sub.find_first_not_of(sub[0]) == std::string::npos) _winner = sub[0]; // diagonal l to r sub = _current_state.substr(0, 1) + _current_state.substr(4, 1) + _current_state.substr(8, 1); if (sub.find(SPACE) == std::string::npos && sub.find_first_not_of(sub[0]) == std::string::npos) _winner = sub[0]; // diagonal r to l sub = _current_state.substr(2, 1) + _current_state.substr(4, 1) + _current_state.substr(6, 1); if (sub.find(SPACE) == std::string::npos && sub.find_first_not_of(sub[0]) == std::string::npos) _winner = sub[0]; _is_finished = _winner != SPACE; if (!_is_finished) _is_finished = _current_state.find(SPACE) == std::string::npos; return _is_finished; }
std::pair<sfs::FileManager::Directory *, std::string> sfs::FileManager:: Locate(std::string path) { if (def::trim(path).empty()) return std::make_pair(nullptr, std::move(std::string())); if (std::strchr(def::PATH_CHARS, path.back()) == nullptr) /* 补齐格式 */ path += def::PATH_CHARS[0]; auto begin = 0U; std::vector<Directory *> stack; { /* 初始化 */ if (std::strchr(def::PATH_CHARS, path.front()) == nullptr) stack = _CurrentDirectoryStack; else { stack.push_back(&_Root); begin = 1U; } } /* 开始寻找目标位置 */ auto len = path.length(); for (auto end = path.find_first_of(def::PATH_CHARS, begin); end != path.npos; end = path.find_first_of(def::PATH_CHARS, begin)) { auto & directories = stack.back()->directories; auto name = std::move(path.substr(begin, end - begin)); if (name.find_first_not_of(def::DOT_CHAR, 0U) == name.npos) { /* ... */ auto n = std::min(name.length(), stack.size()); for (auto i = 1U; i < n; i++) stack.pop_back(); } else if (end == len - 1U) { return std::make_pair(stack.back(), std::move(name)); } else { auto iter = std::find(directories.begin(), directories.end(), name); if (iter != directories.end()) /* 目录 */ stack.push_back(&*iter); else /* 无效位置 */ return std::make_pair(nullptr, std::move(std::string())); } begin = end + 1U; }; auto name = stack.back()->name; if (stack.size() > 1U) stack.pop_back(); return std::make_pair(stack.back(), std::move(name)); }
//++ ------------------------------------------------------------------------------------ // Details: Check if *this string is a decimal number. // Type: Method. // Args: None. // Return: bool - True = yes number, false not a number. // Throws: None. //-- bool CMIUtilString::IsNumber( void ) const { if( empty() ) return false; if( (at( 0 ) == '-') && (length() == 1) ) return false; const MIint nPos = find_first_not_of( "-.0123456789" ); if( nPos != (MIint) std::string::npos ) return false; return true; }
std::string reduce(const std::string& str, const std::string& fill, const std::string& whitespace) { // trim first auto result = trim(str, whitespace); // replace sub ranges auto beginSpace = result.find_first_of(whitespace); while (beginSpace != std::string::npos) { const auto endSpace = result.find_first_not_of(whitespace, beginSpace); const auto range = endSpace - beginSpace; result.replace(beginSpace, range, fill); const auto newStart = beginSpace + fill.length(); beginSpace = result.find_first_of(whitespace, newStart); } return result; }
//++ // Details: Extract the number from the hexadecimal string.. // Type: Method. // Args: vwrNumber - (W) Number extracted from the string. // Return: bool - True = yes number, false not a number. // Throws: None. //-- bool CMIUtilString::ExtractNumberFromHexadecimal(MIint64 &vwrNumber) const { vwrNumber = 0; const size_t nPos = find_first_not_of("xX01234567890ABCDEFabcedf"); if (nPos != std::string::npos) return false; errno = 0; const MIuint64 nNum = ::strtoull(this->c_str(), nullptr, 16); if (errno == ERANGE) return false; vwrNumber = static_cast<MIint64>(nNum); return true; }
//++ ------------------------------------------------------------------------------------ // Details: Extract the number from the hexadecimal string.. // Type: Method. // Args: vwrNumber - (W) Number exracted from the string. // Return: bool - True = yes number, false not a number. // Throws: None. //-- bool CMIUtilString::ExtractNumberFromHexadecimal( MIint64 & vwrNumber ) const { vwrNumber = 0; const MIint nPos = find_first_not_of( "x01234567890ABCDEFabcedf" ); if( nPos != (MIint) std::string::npos ) return false; const MIint64 nNum = ::strtoul( this->c_str(), nullptr, 16 ); if( nNum != ULONG_MAX ) { vwrNumber = nNum; return true; } return true; }
CPLString &CPLString::Trim() { static const char szWhitespace[] = " \t\r\n"; const size_t iLeft = find_first_not_of( szWhitespace ); const size_t iRight = find_last_not_of( szWhitespace ); if( iLeft == std::string::npos ) { erase(); return *this; } assign( substr( iLeft, iRight - iLeft + 1 ) ); return *this; }
std::string Expression::toString() const { std::string expstring; bool elem_added = false; for (auto const& term : termList_) { if (elem_added) { if (term->getValue() < 0.0f) { expstring += " - "; } else { expstring += " + "; } } else { elem_added = true; } auto no_minus = term->toString(); no_minus.erase(0, no_minus.find_first_not_of('-')); expstring += no_minus; } return expstring; }
size_type StringPiece::find_first_not_of(const StringPiece& s, size_type pos) const { if (m_length == 0) return npos; if (s.m_length == 0) return 0; // Avoid the cost of BuildLookupTable() for a single-character search. if (s.m_length == 1) return find_first_not_of(s.m_ptr[0], pos); bool lookup[UCHAR_MAX + 1] = { false }; BuildLookupTable(s, lookup); for (size_type i = pos; i < m_length; ++i) { if (!lookup[static_cast<unsigned char>(m_ptr[i])]) { return i; } } return npos; }
bool wxStringTokenizer::DoHasMoreTokens() const { wxCHECK_MSG( IsOk(), false, wxT("you should call SetString() first") ); if ( find_first_not_of(m_delims, m_delimsLen, m_pos, m_stringEnd) != m_stringEnd ) { // there are non delimiter characters left, so we do have more tokens return true; } switch ( m_mode ) { case wxTOKEN_RET_EMPTY: case wxTOKEN_RET_DELIMS: // special hack for wxTOKEN_RET_EMPTY: we should return the initial // empty token even if there are only delimiters after it return !m_string.empty() && m_pos == m_string.begin(); case wxTOKEN_RET_EMPTY_ALL: // special hack for wxTOKEN_RET_EMPTY_ALL: we can know if we had // already returned the trailing empty token after the last // delimiter by examining m_lastDelim: it is set to NUL if we run // up to the end of the string in GetNextToken(), but if it is not // NUL yet we still have this last token to return even if m_pos is // already at m_string.length() return m_pos < m_stringEnd || m_lastDelim != wxT('\0'); case wxTOKEN_INVALID: case wxTOKEN_DEFAULT: wxFAIL_MSG( wxT("unexpected tokenizer mode") ); wxFALLTHROUGH; case wxTOKEN_STRTOK: // never return empty delimiters break; } return false; }
CL_StringData8::size_type CL_StringData8::find_first_not_of(const CL_StringData8 &s, size_type pos) const { return find_first_not_of(s.data(), pos, s.length()); }
const pstring_t<F> pstring_t<F>::ltrim(const pstring_t ws) const { return substr(find_first_not_of(ws), end()); }
size_t CIString::find_first_not_of(const std::string& str, size_t pos) const { return find_first_not_of(str.data(), pos); }
string::size_type string::find_first_not_of<xmlChar>(const xmlChar * s, size_type pos) const { validate_utf8(s+pos, npos); return find_first_not_of(_Convert<xmlChar>::toUTF8(s), pos); }
size_t string::find_first_not_of(const char* s, size_t pos) const { return find_first_not_of(s, pos, strlen(s)); }
required(hello2.rfind(hello) == 6); required(hello2.rfind(hello, 0) == 0); // find_first_of required(hello.find_first_of('e') == 1); required(hello.find_first_of('l') == 2); required(hello.find_first_of(gm::make_string("abcde")) == 1); required(hello2.find_first_of(hello) == 0); required(hello2.find_first_of('l') == hello2.find('l')); required(hello.find_first_of(gm::make_string("qzxl")) == 2); required(hello.find_first_of(empty) == hello.npos); required(hello.find_first_of(gm::make_string("abce"), 3) == hello.npos); required(hello.find_first_of(gm::make_string("xyz")) == hello.npos); // find_first_not_of required(hello.find_first_not_of('x') == 0); required(hello.find_first_not_of(gm::make_string("elh")) == 4); required(hello.find_first_not_of(hello) == hello.npos); required(hello.find_first_not_of(empty) == 0); required(hello2.find_first_not_of(hello) == 5); // find_last_of required(hello.find_last_of('x') == hello.npos); required(hello.find_last_of('l') == 3); required(hello.find_last_of(empty) == hello.npos); required(hello.find_last_of(gm::make_string("abcdel")) == 3); required(hello.find_last_of(gm::make_string("axcl")) == 3); required(hello2.find_last_of('l') == 9); required(hello2.find_last_of(hello) == 10); // find_last_not_of
bool parseArgs(int argc, char *argv[], TaskConfig &client_cfg, TaskConfig &agent_cfg) { CliMode mode = CliMode::NONE; client_cfg.set("port", "80"); client_cfg.set("mtype", "ipv4"); client_cfg.set("listen_addr", "127.0.0.1"); agent_cfg.add("Measure.Webserver", "frontend.bredbandskollen.se"); agent_cfg.add("Measure.SettingsUrl", "/api/servers"); agent_cfg.add("Measure.ContentsUrl", "/api/content"); agent_cfg.add("Measure.MeasurementsUrl", "/api/measurements"); for (int i=1; i<argc; ++i) { std::string arg(argv[i]); if (arg == "--v6") client_cfg.set("mtype", "ipv6"); else if (arg == "--test") { mode = (mode == CliMode::NONE) ? CliMode::TEST : CliMode::IN_ERROR; } else if (arg == "--live") { mode = (mode == CliMode::NONE) ? CliMode::LIVE : CliMode::IN_ERROR; } else if (arg == "--version") { std::cout << measurement::appName << ' ' << measurement::appVersion << '\n'; return false; } else if (arg == "--quiet") { client_cfg.set("quiet", "1"); } else if (arg == "--local") { mode = (mode == CliMode::NONE) ? CliMode::LOCAL : CliMode::IN_ERROR; #if defined(RUN_SERVER) } else if (arg == "--run-server") { mode = (mode == CliMode::NONE) ? CliMode::SERVER : CliMode::IN_ERROR; #endif } else if (arg.substr(0, 11) == "--duration=") agent_cfg.set("Measure.LoadDuration", argv[i]+11); else if (arg.substr(0, 13) == "--speedlimit=") agent_cfg.set("Measure.SpeedLimit", argv[i]+13); else if (arg.substr(0, 6) == "--out=") client_cfg.set("out", argv[i]+6); else if (arg.substr(0, 6) == "--dir=") client_cfg.set("app_dir", (argv[i]+6) + pathSep); else if (arg.substr(0, 6) == "--log=") client_cfg.set("logfile", argv[i]+6); else if (arg.substr(0, 11) == "--local-ip=") agent_cfg.set("Measure.LocalAddress", argv[i]+11); else if (arg.substr(0, 9) == "--server=") client_cfg.set("server", argv[i]+9); else if (arg.substr(0, 7) == "--port=") client_cfg.set("port", argv[i]+7); else if (arg.substr(0, 9) == "--listen=") client_cfg.set("listen", argv[i]+9); else if (arg.substr(0, 14) == "--listen-addr=") client_cfg.set("listen_addr", argv[i]+14); else if (arg.substr(0, 12) == "--listen-pw=") { client_cfg.set("listen_pw", argv[i]+12); #ifdef USE_GNUTLS } else if (arg == "--ssl") { agent_cfg.set("Measure.TLS", "1"); client_cfg.set("ssl", "1"); if (client_cfg.value("port") == "80") client_cfg.set("port", "443"); #endif } else if (arg.substr(0, 9) == "--fakeip=") agent_cfg.set("Client.fakeip", argv[i]+9); else if (arg == "--check-servers") client_cfg.set("pingsweep", "1"); else if (arg.substr(0, 14) == "--measurements") client_cfg.set("list_measurements", (arg.size() > 15 && arg[14] == '=') ? argv[i]+15 : "10"); else if (arg.substr(0, 10) == "--from-id=") { client_cfg.set("list_from", argv[i]+10); if (client_cfg.value("list_measurements").empty()) client_cfg.set("list_measurements", "10"); } else if (arg == "--browser") { client_cfg.set("browser", "1"); if (client_cfg.value("listen").empty()) client_cfg.set("listen", "0"); // Use any avaliable port } else if (arg.substr(0, 13) == "--proxy-host=") agent_cfg.set("Measure.ProxyServerUrl", argv[i]+13); else if (arg.substr(0, 13) == "--proxy-port=") agent_cfg.set("Measure.ProxyServerPort", argv[i]+13); else { int status = 0; if (arg != "--help") { status = 1; std::cerr << argv[0] << ": invalid argument -- " << arg << std::endl; } std::ostream &fh = status ? std::cerr : std::cout; fh << "Usage: " << argv[0] << " [OPTION]...\n\nOptions:\n\n" " --help Show this help text\n" " --version Print version number and exit\n" << "\nNetwork related options:\n" #ifndef BBK_WEBVIEW << " --v6 Prefer IPv6 (default is IPv4)\n" #endif #ifdef __linux__ #else << " --local-ip=IP Measure using existing local ip address IP\n" << " Note: this will not work on all platforms\n" #endif << " --proxy-host=HOST Use HTTP proxy server HOST\n" << " --proxy-port=PORT Use port PORT on proxy server (default 80)\n" << "\nMeasurement configuration:\n" #ifndef BBK_WEBVIEW << " --server=HOST Use HOST as measurement server\n" << " --port=N Port number for measurement server, default 80\n" #endif #ifdef USE_GNUTLS << " --ssl Measure using transport layer security (default port 443)\n" #endif << " --duration=N Measure upload/download for N seconds (2-10, default 10)\n" << " --speedlimit=N Keep upload/download speed below N mbps on average\n" << "\nMeasurement type:\n" << " --live Measure using Bredbandskollen's live servers (default)\n" << " --test Measure using Bredbandskollen's development servers\n" #ifndef BBK_WEBVIEW << " --local Don't fetch configuration (server list) from bredbandskollen.se,\n" << " communicate only with server given by the --server option.\n" #endif #if defined(RUN_SERVER) << " --run-server Run as a measurement server (requires option --listen=PORT)\n" #endif << "\nLogging:\n" << " --log=FILENAME Write debug log to FILENAME\n" << " (log to stderr if FILENAME is -)\n" #ifndef BBK_WEBVIEW << "\nFinding measurement servers:\n" << " --check-servers Find closest measurement server\n" << "\nList previous measurements:\n" << " --measurements List 10 last measurements\n" << " --measurements=N List N last measurements\n" << " If --quiet, output will be JSON. Otherwise\n" << " output will be lines with tab separated fields.\n" << " --from-id=N List only measurements before ID N\n" << "\nBrowser interface:\n" << " --browser Use a web browser as interface\n" << " --listen=PORT Use web browser as interface;\n" << " the browser must connect to the given PORT\n" << " --listen-addr=IP When listening, bind socket to ip address IP\n" << " (default is 127.0.0.1) to use a web browser on\n" << " a remote host as interface\n" << " Note: this may not work due to e.g. firewalls.\n" << " Don't use it unless you know what you are doing.\n" << " --listen-pw=PW Use PW as a one-time password when connecting from browser\n" << " Note: DO NOT reuse a sensitive password here!\n" << " It is better to omit this option because by default\n" << " a secure one-time password will be generated.\n" << "\nCommand line interface:\n" << " --quiet Write a single line of output\n" << " --out=FILENAME Append output to FILENAME instead of stdout\n" #endif << std::endl; return false; } } client_cfg.set("app_dir", createAndGetAppDir(client_cfg.value("app_dir"))); if (client_cfg.value("local") == "1" && client_cfg.value("server").empty()) { std::cerr << "missing --server option" << std::endl; return false; } std::vector<std::string> pdir = { "listen", "port" }; for (auto &str : pdir) if (!client_cfg.value(str).empty()) { auto port = client_cfg.value(str); if (port.find_first_not_of("0123456789") != std::string::npos || port.size() > 5 || std::stod(port) > 65535) { std::cerr << "invalid port number" << std::endl; return false; } } switch (mode) { case CliMode::NONE: case CliMode::LIVE: agent_cfg.set("Measure.Webserver", "frontend.bredbandskollen.se"); break; case CliMode::TEST: agent_cfg.set("Measure.Webserver", "beta4.bredbandskollen.se"); break; case CliMode::LOCAL: client_cfg.set("local", "1"); agent_cfg.set("Measure.Webserver", "none"); break; #if defined(RUN_SERVER) case CliMode::SERVER: client_cfg.set("local", "1"); client_cfg.set("run_server", "1"); if (client_cfg.value("listen").empty()) { std::cerr << "option --listen is required with --run-server" << std::endl; return false; } break; #endif case CliMode::IN_ERROR: std::cerr << "can have only one of options --live, --test,"; #if defined(RUN_SERVER) std::cerr << " --run-server,"; #endif std::cerr << " and --local"; return false; }; if (!client_cfg.value("listen").empty() && client_cfg.value("listen_pw").empty()) { // Generate one-time password uint32_t src[2]; std::random_device rng; std::uniform_int_distribution<uint32_t> dist; src[0] = dist(rng); src[1] = dist(rng); char pwd[sizeof(src)*2]; base64_encode(reinterpret_cast<const unsigned char *>(src), sizeof(src), pwd); client_cfg.add("listen_pw", std::string(pwd, sizeof(src)*4/3)); } client_cfg.add("url", "http://" + agent_cfg.value("Measure.Webserver") + "/standalone/dev/index.php"); if (client_cfg.value("logfile").empty()) { #if defined(RUN_SERVER) if (mode == CliMode::SERVER) client_cfg.add("logfile", client_cfg.value("app_dir") + "server_log"); else #endif client_cfg.add("logfile", client_cfg.value("app_dir") + "last_log"); } client_cfg.set("config_file", client_cfg.value("app_dir") + "config"); // Default to ipv6 if user wants to use a local ipv6 address if (agent_cfg.value("Measure.LocalAddress").find(':') != std::string::npos) client_cfg.set("mtype", "ipv6"); agent_cfg.add("Measure.AutoSaveReport", client_cfg.value("listen").empty() ? "false" : "true"); agent_cfg.add("Measure.IpType", client_cfg.value("mtype")); agent_cfg.add("Client.appname", measurement::appName); agent_cfg.add("Client.appver", measurement::appVersion); agent_cfg.add("Client.machine", measurement::hw_info); agent_cfg.add("Client.system", measurement::os_version); agent_cfg.add("Client.language", "en"); return true; }
size_t DwString::find_first_not_of(const DwString &aStr, size_t aPos) const { return find_first_not_of(&aStr.mRep->mBuffer[aStr.mStart], aPos, aStr.mLength); }
size_t string::find_first_not_of(const string& str, size_t pos) const { return find_first_not_of(str.begin(), pos, str.size()); }