MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / ParseThreadArg

Function ParseThreadArg

tests/BenchmarkOptions.cpp:24–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24static int ParseThreadArg(const std::string& flag, const std::string& value) {
25 int parsed = 0;
26 try {
27 size_t consumed = 0;
28 parsed = std::stoi(value, &consumed);
29 if (consumed != value.size()) {
30 throw std::invalid_argument("extra characters");
31 }
32 } catch (const std::exception&) {
33 throw std::runtime_error("Invalid " + flag + " value: " + value + " (expected >= 2)");
34 }
35
36 if (parsed < 2) {
37 throw std::runtime_error("Invalid " + flag + " value: " + value + " (expected >= 2)");
38 }
39
40 return parsed;
41}
42
43BenchmarkOptions ParseBenchmarkOptions(const std::vector<std::string>& args) {
44 BenchmarkOptions options;

Callers 1

ParseBenchmarkOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected