| 175 | } |
| 176 | |
| 177 | Utils::StatusWithReason FileSpec::Private::parse(NL::json& node) |
| 178 | { |
| 179 | if (node.is_null()) |
| 180 | return { -1, "'filename' argument contains no data" }; |
| 181 | if (node.is_string()) |
| 182 | setFilePath(node.get<std::string>()); |
| 183 | else if (node.is_object()) |
| 184 | { |
| 185 | auto status = extractPath(node); |
| 186 | if (!status) |
| 187 | return { -1, status.what() }; |
| 188 | status = extractHeaders(node); |
| 189 | if (!status) |
| 190 | return { -1, status.what() }; |
| 191 | status = extractQuery(node); |
| 192 | if (!status) |
| 193 | return { -1, status.what() }; |
| 194 | if (!node.empty()) |
| 195 | return { -1, "Invalid item in filename object: " + node.dump() }; |
| 196 | } |
| 197 | else |
| 198 | return { -1, "'filename' must be specified as a string." }; |
| 199 | return true; |
| 200 | } |
| 201 | |
| 202 | |
| 203 | Utils::StatusWithReason FileSpec::Private::extractPath(NL::json& node) |
no test coverage detected