MCPcopy Create free account
hub / github.com/ElementsProject/elements / matchCmdArgs

Function matchCmdArgs

src/bench/nanobench.h:1510–1536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1508}
1509
1510static bool matchCmdArgs(std::string const& str, std::vector<std::string>& matchResult) {
1511 matchResult.clear();
1512 auto idxOpen = str.find('(');
1513 auto idxClose = str.find(')', idxOpen);
1514 if (idxClose == std::string::npos) {
1515 return false;
1516 }
1517
1518 matchResult.emplace_back(str.substr(0, idxOpen));
1519
1520 // split by comma
1521 matchResult.emplace_back(std::string{});
1522 for (size_t i = idxOpen + 1; i != idxClose; ++i) {
1523 if (str[i] == ' ' || str[i] == '\t') {
1524 // skip whitespace
1525 continue;
1526 }
1527 if (str[i] == ',') {
1528 // got a comma => new string
1529 matchResult.emplace_back(std::string{});
1530 continue;
1531 }
1532 // no whitespace no comma, append
1533 matchResult.back() += str[i];
1534 }
1535 return true;
1536}
1537
1538static bool generateConfigTag(Node const& n, Config const& config, std::ostream& out) {
1539 using detail::d;

Callers 1

nanobench.hFile · 0.85

Calls 3

findMethod · 0.80
emplace_backMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected