CFileInformation.hpp

Go to the documentation of this file.
00001 #ifndef __CFileInformation__
00002 #define __CFileInformation__
00003 
00004 #include "../Basics/CCountedObject.hpp"
00005 #include "../Basics/CString.hpp"
00006 #include "../Basics/CSystemString.hpp"
00007 #include "CTime.hpp"
00008 
00009 #ifndef WIN32
00010     #include <dirent.h>
00011 #endif
00012 
00013 //  ===========================================================================
00014 
00015 using Exponent::Host::CTime;
00016 using Exponent::Basics::CCountedObject;
00017 using Exponent::Basics::CString;
00018 using Exponent::Basics::CSystemString;
00019 
00020 //  ===========================================================================
00021 
00022 namespace Exponent
00023 {
00024     namespace Host
00025     {
00044         class CFileInformation : public CCountedObject
00045         {
00047             EXPONENT_CLASS_DECLARATION;
00050 //  ===========================================================================
00051 
00052         public:
00053 
00054 //  ===========================================================================
00055 
00060             enum EFileAttribute
00061             {
00062                 e_archive = 0,          
00063                 e_compressed,           
00064                 e_directory,            
00065                 e_encryted,             
00066                 e_hidden,               
00067                 e_normal,               
00068                 e_offline,              
00069                 e_readOnly,             
00070                 e_reparse,              
00071                 e_system,               
00072                 e_temporary,            
00073                 e_unknown               
00074             };
00075 
00076 //  ===========================================================================
00077 
00081             CFileInformation();
00082 
00087             CFileInformation(const CFileInformation &info);
00088             
00090 #ifdef WIN32
00091 
00096             CFileInformation(WIN32_FIND_DATA &fileInfo);
00097             
00099 #else
00100 
00105             CFileInformation(dirent *directoryEntry);
00106             
00108 #endif
00109 
00114             virtual ~CFileInformation();
00115 
00116 //  ===========================================================================
00117 
00123             virtual CFileInformation &operator = (const CFileInformation &info);
00124 
00131             static int compareFiles(const CFileInformation **info1, const CFileInformation **info2);
00132 
00133 //  ===========================================================================
00134             
00136 #ifdef WIN32
00137 
00142             void setFileInformationFromData(WIN32_FIND_DATA &fileInfo);
00143             
00145 #endif
00146 
00152             void setFileAttribute(const EFileAttribute attribute);
00153 
00158             void setCreationTime(const CTime &creationTime);
00159 
00164             void setLastAccessTime(const CTime &lastAccess);
00165 
00170             void setLastWriteTime(const CTime &lastWrite);
00171 
00176             void setSizeInBytes(const double size);
00177 
00182             void setFilename(const CString &filename);
00183 
00188             void setFoldername(const CString &foldername);
00189 
00190 //  ===========================================================================
00191 
00195             EFileAttribute getFileAttribute() const { return m_attribute; }
00196 
00201             const CTime &getCreationTime() const { return m_creationTime; }
00202 
00207             const CTime &getLastAccessTime() const { return m_accessTime; }
00208 
00213             const CTime &getLastWriteTime() const { return m_writeTime; }
00214 
00219             double getSizeInBytes() const { return m_fileSizeInBytes; }
00220 
00225             const CString &getFilename() const { return m_filename; }
00226 
00231             const CString &getShortFilename() const { return m_shortFilename; }
00232 
00237             const CString &getFoldername() const { return m_foldername; }
00238 
00243             const CSystemString &getFullPath() const { return m_fullPath; }
00244 
00249             bool isDirectory() const { return m_attribute == e_directory; }
00250 
00251 //  ===========================================================================
00252 
00253         protected:
00254 
00255 //  ===========================================================================
00256 
00257             EFileAttribute m_attribute;             
00258             CTime m_creationTime;                   
00259             CTime m_accessTime;                     
00260             CTime m_writeTime;                      
00261             double m_fileSizeInBytes;               
00262             CString m_filename;                     
00263             CString m_shortFilename;                
00264             CString m_foldername;                   
00265             CSystemString m_fullPath;               
00266         };
00267     }
00268 }
00269 #endif  // End of CFileInformation.hpp

Infinity API - CFileInformation.hpp Source File generated on 7 Mar 2007