MCPcopy Create free account
hub / github.com/apache/arrow / IsValidUriScheme

Function IsValidUriScheme

cpp/src/arrow/util/uri.cc:97–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97bool IsValidUriScheme(std::string_view s) {
98 auto is_alpha = [](char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); };
99 auto is_scheme_char = [&](char c) {
100 return is_alpha(c) || (c >= '0' && c <= '9') || c == '+' || c == '-' || c == '.';
101 };
102
103 if (s.empty()) {
104 return false;
105 }
106 if (!is_alpha(s[0])) {
107 return false;
108 }
109 return std::all_of(s.begin() + 1, s.end(), is_scheme_char);
110}
111
112struct Uri::Impl {
113 Impl() { memset(&uri_, 0, sizeof(uri_)); }

Callers 2

IsLikelyUriFunction · 0.85
TESTFunction · 0.85

Calls 3

emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.68