|
Derived const & | asDerived () const |
|
template<size_t K, class Callback > |
std::enable_if< K==valueCount >::type | doFormatFrom (size_t i, FormatArg &arg, Callback &) const |
|
template<size_t K, class Callback > |
std::enable_if<(K< valueCount)>::type | doFormatFrom (size_t i, FormatArg &arg, Callback &cb) const |
|
template<class Callback > |
void | doFormat (size_t i, FormatArg &arg, Callback &cb) const |
|
template<size_t K> |
std::enable_if< K==valueCount, int >::type | getSizeArgFrom (size_t i, const FormatArg &arg) const |
|
template<class T > |
std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value, int >::type | getValue (const FormatValue< T > &format, const FormatArg &) const |
|
template<class T > |
std::enable_if< !std::is_integral< T >::value||std::is_same< T, bool >::value, int >::type | getValue (const FormatValue< T > &, const FormatArg &arg) const |
|
template<class Derived, bool containerMode, class... Args>
class folly::BaseFormatter< Derived, containerMode, Args >
Formatter class.
Note that this class is tricky, as it keeps references to its lvalue arguments (while it takes ownership of the temporaries), and it doesn't copy the passed-in format string. Thankfully, you can't use this directly, you have to use format(...) below.
Definition at line 72 of file Format.h.
template<class Derived , bool containerMode, class... Args>
template<class Output >
Append to output. out(StringPiece sp) may be called (more than once)
Definition at line 169 of file Format-inl.h.
References testing::Args(), folly::test::end(), and s.
178 auto q =
static_cast<const char*
>(memchr(p,
'}',
size_t(
end - p)));
187 if (p ==
end || *p !=
'}') {
188 throw_exception<BadFormatArg>(
189 "folly::format: single '}' in format string");
195 auto p = str_.begin();
196 auto end = str_.end();
199 bool hasDefaultArgIndex =
false;
200 bool hasExplicitArgIndex =
false;
202 auto q =
static_cast<const char*
>(memchr(p,
'{',
size_t(
end - p)));
211 throw_exception<BadFormatArg>(
212 "folly::format: '}' at end of format string");
223 q =
static_cast<const char*
>(memchr(p,
'}',
size_t(
end - p)));
225 throw_exception<BadFormatArg>(
"folly::format: missing ending '}'");
231 auto piece = arg.splitKey<
true>();
235 "dynamic field width not supported in vformat()");
237 arg.setNextIntKey(nextArg++);
238 hasDefaultArgIndex =
true;
240 arg.setNextKey(piece);
241 hasExplicitArgIndex =
true;
248 "cannot provide width arg index without value arg index");
249 int sizeArg = nextArg++;
250 arg.width =
asDerived().getSizeArg(
size_t(sizeArg), arg);
253 argIndex = nextArg++;
254 hasDefaultArgIndex =
true;
259 "cannot provide value arg index without width arg index");
260 arg.width =
asDerived().getSizeArg(
size_t(arg.widthIndex), arg);
264 argIndex = to<int>(piece);
265 }
catch (
const std::out_of_range&) {
266 arg.error(
"argument index must be integer");
268 arg.enforce(argIndex >= 0,
"argument index must be non-negative");
269 hasExplicitArgIndex =
true;
273 if (hasDefaultArgIndex && hasExplicitArgIndex) {
274 throw_exception<BadFormatArg>(
275 "folly::format: may not have both default and explicit arg indexes");
278 asDerived().doFormat(
size_t(argIndex), arg, out);
auto end(TestAdlIterable &instance)
Range< const char * > StringPiece