FileInfo.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef BASE_FILEINFO_H
00027 #define BASE_FILEINFO_H
00028
00029 #include <string>
00030 #include <vector>
00031 #include <Base/TimeInfo.h>
00032
00033
00034 namespace Base
00035 {
00036
00042 class BaseExport FileInfo
00043 {
00044 public:
00046 FileInfo (const char* _FileName="");
00047 FileInfo (const std::string &_FileName);
00049 void setFile(const char* name);
00051 void setFile(const std::string &name){setFile(name.c_str());}
00052
00053
00056
00057 std::string filePath () const;
00059 std::string dirPath () const;
00061 std::string fileName () const;
00063 std::string fileNamePure () const;
00065 std::wstring toStdWString() const;
00079 std::string extension (bool complete = false) const;
00081 bool hasExtension (const char* Ext) const;
00083
00086
00087 bool exists () const;
00089 bool isReadable () const;
00091 bool isWritable () const;
00093 bool isFile () const;
00095 bool isDir () const;
00097 unsigned int size () const;
00099 TimeInfo lastModified() const;
00101 TimeInfo lastRead() const;
00103
00106
00107 bool createDirectory( void ) const;
00109 std::vector<Base::FileInfo> getDirectoryContent(void) const;
00111 bool deleteDirectory(void) const;
00113 bool deleteDirectoryRecursive(void) const;
00115
00117 bool deleteFile(void) const;
00119 bool renameFile(const char* NewName);
00121 bool copyTo(const char* NewName) const;
00122
00125
00126 static std::string getTempFileName(const char* FileName=0, const char* path=0);
00128 static const std::string &getTempPath(void);
00130
00131 protected:
00132 std::string FileName;
00133 };
00134
00135 }
00136
00137
00138 #endif // BASE_FILEINFO_H
00139