Skip to content

Commit 5560e59

Browse files
committed
Build fix for wxUSE_DATETIME==0
(backport of 642f226)
1 parent 744d7b8 commit 5560e59

File tree

6 files changed

+30
-0
lines changed

6 files changed

+30
-0
lines changed

include/wx/private/uilocale.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ class wxUILocaleImpl : public wxRefCounter
6868
// The entries contain platform-dependent identifiers.
6969
static wxVector<wxString> GetPreferredUILanguages();
7070

71+
#if wxUSE_DATETIME
7172
// Helper function used by GetMonthName/GetWeekDayName(): returns 0 if flags is
7273
// wxDateTime::Name_Full and 1 if it is wxDateTime::Name_Abbr
7374
// or -1 if the flags is incorrect (and asserts in this case)
7475
//
7576
// the return value of this function is used as an index into 2D array
7677
// containing full names in its first row and abbreviated ones in the 2nd one
7778
static int ArrayIndexFromFlag(wxDateTime::NameFlags flags);
79+
#endif // wxUSE_DATETIME
7880

7981
// Use this locale in the UI.
8082
//
@@ -92,11 +94,13 @@ class wxUILocaleImpl : public wxRefCounter
9294
virtual int CompareStrings(const wxString& lhs, const wxString& rhs,
9395
int flags) const = 0;
9496

97+
#if wxUSE_DATETIME
9598
// These functions ought to be (pure) virtual, but aren't for
9699
// ABI-compatibility reasons. Instead they are implemented in
97100
// platform-specific concrete classes.
98101
wxString GetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const;
99102
wxString GetWeekDayName(wxDateTime::WeekDay weekday, wxDateTime::NameFlags flags) const;
103+
#endif // wxUSE_DATETIME
100104

101105
virtual ~wxUILocaleImpl() { }
102106
};

include/wx/uilocale.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class WXDLLIMPEXP_BASE wxUILocale
155155
int CompareStrings(const wxString& lhs, const wxString& rhs,
156156
int flags = wxCompare_CaseSensitive) const;
157157

158+
#if wxUSE_DATETIME
158159
#if wxABI_VERSION >= 30203
159160
// Get the full (default) or abbreviated localized month name
160161
// returns empty string on error
@@ -166,6 +167,7 @@ class WXDLLIMPEXP_BASE wxUILocale
166167
wxString GetWeekDayName(wxDateTime::WeekDay weekday,
167168
wxDateTime::NameFlags flags = wxDateTime::Name_Full) const;
168169
#endif // wxABI_VERSION >= 3.2.3
170+
#endif // wxUSE_DATETIME
169171

170172
// Note that this class is not supposed to be used polymorphically, hence
171173
// its dtor is not virtual.

src/common/uilocale.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ wxString wxUILocale::GetLocalizedName(wxLocaleName name, wxLocaleForm form) cons
602602
return m_impl->GetLocalizedName(name, form);
603603
}
604604

605+
#if wxUSE_DATETIME
605606
wxString wxUILocale::GetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const
606607
{
607608
if (!m_impl)
@@ -617,6 +618,7 @@ wxString wxUILocale::GetWeekDayName(wxDateTime::WeekDay weekday, wxDateTime::Nam
617618

618619
return m_impl->GetWeekDayName(weekday, flags);
619620
}
621+
#endif // wxUSE_DATETIME
620622

621623
wxLayoutDirection wxUILocale::GetLayoutDirection() const
622624
{
@@ -905,6 +907,7 @@ const wxLanguageInfo* wxUILocale::FindLanguageInfo(const wxLocaleIdent& locId)
905907
return infoRet;
906908
}
907909

910+
#if wxUSE_DATETIME
908911
int wxUILocaleImpl::ArrayIndexFromFlag(wxDateTime::NameFlags flags)
909912
{
910913
switch (flags)
@@ -921,5 +924,6 @@ int wxUILocaleImpl::ArrayIndexFromFlag(wxDateTime::NameFlags flags)
921924

922925
return -1;
923926
}
927+
#endif // wxUSE_DATETIME
924928

925929
#endif // wxUSE_INTL

src/msw/uilocale.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ wxString wxLocaleIdent::GetName() const
163163
class wxUILocaleImplMSW : public wxUILocaleImpl
164164
{
165165
public:
166+
#if wxUSE_DATETIME
166167
virtual wxString DoGetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const = 0;
167168
virtual wxString DoGetWeekDayName(wxDateTime::WeekDay weekday, wxDateTime::NameFlags flags) const = 0;
169+
#endif // wxUSE_DATETIME
168170
};
169171

170172
// ----------------------------------------------------------------------------
@@ -225,6 +227,7 @@ class wxUILocaleImplStdC : public wxUILocaleImplMSW
225227
return str;
226228
}
227229

230+
#if wxUSE_DATETIME
228231
wxString DoGetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const wxOVERRIDE
229232
{
230233
return wxDateTime::GetEnglishMonthName(month, flags);
@@ -235,6 +238,7 @@ class wxUILocaleImplStdC : public wxUILocaleImplMSW
235238
{
236239
return wxDateTime::GetEnglishWeekDayName(weekday, flags);
237240
}
241+
#endif // wxUSE_DATETIME
238242

239243
wxLayoutDirection GetLayoutDirection() const wxOVERRIDE
240244
{
@@ -367,6 +371,7 @@ class wxUILocaleImplLCID : public wxUILocaleImplMSW
367371
return str;
368372
}
369373

374+
#if wxUSE_DATETIME
370375
wxString DoGetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const wxOVERRIDE
371376
{
372377
static LCTYPE monthNameIndex[2][12] =
@@ -412,6 +417,7 @@ class wxUILocaleImplLCID : public wxUILocaleImplMSW
412417

413418
return DoGetInfo(lctype);
414419
}
420+
#endif // wxUSE_DATETIME
415421

416422
wxLayoutDirection GetLayoutDirection() const wxOVERRIDE
417423
{
@@ -763,6 +769,7 @@ class wxUILocaleImplName : public wxUILocaleImplMSW
763769
return str;
764770
}
765771

772+
#if wxUSE_DATETIME
766773
wxString DoGetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const wxOVERRIDE
767774
{
768775
static LCTYPE monthNameIndex[2][12] =
@@ -808,6 +815,7 @@ class wxUILocaleImplName : public wxUILocaleImplMSW
808815

809816
return DoGetInfo(lctype);
810817
}
818+
#endif // wxUSE_DATETIME
811819

812820
wxLayoutDirection GetLayoutDirection() const wxOVERRIDE
813821
{
@@ -974,6 +982,7 @@ wxVector<wxString> wxUILocaleImpl::GetPreferredUILanguages()
974982
return wxUILocaleImplName::GetPreferredUILanguages();
975983
}
976984

985+
#if wxUSE_DATETIME
977986
wxString
978987
wxUILocaleImpl::GetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const
979988
{
@@ -985,5 +994,6 @@ wxUILocaleImpl::GetWeekDayName(wxDateTime::WeekDay weekday, wxDateTime::NameFlag
985994
{
986995
return static_cast<const wxUILocaleImplMSW*>(this)->DoGetWeekDayName(weekday, flags);
987996
}
997+
#endif // wxUSE_DATETIME
988998

989999
#endif // wxUSE_INTL

src/osx/core/uilocale.mm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ explicit wxUILocaleImplCF(NSLocale* nsloc)
148148
int CompareStrings(const wxString& lhs, const wxString& rhs,
149149
int flags) const wxOVERRIDE;
150150

151+
#if wxUSE_DATETIME
151152
wxString DoGetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const;
152153
wxString DoGetWeekDayName(wxDateTime::WeekDay weekday, wxDateTime::NameFlags flags) const;
154+
#endif // wxUSE_DATETIME
153155

154156
private:
155157
NSLocale* const m_nsloc;
@@ -227,6 +229,7 @@ int CompareStrings(const wxString& lhs, const wxString& rhs,
227229
return wxCFStringRef::AsString(str);
228230
}
229231

232+
#if wxUSE_DATETIME
230233
wxString
231234
wxUILocaleImplCF::DoGetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const
232235
{
@@ -272,6 +275,7 @@ int CompareStrings(const wxString& lhs, const wxString& rhs,
272275
NSString* weekdayName = [weekdayNames objectAtIndex:(weekday)];
273276
return wxCFStringRef::AsString(weekdayName);
274277
}
278+
#endif // wxUSE_DATETIME
275279

276280
wxLayoutDirection
277281
wxUILocaleImplCF::GetLayoutDirection() const
@@ -320,6 +324,7 @@ int CompareStrings(const wxString& lhs, const wxString& rhs,
320324
return preferred;
321325
}
322326

327+
#if wxUSE_DATETIME
323328
wxString
324329
wxUILocaleImpl::GetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const
325330
{
@@ -331,6 +336,7 @@ int CompareStrings(const wxString& lhs, const wxString& rhs,
331336
{
332337
return static_cast<const wxUILocaleImplCF*>(this)->DoGetWeekDayName(weekday, flags);
333338
}
339+
#endif // wxUSE_DATETIME
334340

335341
int
336342
wxUILocaleImplCF::CompareStrings(const wxString& lhs, const wxString& rhs,

src/unix/uilocale.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,10 @@ class wxUILocaleImplUnix : public wxUILocaleImpl
184184
int CompareStrings(const wxString& lhs, const wxString& rhs,
185185
int flags) const wxOVERRIDE;
186186

187+
#if wxUSE_DATETIME
187188
wxString DoGetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const;
188189
wxString DoGetWeekDayName(wxDateTime::WeekDay weekday, wxDateTime::NameFlags flags) const;
190+
#endif // wxUSE_DATETIME
189191

190192
private:
191193
#ifdef HAVE_LANGINFO_H
@@ -711,6 +713,7 @@ wxUILocaleImplUnix::GetLocalizedName(wxLocaleName name, wxLocaleForm form) const
711713
return str;
712714
}
713715

716+
#if wxUSE_DATETIME
714717
wxString
715718
wxUILocaleImplUnix::DoGetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const
716719
{
@@ -814,6 +817,7 @@ wxUILocaleImpl::GetWeekDayName(wxDateTime::WeekDay weekday, wxDateTime::NameFlag
814817
{
815818
return static_cast<const wxUILocaleImplUnix*>(this)->DoGetWeekDayName(weekday, flags);
816819
}
820+
#endif // wxUSE_DATETIME
817821

818822
wxLayoutDirection
819823
wxUILocaleImplUnix::GetLayoutDirection() const

0 commit comments

Comments
 (0)