X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1ad6d522edba31d25f8197553eaad8dd170b7595..bdebb379299aaf1ee588dbe15968829df49ccedc:/src/msw/regconf.cpp?ds=inline diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index 8428fb5341..13f59406cd 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -33,8 +33,6 @@ #include "wx/config.h" -#ifndef __WIN16__ - #include "wx/msw/registry.h" #include "wx/msw/regconf.h" @@ -148,16 +146,11 @@ wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName, if ( bDoUseGlobal ) { wxLogNull nolog; - m_keyGlobalRoot.Open(); - m_keyGlobal.Open(); + m_keyGlobalRoot.Open(wxRegKey::Read); + m_keyGlobal.Open(wxRegKey::Read); } } -wxRegConfig::~wxRegConfig() -{ - // nothing to do - key will be closed in their dtors -} - // ---------------------------------------------------------------------------- // path management // ---------------------------------------------------------------------------- @@ -222,9 +215,9 @@ void wxRegConfig::SetPath(const wxString& strPath) strFullPath.reserve(2*m_strPath.length()); strFullPath << m_strPath; - if ( strFullPath.Len() == 0 || + if ( strFullPath.Len() == 0 || strFullPath.Last() != wxCONFIG_PATH_SEPARATOR ) - strFullPath << wxCONFIG_PATH_SEPARATOR; + strFullPath << wxCONFIG_PATH_SEPARATOR; strFullPath << strPath; } @@ -392,7 +385,7 @@ void wxRegConfig::SetPath(const wxString& strPath) m_keyGlobal.SetName(m_keyGlobalRoot, strRegPath); wxLogNull nolog; - m_keyGlobal.Open(); + m_keyGlobal.Open(wxRegKey::Read); } } @@ -425,7 +418,7 @@ bool wxRegConfig::GetNextGroup(wxString& str, long& lIndex) const while ( m_keyGlobal.GetNextKey(str, lIndex) ) { if ( !m_keyLocal.Exists() || !LocalKey().HasSubKey(str) ) { // ok, found one - return it - return TRUE; + return true; } } @@ -435,7 +428,7 @@ bool wxRegConfig::GetNextGroup(wxString& str, long& lIndex) const // if we don't have the key at all, don't try to enumerate anything under it if ( !m_keyLocal.Exists() ) - return FALSE; + return false; // much easier with local entries: get the next one we find // (don't forget to clear our flag bit and set it again later) @@ -460,7 +453,7 @@ bool wxRegConfig::GetNextEntry(wxString& str, long& lIndex) const while ( m_keyGlobal.GetNextValue(str, lIndex) ) { if ( !m_keyLocal.Exists() || !LocalKey().HasValue(str) ) { // ok, found one - return it - return TRUE; + return true; } } @@ -470,7 +463,7 @@ bool wxRegConfig::GetNextEntry(wxString& str, long& lIndex) const // if we don't have the key at all, don't try to enumerate anything under it if ( !m_keyLocal.Exists() ) - return FALSE; + return false; // much easier with local entries: get the next one we find // (don't forget to clear our flag bit and set it again later) @@ -562,11 +555,11 @@ wxConfigBase::EntryType wxRegConfig::GetEntryType(const wxString& key) const bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) const { - wxCHECK_MSG( pStr, FALSE, _T("wxRegConfig::Read(): NULL param") ); + wxCHECK_MSG( pStr, false, _T("wxRegConfig::Read(): NULL param") ); wxConfigPathChanger path(this, key); - bool bQueryGlobal = TRUE; + bool bQueryGlobal = true; // if immutable key exists in global key we must check that it's not // overriden by the local key with the same name @@ -577,21 +570,21 @@ bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) const path.Name().c_str()); } - return TRUE; + return true; } else { // don't waste time - it's not there anyhow - bQueryGlobal = FALSE; + bQueryGlobal = false; } } // first try local key if ( (m_keyLocal.Exists() && TryGetValue(LocalKey(), path.Name(), *pStr)) || (bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), *pStr)) ) { - return TRUE; + return true; } - return FALSE; + return false; } // this exactly reproduces the string version above except for ExpandEnvVars(), @@ -599,11 +592,11 @@ bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) const bool wxRegConfig::DoReadLong(const wxString& key, long *plResult) const { - wxCHECK_MSG( plResult, FALSE, _T("wxRegConfig::Read(): NULL param") ); + wxCHECK_MSG( plResult, false, _T("wxRegConfig::Read(): NULL param") ); wxConfigPathChanger path(this, key); - bool bQueryGlobal = TRUE; + bool bQueryGlobal = true; // if immutable key exists in global key we must check that it's not // overriden by the local key with the same name @@ -614,21 +607,21 @@ bool wxRegConfig::DoReadLong(const wxString& key, long *plResult) const path.Name().c_str()); } - return TRUE; + return true; } else { // don't waste time - it's not there anyhow - bQueryGlobal = FALSE; + bQueryGlobal = false; } } // first try local key if ( (m_keyLocal.Exists() && TryGetValue(LocalKey(), path.Name(), plResult)) || (bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), plResult)) ) { - return TRUE; + return true; } - return FALSE; + return false; } bool wxRegConfig::DoWriteString(const wxString& key, const wxString& szValue) @@ -637,7 +630,7 @@ bool wxRegConfig::DoWriteString(const wxString& key, const wxString& szValue) if ( IsImmutable(path.Name()) ) { wxLogError(wxT("Can't change immutable entry '%s'."), path.Name().c_str()); - return FALSE; + return false; } return LocalKey().SetValue(path.Name(), szValue); @@ -649,7 +642,7 @@ bool wxRegConfig::DoWriteLong(const wxString& key, long lValue) if ( IsImmutable(path.Name()) ) { wxLogError(wxT("Can't change immutable entry '%s'."), path.Name().c_str()); - return FALSE; + return false; } return LocalKey().SetValue(path.Name(), lValue); @@ -663,11 +656,11 @@ bool wxRegConfig::RenameEntry(const wxString& oldName, const wxString& newName) { // check that the old entry exists... if ( !HasEntry(oldName) ) - return FALSE; + return false; // and that the new one doesn't if ( HasEntry(newName) ) - return FALSE; + return false; return m_keyLocal.RenameValue(oldName, newName); } @@ -676,11 +669,11 @@ bool wxRegConfig::RenameGroup(const wxString& oldName, const wxString& newName) { // check that the old group exists... if ( !HasGroup(oldName) ) - return FALSE; + return false; // and that the new one doesn't if ( HasGroup(newName) ) - return FALSE; + return false; return wxRegKey(m_keyLocal, oldName).Rename(newName); } @@ -695,7 +688,7 @@ bool wxRegConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso) if ( m_keyLocal.Exists() ) { if ( !m_keyLocal.DeleteValue(path.Name()) ) - return FALSE; + return false; if ( bGroupIfEmptyAlso && m_keyLocal.IsEmpty() ) { wxString strKey = GetPath().AfterLast(wxCONFIG_PATH_SEPARATOR); @@ -704,14 +697,14 @@ bool wxRegConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso) } } - return TRUE; + return true; } bool wxRegConfig::DeleteGroup(const wxString& key) { wxConfigPathChanger path(this, key); - return m_keyLocal.Exists() ? LocalKey().DeleteKey(path.Name()) : TRUE; + return m_keyLocal.Exists() ? LocalKey().DeleteKey(path.Name()) : true; } bool wxRegConfig::DeleteAll() @@ -729,8 +722,5 @@ bool wxRegConfig::DeleteAll() return bOk; } -#endif - // __WIN16__ - #endif // wxUSE_CONFIG