From 25a9c6fafcd96e4f6ee596fe9e4a7da7de7d4933 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 28 Jul 2016 13:45:09 +1000 Subject: [PATCH] introspection: rename type_string to type_name --- introspection.cpp | 28 ++++++++++++++-------------- introspection.hpp | 46 ++++++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 38 deletions(-) diff --git a/introspection.cpp b/introspection.cpp index 6f3f380a..fc14b51c 100644 --- a/introspection.cpp +++ b/introspection.cpp @@ -18,21 +18,21 @@ /////////////////////////////////////////////////////////////////////////////// -constexpr char util::type_string::value[]; +constexpr char util::type_name::value[]; -constexpr char util::type_string< int8_t>::value[]; -constexpr char util::type_string< int16_t>::value[]; -constexpr char util::type_string< int32_t>::value[]; -constexpr char util::type_string< int64_t>::value[]; +constexpr char util::type_name< int8_t>::value[]; +constexpr char util::type_name< int16_t>::value[]; +constexpr char util::type_name< int32_t>::value[]; +constexpr char util::type_name< int64_t>::value[]; -constexpr char util::type_string< uint8_t>::value[]; -constexpr char util::type_string::value[]; -constexpr char util::type_string::value[]; -constexpr char util::type_string::value[]; +constexpr char util::type_name< uint8_t>::value[]; +constexpr char util::type_name::value[]; +constexpr char util::type_name::value[]; +constexpr char util::type_name::value[]; -constexpr char util::type_string::value[]; -constexpr char util::type_string::value[]; +constexpr char util::type_name::value[]; +constexpr char util::type_name::value[]; -constexpr char util::type_string::value[]; -constexpr char util::type_string::value[]; -constexpr char util::type_string::value[]; +constexpr char util::type_name::value[]; +constexpr char util::type_name::value[]; +constexpr char util::type_name::value[]; diff --git a/introspection.hpp b/introspection.hpp index c556ef1b..775f6c27 100644 --- a/introspection.hpp +++ b/introspection.hpp @@ -29,40 +29,38 @@ namespace util { template < typename T > - struct type_string { - // static const std::string value - }; + struct type_name { }; - template <> struct type_string { static constexpr const char value[] = "bool"; }; + template <> struct type_name { static constexpr const char value[] = "bool"; }; - template <> struct type_string { static constexpr const char value[] = "char"; }; - template <> struct type_string { static constexpr const char value[] = "void*"; }; + template <> struct type_name { static constexpr const char value[] = "char"; }; + template <> struct type_name { static constexpr const char value[] = "void*"; }; - template <> struct type_string< int8_t> { static constexpr const char value[] = "int8"; }; - template <> struct type_string< int16_t> { static constexpr const char value[] = "int16"; }; - template <> struct type_string< int32_t> { static constexpr const char value[] = "int32"; }; - template <> struct type_string< int64_t> { static constexpr const char value[] = "int64"; }; + template <> struct type_name< int8_t> { static constexpr const char value[] = "int8"; }; + template <> struct type_name< int16_t> { static constexpr const char value[] = "int16"; }; + template <> struct type_name< int32_t> { static constexpr const char value[] = "int32"; }; + template <> struct type_name< int64_t> { static constexpr const char value[] = "int64"; }; - template <> struct type_string< uint8_t> { static constexpr const char value[] = "uint8"; }; - template <> struct type_string { static constexpr const char value[] = "uint16"; }; - template <> struct type_string { static constexpr const char value[] = "uint32"; }; - template <> struct type_string { static constexpr const char value[] = "uint64"; }; + template <> struct type_name< uint8_t> { static constexpr const char value[] = "uint8"; }; + template <> struct type_name { static constexpr const char value[] = "uint16"; }; + template <> struct type_name { static constexpr const char value[] = "uint32"; }; + template <> struct type_name { static constexpr const char value[] = "uint64"; }; - template <> struct type_string { static constexpr const char value[] = "float32"; }; - template <> struct type_string { static constexpr const char value[] = "float64"; }; + template <> struct type_name { static constexpr const char value[] = "float32"; }; + template <> struct type_name { static constexpr const char value[] = "float64"; }; - template <> struct type_string { static constexpr const char value[] = "string"; }; - template <> struct type_string { static constexpr const char value[] = "cstring"; }; - template <> struct type_string { static constexpr const char value[] = "cstring"; }; + template <> struct type_name { static constexpr const char value[] = "string"; }; + template <> struct type_name { static constexpr const char value[] = "cstring"; }; + template <> struct type_name { static constexpr const char value[] = "cstring"; }; template constexpr - const char* type_string_v = type_string::value; + const char* type_name_v = type_name::value; template const char* to_string (void) - { return type_string_v; } + { return type_name_v; } /////////////////////////////////////////////////////////////////////////// @@ -107,7 +105,7 @@ namespace util { }; \ \ template <> \ - struct type_string<::NS::E> { \ + struct type_name<::NS::E> { \ static constexpr const char ns[] = #NS; \ static constexpr const char value[] = #E; \ }; \ @@ -134,10 +132,10 @@ namespace util { > util::enum_traits<::NS::E>::names; \ \ constexpr \ - const char util::type_string<::NS::E>::ns[]; \ + const char util::type_name<::NS::E>::ns[]; \ \ constexpr \ - const char util::type_string<::NS::E>::value[]; \ + const char util::type_name<::NS::E>::value[]; \ ///------------------------------------------------------------------------