6 #ifndef X_CONFIGMANAGER_H 7 #define X_CONFIGMANAGER_H 104 TiXmlElement* AssertPath(
wxString& path);
105 TiXmlElement* GetUniqElement(TiXmlElement* p,
const wxString& q);
106 void SetNodeText(TiXmlElement *n,
const TiXmlText& t);
107 inline void Collapse(
wxString& str)
const;
109 static void InitPaths();
110 static void MigrateFolders();
128 static bool SetUserDataFolder(
const wxString &user_data_path);
131 static wxString GetUserDataFolder();
187 static wxString GetRevisionString();
188 static unsigned int GetRevisionNumber();
200 void SetPath(
const wxString& strPath);
203 void DeleteSubPath(
const wxString& strPath);
221 void Write(
const wxString& name,
const wxString& value,
bool ignoreEmpty =
false);
224 void Write(
const wxString& key,
const char* str);
226 void Write(
const wxString& name,
int value);
227 bool Read(
const wxString& name,
int* value);
228 int ReadInt(
const wxString& name,
int defaultVal = 0);
230 void Write(
const wxString& name,
bool value);
231 bool Read(
const wxString& name,
bool* value);
232 bool ReadBool(
const wxString& name,
bool defaultVal =
false);
234 void Write(
const wxString& name,
double value);
235 bool Read(
const wxString& name,
double* value);
236 double ReadDouble(
const wxString& name,
double defaultVal = 0.0f);
254 void WriteBinary(
const wxString& name,
void*
ptr,
size_t len);
297 template <
typename T>
void Read(
const wxString& name, std::map<wxString, T*> *map)
300 TiXmlHandle ph(AssertPath(key));
302 if(TiXmlNode *n = ph.FirstChild(key.
mb_str(wxConvUTF8)).FirstChild(
"objmap").Node())
303 while(n->IterateChildren(e) && (e = n->IterateChildren(e)->ToElement()))
307 (*map)[
cbC2U(e->Value())] = obj;
322 if (!m_basepath.EndsWith(
wxT(
"/")))
323 m_basepath +=
wxT(
"/");
325 bool IsValid()
const {
return !m_namespace.empty(); }
328 void Write(
const wxString& name,
const wxString& value,
bool ignoreEmpty =
false);
332 void Write(
const wxString& key,
const char* str);
334 void Write(
const wxString& name,
int value);
335 bool Read(
const wxString& name,
int* value);
336 int ReadInt(
const wxString& name,
int defaultVal = 0);
338 void Write(
const wxString& name,
bool value);
339 bool Read(
const wxString& name,
bool* value);
340 bool ReadBool(
const wxString& name,
bool defaultVal =
false);
342 void Write(
const wxString& name,
double value);
343 bool Read(
const wxString& name,
double* value);
344 double ReadDouble(
const wxString& name,
double defaultVal = 0.0f);
387 void SwitchTo(
const wxString& absFN);
388 void SwitchToR(
const wxString& absFN);
Data folder in user's dir.
TiXmlDocument * volatile_doc
static wxString ReadAppPath()
void Delete(std::vector< T > &s)
Scripts folder in base dir.
Scripts folder in user's dir.
Convenience value meaning "all sd*Global values".
static wxString temp_folder
const wxCharBuffer mb_str(const wxMBConv &conv=wxConvLibc) const
All dirs in the PATH environment variable.
WX_DECLARE_STRING_HASH_MAP(ConfigManager *, NamespaceMap)
static bool has_alternate_user_data_path
static wxString alternate_user_data_path
void Read(const wxString &name, std::map< wxString, T *> *map)
User's home directory.
static wxString config_folder
static wxString GetConfigFolder()
DLLIMPORT wxString cbC2U(const char *str)
Return str as a proper unicode-compatible string.
Convenience value meaning "all sd*User values".
static wxString GetTempFolder()
std::set< wxString > StringSet
All known dirs (i.e. all of the above)
const wxString & GetBasepath() const
static wxString GetScriptsFolder(bool global=true)
Plugins folder in user's dir.
Plugins folder in base dir.
static wxString GetDataFolder(bool global=true)
Code::Blocks' installation base.
static wxString data_path_global
DLLIMPORT wxString Decode(const wxString &data)
DLLIMPORT wxArrayString cbReadBatchBuildPlugins()
Read the list of batch build plugins and return them.
ConfigManagerWrapper(wxString namespace_, wxString basepath)
static wxString GetExecutableFolder()
virtual wxString SerializeOut() const =0
static wxString data_path_user
static wxString GetHomeFolder()
static wxString GetPluginsFolder(bool global=true)
SearchDirs
Search dirs values.
static wxString ReadDataPath()
const wxString ptr(_T("*"))
static wxString home_folder
DLLIMPORT void cbWriteBatchBuildPlugins(wxArrayString bbplugins, wxWindow *messageBoxParent)
Write the list of batch build plugins in the config.
virtual void SerializeIn(const wxString &s)=0
std::map< wxString, ISerializable * > SerializableObjectMap
Wrapper class for reading or writing config values, without the need for the full path...
std::set< wxString > StringSet
std::map< int, wxString > IntToStringMap
std::map< wxString, wxString > StringToStringMap