Regular commit
[backups/.git] / filedata.hpp
index 8c2951b5221fe0def7443fd9b4bf786ddc1c2e84..3df81d9378772e0cbab5e5ca9bc17fb6f6a4226f 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <string>
 #include <set>
+#include <vector>
 
 class FileData {
   public:
@@ -11,7 +12,7 @@ class FileData {
               std::string,
               std::string,
               std::string,
-              unsigned long,
+              unsigned long long,
               unsigned long long,
               std::string,
               unsigned long long = 0
@@ -21,7 +22,7 @@ class FileData {
     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,7 +31,7 @@ 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; }
@@ -43,23 +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;
 };
 
-class FileDataPtrCmp {
-  public:
+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<std::string> cmp;
+    std::less<std::string> cmp;
 };
 
-typedef std::set<FileData*,FileDataPtrCmp> file_set;
+typedef std::set<FileData*,FileDataNameCmp> file_set;
+typedef std::vector<FileData*> file_vector;
 
 #endif