MySQL 9.7.0
Source Code Documentation
mysql::gtids::Tag_trivial Class Reference

Class representing a tag by storing the characters in a member array. More...

#include <tag.h>

Inheritance diagram for mysql::gtids::Tag_trivial:
[legend]

Public Member Functions

 Tag_trivial () noexcept=default
 Default constructor: This does not initialize the tag! Use Tag unless you need std::is_trivially_default_constructible. More...
 
 Tag_trivial (const Is_tag auto &other) noexcept
 Copy from any other tag. More...
 
std::size_t size () const
 Return the number of characters of the tag: an integer between 0 and max_size. More...
 
const char * data () const
 Return a const pointer to the data. More...
 
- Public Member Functions inherited from mysql::gtids::detail::Tag_interface< Tag_trivial >
auto assign (const Is_tag auto &other)
 Copy from the given tag into this tag. More...
 
mysql::utils::Return_status assign (const std::string_view &sv)
 Copy from the given std::string_view into this tag. More...
 
void throwing_assign (const std::string_view &sv)
 Copy from the given std::string_view into this tag. More...
 
void clear ()
 Set the tag to empty. More...
 
- Public Member Functions inherited from mysql::ranges::Buffer_interface< Self_tp, equality_algorithm_tp, enable_hash_tp >
 operator bool () const
 Return true if size() != 0. More...
 
bool operator! () const
 Return true if size() == 0. More...
 
bool empty () const
 Return true if size() == 0. More...
 
std::ptrdiff_t ssize () const
 Return the size as std::ptrdiff_t. More...
 
auto * udata ()
 Return the data buffer as unsigned char *. More...
 
auto * udata () const
 Return the data buffer as const unsigned char * or unsigned char *, const-ness inherited from Self_t::data() const. More...
 
auto * bdata ()
 Return the data buffer as std::byte *. More...
 
auto * bdata () const
 Return the data buffer as const std::byte * or std::byte *, const-ness inherited from Self_t::data() const. More...
 
std::string_view string_view () const
 
auto * begin ()
 Return the begin as char *. More...
 
auto * begin () const
 Return the begin as const char * or char *, const-ness inherited from Self_t::data() const. More...
 
auto * cbegin () const
 Return the begin as const char * or char *, const-ness inherited from Self_t::data() const. More...
 
auto * ubegin ()
 Return the begin as unsigned char *. More...
 
auto * ubegin () const
 Return the begin as const unsigned char * or unsigned char *, const-ness inherited from Self_t::data() const. More...
 
auto * cubegin () const
 Return the begin as const unsigned char * or unsigned char *, const-ness inherited from Self_t::data() const. More...
 
auto * bbegin ()
 Return the begin as std::byte *. More...
 
auto * bbegin () const
 Return the begin as const std::byte * or std::byte *, const-ness inherited from Self_t::data() const. More...
 
auto * cbbegin () const
 Return the begin as const std::byte * or std::byte *, const-ness inherited from Self_t::data() const. More...
 
auto * end ()
 Return the end as char *. More...
 
auto * end () const
 Return the end as const char * or char *, const-ness inherited from Self_t::data() const. More...
 
auto * cend () const
 Return the end as const char * or char *, const-ness inherited from Self_t::data() const. More...
 
auto * uend ()
 Return the end as unsigned char *. More...
 
auto * uend () const
 Return the end as const unsigned char * or unsigned char *, const-ness inherited from Self_t::data() const. More...
 
auto * cuend () const
 Return the end as const unsigned char * or unsigned char *, const-ness inherited from Self_t::data() const. More...
 
auto * bend ()
 Return the end as std::byte *. More...
 
auto * bend () const
 Return the end as const std::byte * or std::byte *, const-ness inherited from Self_t::data() const. More...
 
auto * cbend () const
 Return the end as const std::byte * or or std::byte *, const-ness inherited from Self_t::data() const. More...
 
char & operator[] (std::ptrdiff_t n)
 Return reference the n'th element. More...
 
char operator[] (std::ptrdiff_t n) const
 Return the n'th element, const-ness inherited from Self_t::data() const. More...
 

Static Public Member Functions

static auto throwing_make (const std::string_view &sv)
 Return a new Tag, initialized with the given string. More...
 
- Static Public Member Functions inherited from mysql::gtids::detail::Tag_base
static int get_normalized_first_char (int ch)
 Return the character converted to lowercase, if it is allowed as the first character in a tag; otherwise return 0. More...
 
static bool is_valid_first_char (int ch)
 Return true if the given character is allowed as the first character in a tag. More...
 
static int get_normalized_nonfirst_char (int ch)
 Return the character converted to lowercase, if it is allowed in a tag at other positions than the first; otherwise return 0. More...
 
static bool is_valid_nonfirst_char (int ch)
 Return true if the given character is allowed in a tag, at other positions than the first. More...
 
static bool is_valid (const std::string_view &sv)
 Return true if the given string is a valid tag. More...
 
static std::optional< std::size_t > valid_prefix_length (const std::string_view &sv)
 Return the length of a tag that appears as an initial prefix of the given string, or no value if there is a string of tag characters that does not meet the requiremet of maximum length or the requirement that first character must be a non-digit. More...
 

Private Types

using Base_t = detail::Tag_interface< Tag_trivial >
 

Private Member Functions

auto out_str ()
 Return an Output String Wrapper writing to this Tag. More...
 

Private Attributes

friend Base_t
 The base class needs to call out_str(). More...
 
char m_data [max_size]
 Tag represented as data + size. More...
 
std::size_t m_size
 

Additional Inherited Members

- Static Public Attributes inherited from mysql::gtids::detail::Tag_base
static constexpr std::size_t max_size = 32
 The maximum number of characters a tag. More...
 
static constexpr std::ptrdiff_t max_ssize = 32
 
- Static Public Attributes inherited from mysql::ranges::Buffer_interface< Self_tp, equality_algorithm_tp, enable_hash_tp >
static constexpr auto equality_algorithm = equality_algorithm_tp
 
static constexpr bool equality_enabled
 
static constexpr bool hash_enabled = (enable_hash_tp == Enable_hash::yes)
 

Detailed Description

Class representing a tag by storing the characters in a member array.

This never allocates, and is trivially default constructible and trivially copyable.

Note that trivially default constructible implies that a default-constructed object is uninitialized, so it is in an invalid state rather than a valid empty tag.

Member Typedef Documentation

◆ Base_t

Constructor & Destructor Documentation

◆ Tag_trivial() [1/2]

mysql::gtids::Tag_trivial::Tag_trivial ( )
defaultnoexcept

Default constructor: This does not initialize the tag! Use Tag unless you need std::is_trivially_default_constructible.

◆ Tag_trivial() [2/2]

mysql::gtids::Tag_trivial::Tag_trivial ( const Is_tag auto &  other)
inlineexplicitnoexcept

Copy from any other tag.

Member Function Documentation

◆ data()

const char * mysql::gtids::Tag_trivial::data ( ) const
inline

Return a const pointer to the data.

◆ out_str()

auto mysql::gtids::Tag_trivial::out_str ( )
inlineprivate

Return an Output String Wrapper writing to this Tag.

◆ size()

std::size_t mysql::gtids::Tag_trivial::size ( ) const
inline

Return the number of characters of the tag: an integer between 0 and max_size.

◆ throwing_make()

static auto mysql::gtids::Tag_trivial::throwing_make ( const std::string_view &  sv)
inlinestatic

Return a new Tag, initialized with the given string.

Use in exception-free code only if the tag format has been validated already.

Parameters
svstring_view to copy from.
Exceptions
std::domain_errorif sv does not have the correct tag format.

Member Data Documentation

◆ Base_t

The base class needs to call out_str().

◆ m_data

char mysql::gtids::Tag_trivial::m_data[max_size]
private

Tag represented as data + size.

◆ m_size

std::size_t mysql::gtids::Tag_trivial::m_size
private

The documentation for this class was generated from the following file: