diff options
Diffstat (limited to 'Master/Modellbildung_und_Simulation/Aufgabenblatt1/SineGenerator/src/Util.h')
| -rw-r--r-- | Master/Modellbildung_und_Simulation/Aufgabenblatt1/SineGenerator/src/Util.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt1/SineGenerator/src/Util.h b/Master/Modellbildung_und_Simulation/Aufgabenblatt1/SineGenerator/src/Util.h new file mode 100644 index 0000000..6c98299 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt1/SineGenerator/src/Util.h @@ -0,0 +1,62 @@ +/* + * 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(double 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 unsigned short ToUShort(Glib::ustring& val) + { + std::istringstream buffer(val.raw()); + unsigned short 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_ */ |
