23 template <
bool IsSigned>
27 unsigned max = std::numeric_limits<int>::max();
37 return value >= std::numeric_limits<int>::min() &&
38 value <= std::numeric_limits<int>::max();
53 return static_cast<int>(
value);
64 template <
typename T,
typename U>
78 template <
typename T =
void>
101 if (
sizeof(TargetType) <=
sizeof(
int)) {
137 template <
typename T>
159 template <
typename T>
162 UnsignedType width =
static_cast<UnsignedType
>(
value);
167 unsigned int_max = std::numeric_limits<int>::max();
170 return static_cast<unsigned>(width);
174 template <
typename Impl,
typename Char>
179 this->
write(
"(nil)");
190 if (fmt_spec.
type_ !=
's')
202 CharPtr out = CharPtr();
203 if (fmt_spec.
width_ > 1) {
207 std::fill_n(out, fmt_spec.
width_ - 1, fill);
208 out += fmt_spec.
width_ - 1;
210 std::fill_n(out + 1, fmt_spec.
width_ - 1, fill);
215 *out =
static_cast<Char
>(
value);
221 else if (this->
spec().type_ ==
'p')
224 this->
write(
"(null)");
236 const Char format_str[] = {
'}', 0};
237 const Char *
format = format_str;
243 template <
typename Char>
253 template <
typename Char,
typename ArgFormatter = Pr
intfArgFormatter<Char> >
261 unsigned arg_index = (std::numeric_limits<unsigned>::max)());
272 template <
typename Char,
typename AF>
298 template <
typename Char,
typename AF>
301 const char *error = 0;
302 Arg arg = arg_index == std::numeric_limits<unsigned>::max() ?
309 template <
typename Char,
typename AF>
312 unsigned arg_index = std::numeric_limits<unsigned>::max();
314 if (c >=
'0' && c <=
'9') {
332 parse_flags(spec, s);
334 if (*s >=
'0' && *s <=
'9') {
336 }
else if (*s ==
'*') {
343 template <
typename Char,
typename AF>
346 const Char *start = format_str.
c_str();
347 const Char *s = start;
350 if (c !=
'%')
continue;
352 write(writer, start, s);
356 write(writer, start, s - 1);
362 unsigned arg_index = parse_header(s, spec);
367 if (
'0' <= *s && *s <=
'9') {
369 }
else if (*s ==
'*') {
375 Arg arg = get_arg(s, arg_index);
378 if (spec.
fill_ ==
'0') {
420 spec.
type_ =
static_cast<char>(*s++);
423 switch (spec.
type_) {
437 AF(writer, spec).visit(
arg);
439 write(writer, start, s);
443 template <
typename Char>
Result visit(const Arg &arg)
const Char * c_str() const
void write_int(T value, Spec spec)
CharPtr grow_buffer(std::size_t n)
std::basic_string< Char > str() const
internal::CharTraits< Char >::CharPtr CharPtr
void visit_any_int(U value)
ArgConverter(internal::Arg &arg, wchar_t type)
void visit_bool(bool value)
FMT_DISALLOW_COPY_AND_ASSIGN(ArgConverter)
CharConverter(internal::Arg &arg)
void visit_any_int(T value)
FMT_DISALLOW_COPY_AND_ASSIGN(CharConverter)
bool visit_any_int(T value)
void report_unhandled_arg()
int visit_any_int(T value)
unsigned visit_any_int(T value)
FMT_DISALLOW_COPY_AND_ASSIGN(WidthHandler)
void report_unhandled_arg()
WidthHandler(FormatSpec &spec)
static constexpr bool value
unsigned parse_nonnegative_int(const Char *&s)
bool is_negative(T value)
void printf(BasicWriter< Char > &w, BasicCStringRef< Char > format, ArgList args)
FMT_FUNC int fprintf(std::ostream &os, CStringRef format, ArgList args)
internal::NamedArg< char > arg(StringRef name, const T &arg)
std::string format(CStringRef format_str, ArgList args)
std::string sprintf(CStringRef format, ArgList args)
BasicCStringRef< wchar_t > WCStringRef
FMT_GCC_EXTENSION typedef long long LongLong
BasicCStringRef< char > CStringRef
void write(const mValue &value, std::ostream &os, unsigned int options=0)
static bool fits_in_int(int)
static bool fits_in_int(T value)
static bool fits_in_int(T value)
static bool fits_in_int(bool)
ULongLong ulong_long_value