Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Modified ETag system to make it more stable.
[xestiaab/.git] / source / common / etag.h
1 #include <mutex>
2 #include <map>
3 #include <wx/wx.h>
4 #include <wx/textfile.h>
5 #include <wx/filefn.h>
6 #include <wx/tokenzr.h>
7 #include <SFML/System/Lock.hpp>
9 #ifndef ETAG_H
10 #define ETAG_H
12 struct ETagData{
13     
14     wxString ETagValue;
15     wxString ETagOrigValue;
16     int ETagStatus;
17     
18 };
20 class ETagDB{
21 public:
22     //ETagDB(wxString AccountDir);
23     ETagDB() {};
24     ~ETagDB();
25     
26     // ETag functions.
27     
28     void AddETag(wxString Filename, wxString ETag, wxString ETagOriginal);
29     void RemoveETag(wxString Filename);
30     void UpdateETag(wxString Filename, wxString ETag);
31     void UpdateETag(wxString Filename, wxString ETag, wxString ETagOriginal);
32     std::map<wxString, wxString>* GetFilenamePointer();
33     wxString GetETag(wxString Filename);
34     wxString GetETagOriginal(wxString Filename);
35     bool CheckETagExists(wxString Filename);
36     bool ETagExists(wxString Filename);
37     //boost::mutex ProcessLock;
38     
39     // ETagDB functions.
40     
41     bool WriteETagDB();
42     bool LoadETagDB();
43     void DeleteETagDB();
44     void SetupDB(wxString AccountDirFilename);
45     
46     bool GetWriteStatus();
47     std::map<wxString, ETagData> GetETagData();
48     //void *ProcessLock = new std::mutex;
49     
50 private:
51     std::map<wxString, wxString> FilenameETag;
52     std::map<wxString, wxString> FilenameETagOriginal;
53     bool NeedsWrite = FALSE;
54     bool MarkedDeleted = FALSE;
55     wxString AccountDir;
56     std::mutex *ProcessLock = new std::mutex();
57 };
59 /*
60  class ETagDB2{
61  public:
62         ETagDB2() {} ;
63         ~ETagDB2() {};
64         
65         // ETag functions.
66         
67         void AddETag(wxString Filename, wxString ETag, wxString ETagOriginal);
68         void RemoveETag(wxString Filename);
69         void UpdateETag(wxString Filename, wxString ETag);
70         void UpdateETag(wxString Filename, wxString ETag, wxString ETagOriginal);
71         wxString GetETag(wxString Filename);
72         wxString GetETagOriginal(wxString Filename);
73         
74         // ETagDB functions.
75         
76         bool WriteETagDB();
77         bool LoadETagDB();
78         void DeleteETagDB();
79         
80         bool GetWriteStatus();
81  private:
82         std::map<wxString, wxString> FilenameETag;
83         std::map<wxString, wxString> FilenameETagOriginal;
84         bool NeedsWrite = FALSE;
85         bool MarkedDeleted = FALSE;
86         std::mutex ProcessLock;
87         wxString AccountDir;
88  };
89  */
92 #endif
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy