00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _pfileinfo_h_
00021 #define _pfileinfo_h_
00022
00023 #include <pclasses/config.h>
00024 #include <pclasses/pexport.h>
00025 #include <pclasses/ptypes.h>
00026 #include <pclasses/ptime.h>
00027 #include <string>
00028
00029 namespace P {
00030
00032
00036 class PCORE_EXPORT FileInfo {
00037 public:
00038 #ifndef HAVE_LARGEFILE64
00039 typedef off_t fsize_t;
00040 #else
00041 typedef off64_t fsize_t;
00042 #endif
00043
00045 enum ftype_t {
00046 Unknown,
00047 File,
00048 Directory,
00049 CharDevice,
00050 BlockDevice,
00051 Link,
00052 Pipe
00053 };
00054
00055 FileInfo(const char* path) throw(IOError);
00056 FileInfo(const FileInfo& fi);
00057 ~FileInfo();
00058
00060 inline const std::string& dirName() const throw()
00061 { return m_dirName; }
00062
00064 std::string absDirName() const throw(SystemError);
00065
00067 inline const std::string& name() const throw()
00068 { return m_name; }
00069
00071 std::string path() const throw();
00072
00074 std::string absPath() const throw(SystemError);
00075
00077 inline fsize_t size() const throw()
00078 { return m_size; }
00079
00081 inline ftype_t type() const throw()
00082 { return m_type; }
00083
00085 inline const DateTime& ctime() const throw()
00086 { return m_ctime; }
00087
00089 inline const DateTime& mtime() const throw()
00090 { return m_mtime; }
00091
00093 inline const DateTime& atime() const throw()
00094 { return m_atime; }
00095
00096 FileInfo& operator=(const FileInfo& fi) throw();
00097
00098 private:
00099 fsize_t m_size;
00100 ftype_t m_type;
00101 std::string m_dirName;
00102 std::string m_name;
00103 DateTime m_ctime, m_mtime, m_atime;
00104 };
00105
00106 }
00107
00108 #endif