ToolMap
Loading...
Searching...
No Matches
backupmanager.h
1/***************************************************************************
2 backupmanager.h
3 -------------------
4 copyright : (C) 2011 CREALP Lucien Schreiber
5 ***************************************************************************/
6
7/***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef _BACKUPMANAGER_H
17#define _BACKUPMANAGER_H
18
19#include <wx/wxprec.h>
20
21#ifndef WX_PRECOMP
22#include <wx/wx.h>
23#endif
24
25#include <wx/filename.h>
26#include <wx/progdlg.h>
27#include <wx/regex.h>
28#include <wx/sstream.h>
29#include <wx/wfstream.h>
30#include <wx/xml/xml.h>
31#include <wx/zipstrm.h>
32#include <wx/scopedptr.h>
33
34class DataBaseTM;
35
37 private:
38 wxFileName m_OutFileName;
39 wxFileName m_InDirectory;
40 wxString m_Comment;
41 wxString m_Author;
42 wxDateTime m_Date;
43 bool m_UseDate;
44
45 public:
46 BackupFile();
47
48 virtual ~BackupFile();
49
50 bool IsValid() const;
51
52 inline const wxFileName GetOutputName() const;
53
54 void SetOutputName(const wxFileName& value);
55
56 inline const wxFileName GetInputDirectory() const;
57
58 void SetInputDirectory(const wxFileName& value);
59
60 inline const wxString GetComment() const;
61
62 void SetComment(const wxString& value);
63
64 inline const wxString GetAuthor() const;
65
66 void SetAuthor(const wxString& value);
67
68 inline const wxDateTime GetDate() const;
69
70 void SetDate(wxDateTime value);
71
72 inline const bool IsUsingDate() const;
73
74 void SetUseDate(bool value);
75};
76
77inline const wxFileName BackupFile::GetOutputName() const {
78 return m_OutFileName;
79}
80
81inline const wxFileName BackupFile::GetInputDirectory() const {
82 return m_InDirectory;
83}
84
85inline const wxString BackupFile::GetComment() const {
86 return m_Comment;
87}
88
89inline const wxString BackupFile::GetAuthor() const {
90 return m_Author;
91}
92
93inline const wxDateTime BackupFile::GetDate() const {
94 return m_Date;
95}
96
97inline const bool BackupFile::IsUsingDate() const {
98 return m_UseDate;
99}
100
101/***************** BACKUP MANAGER **********************/
103 private:
104 DataBaseTM* m_Database;
105
106 void _ListMySQLFiles(const wxString& directory, wxArrayString& files);
107
108 public:
109 BackupManager(DataBaseTM* database);
110
111 virtual ~BackupManager();
112
113 bool Backup(const BackupFile& fileinfo, wxWindow* progressparent = nullptr);
114
115 bool Restore(const BackupFile& fileinfo, wxWindow* progressparent = nullptr);
116
117 bool GetFileInfo(const wxFileName& file, BackupFile& fileinfo);
118
119 bool SetMetadata(const BackupFile& fileinfo, wxZipOutputStream* zip);
120
121 inline DataBaseTM* GetDatabase();
122};
123
124inline DataBaseTM* BackupManager::GetDatabase() {
125 return m_Database;
126}
127
128#endif
Definition backupmanager.h:36
Definition backupmanager.h:102
Definition database_tm.h:80