| 317 | static const regex uri_regex("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"); |
| 318 | |
| 319 | bool Uri::Parse( |
| 320 | const string & uri, |
| 321 | string & scheme, |
| 322 | string & authority, |
| 323 | string & path, |
| 324 | string & query, |
| 325 | string & fragment) |
| 326 | { |
| 327 | smatch matches; |
| 328 | if (!regex_match(uri, matches, uri_regex)) |
| 329 | return false; |
| 330 | |
| 331 | scheme = matches.str(2); |
| 332 | authority = matches.str(4); |
| 333 | path = matches.str(5); |
| 334 | query = matches.str(7); |
| 335 | fragment = matches.str(9); |
| 336 | |
| 337 | return true; |
| 338 | } |
| 339 | |
| 340 | string Uri::MergePaths(const Uri & base, const string & ref_path) |
| 341 | { |