// Created: 27.04.98
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// Licence: wxWindows license
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "regconf.h"
#endif
#include "wx/config.h"
-#ifndef __WIN16__
-
#include "wx/msw/registry.h"
#include "wx/msw/regconf.h"
// ----------------------------------------------------------------------------
// we put our data in HKLM\SOFTWARE_KEY\appname
-#define SOFTWARE_KEY wxString("Software\\")
+#define SOFTWARE_KEY wxString(wxT("Software\\"))
// ----------------------------------------------------------------------------
// global functions
m_keyLocal.ReserveMemoryForName(MEMORY_PREALLOC);
m_keyLocalRoot.SetName(wxRegKey::HKCU, SOFTWARE_KEY + str);
- m_keyLocal.SetName(m_keyLocalRoot, _T(""));
+ m_keyLocal.SetName(m_keyLocalRoot, wxEmptyString);
if ( bDoUseGlobal )
{
m_keyGlobal.ReserveMemoryForName(MEMORY_PREALLOC);
m_keyGlobalRoot.SetName(wxRegKey::HKLM, SOFTWARE_KEY + str);
- m_keyGlobal.SetName(m_keyGlobalRoot, _T(""));
+ m_keyGlobal.SetName(m_keyGlobalRoot, wxEmptyString);
}
// Create() will Open() if key already exists
if ( bDoUseGlobal )
{
wxLogNull nolog;
- m_keyGlobalRoot.Open();
- m_keyGlobal.Open();
+ m_keyGlobalRoot.Open(wxRegKey::Read);
+ m_keyGlobal.Open(wxRegKey::Read);
}
}
size_t len = strFullPath.length();
const wxChar *end = src + len;
- wxChar *dst = m_strPath.GetWriteBuf(len);
+ wxStringBufferLength buf(m_strPath, len);
+ wxChar *dst = buf;
wxChar *start = dst;
for ( ; src < end; src++, dst++ )
}
*dst = _T('\0');
-
- m_strPath.UngetWriteBuf(dst - start);
+ buf.SetLength(dst - start);
}
#ifdef WX_DEBUG_SET_PATH
size_t len = m_strPath.length();
const wxChar *src = m_strPath.c_str();
- wxChar *dst = strRegPath.GetWriteBuf(len);
+ wxStringBufferLength buf(strRegPath, len);
+ wxChar *dst = buf;
const wxChar *end = src + len;
for ( ; src < end; src++, dst++ )
*dst = *src;
}
- strRegPath.UngetWriteBuf(len);
+ buf.SetLength(len);
}
// this is not needed any longer as we don't create keys unnecessarily any
// change current key(s)
m_keyLocal.SetName(m_keyLocalRoot, strRegPath);
- m_keyGlobal.SetName(m_keyGlobalRoot, strRegPath);
- // don't create it right now, wait until it is accessed
- //m_keyLocal.Create();
+ if ( GetStyle() & wxCONFIG_USE_GLOBAL_FILE )
+ {
+ m_keyGlobal.SetName(m_keyGlobalRoot, strRegPath);
- wxLogNull nolog;
- m_keyGlobal.Open();
+ wxLogNull nolog;
+ m_keyGlobal.Open(wxRegKey::Read);
+ }
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// deleting
// ----------------------------------------------------------------------------
-bool wxRegConfig::DeleteEntry(const wxString& value, bool WXUNUSED(bGroupIfEmptyAlso))
+
+bool wxRegConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso)
{
wxConfigPathChanger path(this, value);
if ( !m_keyLocal.DeleteValue(path.Name()) )
return FALSE;
- if ( m_keyLocal.IsEmpty() ) {
+ if ( bGroupIfEmptyAlso && m_keyLocal.IsEmpty() ) {
wxString strKey = GetPath().AfterLast(wxCONFIG_PATH_SEPARATOR);
- SetPath(".."); // changes m_keyLocal
+ SetPath(_T("..")); // changes m_keyLocal
return LocalKey().DeleteKey(strKey);
}
}
return bOk;
}
-#endif
- // __WIN16__
-
#endif
// wxUSE_CONFIG