minor cleanup of Unix GetInfo(): assert if invalid parameters are passed; don't use explict wxString ctors
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2689,36 +2689,42 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
|
||||
/* static */
|
||||
wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat)
|
||||
{
|
||||
struct lconv *locale_info = localeconv();
|
||||
switch (cat)
|
||||
lconv * const lc = localeconv();
|
||||
if ( !lc )
|
||||
return wxString();
|
||||
|
||||
switch ( cat )
|
||||
{
|
||||
case wxLOCALE_CAT_NUMBER:
|
||||
switch (index)
|
||||
switch ( index )
|
||||
{
|
||||
case wxLOCALE_THOUSANDS_SEP:
|
||||
return wxString(locale_info->thousands_sep,
|
||||
*wxConvCurrent);
|
||||
return lc->thousands_sep;
|
||||
|
||||
case wxLOCALE_DECIMAL_POINT:
|
||||
return wxString(locale_info->decimal_point,
|
||||
*wxConvCurrent);
|
||||
default:
|
||||
return wxEmptyString;
|
||||
return lc->decimal_point;
|
||||
}
|
||||
break;
|
||||
|
||||
case wxLOCALE_CAT_MONEY:
|
||||
switch (index)
|
||||
switch ( index )
|
||||
{
|
||||
case wxLOCALE_THOUSANDS_SEP:
|
||||
return wxString(locale_info->mon_thousands_sep,
|
||||
*wxConvCurrent);
|
||||
return lc->mon_thousands_sep;
|
||||
|
||||
case wxLOCALE_DECIMAL_POINT:
|
||||
return wxString(locale_info->mon_decimal_point,
|
||||
*wxConvCurrent);
|
||||
default:
|
||||
return wxEmptyString;
|
||||
return lc->mon_decimal_point;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return wxEmptyString;
|
||||
wxFAIL_MSG( "unknown wxLocaleCategory" );
|
||||
return wxString(); // skip second assert below
|
||||
}
|
||||
|
||||
wxFAIL_MSG( "unknown wxLocaleInfo value for this category" );
|
||||
|
||||
return wxString();
|
||||
}
|
||||
|
||||
#endif // platform
|
||||
|
Reference in New Issue
Block a user