From 1183621867c0c8f927ff4219422376733914c7f0 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 15 Dec 2016 08:36:18 -0800 Subject: [PATCH] Add support for exotic character types --- fmt/format.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fmt/format.h b/fmt/format.h index e25c9712..8a0623f4 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -995,7 +995,7 @@ enum Type { INT, UINT, LONG_LONG, ULONG_LONG, BOOL, CHAR, LAST_INTEGER_TYPE = CHAR, // followed by floating-point types. DOUBLE, LONG_DOUBLE, LAST_NUMERIC_TYPE = LONG_DOUBLE, - CSTRING, STRING, WSTRING, POINTER, CUSTOM + CSTRING, STRING, TSTRING, POINTER, CUSTOM }; template @@ -1025,7 +1025,7 @@ struct Value { StringValue string; StringValue sstring; StringValue ustring; - StringValue wstring; // TODO: Char + StringValue tstring; CustomValue custom; }; }; @@ -1115,8 +1115,8 @@ typename std::result_of::type return vis(arg.string.value); case internal::STRING: return vis(StringRef(arg.string.value, arg.string.size)); - case internal::WSTRING: - return vis(WStringRef(arg.wstring.value, arg.wstring.size)); + case internal::TSTRING: + return vis(BasicStringRef(arg.tstring.value, arg.tstring.size)); case internal::POINTER: return vis(arg.pointer); case internal::CUSTOM: @@ -1320,14 +1320,14 @@ template <> constexpr Type gettype() { template <> constexpr Type gettype() { return internal::STRING; } template <> constexpr Type gettype() { return internal::STRING; } template <> constexpr Type gettype() { return internal::CSTRING; } -template <> constexpr Type gettype() { return internal::WSTRING; } +template <> constexpr Type gettype() { return internal::TSTRING; } template <> constexpr Type gettype() { - return internal::WSTRING; + return internal::TSTRING; } template <> constexpr Type gettype() { - return internal::WSTRING; + return internal::TSTRING; } -template <> constexpr Type gettype() { return internal::WSTRING; } +template <> constexpr Type gettype() { return internal::TSTRING; } template <> constexpr Type gettype() { return internal::POINTER; } template <> constexpr Type gettype() { return internal::POINTER; @@ -1371,8 +1371,8 @@ class MakeValue : public basic_format_arg { } void set_string(WStringRef str) { - this->wstring.value = str.data(); - this->wstring.size = str.size(); + this->tstring.value = str.data(); + this->tstring.size = str.size(); } // Formats an argument of a custom type, such as a user-defined class. @@ -1457,10 +1457,10 @@ class MakeValue : public basic_format_arg { set_string(value); \ } - FMT_MAKE_WSTR_VALUE(wchar_t *, WSTRING) - FMT_MAKE_WSTR_VALUE(const wchar_t *, WSTRING) - FMT_MAKE_WSTR_VALUE(const std::wstring &, WSTRING) - FMT_MAKE_WSTR_VALUE(WStringRef, WSTRING) + FMT_MAKE_WSTR_VALUE(wchar_t *, TSTRING) + FMT_MAKE_WSTR_VALUE(const wchar_t *, TSTRING) + FMT_MAKE_WSTR_VALUE(const std::wstring &, TSTRING) + FMT_MAKE_WSTR_VALUE(WStringRef, TSTRING) FMT_MAKE_VALUE(void *, pointer, POINTER) FMT_MAKE_VALUE(const void *, pointer, POINTER)