Empty container and design description for native PalmOS wxPrefConfig. Remove MSW configs from PalmOS.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-12-29 09:48:43 +00:00
parent 6d63e2fc16
commit 23a59c2cbe
13 changed files with 289 additions and 797 deletions

View File

@@ -91,6 +91,8 @@ wxConfigBase *wxConfigBase::Create()
ms_pConfig =
#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE
new wxRegConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName());
#elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE
new wxPrefConfig(wxTheApp->GetAppName());
#else // either we're under Unix or wish to use files even under Windows
new wxFileConfig(wxTheApp->GetAppName());
#endif

View File

@@ -1,220 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/palmos/iniconf.cpp
// Purpose: implementation of wxIniConfig class
// Author: William Osborne
// Modified by:
// Created: 10/13/04
// RCS-ID: $Id:
// Copyright: (c) William Osborne
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "iniconf.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/string.h"
#include "wx/intl.h"
#include "wx/event.h"
#include "wx/app.h"
#include "wx/utils.h"
#endif //WX_PRECOMP
// Doesn't yet compile in Unicode mode
#if wxUSE_CONFIG && !wxUSE_UNICODE
#include "wx/dynarray.h"
#include "wx/log.h"
#include "wx/config.h"
#include "wx/file.h"
#include "wx/palmos/iniconf.h"
#include "wx/palmos/wrapwin.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// we replace all path separators with this character
#define PATH_SEP_REPLACE '_'
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// ctor & dtor
// ----------------------------------------------------------------------------
wxIniConfig::wxIniConfig(const wxString& strAppName,
const wxString& strVendor,
const wxString& localFilename,
const wxString& globalFilename,
long style)
: wxConfigBase(strAppName, strVendor, localFilename, globalFilename, style)
{
}
wxIniConfig::~wxIniConfig()
{
}
// ----------------------------------------------------------------------------
// path management
// ----------------------------------------------------------------------------
void wxIniConfig::SetPath(const wxString& strPath)
{
}
const wxString& wxIniConfig::GetPath() const
{
static wxString s_str;
return s_str;
}
wxString wxIniConfig::GetPrivateKeyName(const wxString& szKey) const
{
wxString strKey;
return strKey;
}
wxString wxIniConfig::GetKeyName(const wxString& szKey) const
{
wxString strKey;
return strKey;
}
// ----------------------------------------------------------------------------
// enumeration
// ----------------------------------------------------------------------------
bool wxIniConfig::GetFirstGroup(wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const
{
return FALSE;
}
bool wxIniConfig::GetNextGroup (wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const
{
return FALSE;
}
bool wxIniConfig::GetFirstEntry(wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const
{
return FALSE;
}
bool wxIniConfig::GetNextEntry (wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const
{
return FALSE;
}
// ----------------------------------------------------------------------------
// misc info
// ----------------------------------------------------------------------------
size_t wxIniConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const
{
return (size_t)-1;
}
size_t wxIniConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const
{
return (size_t)-1;
}
bool wxIniConfig::HasGroup(const wxString& WXUNUSED(strName)) const
{
return FALSE;
}
bool wxIniConfig::HasEntry(const wxString& WXUNUSED(strName)) const
{
return FALSE;
}
// is current group empty?
bool wxIniConfig::IsEmpty() const
{
return TRUE;
}
// ----------------------------------------------------------------------------
// read/write
// ----------------------------------------------------------------------------
bool wxIniConfig::DoReadString(const wxString& szKey, wxString *pstr) const
{
return FALSE;
}
bool wxIniConfig::DoReadLong(const wxString& szKey, long *pl) const
{
return FALSE ;
}
bool wxIniConfig::DoWriteString(const wxString& szKey, const wxString& szValue)
{
return FALSE;
}
bool wxIniConfig::DoWriteLong(const wxString& szKey, long lValue)
{
return FALSE;
}
bool wxIniConfig::Flush(bool /* bCurrentOnly */)
{
return FALSE;
}
// ----------------------------------------------------------------------------
// delete
// ----------------------------------------------------------------------------
bool wxIniConfig::DeleteEntry(const wxString& szKey, bool bGroupIfEmptyAlso)
{
return FALSE;
}
bool wxIniConfig::DeleteGroup(const wxString& szKey)
{
return FALSE;
}
#ifndef MAX_PATH
#define MAX_PATH 256
#endif
bool wxIniConfig::DeleteAll()
{
return FALSE;
}
bool wxIniConfig::RenameEntry(const wxString& WXUNUSED(oldName),
const wxString& WXUNUSED(newName))
{
return FALSE;
}
bool wxIniConfig::RenameGroup(const wxString& WXUNUSED(oldName),
const wxString& WXUNUSED(newName))
{
return FALSE;
}
#endif
// wxUSE_CONFIG && wxUSE_UNICODE

234
src/palmos/prefconf.cpp Normal file
View File

@@ -0,0 +1,234 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/palmos/prefconf.cpp
// Purpose: wxPrefConfig implementation
// Author: Wlodzimierz ABX Skiba
// Modified by:
// Created: 28.12.2004
// RCS-ID: $Id$
// Copyright: (c) Wlodzimierz Skiba
// License: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "prefconf.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/string.h"
#endif //WX_PRECOMP
#if wxUSE_CONFIG && wxUSE_CONFIG_NATIVE
#include "wx/config.h"
// ============================================================================
// implementation
// ============================================================================
/*
http://www.palmos.com/dev/support/docs/protein_books/System_Management/PreferenceConcepts.html
This wxPrefConfig class is a wxConfig wrapper around PalmOS Preferences
functionality. Preferences allow to write any structure into its database so
wxPrefConfig writes there all entries of single group into one Preference.
To optimize read/write operations value of preference is cached. Cache is filled
after each change of the path (including using path to group names in all
operations) and it is flushed on destructor, any path change on or purpose
with Flush().
Meaning of styles:
wxCONFIG_USE_LOCAL_FILE => store config in "saved" preferences database
(not to be backed up during a HotSync operation)
wxCONFIG_USE_GLOBAL_FILE => store config in "unsaved" preferences database
(backed up during a HotSync operation)
Each Preference is an array of chars. First unsigned char describes
number N of chars used for Preference size. Next N chars (string) contains
length of rest of Preference. Preference consists in serie of entries which
should be read in loop until in reaches end of Preference.
Each entry is an set of chars with following structure:
1. name (null terminated)
2. type (single char): b,s,g,l,d (see value)
3. value
- for type="b" (bool) it os "0" or "1"
- for type="s" (string) it is null terminated set of chars
- for type="g" (subgroup) as for "s" but string is converted to
uint16_t for id parameter of ::PrefGetAppPreferences()
- for type="l" (long) as for "s" but string is converted to long
- for type="d" (double) as for "s" but string is converted to double
- otherwise it is ""
So all together first Read in group needs 3 reading from Preference:
1. take the length N of length
2. take the length M of the group content
3. take the group content
and all it is in single Preference to not overload Preferences database.
As long as each next Read/Write is performed in the same group then none
access to Preferences is performed. Flushing needs only single writing to
databease because all 3 parts of Preference can be prepared in memory.
NOTE: wxPrefConfig can read/write only its own entries. It is impossible to
know structures of Preferences of other non wxW applications.
*/
// ----------------------------------------------------------------------------
// ctor/dtor
// ----------------------------------------------------------------------------
wxPrefConfig::wxPrefConfig(const wxString& appName, const wxString& vendorName,
const wxString& strLocal, const wxString& strGlobal,
long style)
: wxConfigBase(appName, vendorName, strLocal, strGlobal, style)
{
}
// ----------------------------------------------------------------------------
// path management
// ----------------------------------------------------------------------------
void wxPrefConfig::SetPath(const wxString& strPath)
{
}
// ----------------------------------------------------------------------------
// enumeration (works only with current group)
// ----------------------------------------------------------------------------
bool wxPrefConfig::GetFirstGroup(wxString& str, long& lIndex) const
{
}
bool wxPrefConfig::GetNextGroup(wxString& str, long& lIndex) const
{
/* TODO */
return false;
}
bool wxPrefConfig::GetFirstEntry(wxString& str, long& lIndex) const
{
/* TODO */
return false;
}
bool wxPrefConfig::GetNextEntry(wxString& str, long& lIndex) const
{
/* TODO */
return false;
}
size_t wxPrefConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const
{
/* TODO */
return 0;
}
size_t wxPrefConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const
{
/* TODO */
return 0;
}
// ----------------------------------------------------------------------------
// tests for existence
// ----------------------------------------------------------------------------
bool wxPrefConfig::HasGroup(const wxString& key) const
{
/* TODO */
return false;
}
bool wxPrefConfig::HasEntry(const wxString& key) const
{
/* TODO */
return false;
}
wxConfigBase::EntryType wxPrefConfig::GetEntryType(const wxString& key) const
{
/* TODO */
return wxConfigBase::Type_Unknown;
}
// ----------------------------------------------------------------------------
// reading/writing
// ----------------------------------------------------------------------------
bool wxPrefConfig::DoReadString(const wxString& key, wxString *pStr) const
{
/* TODO */
return false;
}
// this exactly reproduces the string version above except for ExpandEnvVars(),
// we really should avoid this code duplication somehow...
bool wxPrefConfig::DoReadLong(const wxString& key, long *plResult) const
{
/* TODO */
return false;
}
bool wxPrefConfig::DoWriteString(const wxString& key, const wxString& szValue)
{
/* TODO */
return false;
}
bool wxPrefConfig::DoWriteLong(const wxString& key, long lValue)
{
/* TODO */
return false;
}
// ----------------------------------------------------------------------------
// renaming
// ----------------------------------------------------------------------------
bool wxPrefConfig::RenameEntry(const wxString& oldName, const wxString& newName)
{
/* TODO */
return false;
}
bool wxPrefConfig::RenameGroup(const wxString& oldName, const wxString& newName)
{
/* TODO */
return false;
}
// ----------------------------------------------------------------------------
// deleting
// ----------------------------------------------------------------------------
bool wxPrefConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso)
{
/* TODO */
return false;
}
bool wxPrefConfig::DeleteGroup(const wxString& key)
{
/* TODO */
return false;
}
bool wxPrefConfig::DeleteAll()
{
/* TODO */
return false;
}
#endif // wxUSE_CONFIG && wxUSE_CONFIG_NATIVE

View File

@@ -1,207 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
// Name: palmos/regconf.cpp
// Purpose:
// Author: William Osborne
// Modified by:
// Created: 10/13/04
// RCS-ID: $Id:
// Copyright: (c) William Osborne
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "regconf.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/string.h"
#include "wx/intl.h"
#endif //WX_PRECOMP
#include "wx/event.h"
#include "wx/app.h"
#include "wx/log.h"
#if wxUSE_CONFIG
#include "wx/config.h"
#include "wx/palmos/registry.h"
#include "wx/palmos/regconf.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// we put our data in HKLM\SOFTWARE_KEY\appname
#define SOFTWARE_KEY wxString(wxT("Software\\"))
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------
// get the value if the key is opened and it exists
bool TryGetValue(const wxRegKey& key, const wxString& str, wxString& strVal)
{
return false;
}
bool TryGetValue(const wxRegKey& key, const wxString& str, long *plVal)
{
return false;
}
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// ctor/dtor
// ----------------------------------------------------------------------------
// create the config object which stores its data under HKCU\vendor\app and, if
// style & wxCONFIG_USE_GLOBAL_FILE, under HKLM\vendor\app
wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName,
const wxString& strLocal, const wxString& strGlobal,
long style)
: wxConfigBase(appName, vendorName, strLocal, strGlobal, style)
{
}
wxRegConfig::~wxRegConfig()
{
}
// ----------------------------------------------------------------------------
// path management
// ----------------------------------------------------------------------------
void wxRegConfig::SetPath(const wxString& strPath)
{
}
// ----------------------------------------------------------------------------
// enumeration (works only with current group)
// ----------------------------------------------------------------------------
#define LOCAL_MASK 0x8000
#define IS_LOCAL_INDEX(l) (((l) & LOCAL_MASK) != 0)
bool wxRegConfig::GetFirstGroup(wxString& str, long& lIndex) const
{
return false;
}
bool wxRegConfig::GetNextGroup(wxString& str, long& lIndex) const
{
return false;
}
bool wxRegConfig::GetFirstEntry(wxString& str, long& lIndex) const
{
return false;
}
bool wxRegConfig::GetNextEntry(wxString& str, long& lIndex) const
{
return false;
}
size_t wxRegConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const
{
return 0;
}
size_t wxRegConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const
{
return 0;
}
// ----------------------------------------------------------------------------
// tests for existence
// ----------------------------------------------------------------------------
bool wxRegConfig::HasGroup(const wxString& key) const
{
return false;
}
bool wxRegConfig::HasEntry(const wxString& key) const
{
return false;
}
wxConfigBase::EntryType wxRegConfig::GetEntryType(const wxString& key) const
{
return wxConfigBase::Type_Integer;
}
// ----------------------------------------------------------------------------
// reading/writing
// ----------------------------------------------------------------------------
bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) const
{
return FALSE;
}
// this exactly reproduces the string version above except for ExpandEnvVars(),
// we really should avoid this code duplication somehow...
bool wxRegConfig::DoReadLong(const wxString& key, long *plResult) const
{
return FALSE;
}
bool wxRegConfig::DoWriteString(const wxString& key, const wxString& szValue)
{
return false;
}
bool wxRegConfig::DoWriteLong(const wxString& key, long lValue)
{
return false;
}
// ----------------------------------------------------------------------------
// renaming
// ----------------------------------------------------------------------------
bool wxRegConfig::RenameEntry(const wxString& oldName, const wxString& newName)
{
return false;
}
bool wxRegConfig::RenameGroup(const wxString& oldName, const wxString& newName)
{
return false;
}
// ----------------------------------------------------------------------------
// deleting
// ----------------------------------------------------------------------------
bool wxRegConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso)
{
return false;
}
bool wxRegConfig::DeleteGroup(const wxString& key)
{
return false;
}
bool wxRegConfig::DeleteAll()
{
return false;
}
#endif
// wxUSE_CONFIG

View File

@@ -244,8 +244,6 @@ extern long wxCharsetToCodepage(const wxChar *name)
#else // !wxUSE_FONTMAP
#include "wx/palmos/registry.h"
// this should work if Internet Exploiter is installed
extern long wxCharsetToCodepage(const wxChar *name)
{