| 55 | |
| 56 | template <typename T> |
| 57 | inline std::vector<T> get_array_points(std::string const& json) { |
| 58 | std::vector<T> points; |
| 59 | rapidjson::Document document; |
| 60 | if(document.Parse(json.c_str()).HasParseError()) { |
| 61 | throw std::runtime_error("Cannot parse JSON"); |
| 62 | } |
| 63 | if(!document.IsArray()) { |
| 64 | throw std::runtime_error("It's not JSON Array"); |
| 65 | } |
| 66 | points.reserve(static_cast<std::size_t>(document.Size())); |
| 67 | for(rapidjson::SizeType i = 0; i < document.Size(); i++) { |
| 68 | // points.push_back(document[i].GetDouble()); |
| 69 | points.push_back(get_json_value<T>(document[i])); |
| 70 | } |
| 71 | return points; |
| 72 | } |
| 73 | |
| 74 | } // end ns utils |
nothing calls this directly
no outgoing calls
no test coverage detected