Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
basic_format_args< Context > Class Template Reference

#include <core.h>

Public Types

typedef unsigned size_type
 
typedef basic_format_arg< Context > format_arg
 

Public Member Functions

 basic_format_args ()
 
template<typename... Args>
 basic_format_args (const format_arg_store< Context, Args... > &store)
 
 basic_format_args (const format_arg *args, size_type count)
 
format_arg get (size_type index) const
 
size_type max_size () const
 

Private Member Functions

bool is_packed () const
 
internal::type type (unsigned index) const
 
void set_data (const internal::value< Context > *values)
 
void set_data (const format_arg *args)
 
format_arg do_get (size_type index) const
 

Private Attributes

unsigned long long types_
 
union {
   const internal::value< Context > *   values_
 
   const format_arg *   args_
 
}; 
 

Friends

class internal::arg_map< Context >
 

Detailed Description

template<typename Context>
class basic_format_args< Context >

Formatting arguments.

Definition at line 487 of file core.h.

Member Typedef Documentation

template<typename Context>
typedef basic_format_arg<Context> basic_format_args< Context >::format_arg

Definition at line 1206 of file core.h.

template<typename Context>
typedef unsigned basic_format_args< Context >::size_type

Definition at line 1205 of file core.h.

Constructor & Destructor Documentation

template<typename Context>
basic_format_args< Context >::basic_format_args ( )
inline

Definition at line 1254 of file core.h.

1254 : types_(0) {}
unsigned long long types_
Definition: core.h:1211
template<typename Context>
template<typename... Args>
basic_format_args< Context >::basic_format_args ( const format_arg_store< Context, Args... > &  store)
inline

Constructs a basic_format_args object from ~fmtformat_arg_store.

Definition at line 1262 of file core.h.

1263  : types_(static_cast<unsigned long long>(store.TYPES)) {
1264  set_data(store.data_);
1265  }
void set_data(const internal::value< Context > *values)
Definition: core.h:1232
value_type data_[DATA_SIZE]
Definition: core.h:1153
unsigned long long types_
Definition: core.h:1211
static const unsigned long long TYPES
Definition: core.h:1167
template<typename Context>
basic_format_args< Context >::basic_format_args ( const format_arg args,
size_type  count 
)
inline

Constructs a basic_format_args object from a dynamic set of arguments.

Definition at line 1272 of file core.h.

1273  : types_(internal::is_unpacked_bit | count) {
1274  set_data(args);
1275  }
void set_data(const internal::value< Context > *values)
Definition: core.h:1232
unsigned long long types_
Definition: core.h:1211
const Args & args
Definition: core.h:1496

Member Function Documentation

template<typename Context>
format_arg basic_format_args< Context >::do_get ( size_type  index) const
inlineprivate

Definition at line 1235 of file core.h.

1235  {
1236  format_arg arg;
1237  if (!is_packed()) {
1238  auto num_args = max_size();
1239  if (index < num_args)
1240  arg = args_[index];
1241  return arg;
1242  }
1244  return arg;
1245  arg.type_ = type(index);
1246  if (arg.type_ == internal::none_type)
1247  return arg;
1248  internal::value<Context> &val = arg.value_;
1249  val = values_[index];
1250  return arg;
1251  }
internal::named_arg< T, char > arg(string_view name, const T &arg)
Definition: core.h:1391
bool is_packed() const
Definition: core.h:1222
const internal::value< Context > * values_
Definition: core.h:1218
basic_format_arg< Context > format_arg
Definition: core.h:1206
size_type max_size() const
Definition: core.h:1285
internal::type type(unsigned index) const
Definition: core.h:1224
const format_arg * args_
Definition: core.h:1219
template<typename Context>
format_arg basic_format_args< Context >::get ( size_type  index) const
inline

Returns the argument at specified index.

Definition at line 1278 of file core.h.

1278  {
1280  if (arg.type_ == internal::named_arg_type)
1281  arg = arg.value_.as_named_arg().template deserialize<Context>();
1282  return arg;
1283  }
internal::named_arg< T, char > arg(string_view name, const T &arg)
Definition: core.h:1391
format_arg do_get(size_type index) const
Definition: core.h:1235
basic_format_arg< Context > format_arg
Definition: core.h:1206
template<typename Context>
bool basic_format_args< Context >::is_packed ( ) const
inlineprivate

Definition at line 1222 of file core.h.

1222 { return (types_ & internal::is_unpacked_bit) == 0; }
unsigned long long types_
Definition: core.h:1211
template<typename Context>
size_type basic_format_args< Context >::max_size ( ) const
inline

Definition at line 1285 of file core.h.

1285  {
1286  unsigned long long max_packed = internal::max_packed_args;
1287  return static_cast<size_type>(
1288  is_packed() ? max_packed : types_ & ~internal::is_unpacked_bit);
1289  }
bool is_packed() const
Definition: core.h:1222
unsigned long long types_
Definition: core.h:1211
unsigned size_type
Definition: core.h:1205
template<typename Context>
void basic_format_args< Context >::set_data ( const internal::value< Context > *  values)
inlineprivate

Definition at line 1232 of file core.h.

1232 { values_ = values; }
const internal::value< Context > * values_
Definition: core.h:1218
Q_UINT16 values[128]
template<typename Context>
void basic_format_args< Context >::set_data ( const format_arg args)
inlineprivate

Definition at line 1233 of file core.h.

1233 { args_ = args; }
const format_arg * args_
Definition: core.h:1219
const Args & args
Definition: core.h:1496
template<typename Context>
internal::type basic_format_args< Context >::type ( unsigned  index) const
inlineprivate

Definition at line 1224 of file core.h.

1224  {
1225  unsigned shift = index * 4;
1226  return static_cast<typename internal::type>(
1227  (types_ & (0xfull << shift)) >> shift);
1228  }
unsigned long long types_
Definition: core.h:1211
type
Definition: core.h:530

Friends And Related Function Documentation

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

Definition at line 1230 of file core.h.

Member Data Documentation

union { ... }
template<typename Context>
const format_arg* basic_format_args< Context >::args_

Definition at line 1219 of file core.h.

template<typename Context>
unsigned long long basic_format_args< Context >::types_
private

Definition at line 1211 of file core.h.

template<typename Context>
const internal::value<Context>* basic_format_args< Context >::values_

Definition at line 1218 of file core.h.


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