proxygen
folly::FormatValue< detail::DefaultValueWrapper< dynamic, V > > Class Template Reference

#include <dynamic-inl.h>

Public Member Functions

 FormatValue (const detail::DefaultValueWrapper< dynamic, V > &val)
 
template<class FormatCallback >
void format (FormatArg &arg, FormatCallback &cb) const
 

Private Attributes

const detail::DefaultValueWrapper< dynamic, V > & val_
 

Detailed Description

template<class V>
class folly::FormatValue< detail::DefaultValueWrapper< dynamic, V > >

Definition at line 1203 of file dynamic-inl.h.

Constructor & Destructor Documentation

template<class V >
folly::FormatValue< detail::DefaultValueWrapper< dynamic, V > >::FormatValue ( const detail::DefaultValueWrapper< dynamic, V > &  val)
inlineexplicit

Definition at line 1205 of file dynamic-inl.h.

1206  : val_(val) {}
double val
Definition: String.cpp:273
const detail::DefaultValueWrapper< dynamic, V > & val_
Definition: dynamic-inl.h:1241

Member Function Documentation

template<class V >
template<class FormatCallback >
void folly::FormatValue< detail::DefaultValueWrapper< dynamic, V > >::format ( FormatArg arg,
FormatCallback &  cb 
) const
inline

Definition at line 1209 of file dynamic-inl.h.

References folly::dynamic::ARRAY, folly::dynamic::BOOL, c, folly::dynamic::DOUBLE, folly::format(), folly::dynamic::INT64, folly::dynamic::NULLT, folly::dynamic::OBJECT, folly::FormatArg::splitIntKey(), folly::FormatArg::splitKey(), and folly::dynamic::STRING.

1209  {
1210  auto& c = val_.container;
1211  switch (c.type()) {
1212  case dynamic::NULLT:
1213  case dynamic::BOOL:
1214  case dynamic::INT64:
1215  case dynamic::STRING:
1216  case dynamic::DOUBLE:
1217  FormatValue<dynamic>(c).format(arg, cb);
1218  break;
1219  case dynamic::ARRAY: {
1220  int key = arg.splitIntKey();
1221  if (key >= 0 && size_t(key) < c.size()) {
1222  FormatValue<dynamic>(c.at(key)).format(arg, cb);
1223  } else {
1224  FormatValue<V>(val_.defaultValue).format(arg, cb);
1225  }
1226  break;
1227  }
1228  case dynamic::OBJECT: {
1229  auto pos = c.find(arg.splitKey());
1230  if (pos != c.items().end()) {
1231  FormatValue<dynamic>(pos->second).format(arg, cb);
1232  } else {
1233  FormatValue<V>(val_.defaultValue).format(arg, cb);
1234  }
1235  break;
1236  }
1237  }
1238  }
void format(FormatArg &arg, FormatCallback &cb) const
Definition: dynamic-inl.h:1209
const detail::DefaultValueWrapper< dynamic, V > & val_
Definition: dynamic-inl.h:1241
char c

Member Data Documentation

template<class V >
const detail::DefaultValueWrapper<dynamic, V>& folly::FormatValue< detail::DefaultValueWrapper< dynamic, V > >::val_
private

Definition at line 1241 of file dynamic-inl.h.


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