MySQL 9.6.0
Source Code Documentation
mysql::strconv::String_counter Class Reference

Class that serves as the target for encode(..., Is_string_target), which never writes anything and only stores the size. More...

#include <string_counter.h>

Inheritance diagram for mysql::strconv::String_counter:
[legend]

Public Member Functions

 String_counter (const String_counter &)=delete
 
 String_counter (String_counter &&) noexcept=default
 
String_counteroperator= (const String_counter &)=delete
 
String_counteroperator= (String_counter &&) noexcept=default
 
 ~String_counter ()=default
 
void write_raw (const std::string_view &sv)
 Increment the size by sv.size(). More...
 
void write_char (int)
 Increment the size by 1. More...
 
void write (const Is_format auto &format, const auto &object)
 Increment the size by the size of the given object. More...
 
void write (const Is_format auto &format, const std::string_view &sv)
 Increment the size by the size of the given string. More...
 
void advance (std::size_t size)
 Increment the size by size. More...
 
std::size_t size () const
 Return the current size. More...
 
- Public Member Functions inherited from mysql::strconv::detail::String_target_interface< String_counter >
void concat (const Is_format auto &format, const Args_t &...args)
 Depending on the subclass, write or compute the size of multiple objects to this String_target. More...
 

Static Public Attributes

static constexpr Target_type target_type = Target_type::counter
 

Protected Member Functions

 String_counter ()=default
 Construct a new object. More...
 
- Protected Member Functions inherited from mysql::strconv::detail::String_target_interface< String_counter >
void resolve_format_and_write (const Is_format auto &format, const Object_t &object)
 Resolve the format, using the rules to deduce format based on default format and parent format, and write the given object using the resolved format. More...
 

Private Attributes

std::size_t m_size {0}
 The current size. More...
 

Detailed Description

Class that serves as the target for encode(..., Is_string_target), which never writes anything and only stores the size.

Constructor & Destructor Documentation

◆ String_counter() [1/3]

mysql::strconv::String_counter::String_counter ( )
protecteddefault

Construct a new object.

This is hidden from user code. These object are only meant to be created internally by the framework.

◆ String_counter() [2/3]

mysql::strconv::String_counter::String_counter ( const String_counter )
delete

◆ String_counter() [3/3]

mysql::strconv::String_counter::String_counter ( String_counter &&  )
defaultnoexcept

◆ ~String_counter()

mysql::strconv::String_counter::~String_counter ( )
default

Member Function Documentation

◆ advance()

void mysql::strconv::String_counter::advance ( std::size_t  size)
inline

Increment the size by size.

◆ operator=() [1/2]

String_counter & mysql::strconv::String_counter::operator= ( const String_counter )
delete

◆ operator=() [2/2]

String_counter & mysql::strconv::String_counter::operator= ( String_counter &&  )
defaultnoexcept

◆ size()

std::size_t mysql::strconv::String_counter::size ( ) const
inline

Return the current size.

◆ write() [1/2]

void mysql::strconv::String_counter::write ( const Is_format auto &  format,
const auto &  object 
)
inline

Increment the size by the size of the given object.

◆ write() [2/2]

void mysql::strconv::String_counter::write ( const Is_format auto &  format,
const std::string_view &  sv 
)
inline

Increment the size by the size of the given string.

This overload enables writing string literals directly.

◆ write_char()

void mysql::strconv::String_counter::write_char ( int  )
inline

Increment the size by 1.

◆ write_raw()

void mysql::strconv::String_counter::write_raw ( const std::string_view &  sv)
inline

Increment the size by sv.size().

Member Data Documentation

◆ m_size

std::size_t mysql::strconv::String_counter::m_size {0}
private

The current size.

◆ target_type

constexpr Target_type mysql::strconv::String_counter::target_type = Target_type::counter
staticconstexpr

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