MCPcopy Create free account
hub / github.com/apple/foundationdb / fromStrings

Function fromStrings

flow/CodeProbe.cpp:36–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34namespace {
35
36std::vector<ExecutionContext> fromStrings(std::vector<std::string> const& ctxs) {
37 std::vector<ExecutionContext> res;
38 for (auto const& ctx : ctxs) {
39 std::string c;
40 c.reserve(ctx.size());
41 std::transform(ctx.begin(), ctx.end(), std::back_inserter(c), [](char c) { return std::tolower(c); });
42 if (c == "all") {
43 res.push_back(ExecutionContext::Net2);
44 res.push_back(ExecutionContext::Simulation);
45 } else if (c == "simulation") {
46 res.push_back(ExecutionContext::Simulation);
47 } else if (c == "net2") {
48 res.push_back(ExecutionContext::Net2);
49 } else {
50 throw invalid_option_value();
51 }
52 }
53 std::sort(res.begin(), res.end());
54 res.erase(std::unique(res.begin(), res.end()), res.end());
55 return res;
56}
57
58std::string_view normalizePath(const char* path) {
59 std::string_view srcBase(FDB_SOURCE_DIR);

Callers 1

printJSONMethod · 0.85

Calls 6

reserveMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected