2004-10-19 09:40:30 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2004-12-29 04:48:43 -05:00
|
|
|
// Name: wx/palmos/prefconf.h
|
|
|
|
// Purpose: wxPrefConfig interface
|
|
|
|
// Author: Wlodzimierz ABX Skiba
|
2004-10-19 09:40:30 -04:00
|
|
|
// Modified by:
|
2004-12-29 04:48:43 -05:00
|
|
|
// Created: 28.12.2004
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Wlodzimierz Skiba
|
|
|
|
// License: wxWindows licence
|
2004-10-19 09:40:30 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2004-12-29 04:48:43 -05:00
|
|
|
#ifndef _PREFCONF_H_
|
|
|
|
#define _PREFCONF_H_
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2004-12-29 04:48:43 -05:00
|
|
|
// wxPrefConfig
|
2004-10-19 09:40:30 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2004-12-29 04:48:43 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxPrefConfig : public wxConfigBase
|
2004-10-19 09:40:30 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctor & dtor
|
2004-12-29 04:48:43 -05:00
|
|
|
wxPrefConfig(const wxString& appName = wxEmptyString,
|
|
|
|
const wxString& vendorName = wxEmptyString,
|
|
|
|
const wxString& localFilename = wxEmptyString,
|
|
|
|
const wxString& globalFilename = wxEmptyString,
|
|
|
|
long style = wxCONFIG_USE_GLOBAL_FILE);
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2004-12-29 04:48:43 -05:00
|
|
|
// dtor will save unsaved data
|
|
|
|
virtual ~wxPrefConfig(){}
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// implement inherited pure virtual functions
|
|
|
|
// ------------------------------------------
|
|
|
|
|
|
|
|
// path management
|
|
|
|
virtual void SetPath(const wxString& strPath);
|
|
|
|
virtual const wxString& GetPath() const { return m_strPath; }
|
|
|
|
|
|
|
|
// entry/subgroup info
|
|
|
|
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;
|
|
|
|
|
2004-12-29 04:48:43 -05:00
|
|
|
// tests for existence
|
2004-10-19 09:40:30 -04:00
|
|
|
virtual bool HasGroup(const wxString& strName) const;
|
|
|
|
virtual bool HasEntry(const wxString& strName) const;
|
|
|
|
virtual EntryType GetEntryType(const wxString& name) const;
|
|
|
|
|
2004-12-29 04:48:43 -05:00
|
|
|
// get number of entries/subgroups in the current group, with or without
|
|
|
|
// it's subgroups
|
|
|
|
virtual size_t GetNumberOfEntries(bool bRecursive = false) const;
|
|
|
|
virtual size_t GetNumberOfGroups(bool bRecursive = false) const;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2004-12-29 04:48:43 -05:00
|
|
|
virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) { return true; }
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// rename
|
|
|
|
virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
|
|
|
|
virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
|
|
|
|
|
|
|
|
// delete
|
2004-12-29 04:48:43 -05:00
|
|
|
virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true);
|
2004-10-19 09:40:30 -04:00
|
|
|
virtual bool DeleteGroup(const wxString& key);
|
|
|
|
virtual bool DeleteAll();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// implement read/write methods
|
|
|
|
virtual bool DoReadString(const wxString& key, wxString *pStr) const;
|
|
|
|
virtual bool DoReadLong(const wxString& key, long *plResult) const;
|
|
|
|
|
|
|
|
virtual bool DoWriteString(const wxString& key, const wxString& szValue);
|
|
|
|
virtual bool DoWriteLong(const wxString& key, long lValue);
|
|
|
|
|
|
|
|
private:
|
|
|
|
// no copy ctor/assignment operator
|
2004-12-29 04:48:43 -05:00
|
|
|
wxPrefConfig(const wxPrefConfig&);
|
|
|
|
wxPrefConfig& operator=(const wxPrefConfig&);
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// current path (not '/' terminated)
|
|
|
|
wxString m_strPath;
|
2004-12-29 04:48:43 -05:00
|
|
|
|
|
|
|
// current path (group) content (cache for read/write)
|
|
|
|
wxString m_strGroup;
|
|
|
|
|
|
|
|
// current group modified ?
|
|
|
|
bool m_modGroup;
|
2004-10-19 09:40:30 -04:00
|
|
|
};
|
|
|
|
|
2004-12-29 04:48:43 -05:00
|
|
|
#endif // _PREFCONF_H_
|
|
|
|
|