15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_LIST_OBJECTS_AND_PREFIXES_READER_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_LIST_OBJECTS_AND_PREFIXES_READER_H
18 #include "google/cloud/storage/internal/object_requests.h"
19 #include "google/cloud/internal/pagination_range.h"
20 #include "absl/types/variant.h"
31 using ListObjectsAndPrefixesReader =
32 google::
cloud::internal::PaginationRange<ObjectOrPrefix>;
34 using ListObjectsAndPrefixesIterator = ListObjectsAndPrefixesReader::iterator;
37 inline void SortObjectsAndPrefixes(std::vector<ObjectOrPrefix>& in) {
38 struct GetNameOrPrefix {
39 std::string
const& operator()(std::string
const& v) {
return v; }
40 std::string
const& operator()(
ObjectMetadata const& v) {
return v.name(); }
42 std::sort(in.begin(), in.end(),
43 [](ObjectOrPrefix
const& a, ObjectOrPrefix
const& b) {
44 return (absl::visit(GetNameOrPrefix{}, a) <
45 absl::visit(GetNameOrPrefix{}, b));