From ef659927c466a96c987cd975d718cccc7030ea00 Mon Sep 17 00:00:00 2001 From: fpaparel Date: Tue, 21 Feb 2006 11:29:05 +0000 Subject: [PATCH] - Die tortoise-svn die git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@368 3ecf2c5c-341e-0410-92b4-d18e462d057c --- src/backend/string_utils.cc | 19 ++++++++++++++++++- src/backend/string_utils.hh | 7 ++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/backend/string_utils.cc b/src/backend/string_utils.cc index f9f2937..5400be7 100644 --- a/src/backend/string_utils.cc +++ b/src/backend/string_utils.cc @@ -20,6 +20,7 @@ #include "string_utils.hh" +using namespace std; using Glib::ustring; /** @@ -94,4 +95,20 @@ int_to_string(const int& num, ustring& str) str = '-' + str; } - +void +float_to_string(const float& f, Glib::ustring& str) +{ + stringstream ss; + ss << f; + char p[20]; + ss.getline(p,20); + str = p; +} + +void +string_to_float(const Glib::ustring& str, float& f) +{ + stringstream ss; + ss << str; + ss >> f; +} diff --git a/src/backend/string_utils.hh b/src/backend/string_utils.hh index 4447f05..b0f44a8 100644 --- a/src/backend/string_utils.hh +++ b/src/backend/string_utils.hh @@ -22,13 +22,18 @@ #define STRING_UTILS_HH 1 #include "config.h" +#include +#include #include "glibmm/ustring.h" bool SG_DLLEXPORT string_to_int(const Glib::ustring&, int&); void SG_DLLEXPORT int_to_string(const int&, Glib::ustring&); + + void SG_DLLEXPORT float_to_string(const float&, Glib::ustring&); + + void SG_DLLEXPORT string_to_float(const Glib::ustring&, float&); #endif -