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