• Main Page
  • Namespaces
  • Data Structures
  • Files
  • File List

/www/proggenOrg/dedupe/export/trunk/fileinfo/fileinfo.h

Go to the documentation of this file.
00001 
00008 #ifndef ORG_PROGGEN_DEDUPE_FILEINFO_H
00009 #define ORG_PROGGEN_DEDUPE_FILEINFO_H
00010 
00011 #include <boost/filesystem.hpp>
00012 #include <iostream>
00013 
00014 
00015 namespace Dedupe
00016 {
00021   typedef boost::filesystem::path FilePath;
00022 
00026   typedef std::vector<Dedupe::FilePath> FilePaths;
00027 
00032   class FileInfo
00033   {
00034     public:
00035 
00039     enum FileStatus
00040     {
00041       FileStatusNotSet,  
00042       FileOK,                    
00043       IgnoreFile,               
00044       UncheckedFile       
00045     };
00046 
00051     enum FileType
00052     {
00053       TFile,                
00054       TDirectory,       
00055       TSymbolicLink,
00056       TNotDefined,   
00057       TNotAvailable 
00058      };
00059 
00064     FileInfo( Dedupe::FilePath PathToFile );
00065 
00066     FileInfo( Dedupe::FilePath PathToFile,
00067                     unsigned long long size,
00068                     time_t ChangeDate,
00069                     Dedupe::FileInfo::FileType Type,
00070                     bool keep );
00071 
00072     FileInfo( Dedupe::FilePath PathToFile,
00073                     unsigned long long size,
00074                     time_t ChangeDate,
00075                     Dedupe::FileInfo::FileType Type,
00076                     bool keep,
00077                     unsigned long long HashValue );
00078 
00079 /*****************************************************************************/
00080 
00084     Dedupe::FilePath GetPath() const;
00085 
00089     unsigned long long GetSize() const;
00090 
00094     time_t GetDateChanged() const;
00095 
00099     bool GetExisting() const;
00100 
00104     Dedupe::FileInfo::FileType GetType() const;
00105 
00106 /*****************************************************************************/
00107 
00111     void SetHash( unsigned long long const &value );
00112 
00116     unsigned long long GetHash() const;
00117 
00118 /*****************************************************************************/
00119 
00123     void SetStatus( FileStatus value );
00124 
00128     FileStatus GetStatus() const;
00129 
00134     void SetErrorMessage( std::string const &message );
00135 
00139     std::string GetErrorMessage() const;
00140 
00141 /*****************************************************************************/
00142 
00146     bool GetKeep() const { return Keep; }
00147 
00151     void SetKeep( bool YesNo ) { Keep = YesNo; }
00152 
00156     bool operator < (const FileInfo & rhs ) const { return Path < rhs.Path; }
00157 
00158     friend
00159     bool operator== ( const Dedupe::FileInfo rhs, const Dedupe::FileInfo lhs);
00160 
00161     friend
00162     bool operator!= ( const Dedupe::FileInfo rhs, const Dedupe::FileInfo lhs);
00163 
00164     friend
00165     std::ostream& operator<<( std::ostream& os, const Dedupe::FileInfo& Info );
00166 
00167     friend
00168     bool EqualNoHash ( const Dedupe::FileInfo rhs, const Dedupe::FileInfo lhs);
00169 
00170 
00171 /*****************************************************************************/
00172 
00173     private:
00174 
00175     Dedupe::FilePath Path;
00176     unsigned long long Size;
00177     time_t DateChanged;
00178     bool Existing;
00179     Dedupe::FileInfo::FileType Type;
00180     unsigned long long  Hash;
00181     bool Keep;
00182 
00183     FileStatus StateOfFile;
00184     std::string FileSearchErrorMessage;
00185   };
00186 
00190   typedef std::vector<Dedupe::FileInfo> FileStream;
00191 
00192   inline
00193   bool operator== ( const Dedupe::FileInfo rhs, const Dedupe::FileInfo lhs)
00194   {
00195     return( rhs.Path == lhs.Path )
00196       && ( rhs.Size == lhs.Size )
00197       && ( rhs.DateChanged == lhs.DateChanged )
00198       && ( rhs.Type == lhs.Type )
00199       && ( rhs.Keep == lhs.Keep )
00200       && ( rhs.Hash == lhs.Hash );
00201   }
00202 
00203   inline
00204   bool EqualNoHash ( const Dedupe::FileInfo rhs, const Dedupe::FileInfo lhs)
00205   {
00206     return ( rhs.Path == lhs.Path )
00207         && ( rhs.Size == lhs.Size )
00208         && ( rhs.DateChanged == lhs.DateChanged )
00209         && ( rhs.Type == lhs.Type )
00210         && ( rhs.Keep == lhs.Keep );
00211   }
00212 
00213   inline
00214   bool operator!= ( const Dedupe::FileInfo rhs, const Dedupe::FileInfo lhs)
00215   {
00216     return !( rhs == lhs );
00217   }
00218 
00219   inline
00220   std::ostream& operator<< ( std::ostream& os, const Dedupe::FileInfo& Info )
00221   {
00222     os << Info.Path << ":" << Info.DateChanged << ":" << Info.Size
00223           << ":" << Info.Type << ":" << Info.Hash;
00224     return os;
00225   }
00226 
00227 }
00228 #endif

Generated on Mon Mar 11 2013 12:04:52 for Dedupe by  doxygen 1.7.1