1 #ifndef __TX_UCM_UTILS__
2 #define __TX_UCM_UTILS__
14 inline std::string trimString (std::string& str) {
15 std::string::size_type pos = str.find_last_not_of (
' ');
16 if (pos != std::string::npos) {
18 pos = str.find_first_not_of (
' ');
19 if (pos != std::string::npos) str.erase (0, pos);
21 else str.erase (str.begin(), str.end());
32 inline std::string itoa (
int integer) {
33 std::ostringstream str;
35 return str.str ().c_str ();
45 inline const char* getEnv (
const char* variable) {
46 return (getenv (variable) ? getenv (variable) :
"orphan");
55 inline const char* getTimeStamp () {
63 std::ostringstream date;
64 date << (tm->tm_year + 1900);
69 date << (tm->tm_mon + 1);
71 if (tm->tm_mday < 10) {
78 std::ostringstream time;
79 if (tm->tm_hour < 10) {
84 if (tm->tm_min < 10) {
89 if (tm->tm_sec < 10) {