Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
internal::arg_map< Context > Class Template Reference

#include <core.h>

Classes

struct  entry
 

Public Member Functions

 arg_map ()
 
void init (const basic_format_args< Context > &args)
 
 ~arg_map ()
 
basic_format_arg< Context > find (basic_string_view< char_type > name) const
 

Private Types

typedef Context::char_type char_type
 

Private Member Functions

 arg_map (const arg_map &)=delete
 
void operator= (const arg_map &)=delete
 
void push_back (value< Context > val)
 

Private Attributes

entrymap_
 
unsigned size_
 

Detailed Description

template<typename Context>
class internal::arg_map< Context >

Definition at line 773 of file core.h.

Member Typedef Documentation

template<typename Context>
typedef Context::char_type internal::arg_map< Context >::char_type
private

Definition at line 940 of file core.h.

Constructor & Destructor Documentation

template<typename Context>
internal::arg_map< Context >::arg_map ( const arg_map< Context > &  )
privatedelete
template<typename Context>
internal::arg_map< Context >::arg_map ( )
inline

Definition at line 957 of file core.h.

957 : map_(FMT_NULL), size_(0) {}
entry * map_
Definition: core.h:947
#define FMT_NULL
Definition: core.h:107
unsigned size_
Definition: core.h:948
template<typename Context>
internal::arg_map< Context >::~arg_map ( )
inline

Definition at line 959 of file core.h.

959 { delete [] map_; }
entry * map_
Definition: core.h:947

Member Function Documentation

template<typename Context>
basic_format_arg<Context> internal::arg_map< Context >::find ( basic_string_view< char_type name) const
inline

Definition at line 961 of file core.h.

961  {
962  // The list is unsorted, so just return the first matching name.
963  for (entry *it = map_, *end = map_ + size_; it != end; ++it) {
964  if (it->name == name)
965  return it->arg;
966  }
967  return {};
968  }
QList< Entry > entry
FMT_CONSTEXPR auto end(const C &c) -> decltype(c.end())
Definition: format.h:257
entry * map_
Definition: core.h:947
unsigned size_
Definition: core.h:948
template<typename Context>
void internal::arg_map< Context >::init ( const basic_format_args< Context > &  args)

Definition at line 1273 of file format.h.

1273  {
1274  if (map_)
1275  return;
1276  map_ = new entry[args.max_size()];
1277  if (args.is_packed()) {
1278  for (unsigned i = 0;/*nothing*/; ++i) {
1279  internal::type arg_type = args.type(i);
1280  switch (arg_type) {
1281  case internal::none_type:
1282  return;
1284  push_back(args.values_[i]);
1285  break;
1286  default:
1287  break; // Do nothing.
1288  }
1289  }
1290  }
1291  for (unsigned i = 0; ; ++i) {
1292  switch (args.args_[i].type_) {
1293  case internal::none_type:
1294  return;
1296  push_back(args.args_[i].value_);
1297  break;
1298  default:
1299  break; // Do nothing.
1300  }
1301  }
1302 }
QList< Entry > entry
bool is_packed() const
Definition: core.h:1222
const internal::value< Context > * values_
Definition: core.h:1218
internal::value< Context > value_
Definition: core.h:781
size_type max_size() const
Definition: core.h:1285
internal::type type(unsigned index) const
Definition: core.h:1224
void push_back(value< Context > val)
Definition: core.h:950
entry * map_
Definition: core.h:947
const format_arg * args_
Definition: core.h:1219
internal::type type_
Definition: core.h:782
type
Definition: core.h:530
template<typename Context>
void internal::arg_map< Context >::operator= ( const arg_map< Context > &  )
privatedelete
template<typename Context>
void internal::arg_map< Context >::push_back ( value< Context >  val)
inlineprivate

Definition at line 950 of file core.h.

950  {
951  const internal::named_arg_base<char_type> &named = val.as_named_arg();
952  map_[size_] = entry{named.name, named.template deserialize<Context>()};
953  ++size_;
954  }
QList< Entry > entry
basic_string_view< Char > name
Definition: core.h:1326
entry * map_
Definition: core.h:947
unsigned size_
Definition: core.h:948

Member Data Documentation

template<typename Context>
entry* internal::arg_map< Context >::map_
private

Definition at line 947 of file core.h.

template<typename Context>
unsigned internal::arg_map< Context >::size_
private

Definition at line 948 of file core.h.


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