-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDatabaseExplorer.h
More file actions
89 lines (73 loc) · 2.39 KB
/
DatabaseExplorer.h
File metadata and controls
89 lines (73 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// DatabaseExplorer.h : main header file for the DatabaseExplorer application
//
#pragma once
#ifndef __AFXWIN_H__
#error "include 'pch.h' before including this file for PCH"
#endif
#include "resource.h" // main symbols
#include "DatabaseExplorerDoc.h"
#include <vector>
#include <string>
#include <unordered_map>
extern const CString g_sMutexName;
// CDatabaseExplorerApp:
// See DatabaseExplorer.cpp for the implementation of this class
//
class CDatabaseExplorerApp : public CWinAppEx
{
friend class CMainFrame;
public:
CDatabaseExplorerApp() noexcept;
enum UH_POPULATELIST
{
UH_INITDATABASE = 1,
UH_SELECTDATABASE,
UH_POPULATEDATABASEPANEL,
UH_RUNSQLSATEMENTS,
UH_REFRESH,
UH_LISTTABLE
};
public:
BOOL m_bDark{ FALSE };
BOOL m_bDirty{ FALSE };
BOOL m_bWordWrap{ FALSE };
BOOL m_bHiColorIcons{ TRUE };
BOOL m_bVirtualMode{ FALSE };
UINT m_nAppLook{ ID_VIEW_APPLOOK_OFF_2007_BLACK };
// Overrides
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
// Implementation
public:
virtual void PreLoadState();
virtual void LoadCustomState();
virtual void SaveCustomState();
CString GetAppPath() const;
CString GetAppPathTemp() const;
CString GetFileNameFrom(const CString& sPath) const;
void UpdateBackupFiles();
CString GetTitleNormalized(const CString& sTitle) const;
BOOL HasValidDocumentTitle(CString sTitle) const;
void DisconnectAllDatabases() const;
#ifdef _UNICODE
BOOL FileExist(const CString sFilePath) const { return (-1 != _waccess(sFilePath, 0)); }
#else
BOOL FileExist(const CString sFilePath) const { return (-1 != _access(sFilePath, 0)); }
#endif
private:
std::vector<std::wstring> GetBackupFiles() const;
void SaveQueries(const std::wstring& filename, std::vector<CString>&& queries) const;
std::unordered_map<std::wstring, SDocData> GetDocumentsData() const;
void RemoveOldBackup(const std::unordered_map<std::wstring, SDocData>& docdata);
void SaveNewBackup(std::unordered_map<std::wstring, SDocData>&& docdata);
void SaveDocsOrder(std::vector<CString>&& names) const;
std::vector<std::wstring> GetDocsOrder() const;
CString GetBackupPath() const { return GetAppPath() + _T("Backup\\"); }
void PrepareDataPath() const;
// Generated message map functions
protected:
afx_msg void OnAppAbout();
DECLARE_MESSAGE_MAP()
};
extern CDatabaseExplorerApp theApp;