Flow123d
PE_user_fields-12e8aadde
|
Go to the documentation of this file.
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>
175 class BasicPrintfArgFormatter :
public ArgFormatterBase<Impl, Char> {
178 this->spec().type_ = 0;
179 this->
write(
"(nil)");
190 if (fmt_spec.
type_ !=
's')
191 return this->visit_any_int(
value);
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)");
230 this->spec().type_ = 0;
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>
498 #endif // FMT_PRINTF_H_
Result visit(const Arg &arg)
void report_unhandled_arg()
const Char * c_str() const
CharPtr grow_buffer(std::size_t n)
unsigned parse_nonnegative_int(const Char *&s)
bool is_negative(T value)
FMT_GCC_EXTENSION typedef long long LongLong
FMT_FUNC int fprintf(std::ostream &os, CStringRef format, ArgList args)
static constexpr bool value
static bool fits_in_int(bool)
FMT_DISALLOW_COPY_AND_ASSIGN(ArgConverter)
std::string sprintf(CStringRef format, ArgList args)
static bool fits_in_int(T value)
std::string format(CStringRef format_str, ArgList args)
ArgConverter(internal::Arg &arg, wchar_t type)
void visit_any_int(U value)
void write(const mValue &value, std::ostream &os, unsigned int options=0)
void visit_any_int(T value)
FMT_DISALLOW_COPY_AND_ASSIGN(WidthHandler)
std::basic_string< Char > str() const
ULongLong ulong_long_value
FMT_DISALLOW_COPY_AND_ASSIGN(CharConverter)
void visit_bool(bool value)
internal::CharTraits< Char >::CharPtr CharPtr
internal::NamedArg< char > arg(StringRef name, const T &arg)
void printf(BasicWriter< Char > &w, BasicCStringRef< Char > format, ArgList args)
static bool fits_in_int(T value)
void report_unhandled_arg()
int visit_any_int(T value)
unsigned visit_any_int(T value)
CharConverter(internal::Arg &arg)
WidthHandler(FormatSpec &spec)
void write_int(T value, Spec spec)
BasicCStringRef< wchar_t > WCStringRef
static bool fits_in_int(int)
BasicCStringRef< char > CStringRef
bool visit_any_int(T value)