12#include <wx/wfstream.h>
29 const wxString& vendorName,
30 const wxString& localFilename,
31 const wxString& globalFilename,
34: wxConfigBase(appName, vendorName, localFilename, globalFilename, style),
36 mVendorName(vendorName),
37 mLocalFilename(localFilename),
38 mGlobalFilename(globalFilename),
49 mConfig = std::make_unique<wxFileConfig>
59 bool canWrite =
false;
63 if (fd != -1 || errno == ENOENT)
79 if (canRead && canWrite)
125 return mConfig->GetNumberOfEntries(bRecursive);
130 return mConfig->GetNumberOfGroups(bRecursive);
135 return mConfig->HasGroup(strName);
140 return mConfig->HasEntry(strName);
154 if (!wxFileExists(backup) || (wxRemove(backup) == 0))
164 if (stream.IsOk() && stream.Close())
166 if (!wxFileExists(backup) || (wxRemove(backup) == 0))
175 if (wxFileExists(backup))
191 auto res =
mConfig->RenameEntry(oldName, newName);
201 auto res =
mConfig->RenameGroup(oldName, newName);
211 auto res =
mConfig->DeleteEntry(
key, bDeleteGroupIfEmpty);
231 auto res =
mConfig->DeleteAll();
250bool FileConfig::DoReadBinary(
const wxString&
key, wxMemoryBuffer* buf)
const
277bool FileConfig::DoWriteBinary(
const wxString&
key,
const wxMemoryBuffer& buf)
static const AudacityProject::AttachedObjects::RegisteredFactory key
virtual bool DeleteEntry(const wxString &key, bool bDeleteGroupIfEmpty=true) wxOVERRIDE
FileConfig(const wxString &appName=wxEmptyString, const wxString &vendorName=wxEmptyString, const wxString &localFilename=wxEmptyString, const wxString &globalFilename=wxEmptyString, long style=wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_GLOBAL_FILE, const wxMBConv &conv=wxConvAuto())
const wxString mVendorName
virtual bool GetNextEntry(wxString &str, long &lIndex) const wxOVERRIDE
virtual bool DeleteAll() wxOVERRIDE
virtual bool GetNextGroup(wxString &str, long &lIndex) const wxOVERRIDE
const wxString mGlobalFilename
virtual bool HasEntry(const wxString &strName) const wxOVERRIDE
virtual size_t GetNumberOfEntries(bool bRecursive=false) const wxOVERRIDE
virtual bool DoReadLong(const wxString &key, long *pl) const wxOVERRIDE
virtual size_t GetNumberOfGroups(bool bRecursive=false) const wxOVERRIDE
virtual bool DeleteGroup(const wxString &key) wxOVERRIDE
virtual bool RenameEntry(const wxString &oldName, const wxString &newName) wxOVERRIDE
std::unique_ptr< wxMBConv > mConv
virtual bool GetFirstGroup(wxString &str, long &lIndex) const wxOVERRIDE
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
virtual const wxString & GetPath() const wxOVERRIDE
virtual bool HasGroup(const wxString &strName) const wxOVERRIDE
std::unique_ptr< wxFileConfig > mConfig
virtual bool DoWriteString(const wxString &key, const wxString &szValue) wxOVERRIDE
virtual void SetPath(const wxString &strPath) wxOVERRIDE
virtual bool RenameGroup(const wxString &oldName, const wxString &newName) wxOVERRIDE
virtual bool GetFirstEntry(wxString &str, long &lIndex) const wxOVERRIDE
const wxString mLocalFilename
virtual bool DoWriteLong(const wxString &key, long lValue) wxOVERRIDE
virtual bool DoReadString(const wxString &key, wxString *pStr) const wxOVERRIDE