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

Function workflow_optional_bool

app/workflow/workflow.cpp:91–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89 const auto * value = object.find(key);
90 if (value == nullptr || value->is_null()) {
91 return std::nullopt;
92 }
93 return value->as_number();
94}
95
96bool workflow_optional_bool(
97 const engine::io::json::Value & object,
98 const std::string & key,
99 bool fallback) {
100 const auto * value = object.find(key);
101 if (value == nullptr || value->is_null()) {
102 return fallback;
103 }
104 if (value->is_bool()) {
105 return value->as_bool();
106 }
107 if (value->is_string()) {
108 const std::string & text = value->as_string();
109 if (text == "true") {
110 return true;
111 }
112 if (text == "false") {
113 return false;
114 }
115 }

Callers 2

run_chunked_model_stepFunction · 0.85
run_mix_audio_stepFunction · 0.85

Calls 5

is_nullMethod · 0.80
is_boolMethod · 0.80
as_boolMethod · 0.80
is_stringMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected