MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / parse_int_value

Function parse_int_value

src/framework/runtime/options.cpp:13–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11namespace engine::runtime {
12
13namespace {
14
15int parse_int_value(const std::string & value, std::string_view key) {
16 size_t parsed = 0;
17 const long long out = std::stoll(value, &parsed);
18 if (parsed != value.size()) {
19 throw std::runtime_error(std::string(key) + " must be an integer");
20 }
21 if (out < std::numeric_limits<int>::min() || out > std::numeric_limits<int>::max()) {
22 throw std::runtime_error(std::string(key) + " is outside int range");
23 }
24 return static_cast<int>(out);
25}
26

Callers 1

parse_int_optionFunction · 0.85

Calls 4

minFunction · 0.85
maxFunction · 0.85
stringFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected