Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
internal::arg_formatter_base< Range > Class Template Reference

#include <format.h>

Inheritance diagram for internal::arg_formatter_base< Range >:
arg_formatter< Range > printf_arg_formatter< Range >

Classes

struct  char_spec_handler
 
struct  char_writer
 
struct  cstring_spec_handler
 

Public Types

typedef Range::value_type char_type
 
typedef basic_format_specs< char_typeformat_specs
 

Public Member Functions

 arg_formatter_base (Range r, format_specs *s, locale_ref loc)
 
iterator operator() (monostate)
 
template<typename T >
std::enable_if< std::is_integral< T >::value||std::is_same< T, char_type >::value, iterator >::type operator() (T value)
 
template<typename T >
std::enable_if< std::is_floating_point< T >::value, iterator >::type operator() (T value)
 
iterator operator() (const char_type *value)
 
iterator operator() (basic_string_view< char_type > value)
 
iterator operator() (const void *value)
 

Public Attributes

decltype(internal::declval< Range >().begin()) typedef iterator
 

Protected Member Functions

writer_typewriter ()
 
format_specsspec ()
 
iterator out ()
 
void write (bool value)
 
void write (const char_type *value)
 

Private Types

typedef basic_writer< Rangewriter_type
 

Private Member Functions

void write_char (char_type value)
 
void write_pointer (const void *p)
 

Private Attributes

writer_type writer_
 
format_specsspecs_
 

Detailed Description

template<typename Range>
class internal::arg_formatter_base< Range >

Definition at line 1305 of file format.h.

Member Typedef Documentation

template<typename Range >
typedef Range::value_type internal::arg_formatter_base< Range >::char_type

Definition at line 1307 of file format.h.

Definition at line 1309 of file format.h.

template<typename Range >
typedef basic_writer<Range> internal::arg_formatter_base< Range >::writer_type
private

Definition at line 1312 of file format.h.

Constructor & Destructor Documentation

template<typename Range >
internal::arg_formatter_base< Range >::arg_formatter_base ( Range  r,
format_specs s,
locale_ref  loc 
)
inline

Definition at line 1359 of file format.h.

1360  : writer_(r, loc), specs_(s) {}
format_specs * specs_
Definition: format.h:1314

Member Function Documentation

template<typename Range >
iterator internal::arg_formatter_base< Range >::operator() ( monostate  )
inline

Definition at line 1362 of file format.h.

1362  {
1363  FMT_ASSERT(false, "invalid argument type");
1364  return out();
1365  }
#define FMT_ASSERT(condition, message)
Definition: core.h:170
template<typename Range >
template<typename T >
std::enable_if< std::is_integral<T>::value || std::is_same<T, char_type>::value, iterator>::type internal::arg_formatter_base< Range >::operator() ( value)
inline

Definition at line 1370 of file format.h.

1370  {
1371  // MSVC2013 fails to compile separate overloads for bool and char_type so
1372  // use std::is_same instead.
1374  if (specs_ && specs_->type)
1375  return (*this)(value ? 1 : 0);
1376  write(value != 0);
1377  } else if (std::is_same<T, char_type>::value) {
1379  specs_, char_spec_handler(*this, static_cast<char_type>(value)));
1380  } else {
1382  }
1383  return out();
1384  }
void write_int(int num_digits, string_view prefix, const Spec &spec, F f)
Definition: format.h:2326
FMT_CONSTEXPR void handle_char_specs(const basic_format_specs< Char > *specs, Handler &&handler)
Definition: format.h:1184
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
void write(bool value)
Definition: format.h:1345
format_specs * specs_
Definition: format.h:1314
void write(int value)
Definition: format.h:2573
template<typename Range >
template<typename T >
std::enable_if<std::is_floating_point<T>::value, iterator>::type internal::arg_formatter_base< Range >::operator() ( value)
inline

Definition at line 1388 of file format.h.

1388  {
1390  return out();
1391  }
void write_double(T value, const format_specs &spec)
Definition: format.h:2698
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
format_specs * specs_
Definition: format.h:1314
basic_format_specs< char_type > format_specs
Definition: format.h:1309
template<typename Range >
iterator internal::arg_formatter_base< Range >::operator() ( const char_type value)
inline

Definition at line 1420 of file format.h.

1420  {
1421  if (!specs_) return write(value), out();
1423  specs_->type, cstring_spec_handler(*this, value));
1424  return out();
1425  }
FMT_CONSTEXPR void handle_cstring_type_spec(Char spec, Handler &&handler)
Definition: format.h:1194
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
void write(bool value)
Definition: format.h:1345
format_specs * specs_
Definition: format.h:1314
template<typename Range >
iterator internal::arg_formatter_base< Range >::operator() ( basic_string_view< char_type value)
inline

Definition at line 1427 of file format.h.

1427  {
1428  if (specs_) {
1431  writer_.write(value, *specs_);
1432  } else {
1433  writer_.write(value);
1434  }
1435  return out();
1436  }
FMT_CONSTEXPR void check_string_type_spec(Char spec, ErrorHandler &&eh)
Definition: format.h:1204
format_specs * specs_
Definition: format.h:1314
void write(int value)
Definition: format.h:2573
template<typename Range >
iterator internal::arg_formatter_base< Range >::operator() ( const void *  value)
inline

Definition at line 1438 of file format.h.

1438  {
1439  if (specs_)
1442  return out();
1443  }
FMT_CONSTEXPR void check_pointer_type_spec(Char spec, ErrorHandler &&eh)
Definition: format.h:1210
void write_pointer(const void *p)
Definition: format.h:1333
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
format_specs * specs_
Definition: format.h:1314
template<typename Range >
iterator internal::arg_formatter_base< Range >::out ( )
inlineprotected

Definition at line 1343 of file format.h.

1343 { return writer_.out(); }
iterator out() const
Definition: format.h:2571
template<typename Range >
format_specs* internal::arg_formatter_base< Range >::spec ( )
inlineprotected

Definition at line 1342 of file format.h.

1342 { return specs_; }
format_specs * specs_
Definition: format.h:1314
template<typename Range >
void internal::arg_formatter_base< Range >::write ( bool  value)
inlineprotected

Definition at line 1345 of file format.h.

1345  {
1346  string_view sv(value ? "true" : "false");
1347  specs_ ? writer_.write(sv, *specs_) : writer_.write(sv);
1348  }
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
format_specs * specs_
Definition: format.h:1314
void write(int value)
Definition: format.h:2573
template<typename Range >
void internal::arg_formatter_base< Range >::write ( const char_type value)
inlineprotected

Definition at line 1350 of file format.h.

1350  {
1351  if (!value)
1352  FMT_THROW(format_error("string pointer is null"));
1353  auto length = std::char_traits<char_type>::length(value);
1354  basic_string_view<char_type> sv(value, length);
1355  specs_ ? writer_.write(sv, *specs_) : writer_.write(sv);
1356  }
#define FMT_THROW(x)
Definition: format.h:115
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
format_specs * specs_
Definition: format.h:1314
void write(int value)
Definition: format.h:2573
template<typename Range >
void internal::arg_formatter_base< Range >::write_char ( char_type  value)
inlineprivate

Definition at line 1326 of file format.h.

1326  {
1327  if (specs_)
1328  writer_.write_padded(*specs_, char_writer{value});
1329  else
1330  writer_.write(value);
1331  }
void write_padded(const align_spec &spec, F &&f)
Definition: format.h:2279
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
format_specs * specs_
Definition: format.h:1314
void write(int value)
Definition: format.h:2573
template<typename Range >
void internal::arg_formatter_base< Range >::write_pointer ( const void *  p)
inlineprivate

Definition at line 1333 of file format.h.

1333  {
1334  format_specs specs = specs_ ? *specs_ : format_specs();
1335  specs.flags = HASH_FLAG;
1336  specs.type = 'x';
1337  writer_.write_int(reinterpret_cast<uintptr_t>(p), specs);
1338  }
void write_int(int num_digits, string_view prefix, const Spec &spec, F f)
Definition: format.h:2326
p
Definition: test.py:223
uint_least8_t flags
Definition: format.h:1102
format_specs * specs_
Definition: format.h:1314
basic_format_specs< char_type > format_specs
Definition: format.h:1309
template<typename Range >
writer_type& internal::arg_formatter_base< Range >::writer ( )
inlineprotected

Definition at line 1341 of file format.h.

1341 { return writer_; }

Member Data Documentation

template<typename Range >
decltype(internal::declval<Range>().begin()) typedef internal::arg_formatter_base< Range >::iterator

Definition at line 1308 of file format.h.

template<typename Range >
format_specs* internal::arg_formatter_base< Range >::specs_
private

Definition at line 1314 of file format.h.

template<typename Range >
writer_type internal::arg_formatter_base< Range >::writer_
private

Definition at line 1313 of file format.h.


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