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

Method path

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

Source from the content-addressed store, hash-verified

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

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