From 090846feb8fbb5c28ee24ca12c1afad0dafb48cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Le=C5=9Bniak?= Date: Wed, 2 Oct 2024 14:10:00 +0200 Subject: [PATCH] Make smt types work with explain_op --- programs/util/explain_op.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/programs/util/explain_op.cpp b/programs/util/explain_op.cpp index 30929f5a90..e6f5e8224b 100644 --- a/programs/util/explain_op.cpp +++ b/programs/util/explain_op.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -22,6 +23,7 @@ std::string to_string(uint8_t v); std::string to_string(uint16_t v); std::string to_string(uint32_t v); std::string to_string(uint64_t v); +std::string to_string(fc::uint128_t v); std::string to_string(const fc::unsigned_int& v); template std::string to_string(const hive::protocol::fixed_string& v); @@ -42,6 +44,8 @@ std::string to_string(const fc::safe& v); template std::string to_string(const fc::array& v); std::string to_string(const std::vector& v); +template +auto to_string(const T& v) -> std::enable_if_t::is_defined::value && fc::reflector::is_enum::value, std::string>; template struct is_to_string_invocable : std::false_type {}; @@ -235,6 +239,11 @@ std::string to_string(uint64_t v) return std::to_string(v); } +std::string to_string(fc::uint128_t v) +{ + return std::to_string(v); +} + std::string to_string(const fc::unsigned_int& v) { return std::to_string(v.value); @@ -328,6 +337,12 @@ std::string to_string(const std::vector& v) return fc::to_hex(v); } +template +auto to_string(const T& v) -> std::enable_if_t::is_defined::value && fc::reflector::is_enum::value, std::string> +{ + return fc::reflector::to_string(v); +} + void chop(std::string& s, char prefix) { if (s.size() > 0 && s[0] == prefix)