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

Contents of /smsdaemon/util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 89 - (show annotations) (download)
Mon Jun 16 10:09:17 2008 UTC (15 years, 11 months ago) by torben
File MIME type: text/plain
File size: 1206 byte(s)
Easier access to gettimeofday()

1 #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 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 std::string str_toupper(std::string str);
20 std::string str_tolower(std::string str);
21
22 std::string str_formatint(int i);
23
24 std::string str_replace_char(std::string str, char search, char replace);
25 std::string str_characters(std::string str);
26
27 std::string str_gsm2latin(std::string str);
28 std::string str_latin2gsm(std::string str);
29
30 std::string readUrl(std::string url, std::string tempfile);
31
32 std::string convertToUnicode(std::string);
33 std::string convertFromUnicode(std::string);
34
35 int uTimeDiff(const timeval& then, const timeval& now);
36 int mTimeDiff(const timeval& then, const timeval& now);
37
38 timeval GetTimeOfDay();
39
40 int my_system(const char* cmd);
41
42
43 inline void Sleep(unsigned int msec)
44 {
45 for (unsigned int i=0; i<msec; ++i)
46 usleep(1000);
47 }
48
49 }
50
51
52
53 #endif // __UTIL_H__

  ViewVC Help
Powered by ViewVC 1.1.20