X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=blobdiff_plain;f=filedata.hpp;h=f98b520e5e8d18eef6d2bf79b3a0c58ab181e0eb;hb=e5d3b458ea4e2ece0b7d3c5999b806489d9ae49c;hp=b339f05f92b2fcc4c425e13c119b56bbb37a8a5b;hpb=7f06c56f69c8bfda925dd6b28d73201f0a7ea311;p=backups%2F.git diff --git a/filedata.hpp b/filedata.hpp index b339f05..f98b520 100644 --- a/filedata.hpp +++ b/filedata.hpp @@ -29,6 +29,30 @@ class FileData { void setFileName( const std::string &arg ) { filename = arg; } void setLastBackupDate( unsigned long long arg ) { last_backup_date = arg; } + struct LastBackupCmp { + bool operator()( const FileData *a, const FileData *b ) { + return a->getLastBackupDate() < b->getLastBackupDate(); + } + }; + + struct SizeCmp { + bool operator()( const FileData *a, const FileData *b ) { + return a->getFileSize() < b->getFileSize(); + } + }; + + struct NameCmp { + bool operator()( const FileData *a, const FileData *b ) { + return cmp( a->getFileName(), b->getFileName() ); + } + private: + std::less cmp; + }; + + static const LastBackupCmp lastbackupcmp; + static const SizeCmp sizecmp; + static const NameCmp namecmp; + private: FileData( const FileData & ); @@ -48,29 +72,9 @@ std::istream &operator>>( std::istream &i, FileData *d ); std::ostream &operator<<( std::ostream &o, const FileData &d ); std::istream &operator>>( std::istream &i, FileData &d ); -struct FileDataLastBackupCmp { - bool operator()( const FileData *a, const FileData *b ) { - return a->getLastBackupDate() < b->getLastBackupDate(); - } -}; - -struct FileDataSizeCmp { - bool operator()( const FileData *a, const FileData *b ) { - return a->getFileSize() < b->getFileSize(); - } -}; - -struct FileDataNameCmp { - bool operator()( const FileData *a, const FileData *b ) { - return cmp( a->getFileName(), b->getFileName() ); - } - private: - std::less cmp; -}; - bool needs_backup( const FileData *before, const FileData *after ); -typedef std::set file_set; -typedef std::vector file_vector; +typedef std::set file_set; +typedef std::vector file_vector; #endif