00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _SWORD_STREAMS_FILE_
00020 #define _SWORD_STREAMS_FILE_
00021
00022 #include "sword/time.Time.h"
00023
00024 namespace sword {
00025
00026 class SWORDDECL File {
00027 public:
00028 File();
00029 File(const char *pathname);
00030 File(const std::string &pathname);
00031 File(const File &file);
00032 File(const File &file, const std::string &pathname);
00033 File(const File &file, const char *pathname);
00034
00035 void add(const std::string &pathname);
00036 void canonize() const;
00037 void canonize(const std::string &basepath) const;
00038
00039 std::string pathname() const;
00040 std::string path() const;
00041 std::string filename() const;
00042 std::string fileext() const;
00043
00044 bool exists() const;
00045 bool isFile() const;
00046 bool isDirectory() const;
00047 bool isLink() const;
00048 Time time() const;
00049 word size() const;
00050
00051
00052
00053 enum Special
00054 {
00055 spHome = 0,
00056 spTemp = 1,
00057 spCurrent = 2,
00058 spApplicationData = 3,
00059 spStartMenu = 4
00060 };
00061
00062 static File special(Special which);
00063
00064
00065 class NoEntryException : public Exception {};
00066 class SpecialDirException : public Exception {};
00067
00068 private:
00069 mutable std::string pathname_;
00070 mutable bool canonic_;
00071
00072 void canonize_(char *dest1) const;
00073 static bool exists_ (const std::string &pathname);
00074 };
00075
00076 }
00077
00078 #include "sword.private/streams.File.inl"
00079
00080 #endif // _SWORD_STREAMS_FILE_