Compilation fixes for wxUSE_LOCALE and wxUSE_XLOCALE set to 0.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Dimitri Schoolwerth
2011-04-04 22:07:42 +00:00
parent 326c0adbfc
commit 88def1632e
2 changed files with 21 additions and 0 deletions

View File

@@ -39,7 +39,9 @@ class LocaleId
public: public:
LocaleId() LocaleId()
{ {
#if wxUSE_INTL
m_wxloc = NULL; m_wxloc = NULL;
#endif // wxUSE_INTL
m_cloc = NULL; m_cloc = NULL;
} }
@@ -48,6 +50,7 @@ public:
Free(); Free();
} }
#if wxUSE_INTL
// Return true if this is the first time this function is called for this // Return true if this is the first time this function is called for this
// object or if the program locale has changed since the last time it was // object or if the program locale has changed since the last time it was
// called. Otherwise just return false indicating that updating locale- // called. Otherwise just return false indicating that updating locale-
@@ -70,15 +73,20 @@ public:
return true; return true;
} }
#endif // wxUSE_INTL
private: private:
void Free() void Free()
{ {
#if wxUSE_INTL
free(m_cloc); free(m_cloc);
#endif // wxUSE_INTL
} }
#if wxUSE_INTL
// Non-owned pointer to wxLocale which was used. // Non-owned pointer to wxLocale which was used.
wxLocale *m_wxloc; wxLocale *m_wxloc;
#endif // wxUSE_INTL
// Owned pointer to the C locale string. // Owned pointer to the C locale string.
char *m_cloc; char *m_cloc;
@@ -98,6 +106,7 @@ private:
wxChar wxNumberFormatter::GetDecimalSeparator() wxChar wxNumberFormatter::GetDecimalSeparator()
{ {
#if wxUSE_INTL
// Notice that while using static variable here is not MT-safe, the worst // Notice that while using static variable here is not MT-safe, the worst
// that can happen is that we redo the initialization if we're called // that can happen is that we redo the initialization if we're called
// concurrently from more than one thread so it's not a real problem. // concurrently from more than one thread so it's not a real problem.
@@ -128,10 +137,14 @@ wxChar wxNumberFormatter::GetDecimalSeparator()
} }
return s_decimalSeparator; return s_decimalSeparator;
#else // !wxUSE_INTL
return wxT('.');
#endif // wxUSE_INTL/!wxUSE_INTL
} }
bool wxNumberFormatter::GetThousandsSeparatorIfUsed(wxChar *sep) bool wxNumberFormatter::GetThousandsSeparatorIfUsed(wxChar *sep)
{ {
#if wxUSE_INTL
static wxChar s_thousandsSeparator = 0; static wxChar s_thousandsSeparator = 0;
static LocaleId s_localeUsedForInit; static LocaleId s_localeUsedForInit;
@@ -157,6 +170,10 @@ bool wxNumberFormatter::GetThousandsSeparatorIfUsed(wxChar *sep)
*sep = s_thousandsSeparator; *sep = s_thousandsSeparator;
return true; return true;
#else // !wxUSE_INTL
wxUnusedVar(sep);
return false;
#endif // wxUSE_INTL/!wxUSE_INTL
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -209,11 +209,15 @@ private:
// functions honours wxDP_SHOWCENTURY flag. // functions honours wxDP_SHOWCENTURY flag.
wxString GetLocaleDateFormat() const wxString GetLocaleDateFormat() const
{ {
#if wxUSE_INTL
wxString fmt = wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT); wxString fmt = wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT);
if ( HasDPFlag(wxDP_SHOWCENTURY) ) if ( HasDPFlag(wxDP_SHOWCENTURY) )
fmt.Replace("%y", "%Y"); fmt.Replace("%y", "%Y");
return fmt; return fmt;
#else // !wxUSE_INTL
return wxT("x");
#endif // wxUSE_INTL/!wxUSE_INTL
} }
bool SetFormat(const wxString& fmt) bool SetFormat(const wxString& fmt)