blob: 3ff7d76387cd1dc428d261b7f46fe4a93fad41e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/*
* Util.h
*
* Created on: 31.03.2011
* Author: sven
*/
#ifndef UTIL_H_
#define UTIL_H_
#ifndef _GLIBCXX_SSTREAM
#include <sstream>
#endif
#ifndef _GLIBMM_USTRING_H
#include <glibmm/ustring.h>
#endif
class Util
{
public:
static Glib::ustring ToUString(unsigned short val)
{
std::ostringstream ssIn;
ssIn << val;
Glib::ustring res = ssIn.str();
return res;
}
static Glib::ustring ToUString(short val)
{
std::ostringstream ssIn;
ssIn << val;
Glib::ustring res = ssIn.str();
return res;
}
static Glib::ustring ToUString(unsigned val)
{
std::ostringstream ssIn;
ssIn << val;
Glib::ustring res = ssIn.str();
return res;
}
static Glib::ustring ToUString(double val)
{
std::ostringstream ssIn;
ssIn << val;
Glib::ustring res = ssIn.str();
return res;
}
static unsigned short ToUShort(Glib::ustring& val)
{
std::istringstream buffer(val.raw());
unsigned short res;
buffer >> res;
return res;
}
static unsigned ToUint(Glib::ustring& val)
{
std::istringstream buffer(val.raw());
unsigned res;
buffer >> res;
return res;
}
static short ToShort(Glib::ustring& val)
{
std::istringstream buffer(val.raw());
short res;
buffer >> res;
return res;
}
};
#endif /* UTIL_H_ */
|