MCPcopy Create free account
hub / github.com/VROOM-Project/vroom / parse_coordinates

Function parse_coordinates

src/utils/input_parser.cpp:20–27  ·  view source on GitHub ↗

Helper to get optional array of coordinates.

Source from the content-addressed store, hash-verified

18
19// Helper to get optional array of coordinates.
20inline Coordinates parse_coordinates(const rapidjson::Value& object,
21 const char* key) {
22 if (!object[key].IsArray() || (object[key].Size() < 2) ||
23 !object[key][0].IsNumber() || !object[key][1].IsNumber()) {
24 throw InputException("Invalid " + std::string(key) + " array.");
25 }
26 return {object[key][0].GetDouble(), object[key][1].GetDouble()};
27}
28
29inline std::string get_string(const rapidjson::Value& object, const char* key) {
30 std::string value;

Callers 2

get_vehicleFunction · 0.85
get_task_locationFunction · 0.85

Calls 1

InputExceptionClass · 0.85

Tested by

no test coverage detected