/[projects]/smsdaemon/Util.h
ViewVC logotype

Annotation of /smsdaemon/Util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 42 - (hide annotations) (download)
Tue Jun 10 22:22:19 2008 UTC (15 years, 11 months ago) by torben
Original Path: smsdaemon/util.h
File MIME type: text/plain
File size: 1148 byte(s)
Added some character conversion rutines.

1 torben 26 #ifndef __UTIL_H__
2     #define __UTIL_H__
3    
4    
5     #include <string>
6     #include <vector>
7     #include <cctype>
8    
9     struct timeval;
10    
11     namespace Util
12     {
13     std::vector<std::string> str_split(std::string input, std::string delimiter);
14     void str_dump(const std::string& str);
15    
16 torben 38 std::string str_replace(std::string str, std::string search, std::string replace = "");
17     std::string str_striptags(std::string str);
18     std::string str_trim(std::string str);
19    
20 torben 42 std::string str_replace_char(std::string str, char search, char replace);
21 torben 38 std::string str_characters(std::string str);
22 torben 42 std::string str_gsm2latin1(std::string str);
23 torben 38
24 torben 26 std::string readUrl(std::string url, std::string tempfile);
25    
26     std::string convertToUnicode(std::string);
27 torben 42 std::string convertFromUnicode(std::string);
28 torben 26
29     int uTimeDiff(const timeval& then, const timeval& now);
30     int mTimeDiff(const timeval& then, const timeval& now);
31    
32     inline void Sleep(unsigned int msec)
33     {
34     for (unsigned int i=0; i<msec; ++i)
35     usleep(1000);
36     }
37    
38     inline std::string str_tolower(std::string str)
39     {
40     for(unsigned int i=0; i<str.size();++i)
41     str[i] = tolower(str[i]);
42     return str;
43     }
44    
45     }
46    
47    
48    
49     #endif // __UTIL_H__

  ViewVC Help
Powered by ViewVC 1.1.20