The following functions extract one component and return an iterator one-past last component character They must be called in the right order to ensure coherency Scheme -> Authority -> Path -> Query -> Fragment
| 56 | // They must be called in the right order to ensure coherency |
| 57 | // Scheme -> Authority -> Path -> Query -> Fragment |
| 58 | const char* ExtractScheme(const char* uri, const char* end, vtkURIComponent& output) |
| 59 | { |
| 60 | const auto schemeEnd = std::find_if_not(uri, end, |
| 61 | [](char c) |
| 62 | { return std::isalnum(static_cast<unsigned char>(c)) || c == '+' || c == '-' || c == '.'; }); |
| 63 | |
| 64 | if (schemeEnd == end || *schemeEnd != ':') |
| 65 | { |
| 66 | return uri; // not a scheme |
| 67 | } |
| 68 | |
| 69 | output = std::string{ uri, schemeEnd }; |
| 70 | |
| 71 | return schemeEnd + 1; |
| 72 | } |
| 73 | |
| 74 | const char* ExtractAuthority(const char* uri, const char* end, vtkURIComponent& output) |
| 75 | { |