Line | |
---|
1 | /*! |
---|
2 | * @file file.h |
---|
3 | * @brief Definition of File Handler class |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef __FILE_H_ |
---|
7 | #define __FILE_H_ |
---|
8 | |
---|
9 | |
---|
10 | #include <string> |
---|
11 | |
---|
12 | class File |
---|
13 | { |
---|
14 | public: |
---|
15 | typedef enum |
---|
16 | { |
---|
17 | ReadOnly, |
---|
18 | WriteOnly, |
---|
19 | ReadWrite, |
---|
20 | Append, |
---|
21 | } OpenMode; |
---|
22 | |
---|
23 | public: |
---|
24 | File(); |
---|
25 | File(const std::string& fileName); |
---|
26 | File(const File& file); |
---|
27 | ~File(); |
---|
28 | |
---|
29 | virtual bool open(OpenMode mode); |
---|
30 | virtual bool close(); |
---|
31 | int handle(); |
---|
32 | |
---|
33 | bool exists(); |
---|
34 | bool isLink(); // only on UNIX |
---|
35 | bool isFile(); |
---|
36 | bool isDirectory(); |
---|
37 | bool isReadeable(); |
---|
38 | bool isWriteable(); |
---|
39 | bool isExecutable(); |
---|
40 | |
---|
41 | |
---|
42 | bool copy(const File& destination); |
---|
43 | bool rename(const File& destination); |
---|
44 | bool touch(); |
---|
45 | bool remove(); |
---|
46 | |
---|
47 | static void relToAbs(std::string& fileName); |
---|
48 | static void absToRel(std::string& fileName); |
---|
49 | static const std::string& cwd(); |
---|
50 | |
---|
51 | private: |
---|
52 | void homeDirCheck(std::string& fileName); |
---|
53 | |
---|
54 | private: |
---|
55 | int _handle; //!< The FileHandle (if set). |
---|
56 | std::string name; //!< The Name of the File. |
---|
57 | |
---|
58 | static std::string _cwd; //!< The currend Working directory. |
---|
59 | }; |
---|
60 | |
---|
61 | #endif /* __FILE_H_ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.