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; }
32 struct LastBackupCmp {
33 bool operator()( const FileData *a, const FileData *b ) {
34 return a->getLastBackupDate() < b->getLastBackupDate();
39 bool operator()( const FileData *a, const FileData *b ) {
40 return a->getFileSize() < b->getFileSize();
45 bool operator()( const FileData *a, const FileData *b ) {
46 return cmp( a->getFileName(), b->getFileName() );
49 std::less<std::string> cmp;
52 static const LastBackupCmp lastbackupcmp;
53 static const SizeCmp sizecmp;
54 static const NameCmp namecmp;
57 FileData( const FileData & );
60 std::string permissions;
62 std::string groupname;
63 unsigned long long filesize;
64 unsigned long long modified_date;
65 unsigned long long last_backup_date;
69 std::ostream &operator<<( std::ostream &o, const FileData *d );
70 std::istream &operator>>( std::istream &i, FileData *d );
72 std::ostream &operator<<( std::ostream &o, const FileData &d );
73 std::istream &operator>>( std::istream &i, FileData &d );
75 bool needs_backup( const FileData *before, const FileData *after );
77 typedef std::set<FileData*,FileData::NameCmp> file_set;
78 typedef std::vector<FileData*> file_vector;