MySQL 9.1.0
Source Code Documentation
mysql::abi_helpers::Packet_builder< Type_enum_t > Class Template Reference

Class to help constructing a Packet, by pushing values one by one. More...

#include <packet.h>

Public Member Functions

 Packet_builder (Packet_t &packet)
 Construct a new Packet_builder that can be used to store data in the given Packet. More...
 
void push_int (Type_enum_t type, long long value)
 Append an int field. More...
 
void push_string_copy (Type_enum_t type, const char *value, std::size_t length, PSI_memory_key key)
 Append a string field, taking a copy of the parameter (raw pointer and length). More...
 
void push_string_copy (Type_enum_t type, const char *value, PSI_memory_key key)
 Append a string field, taking a copy of the parameter (raw pointer to null-terminated string). More...
 
void push_string_copy (Type_enum_t type, const std::string &value, PSI_memory_key key)
 Append a string field, taking a copy of the parameter (std::string). More...
 
void push_string_view (Type_enum_t type, char *value)
 Append a string field, sharing memory with the caller (raw pointer to null-terminated string). More...
 
void push_string_view (Type_enum_t type, const std::string &value)
 Append a string field, sharing memory with the caller (std::string). More...
 
void push_bool (Type_enum_t type, bool value)
 Append a boolean field. More...
 
std::size_t get_position ()
 

Private Types

using Packet_t = Packet< Type_enum_t >
 

Private Attributes

Packet_tm_packet
 
std::size_t m_position
 

Detailed Description

template<class Type_enum_t>
class mysql::abi_helpers::Packet_builder< Type_enum_t >

Class to help constructing a Packet, by pushing values one by one.

Template Parameters
Type_enum_tEnumeration for the type codes.

Member Typedef Documentation

◆ Packet_t

template<class Type_enum_t >
using mysql::abi_helpers::Packet_builder< Type_enum_t >::Packet_t = Packet<Type_enum_t>
private

Constructor & Destructor Documentation

◆ Packet_builder()

template<class Type_enum_t >
mysql::abi_helpers::Packet_builder< Type_enum_t >::Packet_builder ( Packet_t packet)
inline

Construct a new Packet_builder that can be used to store data in the given Packet.

Parameters
packetTarget Packet.

Member Function Documentation

◆ get_position()

template<class Type_enum_t >
std::size_t mysql::abi_helpers::Packet_builder< Type_enum_t >::get_position ( )
inline
Returns
The current position.

◆ push_bool()

template<class Type_enum_t >
void mysql::abi_helpers::Packet_builder< Type_enum_t >::push_bool ( Type_enum_t  type,
bool  value 
)
inline

Append a boolean field.

Parameters
typeThe field type.
valueThe boolean value.

◆ push_int()

template<class Type_enum_t >
void mysql::abi_helpers::Packet_builder< Type_enum_t >::push_int ( Type_enum_t  type,
long long  value 
)
inline

Append an int field.

Parameters
typethe field type
valuethe field value

◆ push_string_copy() [1/3]

template<class Type_enum_t >
void mysql::abi_helpers::Packet_builder< Type_enum_t >::push_string_copy ( Type_enum_t  type,
const char *  value,
PSI_memory_key  key 
)
inline

Append a string field, taking a copy of the parameter (raw pointer to null-terminated string).

Parameters
typeThe field type
valueThe string to copy (null-terminated).
keyPSI_memory_key used to track the allocation.

◆ push_string_copy() [2/3]

template<class Type_enum_t >
void mysql::abi_helpers::Packet_builder< Type_enum_t >::push_string_copy ( Type_enum_t  type,
const char *  value,
std::size_t  length,
PSI_memory_key  key 
)
inline

Append a string field, taking a copy of the parameter (raw pointer and length).

Parameters
typeThe field type
valueThe string to copy (not necessarily null-terminated).
lengthThe number of bytes to copy
keyPSI_memory_key used to track the allocation.

◆ push_string_copy() [3/3]

template<class Type_enum_t >
void mysql::abi_helpers::Packet_builder< Type_enum_t >::push_string_copy ( Type_enum_t  type,
const std::string &  value,
PSI_memory_key  key 
)
inline

Append a string field, taking a copy of the parameter (std::string).

Parameters
typeThe field type.
valueThe string to copy.
keyPSI_memory_key used to track the allocation.

◆ push_string_view() [1/2]

template<class Type_enum_t >
void mysql::abi_helpers::Packet_builder< Type_enum_t >::push_string_view ( Type_enum_t  type,
char *  value 
)
inline

Append a string field, sharing memory with the caller (raw pointer to null-terminated string).

Parameters
typeThe field type.
valueThe string to push (null-terminated).

◆ push_string_view() [2/2]

template<class Type_enum_t >
void mysql::abi_helpers::Packet_builder< Type_enum_t >::push_string_view ( Type_enum_t  type,
const std::string &  value 
)
inline

Append a string field, sharing memory with the caller (std::string).

Parameters
typeThe field type.
valueString object. The pointer value.c_str() will be pushed.

Member Data Documentation

◆ m_packet

template<class Type_enum_t >
Packet_t& mysql::abi_helpers::Packet_builder< Type_enum_t >::m_packet
private

◆ m_position

template<class Type_enum_t >
std::size_t mysql::abi_helpers::Packet_builder< Type_enum_t >::m_position
private

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