source: box/trunk/lib/backupstore/BackupStoreAccountDatabase.h @ 2530

Revision 2530, 1.9 KB checked in by chris, 3 years ago (diff)

Make BackupStoreAccountDatabase::AddEntry? and
BackupStoreAccountDatabase::GetEntry? return a copy of the new entry.

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    BackupStoreAccountDatabase.h
5//              Purpose: Database of accounts for the backup store
6//              Created: 2003/08/20
7//
8// --------------------------------------------------------------------------
9
10#ifndef BACKUPSTOREACCOUNTDATABASE__H
11#define BACKUPSTOREACCOUNTDATABASE__H
12
13#include <memory>
14#include <vector>
15
16#include "BoxTime.h"
17
18class _BackupStoreAccountDatabase;
19
20// --------------------------------------------------------------------------
21//
22// Class
23//              Name:    BackupStoreAccountDatabase
24//              Purpose: Database of accounts for the backup store
25//              Created: 2003/08/20
26//
27// --------------------------------------------------------------------------
28class BackupStoreAccountDatabase
29{
30public:
31        friend class _BackupStoreAccountDatabase;       // to stop compiler warnings
32        ~BackupStoreAccountDatabase();
33private:
34        BackupStoreAccountDatabase(const char *Filename);
35        BackupStoreAccountDatabase(const BackupStoreAccountDatabase &);
36public:
37
38        static std::auto_ptr<BackupStoreAccountDatabase> Read(const char *Filename);
39        void Write();
40
41        class Entry
42        {
43        public:
44                Entry();
45                Entry(int32_t ID, int DiscSet);
46                Entry(const Entry &rEntry);
47                ~Entry();
48
49                int32_t GetID() const {return mID;}
50                int GetDiscSet() const {return mDiscSet;}
51               
52        private:
53                int32_t mID;
54                int mDiscSet;
55        };
56
57        bool EntryExists(int32_t ID) const;
58        Entry GetEntry(int32_t ID) const;
59        Entry AddEntry(int32_t ID, int DiscSet);
60        void DeleteEntry(int32_t ID);
61
62        // This interface should change in the future. But for now it'll do.
63        void GetAllAccountIDs(std::vector<int32_t> &rIDsOut);
64
65private:
66        void ReadFile() const;  // const in concept only
67        void CheckUpToDate() const;     // const in concept only
68        box_time_t GetDBFileModificationTime() const;
69
70private:
71        mutable _BackupStoreAccountDatabase *pImpl;
72};
73
74#endif // BACKUPSTOREACCOUNTDATABASE__H
75
Note: See TracBrowser for help on using the repository browser.