From 30838707e8aa17da19c64db58cad6dbff6849cdf Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 1 Jan 2014 12:06:16 +0100 Subject: [PATCH] [DEBUG] generating of the output color text in error --- etk/Color.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/etk/Color.h b/etk/Color.h index fe12baf..5e96e02 100644 --- a/etk/Color.h +++ b/etk/Color.h @@ -11,6 +11,8 @@ #ifndef __ETK_COLOR_H__ #define __ETK_COLOR_H__ +#include + namespace etk { /** * @brief The color class is a template to abstract the color implementation choice. @@ -166,14 +168,18 @@ namespace etk { * @return The formated string */ std::string getHexString(void) const { - return "0x" + std::to_string(get(), std::hex); + std::ostringstream oss; + oss << "0x" << std::setw(8) << std::setfill('0') << std::hex << get(); + return oss.str(); }; /** * @brief Convert the color in an generic string value ("#FEDCBA98") * @return The formated string */ std::string getString(void) const { - return "#" + std::to_string(get(), std::hex); + std::ostringstream oss; + oss << "#" << std::setw(8) << std::setfill('0') << std::hex << get(); + return oss.str(); }; /** * @brief Get red color.