summaryrefslogtreecommitdiffstats
path: root/Master/Modellbildung_und_Simulation/Aufgabenblatt1/DFTApp/src/Util.h
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Modellbildung_und_Simulation/Aufgabenblatt1/DFTApp/src/Util.h
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Modellbildung_und_Simulation/Aufgabenblatt1/DFTApp/src/Util.h')
-rw-r--r--Master/Modellbildung_und_Simulation/Aufgabenblatt1/DFTApp/src/Util.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt1/DFTApp/src/Util.h b/Master/Modellbildung_und_Simulation/Aufgabenblatt1/DFTApp/src/Util.h
new file mode 100644
index 0000000..c1f7130
--- /dev/null
+++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt1/DFTApp/src/Util.h
@@ -0,0 +1,89 @@
+/*
+ * Util.h
+ *
+ * Created on: 31.03.2011
+ * Author: sven
+ */
+
+#ifndef UTIL_H_
+#define UTIL_H_
+
+#ifndef _GLIBCXX_SSTREAM
+ #include <sstream>
+#endif
+
+#include <iomanip>
+
+#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(int val)
+ {
+ std::ostringstream ssIn;
+ ssIn << val;
+ Glib::ustring res = ssIn.str();
+ return res;
+ }
+
+ static Glib::ustring ToUString(double val)
+ {
+ std::ostringstream ssIn;
+ ssIn << std::setprecision(12) << std::fixed << 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_ */