attempt to fix DLL samples link with VC6 which has trouble instantiating template methods of dll-exported classes apparently

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58575 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-01-31 22:47:28 +00:00
parent 5c6aad4737
commit c7c8fac6f8
2 changed files with 62 additions and 25 deletions

View File

@@ -107,3 +107,43 @@ bool wxPersistenceManager::Restore(void *obj)
return it->second->Restore();
}
namespace
{
template <typename T>
inline bool
DoSaveValue(wxConfigBase *conf, const wxString& key, T value)
{
return conf && conf->Write(key, value);
}
template <typename T>
bool
DoRestoreValue(wxConfigBase *conf, const wxString& key, T *value)
{
return conf && conf->Read(key, value);
}
} // anonymous namespace
#define wxPERSIST_DEFINE_SAVE_RESTORE_FOR(Type) \
bool wxPersistenceManager::SaveValue(const wxPersistentObject& who, \
const wxString& name, \
Type value) \
{ \
return DoSaveValue(GetConfig(), GetKey(who, name), value); \
} \
\
bool wxPersistenceManager::RestoreValue(const wxPersistentObject& who, \
const wxString& name, \
Type *value) \
{ \
return DoRestoreValue(GetConfig(), GetKey(who, name), value); \
}
wxPERSIST_DEFINE_SAVE_RESTORE_FOR(bool)
wxPERSIST_DEFINE_SAVE_RESTORE_FOR(int)
wxPERSIST_DEFINE_SAVE_RESTORE_FOR(long)
wxPERSIST_DEFINE_SAVE_RESTORE_FOR(wxString)
#undef wxPERSIST_DEFINE_SAVE_RESTORE_FOR