15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_BYTES_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_BYTES_H
18#include "google/cloud/spanner/version.h"
19#include "google/cloud/internal/base64_transforms.h"
20#include "google/cloud/status_or.h"
28namespace spanner_internal {
29GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
31GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
35GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
38
39
40
41
42
50 template <
typename InputIt>
51 Bytes(InputIt first, InputIt last) {
53 while (first != last) encoder.PushBack(*first++);
54 base64_rep_ = std::move(encoder).FlushAndPad();
56 template <
typename Container>
57 explicit Bytes(Container
const& c) :
Bytes(std::begin(c), std::end(c)) {}
62 template <
typename Container>
63 Container
get()
const {
64 google::
cloud::internal::Base64Decoder decoder(base64_rep_);
65 return Container(decoder.begin(), decoder.end());
71 return a.base64_rep_ == b.base64_rep_;
77
78
79
80
81
82 friend std::ostream& operator<<(std::ostream& os,
Bytes const& bytes);
85 friend struct spanner_internal::BytesInternals;
87 std::string base64_rep_;
90GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
93namespace spanner_internal {
94GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
95StatusOr<
spanner::
Bytes> BytesFromBase64(std::string input);
97GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
A representation of the Spanner BYTES type: variable-length binary data.
Definition: bytes.h:43
Bytes()=default
An empty sequence.
friend bool operator==(Bytes const &a, Bytes const &b)
Definition: bytes.h:70
Bytes(Container const &c)
Definition: bytes.h:57
Bytes(InputIt first, InputIt last)
Definition: bytes.h:51
friend bool operator!=(Bytes const &a, Bytes const &b)
Definition: bytes.h:73
Container get() const
Conversion to a sequence of octets.
Definition: bytes.h:63
Contains all the Cloud Spanner C++ client types and functions.
Definition: backoff_policy.h:23