make wxSetEnv compatible with ANSI and Unicode, deprecate passing NULL to it in favour of wxUnsetEnv()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46547 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-06-19 20:02:49 +00:00
parent 531814a7fb
commit 90a77e6484
8 changed files with 92 additions and 16 deletions

View File

@@ -457,10 +457,30 @@ WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true);
WXDLLIMPEXP_BASE bool wxGetEnv(const wxString& var, wxString *value);
// set the env var name to the given value, return true on success
WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxChar *value);
WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxString& value);
// remove the env var from environment
inline bool wxUnsetEnv(const wxString& var) { return wxSetEnv(var, NULL); }
WXDLLIMPEXP_BASE bool wxUnsetEnv(const wxString& var);
#if WXWIN_COMPATIBILITY_2_8
inline bool wxSetEnv(const wxString& var, const char *value)
{ return wxSetEnv(var, wxString(value)); }
inline bool wxSetEnv(const wxString& var, const wchar_t *value)
{ return wxSetEnv(var, wxString(value)); }
template<typename T>
inline bool wxSetEnv(const wxString& var, const wxCharTypeBuffer<T>& value)
{ return wxSetEnv(var, wxString(value)); }
inline bool wxSetEnv(const wxString& var, const wxCStrData& value)
{ return wxSetEnv(var, wxString(value)); }
// this one is for passing NULL directly - don't use it, use wxUnsetEnv instead
wxDEPRECATED( inline bool wxSetEnv(const wxString& var, int value) );
inline bool wxSetEnv(const wxString& var, int value)
{
wxASSERT_MSG( value == 0, "using non-NULL integer as string?" );
return wxUnsetEnv(var);
}
#endif // WXWIN_COMPATIBILITY_2_8
// ----------------------------------------------------------------------------
// Network and username functions.