| 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 | } |