Last change
on this file since 7622 was
7622,
checked in by bensch, 18 years ago
|
orxonox/qt_gui: all functions implemented so far
|
File size:
1.6 KB
|
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> |
---|
[7616] | 11 | typedef struct stat; |
---|
[7609] | 12 | |
---|
| 13 | class File |
---|
| 14 | { |
---|
| 15 | public: |
---|
| 16 | typedef enum |
---|
| 17 | { |
---|
| 18 | ReadOnly, |
---|
| 19 | WriteOnly, |
---|
| 20 | ReadWrite, |
---|
| 21 | Append, |
---|
| 22 | } OpenMode; |
---|
| 23 | |
---|
| 24 | public: |
---|
[7621] | 25 | File(); |
---|
[7609] | 26 | File(const std::string& fileName); |
---|
| 27 | File(const File& file); |
---|
| 28 | ~File(); |
---|
[7621] | 29 | void setFileName(const std::string& fileName); |
---|
| 30 | File& operator=(const std::string& fileName); |
---|
| 31 | File& operator=(const File& file); |
---|
| 32 | bool operator==(const std::string& fileName) const; |
---|
| 33 | bool operator==(const File& file) const; |
---|
[7609] | 34 | |
---|
| 35 | virtual bool open(OpenMode mode); |
---|
| 36 | virtual bool close(); |
---|
[7621] | 37 | int handle() const { return this->_handle; }; |
---|
[7609] | 38 | |
---|
[7616] | 39 | /** @returns the FileName of this File */ |
---|
| 40 | const std::string& name() const { return this->_name; }; |
---|
| 41 | |
---|
[7620] | 42 | bool exists() const; |
---|
| 43 | bool isLink() const; |
---|
| 44 | bool isFile() const ; |
---|
| 45 | bool isDirectory() const; |
---|
| 46 | bool isReadeable() const; |
---|
| 47 | bool isWriteable() const; |
---|
| 48 | bool isExecutable() const; |
---|
[7609] | 49 | |
---|
| 50 | |
---|
| 51 | bool copy(const File& destination); |
---|
| 52 | bool rename(const File& destination); |
---|
| 53 | bool touch(); |
---|
| 54 | bool remove(); |
---|
| 55 | |
---|
[7621] | 56 | static void relToAbs(std::string& relFileName); |
---|
| 57 | static void absToRel(std::string& absFileName); |
---|
[7611] | 58 | static const std::string& cwd(); |
---|
[7609] | 59 | |
---|
| 60 | private: |
---|
[7616] | 61 | void init(); |
---|
[7621] | 62 | void statFile(); |
---|
[7609] | 63 | void homeDirCheck(std::string& fileName); |
---|
| 64 | |
---|
| 65 | private: |
---|
[7611] | 66 | int _handle; //!< The FileHandle (if set). |
---|
[7616] | 67 | std::string _name; //!< The Name of the File. |
---|
| 68 | stat* _status; //!< The Stat of the File. |
---|
[7611] | 69 | |
---|
| 70 | static std::string _cwd; //!< The currend Working directory. |
---|
[7616] | 71 | |
---|
[7609] | 72 | }; |
---|
| 73 | |
---|
[7611] | 74 | #endif /* __FILE_H_ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.