==============================================================================
| 254 | |
| 255 | //============================================================================== |
| 256 | bool Uri::fromStringOrPath(const std::string& _input) |
| 257 | { |
| 258 | // TODO(JS): Need to check if _input is an "absolute" path? |
| 259 | |
| 260 | #ifdef _WIN32 |
| 261 | |
| 262 | // Assume that any URI begin with pattern [SINGLE_LETTER]:[/ or \\] is an |
| 263 | // absolute path. |
| 264 | static std::regex windowsPathRegex(R"END([a-zA-Z]:[/|\\])END"); |
| 265 | const bool isPath = std::regex_search( |
| 266 | _input, windowsPathRegex, std::regex_constants::match_continuous); |
| 267 | |
| 268 | if (isPath) |
| 269 | return fromPath(_input); |
| 270 | |
| 271 | #else |
| 272 | |
| 273 | // Assume that any URI without a scheme is a path. |
| 274 | static std::regex uriSchemeRegex(R"END(^(([^:/?#]+):))END"); |
| 275 | const bool noScheme = !std::regex_search( |
| 276 | _input, uriSchemeRegex, std::regex_constants::match_continuous); |
| 277 | |
| 278 | if (noScheme) |
| 279 | return fromPath(_input); |
| 280 | |
| 281 | #endif |
| 282 | |
| 283 | return fromString(_input); |
| 284 | } |
| 285 | |
| 286 | //============================================================================== |
| 287 | bool Uri::fromRelativeUri( |
no outgoing calls