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

Annotation of /smsdaemon/Util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 196 - (hide annotations) (download)
Thu Dec 18 06:53:29 2008 UTC (15 years, 5 months ago) by torben
File MIME type: text/plain
File size: 1549 byte(s)
Make pretty

astyle -t -b -N

1 torben 26 #ifndef __UTIL_H__
2     #define __UTIL_H__
3    
4    
5     #include <string>
6     #include <vector>
7    
8     struct timeval;
9    
10     namespace Util
11     {
12 torben 185 //use whitespace
13     std::vector<std::string> str_split(std::string input);
14    
15 torben 26 std::vector<std::string> str_split(std::string input, std::string delimiter);
16     void str_dump(const std::string& str);
17    
18 torben 38 std::string str_replace(std::string str, std::string search, std::string replace = "");
19     std::string str_striptags(std::string str);
20     std::string str_trim(std::string str);
21    
22 torben 43 std::string str_toupper(std::string str);
23     std::string str_tolower(std::string str);
24    
25 torben 59 std::string str_formatint(int i);
26    
27 torben 42 std::string str_replace_char(std::string str, char search, char replace);
28 torben 38 std::string str_characters(std::string str);
29    
30 torben 43 std::string str_gsm2latin(std::string str);
31     std::string str_latin2gsm(std::string str);
32    
33 torben 193 // Deprecated:: use HttpClient instead
34     // std::string readUrl(std::string url, std::string tempfile);
35 torben 26
36 torben 141 std::string iconv_wrapper(std::string _input, std::string to_format, std::string from_format);
37    
38 torben 26 std::string convertToUnicode(std::string);
39 torben 42 std::string convertFromUnicode(std::string);
40 torben 26
41     int uTimeDiff(const timeval& then, const timeval& now);
42     int mTimeDiff(const timeval& then, const timeval& now);
43    
44 torben 89 timeval GetTimeOfDay();
45    
46 torben 107 int my_system(const char* cmd, std::string* response = 0);
47 torben 86
48 torben 132 std::string readfile(std::string filename);
49 torben 89
50 torben 26 inline void Sleep(unsigned int msec)
51     {
52 torben 196 if (msec < 1000)
53 torben 127 {
54     usleep(1000*msec);
55     }
56     else
57     {
58 torben 196 for (unsigned int i=0; i<msec; ++i)
59     usleep(1000);
60 torben 127 }
61 torben 26 }
62    
63     }
64    
65    
66    
67     #endif // __UTIL_H__

Properties

Name Value
svn:mergeinfo

  ViewVC Help
Powered by ViewVC 1.1.20