- Die tortoise-svn die

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@368 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
fpaparel 2006-02-21 11:29:05 +00:00
parent 0de370f4d3
commit ef659927c4
2 changed files with 24 additions and 2 deletions

View File

@ -20,6 +20,7 @@
#include "string_utils.hh" #include "string_utils.hh"
using namespace std;
using Glib::ustring; using Glib::ustring;
/** /**
@ -94,4 +95,20 @@ int_to_string(const int& num, ustring& str)
str = '-' + 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;
}

View File

@ -22,13 +22,18 @@
#define STRING_UTILS_HH 1 #define STRING_UTILS_HH 1
#include "config.h" #include "config.h"
#include <sstream>
#include <iostream>
#include "glibmm/ustring.h" #include "glibmm/ustring.h"
bool SG_DLLEXPORT string_to_int(const Glib::ustring&, int&); bool SG_DLLEXPORT string_to_int(const Glib::ustring&, int&);
void SG_DLLEXPORT int_to_string(const int&, Glib::ustring&); 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 #endif