From 76179f264b0c2da54dc11e0c3b0c3244ea6bdc81 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 11 Mar 2016 13:15:50 +1100 Subject: [PATCH] introspection: add fundamental types for type_string --- introspection.cpp | 9 +++++++++ introspection.hpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/introspection.cpp b/introspection.cpp index a629f082..5e0c956f 100644 --- a/introspection.cpp +++ b/introspection.cpp @@ -18,8 +18,17 @@ /////////////////////////////////////////////////////////////////////////////// +constexpr char util::type_string::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_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_string::value[]; constexpr char util::type_string::value[]; diff --git a/introspection.hpp b/introspection.hpp index 521323ad..f174b5bb 100644 --- a/introspection.hpp +++ b/introspection.hpp @@ -31,9 +31,18 @@ namespace util { // static const std::string value }; + template <> struct type_string { static constexpr const char value[] = "bool"; }; + + 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_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_string { static constexpr const char value[] = "float32"; }; template <> struct type_string { static constexpr const char value[] = "float64"; };