From b1eb9982d1cd7b332c6e9ad7d01f9fcb21df42f0 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 27 Apr 2016 16:05:16 +1000 Subject: [PATCH] introspection: add more types to type_string --- introspection.cpp | 4 ++-- introspection.hpp | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/introspection.cpp b/introspection.cpp index d0fb43ae..6f3f380a 100644 --- a/introspection.cpp +++ b/introspection.cpp @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2015 Danny Robson + * Copyright 2015-2016 Danny Robson */ #include "introspection.hpp" @@ -35,4 +35,4 @@ constexpr char util::type_string::value[]; constexpr char util::type_string::value[]; constexpr char util::type_string::value[]; -constexpr char util::type_string::value[]; +constexpr char util::type_string::value[]; diff --git a/introspection.hpp b/introspection.hpp index 6b62b87f..c556ef1b 100644 --- a/introspection.hpp +++ b/introspection.hpp @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2015 Danny Robson + * Copyright 2015-2016 Danny Robson */ #ifndef __UTIL_INTROSPECTION_HPP @@ -21,6 +21,7 @@ #include "./variadic.hpp" #include +#include #include #include @@ -34,6 +35,9 @@ namespace util { template <> struct type_string { 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_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"; }; @@ -48,19 +52,18 @@ namespace util { template <> struct type_string { 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[] = "string"; }; - 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 constexpr const char* type_string_v = type_string::value; template - auto + const char* to_string (void) - { - return type_string::value; - } + { return type_string_v; } + /////////////////////////////////////////////////////////////////////////// /// Lists valid values of an enumeration