Google Cloud Storage C++ Client  1.24.0
A C++ Client Library for Google Cloud Storage
download_options.h
Go to the documentation of this file.
1 // Copyright 2018 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_DOWNLOAD_OPTIONS_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_DOWNLOAD_OPTIONS_H
17 
18 #include "google/cloud/storage/internal/complex_option.h"
20 #include <cstdint>
21 #include <iostream>
22 #include <string>
23 
24 namespace google {
25 namespace cloud {
26 namespace storage {
27 inline namespace STORAGE_CLIENT_NS {
28 struct ReadRangeData {
29  std::int64_t begin;
30  std::int64_t end;
31 };
32 
39 struct ReadRange : public internal::ComplexOption<ReadRange, ReadRangeData> {
40  ReadRange() = default;
41  explicit ReadRange(std::int64_t begin, std::int64_t end)
42  : ComplexOption(ReadRangeData{begin, end}) {}
43  static char const* name() { return "read-range"; }
44 };
45 
46 inline std::ostream& operator<<(std::ostream& os, ReadRangeData const& rhs) {
47  return os << "ReadRangeData={begin=" << rhs.begin << ", end=" << rhs.end
48  << "}";
49 }
50 
55  : public internal::ComplexOption<ReadFromOffset, std::int64_t> {
56  using ComplexOption::ComplexOption;
57  // GCC <= 7.0 does not use the inherited default constructor, redeclare it
58  // explicitly
59  ReadFromOffset() = default;
60  static char const* name() { return "read-offset"; }
61 };
62 
66 struct ReadLast : public internal::ComplexOption<ReadLast, std::int64_t> {
67  using ComplexOption::ComplexOption;
68  // GCC <= 7.0 does not use the inherited default constructor, redeclare it
69  // explicitly
70  ReadLast() = default;
71  static char const* name() { return "read-last"; }
72 };
73 
74 } // namespace STORAGE_CLIENT_NS
75 } // namespace storage
76 } // namespace cloud
77 } // namespace google
78 
79 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_DOWNLOAD_OPTIONS_H
google::cloud::storage::v1::operator<<
std::ostream & operator<<(std::ostream &os, BucketAccessControl const &rhs)
Definition: bucket_access_control.cc:27
google::cloud::storage::v1::ReadRangeData
Definition: download_options.h:28
google::cloud::storage::v1::ReadFromOffset::ReadFromOffset
ReadFromOffset()=default
google::cloud::storage::v1::ReadRange
Request only a portion of the GCS object in a ReadObject operation.
Definition: download_options.h:39
google::cloud::storage::v1::ReadRange::name
static char const * name()
Definition: download_options.h:43
google::cloud::storage::v1::ReadRangeData::begin
std::int64_t begin
Definition: download_options.h:29
version.h
google::cloud::storage::v1::ReadLast
Read last N bytes from the GCS object.
Definition: download_options.h:66
google::cloud::storage::v1::ReadFromOffset
Download all the data from the GCS object starting at the given offset.
Definition: download_options.h:55
google::cloud::storage::v1::ReadLast::ReadLast
ReadLast()=default
STORAGE_CLIENT_NS
#define STORAGE_CLIENT_NS
Definition: version.h:22
google::cloud::storage::v1::ReadLast::name
static char const * name()
Definition: download_options.h:71
google::cloud::storage::v1::ReadRange::ReadRange
ReadRange()=default
google::cloud::storage::v1::ReadRange::ReadRange
ReadRange(std::int64_t begin, std::int64_t end)
Definition: download_options.h:41
google::cloud::storage::v1::ReadRangeData::end
std::int64_t end
Definition: download_options.h:30
google
google::cloud::storage::v1::ReadFromOffset::name
static char const * name()
Definition: download_options.h:60