Skip to content

Commit

Permalink
Make smt types work with explain_op
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof Leśniak authored and dnotestein committed Oct 2, 2024
1 parent fc95021 commit 090846f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions programs/util/explain_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <fc/crypto/ripemd160.hpp>
#include <fc/io/varint.hpp>
#include <fc/string.hpp>
#include <fc/uint128.hpp>

#include <iostream>
#include <string>
Expand All @@ -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<size_t N>
std::string to_string(const hive::protocol::fixed_string<N>& v);
Expand All @@ -42,6 +44,8 @@ std::string to_string(const fc::safe<T>& v);
template<typename T, size_t N>
std::string to_string(const fc::array<T, N>& v);
std::string to_string(const std::vector<char>& v);
template<typename T>
auto to_string(const T& v) -> std::enable_if_t<fc::reflector<T>::is_defined::value && fc::reflector<T>::is_enum::value, std::string>;

template <typename, typename = void>
struct is_to_string_invocable : std::false_type {};
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -328,6 +337,12 @@ std::string to_string(const std::vector<char>& v)
return fc::to_hex(v);
}

template<typename T>
auto to_string(const T& v) -> std::enable_if_t<fc::reflector<T>::is_defined::value && fc::reflector<T>::is_enum::value, std::string>
{
return fc::reflector<T>::to_string(v);
}

void chop(std::string& s, char prefix)
{
if (s.size() > 0 && s[0] == prefix)
Expand Down

0 comments on commit 090846f

Please sign in to comment.