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