28 #include <type_traits> 31 #include "platform/core.h" 63 unsigned long long as_uint;
66 const char* as_string;
67 const void* as_pointer;
100 template <TraceArgument::Type T>
101 inline std::string internal_to_string();
108 template <
typename T>
124 "TraceArgument must be 8 or less bytes");
134 #define ARGUMENT_CONVERSION(src, dst) \ 136 inline constexpr TraceArgument::TraceArgument(src arg) : as_##dst(arg) {} \ 138 class TraceArgumentConversion<src> { \ 140 inline static constexpr TraceArgument::Type getType() { \ 141 return TraceArgument::Type::is_##dst; \ 144 inline static constexpr TraceArgument asArgument(src arg) { \ 145 return TraceArgument(arg); \ 188 #undef ARGUMENT_CONVERSION 198 return TraceArgument::Type::is_pointer;
211 std::stringstream ss;
214 return as_bool ?
"true" :
"false";
216 return std::to_string(as_int);
218 return std::to_string(as_uint);
219 case Type::is_double:
220 return std::to_string(as_double);
221 case Type::is_pointer:
223 return "\"" + ss.str() +
"\"";
224 case Type::is_string:
225 return "\"" + std::string(as_string) +
"\"";
226 case Type::is_istring:
227 return "\"" + std::string(as_istring) +
"\"";
229 return std::string(
"\"Type::is_none\"");
231 throw std::invalid_argument(
"Invalid TraceArgument type");
Type
Definition: trace_argument.h:51
Definition: trace_argument.h:109
Definition: trace_argument.h:47
std::string to_string(TraceArgument::Type type) const
Definition: trace_argument.h:209
Definition: trace_argument.h:38
#define ARGUMENT_CONVERSION(src, dst)
Definition: trace_argument.h:134
Definition: category_registry.h:32