MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / interpretValue

Method interpretValue

opt_utils/src/json.cpp:1269–1310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1267 data.push(MakePair(Value::VT_STRING, str));
1268 }
1269 bool Parser::interpretValue(const std::string &value)
1270 {
1271 std::string upperValue(value.size(), '\0');
1272
1273 std::transform(value.begin(), value.end(), upperValue.begin(), toupper);
1274
1275 if (upperValue == "NULL")
1276 {
1277 data.push(MakePair(Value::VT_NULL, std::string("")));
1278 }
1279 else if (upperValue == "TRUE")
1280 {
1281 data.push(MakePair(Value::VT_BOOL, std::string("true")));
1282 }
1283 else if (upperValue == "FALSE")
1284 {
1285 data.push(MakePair(Value::VT_BOOL, std::string("false")));
1286 }
1287 else
1288 {
1289 bool number = true;
1290 for (std::string::const_iterator it = value.begin(); it != value.end(); ++it)
1291 {
1292 if (!IsNumber(*it))
1293 {
1294 number = false;
1295 break;
1296 }
1297 }
1298
1299 if (number)
1300 {
1301 data.push(MakePair(Value::VT_NUMBER, value));
1302 }
1303 else
1304 {
1305 return false;
1306 }
1307 }
1308
1309 return true;
1310 }
1311}

Callers

nothing calls this directly

Calls 6

MakePairFunction · 0.85
IsNumberFunction · 0.85
pushMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected