23 #include "wxgis/core/core.h"
25 #include <wx/stdpaths.h>
26 #include <wx/filename.h>
27 #include <wx/hashmap.h>
28 #include <wx/xml/xml.h>
30 WX_DECLARE_STRING_HASH_MAP( wxXmlNode*, wxGISConfigNodesMap );
44 void Create(
bool bPortable =
false);
45 void ReportPaths(
void);
47 bool IsOk()
const {
return m_refData != NULL; };
50 bool operator != (
const wxGISConfig& obj)
const {
return !(*
this == obj); };
52 wxString Read(wxGISEnumConfigKey Key,
const wxString &sPath,
const wxString &sDefaultValue);
53 int ReadInt(wxGISEnumConfigKey Key,
const wxString &sPath,
int nDefaultValue);
54 double ReadDouble(wxGISEnumConfigKey Key,
const wxString &sPath,
double dDefaultValue);
55 bool ReadBool(wxGISEnumConfigKey Key,
const wxString &sPath,
bool bDefaultValue);
56 bool Write(wxGISEnumConfigKey Key,
const wxString &sPath,
const wxString &sValue);
57 bool Write(wxGISEnumConfigKey Key,
const wxString &sPath,
bool bValue);
58 bool Write(wxGISEnumConfigKey Key,
const wxString &sPath,
int nValue);
60 static void DeleteNodeChildren(wxXmlNode* pNode);
61 wxXmlNode *GetConfigNode(wxGISEnumConfigKey Key,
const wxString &sPath);
62 wxXmlNode *CreateConfigNode(wxGISEnumConfigKey Key,
const wxString &sPath);
64 wxString GetLocalConfigDir(
void)
const;
65 wxString GetGlobalConfigDir(
void)
const;
66 wxString GetLocalConfigDirNonPortable(
void)
const;
68 void Save(
const wxGISEnumConfigKey Key = enumGISHKAny);
70 bool SplitPathToXml(
const wxString & fullpath, wxString *psFileName, wxString *psPathInXml);
71 bool SplitPathToAttribute(
const wxString & fullpath, wxString *psPathToAttribute, wxString *psAttributeName);
72 wxXmlNode* GetConfigRootNode(wxGISEnumConfigKey Key,
const wxString &sFileName)
const;
74 virtual wxObjectRefData *CreateRefData()
const;
75 virtual wxObjectRefData *CloneRefData(
const wxObjectRefData *data)
const;
92 void Save(
const wxGISEnumConfigKey Key = enumGISHKAny,
const wxString& sXmlFileName = wxEmptyString);
99 wxXmlDocument *pXmlDoc;
100 wxGISEnumConfigKey eKey;
101 wxString sXmlFileName;
102 wxString sXmlFilePath;
106 wxString m_sLocalConfigDirPath, m_sGlobalConfigDirPath, m_sAppExeDirPath;
107 wxString m_sLocalConfigDirPathNonPortable;
109 wxVector<WXXMLCONF> m_paConfigFiles;
110 wxGISConfigNodesMap m_pmConfigNodes;
112 wxCriticalSection m_oCritSect;
130 wxString GetLocale(
void);
131 wxString GetLocaleDir(
void);
132 wxString GetSysDir(
void);
133 wxString GetTempDir(
void);
134 wxString GetLogDir(
void);
135 bool GetDebugMode(
void);
136 void SetLocale(
const wxString &sLocale);
137 void SetLocaleDir(
const wxString &sLocaleDir);
138 void SetSysDir(
const wxString &sSysDir);
139 void SetLogDir(
const wxString &sLogDir);
140 void SetDebugMode(
bool bDebug);