- // currently these methods simply use wxConfig::Get()\r
- //\r
- // TODO: make this customizable by allowing\r
- // (a) specifying custom wxConfig object to use\r
- // (b) allowing to use something else entirely\r
- template <typename T>\r
- bool\r
- SaveValue(const wxPersistentObject& who, const wxString& name, T value)\r
- {\r
- wxConfigBase * const conf = GetConfig();\r
- if ( !conf )\r
- return false;\r
-\r
- return conf->Write(GetKey(who, name), value);\r
- }\r
-\r
- template <typename T>\r
- bool\r
- RestoreValue(const wxPersistentObject& who, const wxString& name, T *value)\r
- {\r
- wxConfigBase * const conf = GetConfig();\r
- if ( !conf )\r
- return false;\r
-\r
- return conf->Read(GetKey(who, name), value);\r
- }\r
+ // currently these methods simply use wxConfig::Get() but they may be\r
+ // overridden in the derived class (once we allow creating custom\r
+ // persistent managers)\r
+#define wxPERSIST_DECLARE_SAVE_RESTORE_FOR(Type) \\r
+ virtual bool SaveValue(const wxPersistentObject& who, \\r
+ const wxString& name, \\r
+ Type value); \\r
+ \\r
+ virtual bool \\r
+ RestoreValue(const wxPersistentObject& who, \\r
+ const wxString& name, \\r
+ Type *value)\r
+\r
+ wxPERSIST_DECLARE_SAVE_RESTORE_FOR(bool);\r
+ wxPERSIST_DECLARE_SAVE_RESTORE_FOR(int);\r
+ wxPERSIST_DECLARE_SAVE_RESTORE_FOR(long);\r
+ wxPERSIST_DECLARE_SAVE_RESTORE_FOR(wxString);\r
+\r
+#undef wxPERSIST_DECLARE_SAVE_RESTORE_FOR\r