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

Function IsValidUriScheme

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

Source from the content-addressed store, hash-verified

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