MCPcopy Create free account
hub / github.com/RunanywhereAI/RCLI / config_get_string

Function config_get_string

src/api/rcli_api.cpp:161–171  ·  view source on GitHub ↗

Simple JSON string value extractor (for config parsing)

Source from the content-addressed store, hash-verified

159
160// Simple JSON string value extractor (for config parsing)
161static std::string config_get_string(const std::string& json, const std::string& key) {
162 auto pos = json.find("\"" + key + "\"");
163 if (pos == std::string::npos) return "";
164 auto colon = json.find(':', pos);
165 if (colon == std::string::npos) return "";
166 auto q1 = json.find('"', colon + 1);
167 if (q1 == std::string::npos) return "";
168 auto q2 = json.find('"', q1 + 1);
169 if (q2 == std::string::npos) return "";
170 return json.substr(q1 + 1, q2 - q1 - 1);
171}
172
173static int config_get_int(const std::string& json, const std::string& key, int default_val) {
174 auto pos = json.find("\"" + key + "\"");

Callers 1

rcli_createFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected