11 // Construct a FileData object with default values
14 char getFileType() const { return filetype; }
15 const std::string &getPermissions() const { return permissions; }
16 const std::string &getUserName() const { return username; }
17 const std::string &getGroupName() const { return groupname; }
18 unsigned long long getFileSize() const { return filesize; }
19 unsigned long long getModifiedDate() const { return modified_date; }
20 const std::string &getFileName() const { return filename; }
21 unsigned long long getLastBackupDate() const { return last_backup_date; }
23 void setFileType( char arg ) { filetype = arg; }
24 void setPermissions( const std::string &arg ) { permissions = arg; }
25 void setUserName( const std::string &arg ) { username = arg; }
26 void setGroupName( const std::string &arg ) { groupname = arg; }
27 void setFileSize( unsigned long long arg ) { filesize = arg; }
28 void setModifiedDate( unsigned long long arg ) { modified_date = arg; }
29 void setFileName( const std::string &arg ) { filename = arg; }
30 void setLastBackupDate( unsigned long long arg ) { last_backup_date = arg; }
33 FileData( const FileData & );
36 std::string permissions;
38 std::string groupname;
39 unsigned long long filesize;
40 unsigned long long modified_date;
41 unsigned long long last_backup_date;
45 std::ostream &operator<<( std::ostream &o, const FileData *d );
46 std::istream &operator>>( std::istream &i, FileData *d );
48 std::ostream &operator<<( std::ostream &o, const FileData &d );
49 std::istream &operator>>( std::istream &i, FileData &d );
51 struct FileDataLastBackupCmp {
52 bool operator()( const FileData *a, const FileData *b ) {
53 return a->getLastBackupDate() < b->getLastBackupDate();
57 struct FileDataSizeCmp {
58 bool operator()( const FileData *a, const FileData *b ) {
59 return a->getFileSize() < b->getFileSize();
63 struct FileDataNameCmp {
64 bool operator()( const FileData *a, const FileData *b ) {
65 return cmp( a->getFileName(), b->getFileName() );
68 std::less<std::string> cmp;
71 bool needs_backup( const FileData *before, const FileData *after );
73 typedef std::set<FileData*,FileDataNameCmp> file_set;
74 typedef std::vector<FileData*> file_vector;