From 546b04b846b39666ab16b4e212cc17ded320faf9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 10 Apr 2013 17:05:46 +0200 Subject: [PATCH] CComponentsText: add helper to convert integer to string --- src/gui/components/cc.h | 2 ++ src/gui/components/cc_item_text.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 55a8418a6..3dfa32763 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -164,6 +164,8 @@ class CComponentsText : public CComponentsItem const char* ct_text; bool ct_text_sent, ct_paint_textbg; + std::string iToString(int int_val); //helper to convert int to string + void initVarText(); void clearCCText(); void initCCText(); diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index f06380b07..67c89fa24 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -31,6 +31,7 @@ #include #include #include "cc.h" +#include using namespace std; @@ -206,3 +207,14 @@ void CComponentsText::removeLineBreaks(std::string& str) spos = str.find_first_of("\r\n"); } } + + +//helper, converts int to string +string CComponentsText::iToString(int int_val) +{ + int i = int_val; + ostringstream i_str; + i_str << i; + string i_string(i_str.str()); + return i_string; +}