Audacity 3.2.0
AudacityFileConfig.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5@file AudacityFileConfig.h
6@brief Extend FileConfig with application-specific behavior
7
8Paul Licameli split from Prefs.h
9
10**********************************************************************/
11
12#ifndef __AUDACITY_FILE_CONFIG__
13#define __AUDACITY_FILE_CONFIG__
14
15#include <memory>
16#include <wx/fileconf.h>
17
19class AUDACITY_DLL_API AudacityFileConfig final : public wxFileConfig
20{
21public:
23 static std::unique_ptr<AudacityFileConfig> Create(
24 const wxString& appName = {},
25 const wxString& vendorName = {},
26 const wxString& localFilename = {},
27 const wxString& globalFilename = {},
28 long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE,
29 const wxMBConv& conv = wxConvAuto()
30 );
31
32 bool Flush(bool bCurrentOnly) override;
33
34 ~AudacityFileConfig() override;
35
36 bool RenameEntry(const wxString& oldName, const wxString& newName) override;
37 bool RenameGroup(const wxString& oldName, const wxString& newName) override;
38 bool DeleteEntry(const wxString& key, bool bDeleteGroupIfEmpty) override;
39 bool DeleteGroup(const wxString& key) override;
40 bool DeleteAll() override;
41
42protected:
43 bool DoWriteString(const wxString& key, const wxString& szValue) override;
44 bool DoWriteLong(const wxString& key, long lValue) override;
45#if wxUSE_BASE64
46 bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf) override;
47#endif
48
49private:
52 const wxString& appName,
53 const wxString& vendorName,
54 const wxString& localFilename,
55 const wxString& globalFilename,
56 long style,
57 const wxMBConv& conv
58 );
59
60 void Init();
61 void Warn() const;
62
63 //wxFileConfig already has m_isDirty flag, but it's inaccessible
64 bool mDirty{false};
65 const wxString mLocalFilename;
66};
67#endif
static const AudacityProject::AttachedObjects::RegisteredFactory key
Our own specialisation of FileConfig.
const wxString mLocalFilename