MySQL 9.6.0
Source Code Documentation
mysql::strconv::detail::Parse_position< Self_tp > Class Template Reference

Base class for the current position of a string parser, holding both the parsed string and the position within the parsed string. More...

#include <parse_position.h>

Inheritance diagram for mysql::strconv::detail::Parse_position< Self_tp >:
[legend]

Public Types

using Iterator_category_t = std::contiguous_iterator_tag
 

Public Member Functions

 Parse_position (const std::string_view &source, std::size_t int_pos=0)
 Construct a new Parse_position from the given range. More...
 
 Parse_position ()=default
 Construct a new object. More...
 
const char * get_pointer () const
 Dereference the iterator and return the value. More...
 
void advance (std::ptrdiff_t delta)
 Move the iterator delta steps. More...
 
std::ptrdiff_t distance_from (const Parse_position &other) const
 Return the distance from iterator other to this. More...
 
bool is_sentinel () const
 Return true if this iterator is at the end. More...
 
void set_int_pos (std::size_t int_pos_arg)
 Set the position to the given one. More...
 
std::size_t int_pos () const
 Return the current position as an integer. More...
 
const char * pos () const
 Return the current position as a char pointer. More...
 
const unsigned char * upos () const
 Return the current position as an unsigned char pointer. More...
 
const std::bytebpos () const
 Return the current position as an std::byte pointer. More...
 
const char * begin () const
 Return pointer to the beginning of the underlying string. More...
 
const unsigned char * ubegin () const
 Return pointer to the beginning of the underlying string. More...
 
const std::bytebbegin () const
 Return pointer to the beginning of the underlying string. More...
 
const char * end () const
 Return pointer to the end of the underlying string. More...
 
const unsigned char * uend () const
 Return pointer to the end of the underlying string. More...
 
const std::bytebend () const
 Return pointer to the end of the underlying string. More...
 
std::size_t remaining_size () const
 Return the remaining size. More...
 
std::size_t str_size () const
 Return the length of the underlying string. More...
 
std::string_view parsed_str () const
 Return a string_view over the left part of the string, up to the position. More...
 
std::string_view remaining_str () const
 Return a string_view over the remaining string. More...
 
std::string_view str () const
 Return a string_view over the underlying string. More...
 
- Public Member Functions inherited from mysql::iterators::Iterator_interface< Self_tp >
decltype(auto) operator* () const
 Dereference operator, which returns the current value. More...
 
auto operator-> () const
 Arrow operator, return a pointer (possibly a fancy pointer) to the current element. More...
 
Self_toperator++ ()
 Pre-increment operator, which advances the position one step and returns a reference to the iterator itself. More...
 
auto operator++ (int)
 Post-increment operator, which advances the position one step. More...
 
Self_toperator-- ()
 Pre-decrement iterator, which moves one step back and returns a reference to the iterator itself. More...
 
auto operator-- (int)
 Post-decrement operator, which moves one step back and returns a copy of the iterator before the decrement. More...
 
Self_toperator+= (std::ptrdiff_t delta)
 Addition assignment operator, which moves the iterator forward by the given number of steps, and returns a reference to the iterator itself. More...
 
Self_toperator-= (std::ptrdiff_t delta)
 Subtraction assignment operator, which moves the iterator backward by the given number of steps, and returns a reference to the iterator itself. More...
 
Self_t operator+ (std::ptrdiff_t delta) const
 Addition operator, which returns a new iterator that is the given number of steps ahead of the current iterator. More...
 
Self_t operator- (std::ptrdiff_t delta) const
 Subtraction-of-integer operator, which returns a new iterator that is the given number of steps behind of the current iterator. More...
 
std::ptrdiff_t operator- (const Self_t &other) const
 Subtraction-of-iterator operator, which returns the number of steps from other this. More...
 
decltype(auto) operator[] (std::ptrdiff_t delta) const
 Subscript operator, which returns a new iterator that is the given number of steps ahead of the current iterator. More...
 

Private Attributes

std::string_view m_source {}
 The beginning of the range. More...
 
std::size_t m_int_pos {}
 The current position. More...
 

Additional Inherited Members

- Protected Types inherited from mysql::iterators::Iterator_interface< Self_tp >
using Self_t = Self_tp
 

Detailed Description

template<class Self_tp>
class mysql::strconv::detail::Parse_position< Self_tp >

Base class for the current position of a string parser, holding both the parsed string and the position within the parsed string.

Subclasses are contiguous iterators over the characters in the parsed string.

Template Parameters
Self_tpThe subclass inheriting from this class.

Member Typedef Documentation

◆ Iterator_category_t

template<class Self_tp >
using mysql::strconv::detail::Parse_position< Self_tp >::Iterator_category_t = std::contiguous_iterator_tag

Constructor & Destructor Documentation

◆ Parse_position() [1/2]

template<class Self_tp >
mysql::strconv::detail::Parse_position< Self_tp >::Parse_position ( const std::string_view &  source,
std::size_t  int_pos = 0 
)
inlineexplicit

Construct a new Parse_position from the given range.

Parameters
sourceSource string.
int_posCurrent position. Defaults to 0, i.e., the beginning.

◆ Parse_position() [2/2]

template<class Self_tp >
mysql::strconv::detail::Parse_position< Self_tp >::Parse_position ( )
default

Construct a new object.

The object cannot be used for anything besides assigning another object to it.

Member Function Documentation

◆ advance()

template<class Self_tp >
void mysql::strconv::detail::Parse_position< Self_tp >::advance ( std::ptrdiff_t  delta)
inline

Move the iterator delta steps.

◆ bbegin()

template<class Self_tp >
const std::byte * mysql::strconv::detail::Parse_position< Self_tp >::bbegin ( ) const
inline

Return pointer to the beginning of the underlying string.

◆ begin()

template<class Self_tp >
const char * mysql::strconv::detail::Parse_position< Self_tp >::begin ( ) const
inline

Return pointer to the beginning of the underlying string.

◆ bend()

template<class Self_tp >
const std::byte * mysql::strconv::detail::Parse_position< Self_tp >::bend ( ) const
inline

Return pointer to the end of the underlying string.

◆ bpos()

template<class Self_tp >
const std::byte * mysql::strconv::detail::Parse_position< Self_tp >::bpos ( ) const
inline

Return the current position as an std::byte pointer.

◆ distance_from()

template<class Self_tp >
std::ptrdiff_t mysql::strconv::detail::Parse_position< Self_tp >::distance_from ( const Parse_position< Self_tp > &  other) const
inline

Return the distance from iterator other to this.

◆ end()

template<class Self_tp >
const char * mysql::strconv::detail::Parse_position< Self_tp >::end ( ) const
inline

Return pointer to the end of the underlying string.

◆ get_pointer()

template<class Self_tp >
const char * mysql::strconv::detail::Parse_position< Self_tp >::get_pointer ( ) const
inline

Dereference the iterator and return the value.

◆ int_pos()

template<class Self_tp >
std::size_t mysql::strconv::detail::Parse_position< Self_tp >::int_pos ( ) const
inline

Return the current position as an integer.

◆ is_sentinel()

template<class Self_tp >
bool mysql::strconv::detail::Parse_position< Self_tp >::is_sentinel ( ) const
inline

Return true if this iterator is at the end.

◆ parsed_str()

template<class Self_tp >
std::string_view mysql::strconv::detail::Parse_position< Self_tp >::parsed_str ( ) const
inline

Return a string_view over the left part of the string, up to the position.

◆ pos()

template<class Self_tp >
const char * mysql::strconv::detail::Parse_position< Self_tp >::pos ( ) const
inline

Return the current position as a char pointer.

◆ remaining_size()

template<class Self_tp >
std::size_t mysql::strconv::detail::Parse_position< Self_tp >::remaining_size ( ) const
inline

Return the remaining size.

◆ remaining_str()

template<class Self_tp >
std::string_view mysql::strconv::detail::Parse_position< Self_tp >::remaining_str ( ) const
inline

Return a string_view over the remaining string.

◆ set_int_pos()

template<class Self_tp >
void mysql::strconv::detail::Parse_position< Self_tp >::set_int_pos ( std::size_t  int_pos_arg)
inline

Set the position to the given one.

◆ str()

template<class Self_tp >
std::string_view mysql::strconv::detail::Parse_position< Self_tp >::str ( ) const
inline

Return a string_view over the underlying string.

◆ str_size()

template<class Self_tp >
std::size_t mysql::strconv::detail::Parse_position< Self_tp >::str_size ( ) const
inline

Return the length of the underlying string.

◆ ubegin()

template<class Self_tp >
const unsigned char * mysql::strconv::detail::Parse_position< Self_tp >::ubegin ( ) const
inline

Return pointer to the beginning of the underlying string.

◆ uend()

template<class Self_tp >
const unsigned char * mysql::strconv::detail::Parse_position< Self_tp >::uend ( ) const
inline

Return pointer to the end of the underlying string.

◆ upos()

template<class Self_tp >
const unsigned char * mysql::strconv::detail::Parse_position< Self_tp >::upos ( ) const
inline

Return the current position as an unsigned char pointer.

Member Data Documentation

◆ m_int_pos

template<class Self_tp >
std::size_t mysql::strconv::detail::Parse_position< Self_tp >::m_int_pos {}
private

The current position.

◆ m_source

template<class Self_tp >
std::string_view mysql::strconv::detail::Parse_position< Self_tp >::m_source {}
private

The beginning of the range.


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