ReportUnknownType -> report_unknown_type (https://github.com/cppformat/cppformat/issues/50)

This commit is contained in:
Victor Zverovich 2014-07-26 08:42:19 -07:00
parent b498ba0bc5
commit f634ccb344
2 changed files with 8 additions and 8 deletions

View File

@ -278,7 +278,7 @@ const uint64_t fmt::internal::POWERS_OF_10_64[] = {
ULongLong(1000000000) * ULongLong(1000000000) * 10 ULongLong(1000000000) * ULongLong(1000000000) * 10
}; };
void fmt::internal::ReportUnknownType(char code, const char *type) { void fmt::internal::report_unknown_type(char code, const char *type) {
if (std::isprint(static_cast<unsigned char>(code))) { if (std::isprint(static_cast<unsigned char>(code))) {
throw fmt::FormatError( throw fmt::FormatError(
fmt::format("unknown format code '{}' for {}", code, type)); fmt::format("unknown format code '{}' for {}", code, type));
@ -466,7 +466,7 @@ class fmt::internal::ArgFormatter :
void visit_pointer(const void *value) { void visit_pointer(const void *value) {
if (spec_.type_ && spec_.type_ != 'p') if (spec_.type_ && spec_.type_ != 'p')
fmt::internal::ReportUnknownType(spec_.type_, "pointer"); fmt::internal::report_unknown_type(spec_.type_, "pointer");
spec_.flags_ = fmt::HASH_FLAG; spec_.flags_ = fmt::HASH_FLAG;
spec_.type_ = 'x'; spec_.type_ = 'x';
writer_.write_int(reinterpret_cast<uintptr_t>(value), spec_); writer_.write_int(reinterpret_cast<uintptr_t>(value), spec_);
@ -522,7 +522,7 @@ void fmt::BasicWriter<Char>::write_double(T value, const FormatSpec &spec) {
upper = true; upper = true;
break; break;
default: default:
internal::ReportUnknownType(type, "double"); internal::report_unknown_type(type, "double");
break; break;
} }
@ -657,7 +657,7 @@ void fmt::BasicWriter<Char>::write_str(
// Check if StringChar is convertible to Char. // Check if StringChar is convertible to Char.
internal::CharTraits<Char>::convert(StringChar()); internal::CharTraits<Char>::convert(StringChar());
if (spec.type_ && spec.type_ != 's') if (spec.type_ && spec.type_ != 's')
internal::ReportUnknownType(spec.type_, "string"); internal::report_unknown_type(spec.type_, "string");
const StringChar *s = str.value; const StringChar *s = str.value;
std::size_t size = str.size; std::size_t size = str.size;
if (size == 0) { if (size == 0) {
@ -932,14 +932,14 @@ void fmt::internal::PrintfFormatter<Char>::Format(
break; break;
case Arg::POINTER: case Arg::POINTER:
if (spec.type_ && spec.type_ != 'p') if (spec.type_ && spec.type_ != 'p')
internal::ReportUnknownType(spec.type_, "pointer"); internal::report_unknown_type(spec.type_, "pointer");
spec.flags_= HASH_FLAG; spec.flags_= HASH_FLAG;
spec.type_ = 'x'; spec.type_ = 'x';
writer.write_int(reinterpret_cast<uintptr_t>(arg.pointer_value), spec); writer.write_int(reinterpret_cast<uintptr_t>(arg.pointer_value), spec);
break; break;
case Arg::CUSTOM: case Arg::CUSTOM:
if (spec.type_) if (spec.type_)
internal::ReportUnknownType(spec.type_, "object"); internal::report_unknown_type(spec.type_, "object");
arg.custom.format(&writer, arg.custom.value, "s"); arg.custom.format(&writer, arg.custom.value, "s");
break; break;
default: default:

View File

@ -426,7 +426,7 @@ struct IsLongDouble { enum {VALUE = 0}; };
template <> template <>
struct IsLongDouble<long double> { enum {VALUE = 1}; }; struct IsLongDouble<long double> { enum {VALUE = 1}; };
void ReportUnknownType(char code, const char *type); void report_unknown_type(char code, const char *type);
extern const uint32_t POWERS_OF_10_32[]; extern const uint32_t POWERS_OF_10_32[];
extern const uint64_t POWERS_OF_10_64[]; extern const uint64_t POWERS_OF_10_64[];
@ -1675,7 +1675,7 @@ void BasicWriter<Char>::write_int(T value, const Spec &spec) {
break; break;
} }
default: default:
internal::ReportUnknownType( internal::report_unknown_type(
spec.type(), spec.flag(CHAR_FLAG) ? "char" : "integer"); spec.type(), spec.flag(CHAR_FLAG) ? "char" : "integer");
break; break;
} }