]> pilppa.org Git - lib1wire.git/blob - src/W1Util.hh
2ddf05adbc952dc3adc8e8b7c7000ff367a61744
[lib1wire.git] / src / W1Util.hh
1 /*
2  * W1Util.hh
3  *
4  *  Created on: Nov 14, 2010
5  *      Author: lamikr
6  */
7
8 #ifndef W1UTIL_HH_
9 #define W1UTIL_HH_
10
11 #include <fstream>
12 #include <string>
13 #include <vector>
14
15 #include "Date.hh"
16
17 #include <stdbool.h>
18 #include <dirent.h>
19 #include <stdbool.h>
20
21 #include "W1DataList.hh"
22
23 namespace w1 {
24         class W1Util {
25                 public:
26                         W1Util();
27                         virtual ~W1Util();
28                         static std::string concat_paths(std::string path_start, std::string path_end);
29                         static std::string concat_paths(const char *path_start, const char *path_end);
30                         static bool is_subdirectory(const char *path, dirent *direntry);
31                         static bool is_datafile(const char *path, dirent *direntry);
32                         static std::vector<std::string> get_subdirectories(const std::string& path);
33                         static std::vector<std::string> get_data_files(const std::string& path);
34                         static plp::Date parse_date_str(std::string date_str);
35                         static Data *parse_data_line(const std::string& dataline);
36                         static char *parse_directory_path(const char *file_path);
37                         static bool mkdirs(char *path);
38                         static std::ofstream *open_for_writing(const char *path);
39         };
40 }
41
42 #endif /* W1UTIL_HH_ */