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

Method path

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

Source from the content-addressed store, hash-verified

184}
185
186std::string Uri::path() const {
187 const auto& segments = impl_->path_segments_;
188
189 bool must_prepend_slash = impl_->is_absolute_path_;
190#ifdef _WIN32
191 // On Windows, "file:///C:/foo" should have path "C:/foo", not "/C:/foo",
192 // despite it being absolute.
193 // (see https://tools.ietf.org/html/rfc8089#page-13)
194 if (impl_->is_absolute_path_ && impl_->is_file_uri_ && segments.size() > 0 &&
195 IsDriveSpec(segments[0])) {
196 must_prepend_slash = false;
197 }
198#endif
199
200 std::stringstream ss;
201 if (must_prepend_slash) {
202 ss << "/";
203 }
204 bool first = true;
205 for (const auto& seg : segments) {
206 if (!first) {
207 ss << "/";
208 }
209 first = false;
210 ss << UriUnescape(seg);
211 }
212 return std::move(ss).str();
213}
214
215std::string Uri::query_string() const { return TextRangeToString(impl_->uri_.query); }
216

Callers 15

test_newMethod · 0.45
test_closeMethod · 0.45
test_sizeMethod · 0.45
test_readMethod · 0.45
test_read_atMethod · 0.45
test_modeMethod · 0.45
test_reader_backendMethod · 0.45
test_write_tableMethod · 0.45
test_createMethod · 0.45

Calls 4

IsDriveSpecFunction · 0.85
UriUnescapeFunction · 0.85
strMethod · 0.80
sizeMethod · 0.45

Tested by 15

test_newMethod · 0.36
test_closeMethod · 0.36
test_sizeMethod · 0.36
test_readMethod · 0.36
test_read_atMethod · 0.36
test_modeMethod · 0.36
test_reader_backendMethod · 0.36
test_write_tableMethod · 0.36
test_createMethod · 0.36
test_appendMethod · 0.36