24#ifndef MYSQL_STRCONV_ENCODE_ENCODE_H
25#define MYSQL_STRCONV_ENCODE_ENCODE_H
86 target.write(
format,
object);
110 const auto &
object) {
112 target.write(
format,
object);
130template <
class String_t = std::
string>
132 const auto &
object) {
136 throw std::bad_alloc();
153template <
class String_t = std::
string>
155 const auto &
object) {
168template <
class String_t = std::
string>
205template <
class String_t = std::
string>
207 const auto &
object) {
228 auto &opt_string_ref = streamable.opt_string_ref();
229 if (opt_string_ref.has_value()) {
230 out << opt_string_ref.value();
232 out.setstate(std::ios_base::badbit);
233 if ((out.exceptions() & std::ios_base::badbit) != 0)
234 throw std::ios_base::failure(
"Out of memory");
Wrapper around an std::optional<std::string> object returned from encode, intended to be passed to op...
Definition: encode.h:169
std::optional< String_t > Opt_string
Definition: encode.h:171
Opt_string m_opt_string
Stored optional string object.
Definition: encode.h:181
Streamable(Opt_string &&other)
Construct a new Streamable from an expiring optional string.
Definition: encode.h:174
const Opt_string & opt_string_ref() const
Return reference to the optional string stored in this object.
Definition: encode.h:177
String_counter subclass that can be instantiated.
Definition: string_counter.h:97
True if Test is an Output String Wrapper with Resize_policy fixed.
Definition: out_str.h:235
True if Test is an Output String Wrapper with Resize_policy growable.
Definition: out_str.h:240
Concept that holds for String_counter and String_writer.
Definition: string_target.h:111
uint counter
Definition: mysqlimport.cc:58
String_t encode(const Is_format auto &format, const auto &object)
Return an std::string object holding the string representation of the given object.
Definition: encode.h:131
Definition: gtid_binary_format.h:41
void encode(const Debug_format &format, Is_string_target auto &target, const Repeat &repeat)
Definition: debug_repeat.h:39
std::ostream & operator<<(std::ostream &out, const mysql::meta::Is_specialization< Streamable > auto &streamable)
Use output operator to write the string representation of a format-tagged object to the given ostream...
Definition: encode.h:225
Streamable< String_t > encode_to_streamable(const Is_format auto &format, const auto &object)
Return a Streamable object holding the result from encode(format, object).
Definition: encode.h:206
std::size_t compute_encoded_length(const Is_format auto &format, const auto &object)
Return the string length of the object.
Definition: encode.h:57
mysql::utils::Return_status out_str_write(const Out_str_t &out_str, const Producer_counter_t &producer_counter, const Producer_writer_t &producer_writer, const Oom_action_t &oom_action=detail::nop)
Given an Is_out_str object, a String_producer_counter, and a String_producer_writer,...
Definition: out_str_write.h:178
auto out_str_growable(String_t &str)
Return a wrapper around a growable output buffer, represented as a std::string or similar type.
Definition: out_str.h:985
Define std::hash<Gtid>.
Definition: gtid.h:355