1998-05-27 19:07:33 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: msw/regconf.h
|
1998-08-02 19:04:55 -04:00
|
|
|
// Purpose: Registry based implementation of wxConfigBase
|
1998-05-27 19:07:33 -04:00
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 27.04.98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
1998-08-07 19:52:45 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-27 19:07:33 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _REGCONF_H
|
|
|
|
#define _REGCONF_H
|
|
|
|
|
1998-07-03 12:36:10 -04:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "regconf.h"
|
|
|
|
#endif
|
|
|
|
|
1998-08-02 19:04:55 -04:00
|
|
|
#ifndef _REGISTRY_H
|
|
|
|
#include <wx/msw/registry.h>
|
|
|
|
#endif
|
|
|
|
|
1998-05-27 19:07:33 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxRegConfig
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
1998-08-02 19:04:55 -04:00
|
|
|
class wxRegConfig : public wxConfigBase
|
1998-05-27 19:07:33 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctor & dtor
|
|
|
|
// will store data in HKLM\strRegHive and HKCU\strRegHive
|
|
|
|
wxRegConfig(const wxString& strRegHive);
|
|
|
|
// dtor will save unsaved data
|
|
|
|
virtual ~wxRegConfig();
|
|
|
|
|
|
|
|
// implement inherited pure virtual functions
|
|
|
|
// ------------------------------------------
|
|
|
|
|
|
|
|
// path management
|
|
|
|
virtual void SetPath(const wxString& strPath);
|
|
|
|
virtual const wxString& GetPath() const { return m_strPath; }
|
|
|
|
|
1998-08-02 19:04:55 -04:00
|
|
|
// entry/subgroup info
|
|
|
|
// enumerate all of them
|
|
|
|
virtual bool GetFirstGroup(wxString& str, long& lIndex) const;
|
|
|
|
virtual bool GetNextGroup (wxString& str, long& lIndex) const;
|
|
|
|
virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
|
|
|
|
virtual bool GetNextEntry (wxString& str, long& lIndex) const;
|
1998-05-27 19:07:33 -04:00
|
|
|
|
1998-08-02 19:04:55 -04:00
|
|
|
// tests for existence
|
1998-07-08 13:56:43 -04:00
|
|
|
virtual bool HasGroup(const wxString& strName) const;
|
|
|
|
virtual bool HasEntry(const wxString& strName) const;
|
|
|
|
|
1998-07-24 11:44:58 -04:00
|
|
|
// get number of entries/subgroups in the current group, with or without
|
|
|
|
// it's subgroups
|
1998-08-18 16:15:51 -04:00
|
|
|
virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
|
|
|
|
virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
|
1998-07-24 11:44:58 -04:00
|
|
|
|
1998-05-27 19:07:33 -04:00
|
|
|
// read/write
|
1998-08-02 19:04:55 -04:00
|
|
|
virtual bool Read(wxString *pStr, const char *szKey,
|
|
|
|
const char *szDefault = 0) const;
|
|
|
|
virtual bool Read(long *result, const char *szKey, long lDefault = 0) const;
|
1998-05-27 19:07:33 -04:00
|
|
|
virtual bool Write(const char *szKey, const char *szValue);
|
|
|
|
virtual bool Write(const char *szKey, long Value);
|
1998-07-01 13:26:46 -04:00
|
|
|
virtual bool Flush(bool /* bCurrentOnly = FALSE */ ) { return TRUE; }
|
1998-05-27 19:07:33 -04:00
|
|
|
|
|
|
|
// delete
|
|
|
|
virtual bool DeleteEntry(const char *szKey, bool bGroupIfEmptyAlso);
|
|
|
|
virtual bool DeleteGroup(const char *szKey);
|
|
|
|
virtual bool DeleteAll();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// these keys are opened during all lifetime of wxRegConfig object
|
|
|
|
wxRegKey m_keyLocalRoot, m_keyLocal,
|
|
|
|
m_keyGlobalRoot, m_keyGlobal;
|
|
|
|
|
|
|
|
// current path (not '/' terminated)
|
|
|
|
wxString m_strPath;
|
|
|
|
};
|
|
|
|
|
1998-07-01 13:26:46 -04:00
|
|
|
#endif //_REGCONF_H
|