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

Annotation of /smsdaemon/Util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26 - (hide annotations) (download)
Mon Jun 9 18:15:53 2008 UTC (15 years, 11 months ago) by torben
Original Path: smsdaemon/util.h
File MIME type: text/plain
File size: 840 byte(s)
Added first basic edition of smsdaemon.

So far sending & receiving sms works and a basic sample plugin is implemented.

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     void str_clean(std::string* str, std::string search, std::string replace = "");
16    
17     std::string readUrl(std::string url, std::string tempfile);
18    
19     std::string convertToUnicode(std::string);
20    
21     int uTimeDiff(const timeval& then, const timeval& now);
22     int mTimeDiff(const timeval& then, const timeval& now);
23    
24     inline void Sleep(unsigned int msec)
25     {
26     for (unsigned int i=0; i<msec; ++i)
27     usleep(1000);
28     }
29    
30     inline std::string str_tolower(std::string str)
31     {
32     for(unsigned int i=0; i<str.size();++i)
33     str[i] = tolower(str[i]);
34     return str;
35     }
36    
37     }
38    
39    
40    
41     #endif // __UTIL_H__

  ViewVC Help
Powered by ViewVC 1.1.20