diff --git a/Util.h b/Util.h index bd048f6..5933c15 100644 --- a/Util.h +++ b/Util.h @@ -51,6 +51,7 @@ } +// TODO: perhaps rename this function, it converts the string "#010203" to the int 0x010203 inline static unsigned int str2col(std::string str) { if (str[0] == '#') @@ -64,3 +65,14 @@ return (float)atof(str.c_str()); } + +// TODO: this doesn't work for any T, should work for int, perhaps need to add an std::enable_if +template +inline static std::string int2hex(const T& value) +{ + std::ostringstream oss; + oss << std::hex << value; + return oss.str(); +} + +