| Rev | Line | |
|---|
| [7609] | 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 isReadeable(); |
|---|
| 37 | bool isWriteable(); |
|---|
| 38 | bool isExecutable(); |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | bool copy(const File& destination); |
|---|
| 42 | bool rename(const File& destination); |
|---|
| 43 | bool touch(); |
|---|
| 44 | bool remove(); |
|---|
| 45 | |
|---|
| 46 | static void relToAbs(std::string& fileName); |
|---|
| 47 | |
|---|
| 48 | private: |
|---|
| 49 | void homeDirCheck(std::string& fileName); |
|---|
| 50 | |
|---|
| 51 | private: |
|---|
| 52 | int _handle; //!< The FileHandle (if set). |
|---|
| 53 | std::string name; //!< The Name of the File. |
|---|
| 54 | }; |
|---|
| 55 | |
|---|
| 56 | #endif /* __FILE_H_ */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.