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

Annotation of /smsdaemon/Util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 158 - (hide annotations) (download)
Mon Dec 8 21:49:49 2008 UTC (15 years, 5 months ago) by torben
File MIME type: text/plain
File size: 1442 byte(s)
rename:
	util.* -> Util.*
	common.* -> Common.*

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     std::vector<std::string> str_split(std::string input, std::string delimiter);
13     void str_dump(const std::string& str);
14    
15 torben 38 std::string str_replace(std::string str, std::string search, std::string replace = "");
16     std::string str_striptags(std::string str);
17     std::string str_trim(std::string str);
18    
19 torben 43 std::string str_toupper(std::string str);
20     std::string str_tolower(std::string str);
21    
22 torben 59 std::string str_formatint(int i);
23    
24 torben 42 std::string str_replace_char(std::string str, char search, char replace);
25 torben 38 std::string str_characters(std::string str);
26    
27 torben 43 std::string str_gsm2latin(std::string str);
28     std::string str_latin2gsm(std::string str);
29    
30 torben 26 std::string readUrl(std::string url, std::string tempfile);
31    
32 torben 141 std::string iconv_wrapper(std::string _input, std::string to_format, std::string from_format);
33    
34 torben 26 std::string convertToUnicode(std::string);
35 torben 42 std::string convertFromUnicode(std::string);
36 torben 26
37     int uTimeDiff(const timeval& then, const timeval& now);
38     int mTimeDiff(const timeval& then, const timeval& now);
39    
40 torben 89 timeval GetTimeOfDay();
41    
42 torben 107 int my_system(const char* cmd, std::string* response = 0);
43 torben 86
44 torben 132 std::string readfile(std::string filename);
45 torben 89
46 torben 26 inline void Sleep(unsigned int msec)
47     {
48 torben 127 if (msec < 1000)
49     {
50     usleep(1000*msec);
51     }
52     else
53     {
54     for (unsigned int i=0; i<msec; ++i)
55     usleep(1000);
56     }
57 torben 26 }
58    
59     }
60    
61    
62    
63     #endif // __UTIL_H__

Properties

Name Value
svn:mergeinfo

  ViewVC Help
Powered by ViewVC 1.1.20