24#ifndef MYSQL_GTID_UUID_H
25#define MYSQL_GTID_UUID_H
93 static bool is_valid(
const char *
string,
size_t len);
108 int parse(
const char *
string,
size_t len);
123 const unsigned char *out_binary_string);
140 static bool read_section(
int section_len,
const char **section_str,
141 const unsigned char **out_binary_str);
146 std::array<unsigned char, BYTE_LENGTH>
bytes;
156 static size_t to_string(
const unsigned char *bytes_arg,
char *
buf);
174 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
175 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
176 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5,
177 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1,
178 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
179 -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1,
180 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
181 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
182 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
183 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
184 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
185 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
186 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
187 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
192static_assert(std::is_trivial_v<Uuid>);
193static_assert(std::is_standard_layout_v<Uuid>);
197 return std::hash<std::string>()(std::string(
208namespace [[deprecated]] gtids {
Definition: item_cmpfunc.h:1664
static char buf[MAX_BUF]
Definition: conf_to_src.cc:73
Definition: buf0block_hint.cc:30
bool operator!=(const Uuid &a, const Uuid &b)
Definition: uuid.h:203
bool operator==(const Uuid &a, const Uuid &b)
Definition: uuid.h:202
size_t operator()(const Uuid &uuid) const
Definition: uuid.h:196
Uuid is a trivial and of standard layout The structure contains the following components.
Definition: uuid.h:64
bool operator<(const Uuid &other) const
Definition: uuid.h:81
static const size_t TEXT_LENGTH
The number of bytes in the textual representation of a Uuid.
Definition: uuid.h:168
static constexpr int bytes_per_section[NUMBER_OF_SECTIONS]
Definition: uuid.h:172
static constexpr std::size_t BYTE_LENGTH
The number of bytes in the data of a Uuid.
Definition: uuid.h:143
bool equals(const Uuid &other) const
Returns true if this UUID is equal the given UUID.
Definition: uuid.h:77
void copy_from(const unsigned char *data)
Copies the given 16-byte data to this UUID.
Definition: uuid.h:68
static const int NUMBER_OF_SECTIONS
Definition: uuid.h:171
void print() const
Definition: uuid.h:162
void copy_to(unsigned char *data) const
Copies the given UUID object to this UUID.
Definition: uuid.h:73
std::array< unsigned char, BYTE_LENGTH > bytes
The data for this Uuid.
Definition: uuid.h:146
static bool read_section(int section_len, const char **section_str, const unsigned char **out_binary_str)
Helper method used to validate and parse one section of a uuid.
Definition: uuid.cpp:72
static constexpr int hex_to_byte[256]
Definition: uuid.h:173
std::string to_string() const
Definition: uuid.h:157
int parse(const char *string, size_t len)
Stores the UUID represented by a string of the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or XXXXXXXXX...
Definition: uuid.cpp:35
static bool is_valid(const char *string, size_t len)
Returns true if parse() would succeed, but doesn't store the result.
Definition: uuid.cpp:92
void clear()
Set to all zeros.
Definition: uuid.h:66
static const size_t BIT_LENGTH
The number of bits in the data of a Uuid.
Definition: uuid.h:170