Public Types | Public Member Functions | Public Attributes | List of all members
format_handler< ArgFormatter, Char, Context > Struct Template Reference

#include <format.h>

Inheritance diagram for format_handler< ArgFormatter, Char, Context >:
internal::error_handler

Public Types

typedef ArgFormatter::range range
 

Public Member Functions

 format_handler (range r, basic_string_view< Char > str, basic_format_args< Context > format_args, internal::locale_ref loc)
 
void on_text (const Char *begin, const Char *end)
 
void on_arg_id ()
 
void on_arg_id (unsigned id)
 
void on_arg_id (basic_string_view< Char > id)
 
void on_replacement_field (const Char *p)
 
const Char * on_format_specs (const Char *begin, const Char *end)
 
- Public Member Functions inherited from internal::error_handler
FMT_CONSTEXPR error_handler ()
 
FMT_CONSTEXPR error_handler (const error_handler &)
 
FMT_API void on_error (const char *message)
 

Public Attributes

Context context
 
basic_format_arg< Context > arg
 

Detailed Description

template<typename ArgFormatter, typename Char, typename Context>
struct format_handler< ArgFormatter, Char, Context >

Definition at line 3068 of file format.h.

Member Typedef Documentation

template<typename ArgFormatter, typename Char, typename Context>
typedef ArgFormatter::range format_handler< ArgFormatter, Char, Context >::range

Definition at line 3069 of file format.h.

Constructor & Destructor Documentation

template<typename ArgFormatter, typename Char, typename Context>
format_handler< ArgFormatter, Char, Context >::format_handler ( range  r,
basic_string_view< Char >  str,
basic_format_args< Context >  format_args,
internal::locale_ref  loc 
)
inline

Definition at line 3071 of file format.h.

3074  : context(r.begin(), str, format_args, loc) {}
std::string str(const std::pair< Type, Type > &tt)
Definition: test_pimpos.cxx:12
Context context
Definition: format.h:3118

Member Function Documentation

template<typename ArgFormatter, typename Char, typename Context>
void format_handler< ArgFormatter, Char, Context >::on_arg_id ( )
inline

Definition at line 3084 of file format.h.

3084 { arg = context.next_arg(); }
basic_format_arg< Context > arg
Definition: format.h:3119
format_arg next_arg()
Definition: core.h:1114
template<typename ArgFormatter, typename Char, typename Context>
void format_handler< ArgFormatter, Char, Context >::on_arg_id ( unsigned  id)
inline

Definition at line 3085 of file format.h.

3085  {
3086  context.parse_context().check_arg_id(id);
3087  arg = context.get_arg(id);
3088  }
basic_format_arg< Context > arg
Definition: format.h:3119
format_arg get_arg(unsigned arg_id)
Definition: core.h:1117
basic_parse_context< char_type > & parse_context()
Definition: core.h:1023
template<typename ArgFormatter, typename Char, typename Context>
void format_handler< ArgFormatter, Char, Context >::on_arg_id ( basic_string_view< Char >  id)
inline

Definition at line 3089 of file format.h.

3089  {
3090  arg = context.get_arg(id);
3091  }
basic_format_arg< Context > arg
Definition: format.h:3119
format_arg get_arg(unsigned arg_id)
Definition: core.h:1117
template<typename ArgFormatter, typename Char, typename Context>
const Char* format_handler< ArgFormatter, Char, Context >::on_format_specs ( const Char *  begin,
const Char *  end 
)
inline

Definition at line 3100 of file format.h.

3100  {
3101  auto &parse_ctx = context.parse_context();
3102  parse_ctx.advance_to(begin);
3104  if (visit_format_arg(f, arg))
3105  return parse_ctx.begin();
3109  handler(specs_handler<Context>(specs, context), arg.type());
3110  begin = parse_format_specs(begin, end, handler);
3111  if (begin == end || *begin != '}')
3112  on_error("missing '}' in format string");
3113  parse_ctx.advance_to(begin);
3114  context.advance_to(visit_format_arg(ArgFormatter(context, &specs), arg));
3115  return begin;
3116  }
basic_format_arg< Context > arg
Definition: format.h:3119
FMT_API void on_error(const char *message)
Definition: format-inl.h:929
FMT_CONSTEXPR T * end(T(&array)[N]) FMT_NOEXCEPT
Definition: format.h:259
void advance_to(iterator it)
Definition: core.h:1038
FMT_CONSTEXPR T * begin(T(&array)[N]) FMT_NOEXCEPT
Definition: format.h:255
FMT_CONSTEXPR const ParseContext::char_type * parse_format_specs(ParseContext &ctx)
Definition: format.h:2053
static msg_handler handler
Definition: qglobal.cpp:234
basic_parse_context< char_type > & parse_context()
Definition: core.h:1023
FMT_CONSTEXPR internal::result_of< Visitor(int)>::type visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg)
Definition: core.h:831
template<typename ArgFormatter, typename Char, typename Context>
void format_handler< ArgFormatter, Char, Context >::on_replacement_field ( const Char *  p)
inline

Definition at line 3093 of file format.h.

3093  {
3094  context.parse_context().advance_to(p);
3096  if (!visit_format_arg(f, arg))
3097  context.advance_to(visit_format_arg(ArgFormatter(context), arg));
3098  }
basic_format_arg< Context > arg
Definition: format.h:3119
void advance_to(iterator it)
Definition: core.h:1038
p
Definition: test.py:223
basic_parse_context< char_type > & parse_context()
Definition: core.h:1023
FMT_CONSTEXPR internal::result_of< Visitor(int)>::type visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg)
Definition: core.h:831
template<typename ArgFormatter, typename Char, typename Context>
void format_handler< ArgFormatter, Char, Context >::on_text ( const Char *  begin,
const Char *  end 
)
inline

Definition at line 3076 of file format.h.

3076  {
3077  auto size = internal::to_unsigned(end - begin);
3078  auto out = context.out();
3079  auto &&it = internal::reserve(out, size);
3080  it = std::copy_n(begin, size, it);
3081  context.advance_to(out);
3082  }
FMT_CONSTEXPR T * end(T(&array)[N]) FMT_NOEXCEPT
Definition: format.h:259
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:87
void advance_to(iterator it)
Definition: core.h:1038
std::enable_if< is_contiguous< Container >::value, typename checked< typename Container::value_type >::type >::type reserve(std::back_insert_iterator< Container > &it, std::size_t n)
Definition: format.h:596
FMT_CONSTEXPR T * begin(T(&array)[N]) FMT_NOEXCEPT
Definition: format.h:255
FMT_CONSTEXPR std::make_unsigned< Int >::type to_unsigned(Int value)
Definition: core.h:208
iterator out()
Definition: core.h:1034

Member Data Documentation

template<typename ArgFormatter, typename Char, typename Context>
basic_format_arg<Context> format_handler< ArgFormatter, Char, Context >::arg

Definition at line 3119 of file format.h.

template<typename ArgFormatter, typename Char, typename Context>
Context format_handler< ArgFormatter, Char, Context >::context

Definition at line 3118 of file format.h.


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