X-Git-Url: http://git.pippins.net/embedvideo/.git/static/gitweb.js?a=blobdiff_plain;f=filedata.hpp;h=9d71f8c7905bacef50e0f094e183758c33b9987e;hb=c0f4bf630c7ae5d647e8884f797823565c62785f;hp=8c2951b5221fe0def7443fd9b4bf786ddc1c2e84;hpb=8d352159cb90b923e34c879242ed7516418ec827;p=backups%2F.git diff --git a/filedata.hpp b/filedata.hpp index 8c2951b..9d71f8c 100644 --- a/filedata.hpp +++ b/filedata.hpp @@ -3,25 +3,27 @@ #include #include +#include class FileData { public: // Construct a FileData object with default values + FileData() {} FileData( char, std::string, std::string, std::string, - unsigned long, unsigned long long, - std::string, - unsigned long long = 0 + unsigned long long, + unsigned long long, + std::string ); char getFileType() const { return filetype; } const std::string &getPermissions() const { return permissions; } const std::string &getUserName() const { return username; } const std::string &getGroupName() const { return groupname; } - unsigned long getFileSize() const { return filesize; } + unsigned long long getFileSize() const { return filesize; } unsigned long long getModifiedDate() const { return modified_date; } const std::string &getFileName() const { return filename; } unsigned long long getLastBackupDate() const { return last_backup_date; } @@ -30,36 +32,51 @@ class FileData { void setPermissions( const std::string &arg ) { permissions = arg; } void setUserName( const std::string &arg ) { username = arg; } void setGroupName( const std::string &arg ) { groupname = arg; } - void setFileSize( unsigned long arg ) { filesize = arg; } + void setFileSize( unsigned long long arg ) { filesize = arg; } void setModifiedDate( unsigned long long arg ) { modified_date = arg; } void setFileName( const std::string &arg ) { filename = arg; } void setLastBackupDate( unsigned long long arg ) { last_backup_date = arg; } private: - FileData(); FileData( const FileData & ); char filetype; std::string permissions; std::string username; std::string groupname; - unsigned long filesize; + unsigned long long filesize; unsigned long long modified_date; + unsigned long long last_backup_date; std::string filename; +}; - unsigned long long last_backup_date; +std::ostream &operator<<( const FileData *d, std::ostream &o ); +std::istream &operator>>( std::istream &i, FileData *d ); + +std::ostream &operator<<( const FileData &d, std::ostream &o ); +std::istream &operator>>( std::istream &i, FileData &d ); + +struct FileDataLastBackupCmp { + bool operator()( const FileData *a, const FileData *b ) { + return a->getLastBackupDate() < b->getLastBackupDate(); + } }; -class FileDataPtrCmp { - public: +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; + std::less cmp; }; -typedef std::set file_set; +typedef std::set file_set; +typedef std::vector file_vector; #endif