MySQL 9.1.0
Source Code Documentation
|
Uuid is a trivial and of standard layout The structure contains the following components. More...
#include <uuid.h>
Public Member Functions | |
void | clear () |
Set to all zeros. More... | |
void | copy_from (const unsigned char *data) |
Copies the given 16-byte data to this UUID. More... | |
void | copy_to (unsigned char *data) const |
Copies the given UUID object to this UUID. More... | |
bool | equals (const Uuid &other) const |
Returns true if this UUID is equal the given UUID. More... | |
bool | operator< (const Uuid &other) const |
int | parse (const char *string, size_t len) |
Stores the UUID represented by a string of the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX or {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} in this object. More... | |
size_t | to_string (char *buf) const |
Generates a 36+1 character long representation of this UUID object in the given string buffer. More... | |
std::string | to_string () const |
void | print () const |
Static Public Member Functions | |
static bool | is_valid (const char *string, size_t len) |
Returns true if parse() would succeed, but doesn't store the result. More... | |
static int | parse (const char *in_string, size_t len, const unsigned char *out_binary_string) |
Parses the UUID passed as argument in in_string and functions and writes the binary representation in out_binary_string. More... | |
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. More... | |
static size_t | to_string (const unsigned char *bytes_arg, char *buf) |
Convert the given binary buffer to a UUID. More... | |
Public Attributes | |
std::array< unsigned char, BYTE_LENGTH > | bytes |
The data for this Uuid. More... | |
Static Public Attributes | |
static constexpr std::size_t | BYTE_LENGTH = 16 |
The number of bytes in the data of a Uuid. More... | |
static const size_t | TEXT_LENGTH = 36 |
The number of bytes in the textual representation of a Uuid. More... | |
static const size_t | BIT_LENGTH = 128 |
The number of bits in the data of a Uuid. More... | |
static const int | NUMBER_OF_SECTIONS = 5 |
static constexpr int | bytes_per_section [NUMBER_OF_SECTIONS] = {4, 2, 2, 2, 6} |
static constexpr int | hex_to_byte [256] |
Uuid is a trivial and of standard layout The structure contains the following components.
Name | Format | Description |
---|---|---|
byte | unsigned char array | This stores the Uuid of the server on which transaction is originated |
|
inline |
Set to all zeros.
|
inline |
Copies the given 16-byte data to this UUID.
|
inline |
Copies the given UUID object to this UUID.
|
inline |
Returns true if this UUID is equal the given UUID.
|
static |
Returns true if parse() would succeed, but doesn't store the result.
string | String that needs to be checked. |
len | Length of that string. |
true | valid string. |
false | invalid string. |
|
inline |
|
static |
Parses the UUID passed as argument in in_string and functions and writes the binary representation in out_binary_string.
Depends on UUID's read_section method and the constants for text length.
[in] | in_string | String to be parsed. |
[in] | len | Length of that string. |
[out] | out_binary_string | String where the binary UUID will be stored |
0 | success. |
>0 | failure. |
int mysql::gtid::Uuid::parse | ( | const char * | string, |
size_t | len | ||
) |
Stores the UUID represented by a string of the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX or {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} in this object.
string | String to be parsed and stored. |
len | Length of that string. |
0 | success. |
>0 | failure. |
|
inline |
|
static |
Helper method used to validate and parse one section of a uuid.
If the last parameter, out_binary_str, is NULL then the function will just validate the section.
[in] | section_len | Length of the section to be parsed. |
[in,out] | section_str | Pointer to a string containing the section. It will be updated during the execution as the string is parsed. |
[out] | out_binary_str | String where the section will be stored in binary format. If null, the function will just validate the input string. |
false | success. |
true | failure. |
|
inline |
size_t mysql::gtid::Uuid::to_string | ( | char * | buf | ) | const |
Generates a 36+1 character long representation of this UUID object in the given string buffer.
36 | - the length of the resulting string. |
|
static |
Convert the given binary buffer to a UUID.
|
static |
The number of bits in the data of a Uuid.
|
staticconstexpr |
The number of bytes in the data of a Uuid.
std::array<unsigned char, BYTE_LENGTH> mysql::gtid::Uuid::bytes |
The data for this Uuid.
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
static |
The number of bytes in the textual representation of a Uuid.