| 496 | std::vector<std::string> path_parts; |
| 497 | |
| 498 | static Result<AzureLocation> FromString(const std::string& string) { |
| 499 | // Example expected string format: testcontainer/testdir/testfile.txt |
| 500 | // container = testcontainer |
| 501 | // path = testdir/testfile.txt |
| 502 | // path_parts = [testdir, testfile.txt] |
| 503 | if (internal::IsLikelyUri(string)) { |
| 504 | return Status::Invalid( |
| 505 | "Expected an Azure object location of the form 'container/path...'," |
| 506 | " got a URI: '", |
| 507 | string, "'"); |
| 508 | } |
| 509 | auto first_sep = string.find_first_of(internal::kSep); |
| 510 | if (first_sep == 0) { |
| 511 | return Status::Invalid("Location cannot start with a separator ('", string, "')"); |
| 512 | } |
| 513 | if (first_sep == std::string::npos) { |
| 514 | return AzureLocation{string, string, "", {}}; |
| 515 | } |
| 516 | AzureLocation location; |
| 517 | location.all = string; |
| 518 | location.container = string.substr(0, first_sep); |
| 519 | location.path = string.substr(first_sep + 1); |
| 520 | location.path_parts = internal::SplitAbstractPath(location.path); |
| 521 | RETURN_NOT_OK(location.Validate()); |
| 522 | return location; |
| 523 | } |
| 524 | |
| 525 | AzureLocation parent() const { |
| 526 | DCHECK(has_parent()); |
nothing calls this directly
no test coverage detected