Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/qt_gui/src/lib/util/file.h @ 7620

Last change on this file since 7620 was 7620, checked in by bensch, 18 years ago

some cool consts

File size: 1.3 KB
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>
11typedef struct stat;
12
13class File
14{
15  public:
16  typedef enum
17  {
18    ReadOnly,
19    WriteOnly,
20    ReadWrite,
21    Append,
22  } OpenMode;
23
24public:
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  /** @returns the FileName of this File */
34  const std::string& name() const { return this->_name; };
35
36  bool exists() const;
37  bool isLink() const;
38  bool isFile() const ;
39  bool isDirectory() const;
40  bool isReadeable() const;
41  bool isWriteable() const;
42  bool isExecutable() const;
43
44
45  bool copy(const File& destination);
46  bool rename(const File& destination);
47  bool touch();
48  bool remove();
49
50  static void relToAbs(std::string& fileName);
51  static void absToRel(std::string& fileName);
52  static const std::string& cwd();
53
54  private:
55    void init();
56    bool statFile();
57    void homeDirCheck(std::string& fileName);
58
59  private:
60    int                 _handle;          //!< The FileHandle (if set).
61    std::string         _name;            //!< The Name of the File.
62    stat*               _status;          //!< The Stat of the File.
63
64    static std::string  _cwd;             //!< The currend Working directory.
65
66};
67
68#endif /* __FILE_H_ */
Note: See TracBrowser for help on using the repository browser.