X-Git-Url: http://git.pippins.net/embedvideo/.git/static/git-logo.png?a=blobdiff_plain;ds=inline;f=filedata.hpp;h=3df81d9378772e0cbab5e5ca9bc17fb6f6a4226f;hb=e2cc1e337cc5461d93a94931097ceb34e325c7ac;hp=86e5b0ebf3629137ccdf830b8c1f5591b63550bf;hpb=b6878571e12b7d5de53721f12e8fb956d07e44d6;p=backups%2F.git diff --git a/filedata.hpp b/filedata.hpp index 86e5b0e..3df81d9 100644 --- a/filedata.hpp +++ b/filedata.hpp @@ -1,4 +1,9 @@ +#ifndef FILEDATA_H +#define FILEDATA_H + #include +#include +#include class FileData { public: @@ -7,11 +12,30 @@ class FileData { std::string, std::string, std::string, - unsigned long, unsigned long long, - std::string + unsigned long long, + std::string, + unsigned long long = 0 ); + 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 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; } + + void setFileType( char arg ) { filetype = arg; } + 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 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 & ); @@ -20,9 +44,34 @@ class FileData { std::string permissions; std::string username; std::string groupname; - unsigned long filesize; + unsigned long long filesize; unsigned long long modified_date; std::string filename; unsigned long long last_backup_date; }; + +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; +}; + +typedef std::set file_set; +typedef std::vector file_vector; + +#endif