BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslfmt::basic_format_parse_context< t_CHAR > Class Template Reference

#include <bslfmt_formatparsecontext.h>

Detailed Description

template<class t_CHAR>
class bslfmt::basic_format_parse_context< t_CHAR >

A format context for use by formatter::parse() partial specialization. It provides access to iterators for the start and end of the remaining (unparsed) format string, as well as argument counters.

See bslfmt_formatparsecontext

Public Types

typedef bsl::basic_string_view< t_CHAR >::const_iterator const_iterator
 
typedef const_iterator iterator
 
typedef t_CHAR char_type
 

Public Member Functions

BSLS_KEYWORD_CONSTEXPR_CPP20 basic_format_parse_context (bsl::basic_string_view< t_CHAR > fmt) BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP20 basic_format_parse_context (bsl::basic_string_view< t_CHAR > fmt, size_t numArgs) BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP20 void advance_to (const_iterator it)
 
BSLS_KEYWORD_CONSTEXPR_CPP20 size_t next_arg_id ()
 
BSLS_KEYWORD_CONSTEXPR_CPP20 void check_arg_id (size_t id)
 
BSLS_KEYWORD_CONSTEXPR_CPP20 const_iterator begin () const BSLS_KEYWORD_NOEXCEPT
 
BSLS_KEYWORD_CONSTEXPR_CPP20 const_iterator end () const BSLS_KEYWORD_NOEXCEPT
 

Member Typedef Documentation

◆ char_type

template<class t_CHAR >
typedef t_CHAR bslfmt::basic_format_parse_context< t_CHAR >::char_type

◆ const_iterator

template<class t_CHAR >
typedef bsl::basic_string_view<t_CHAR>::const_iterator bslfmt::basic_format_parse_context< t_CHAR >::const_iterator

◆ iterator

template<class t_CHAR >
typedef const_iterator bslfmt::basic_format_parse_context< t_CHAR >::iterator

Constructor & Destructor Documentation

◆ basic_format_parse_context() [1/2]

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 bslfmt::basic_format_parse_context< t_CHAR >::basic_format_parse_context ( bsl::basic_string_view< t_CHAR >  fmt)
inlineexplicit

Create an instance of this type with the specified fmt parse string and number of arguments set to zero. The string is stored by reference, so fmt must outlive this object.

◆ basic_format_parse_context() [2/2]

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 bslfmt::basic_format_parse_context< t_CHAR >::basic_format_parse_context ( bsl::basic_string_view< t_CHAR >  fmt,
size_t  numArgs 
)
inlineexplicit

Create an instance of this type with the specified fmt parse string and number of arguments set to the specified numArgs. The string is stored by reference, so fmt must outlive this object.

Member Function Documentation

◆ advance_to()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 void bslfmt::basic_format_parse_context< t_CHAR >::advance_to ( const_iterator  it)
inline

Update the held iterator to the unparsed portion of the format string to be the specified it. Subsequent calls to begin will return this value.

Precondition
The behavior is undefined unless it is a valid iterator to the format string used in construction of this context.

◆ begin()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 basic_format_parse_context< t_CHAR >::const_iterator bslfmt::basic_format_parse_context< t_CHAR >::begin ( ) const
inline

Return an iterator to the start of the unparsed portion of the format string.

◆ check_arg_id()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 void bslfmt::basic_format_parse_context< t_CHAR >::check_arg_id ( size_t  id)
inline

Check that the specified id is a valid argument index. If the indexing mode is unset, the indexing mode is set to e_MANUAL. If the indexing mode is e_AUTOMATIC, caused by a previous call to next_arg_id then an exception of type format_error is thrown. If id is not less than the number of arguments then an exception of type format_error is thrown.

◆ end()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 basic_format_parse_context< t_CHAR >::const_iterator bslfmt::basic_format_parse_context< t_CHAR >::end ( ) const
inline

Return an iterator to the start of the unparsed portion of the format string.

◆ next_arg_id()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 size_t bslfmt::basic_format_parse_context< t_CHAR >::next_arg_id ( )
inline

Return the index of the next-unused argument. If the indexing mode is unset, the indexing mode is set to e_AUTOMATIC. If the indexing mode is e_MANUAL, caused by a previous call to check_arg_id then an exception of type format_error is thrown. If there are no remaining unused arguments then an exception of type format_error is thrown.


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