MySQL 9.6.0
Source Code Documentation
mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp > Class Template Reference

Format class to encode ascii strings. More...

#include <escaped_format.h>

Inheritance diagram for mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >:
[legend]

Public Types

using Table_t = std::array< std::string_view, 256 >
 

Public Member Functions

 Escaped_format (With_quotes with_quotes=With_quotes::no)
 Construct a new Format object. More...
 

Static Public Member Functions

static const Table_ttable ()
 Return the conversion table for this format. More...
 

Public Attributes

With_quotes m_with_quotes
 Indicates whether output strings should be enclosed in quote characters. More...
 

Static Public Attributes

static constexpr char quote_char = quote_char_tp
 
static constexpr char escape_char = escape_char_tp
 
static constexpr Preserve_high_characters preserve_high_characters
 
static constexpr Numeric_control_characters numeric_control_characters
 

Static Private Member Functions

static const Table_tbuild_table ()
 Construct and return the table. More...
 

Static Private Attributes

static Table_t m_table
 Element 'c' is a string_view over character 'c' escaped. More...
 
static std::array< std::array< char, 4 >, 256 > m_data_table
 Element 'c' is a character array containing the string data for character 'c' escaped. More...
 

Detailed Description

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
requires (quote_char_tp >= 32 && (unsigned)quote_char_tp < 128 && escape_char_tp >= 32 && (unsigned)escape_char_tp < 128)
class mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >

Format class to encode ascii strings.

Template Parameters
quote_char_tpThe character that surrounds a string, e.g. double quote.
escape_char_tpThe character that begins an escape sequence, e.g. backslash.
preserve_high_characters_tpWhether ascii 128..255 should be preserved or escaped: backslash-xff vs ascii 255.
numeric_control_characters_tpWhether ascii 7..13 should use hex instead of mnemonics: backslash-x0a vs backslash-n.

Member Typedef Documentation

◆ Table_t

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
using mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::Table_t = std::array<std::string_view, 256>

Constructor & Destructor Documentation

◆ Escaped_format()

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::Escaped_format ( With_quotes  with_quotes = With_quotes::no)
inlineexplicit

Construct a new Format object.

Parameters
with_quotesIndicates whether output strings should be enclosed in quote characters.

Member Function Documentation

◆ build_table()

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
static const Table_t & mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::build_table ( )
inlinestaticprivate

Construct and return the table.

◆ table()

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
static const Table_t & mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::table ( )
inlinestatic

Return the conversion table for this format.

For a character c between 0 and 255, element c is the possibly-escaped form of character c, as a std::string_view.

Member Data Documentation

◆ escape_char

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
constexpr char mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::escape_char = escape_char_tp
staticconstexpr

◆ m_data_table

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
std::array<std::array<char, 4>, 256> mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::m_data_table
inlinestaticprivate

Element 'c' is a character array containing the string data for character 'c' escaped.

◆ m_table

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
Table_t mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::m_table
inlinestaticprivate

Element 'c' is a string_view over character 'c' escaped.

◆ m_with_quotes

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
With_quotes mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::m_with_quotes

Indicates whether output strings should be enclosed in quote characters.

◆ numeric_control_characters

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
constexpr Numeric_control_characters mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::numeric_control_characters
staticconstexpr
Initial value:
=
numeric_control_characters_tp

◆ preserve_high_characters

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
constexpr Preserve_high_characters mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::preserve_high_characters
staticconstexpr
Initial value:
=
preserve_high_characters_tp

◆ quote_char

template<char quote_char_tp = '"', char escape_char_tp = '\\', Preserve_high_characters preserve_high_characters_tp = Preserve_high_characters::no, Numeric_control_characters numeric_control_characters_tp = Numeric_control_characters::no>
constexpr char mysql::strconv::Escaped_format< quote_char_tp, escape_char_tp, preserve_high_characters_tp, numeric_control_characters_tp >::quote_char = quote_char_tp
staticconstexpr

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