Subversion Repositories HomeAutomation

Rev

Rev 1011 | Rev 1026 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1011 Rev 1024
Line 32... Line 32...
32
#include <cmath>
32
#include <cmath>
33
#include <sys/types.h>
33
#include <sys/types.h>
34
#include <dirent.h>
34
#include <dirent.h>
35
 
35
 
36
string niceTime();
36
string niceTime();
37
 
-
 
38
unsigned int hex2uint(string hex);
37
unsigned int hex2uint(string hex);
39
 
-
 
40
string hex2bin(string hex);
38
string hex2bin(string hex);
41
string bin2hex(string bin);
39
string bin2hex(string bin);
42
 
-
 
43
float bin2float(string bin);
40
float bin2float(string bin);
44
string float2bin(float num, int length);
41
string float2bin(float num, int length);
45
 
-
 
46
unsigned int bin2uint(string bin);
42
unsigned int bin2uint(string bin);
47
string uint2bin(unsigned int num, int length);
43
string uint2bin(unsigned int num, int length);
48
 
-
 
49
string uint2hex(unsigned int num, int length);
44
string uint2hex(unsigned int num, int length);
50
 
-
 
51
vector<string> explode(string delimiter, string str);
45
vector<string> explode(string delimiter, string str);
52
string strtoupper(string s);
46
string strtoupper(string s);
53
string strtolower(string s);
47
string strtolower(string s);
54
string trim(string s);
48
string trim(string s);
55
string trim(const string s, char c);
49
string trim(const string s, char c);
Line 63... Line 57...
63
string file_get_contents(string filename);
57
string file_get_contents(string filename);
64
bool file_exists(string filename);
58
bool file_exists(string filename);
65
string escape(string in);
59
string escape(string in);
66
string rpad(string in, int length, char c);
60
string rpad(string in, int length, char c);
67
string lpad(string in, int length, char c);
61
string lpad(string in, int length, char c);
68
 
-
 
69
class FileTools
-
 
70
{
-
 
71
public:
-
 
72
    static vector<string> GetDirList(string path);
-
 
73
    static string GetUniqeFilename(string path, string prefix, string postfix);
-
 
74
    static string GetUniqeFilename(string path) { return GetUniqeFilename(path, "", ""); }
-
 
75
    static bool SaveFile(string filepath, string data);
-
 
76
    static string Get(string src);
-
 
77
    static bool Copy(string src, string dest);
-
 
78
    static bool Exist(string filename);
-
 
79
 
-
 
80
};
-
 
81
 
62
 
82
#endif // _TOOLS_H
63
#endif // _TOOLS_H