It now reads both stdin and the database
[backups/.git] / filedata.hpp
1 #ifndef FILEDATA_H
2 #define FILEDATA_H
3
4 #include <string>
5 #include <set>
6
7 class FileData {
8   public:
9     // Construct a FileData object with default values
10     FileData( char,
11               std::string,
12               std::string,
13               std::string,
14               unsigned long,
15               unsigned long long,
16               std::string,
17               unsigned long long = 0
18               );
19
20     char               getFileType() const { return filetype; }
21
22     const std::string &getFileName() const { return filename; }
23
24   private:
25     FileData();
26     FileData( const FileData & );
27
28     char               filetype;
29     std::string        permissions;
30     std::string        username;
31     std::string        groupname;
32     unsigned long      filesize;
33     unsigned long long modified_date;
34     std::string        filename;
35
36     unsigned long long last_backup_date;
37 };
38
39 class FileDataPtrCmp {
40   public:
41
42   bool operator()( const FileData *a, const FileData *b ) {
43     return cmp( a->getFileName(), b->getFileName() );
44   }
45   private:
46   std::less<std::string> cmp;
47 };
48
49 typedef std::set<FileData*,FileDataPtrCmp> file_set;
50
51 #endif