add wxXLocale class and wxIsxxx_l() and wxToxxx_l() functions (heavily modified and extended patch 1874287)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51632 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-02-10 17:03:23 +00:00
parent 451c13c85c
commit 6e4ae332ac
38 changed files with 1108 additions and 10 deletions

View File

@@ -427,6 +427,7 @@ ALL_BASE_HEADERS = \
wx/wxcrtbase.h \
wx/wxcrtvararg.h \
wx/wxprec.h \
wx/xlocale.h \
wx/xti.h \
wx/xtistrm.h \
wx/zipstrm.h \
@@ -576,6 +577,7 @@ ALL_PORTS_BASE_HEADERS = \
wx/wxcrtbase.h \
wx/wxcrtvararg.h \
wx/wxprec.h \
wx/xlocale.h \
wx/xti.h \
wx/xtistrm.h \
wx/zipstrm.h \
@@ -718,6 +720,7 @@ ALL_BASE_SOURCES = \
src/common/wfstream.cpp \
src/common/wxcrt.cpp \
src/common/wxprintf.cpp \
src/common/xlocale.cpp \
src/common/xti.cpp \
src/common/xtistrm.cpp \
src/common/zipstrm.cpp \
@@ -902,6 +905,7 @@ MONODLL_OBJECTS = \
monodll_wfstream.o \
monodll_wxcrt.o \
monodll_wxprintf.o \
monodll_xlocale.o \
monodll_xti.o \
monodll_xtistrm.o \
monodll_zipstrm.o \
@@ -1016,6 +1020,7 @@ MONOLIB_OBJECTS = \
monolib_wfstream.o \
monolib_wxcrt.o \
monolib_wxprintf.o \
monolib_xlocale.o \
monolib_xti.o \
monolib_xtistrm.o \
monolib_zipstrm.o \
@@ -1128,6 +1133,7 @@ BASEDLL_OBJECTS = \
basedll_wfstream.o \
basedll_wxcrt.o \
basedll_wxprintf.o \
basedll_xlocale.o \
basedll_xti.o \
basedll_xtistrm.o \
basedll_zipstrm.o \
@@ -1223,6 +1229,7 @@ BASELIB_OBJECTS = \
baselib_wfstream.o \
baselib_wxcrt.o \
baselib_wxprintf.o \
baselib_xlocale.o \
baselib_xti.o \
baselib_xtistrm.o \
baselib_zipstrm.o \
@@ -13778,6 +13785,9 @@ monodll_wxcrt.o: $(srcdir)/src/common/wxcrt.cpp $(MONODLL_ODEP)
monodll_wxprintf.o: $(srcdir)/src/common/wxprintf.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/wxprintf.cpp
monodll_xlocale.o: $(srcdir)/src/common/xlocale.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/xlocale.cpp
monodll_xti.o: $(srcdir)/src/common/xti.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/xti.cpp
@@ -18281,6 +18291,9 @@ monolib_wxcrt.o: $(srcdir)/src/common/wxcrt.cpp $(MONOLIB_ODEP)
monolib_wxprintf.o: $(srcdir)/src/common/wxprintf.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/wxprintf.cpp
monolib_xlocale.o: $(srcdir)/src/common/xlocale.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/xlocale.cpp
monolib_xti.o: $(srcdir)/src/common/xti.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/xti.cpp
@@ -22784,6 +22797,9 @@ basedll_wxcrt.o: $(srcdir)/src/common/wxcrt.cpp $(BASEDLL_ODEP)
basedll_wxprintf.o: $(srcdir)/src/common/wxprintf.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/wxprintf.cpp
basedll_xlocale.o: $(srcdir)/src/common/xlocale.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/xlocale.cpp
basedll_xti.o: $(srcdir)/src/common/xti.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/xti.cpp
@@ -23591,6 +23607,9 @@ baselib_wxcrt.o: $(srcdir)/src/common/wxcrt.cpp $(BASELIB_ODEP)
baselib_wxprintf.o: $(srcdir)/src/common/wxprintf.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/wxprintf.cpp
baselib_xlocale.o: $(srcdir)/src/common/xlocale.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/xlocale.cpp
baselib_xti.o: $(srcdir)/src/common/xti.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/xti.cpp

View File

@@ -416,6 +416,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/common/wfstream.cpp
src/common/wxcrt.cpp
src/common/wxprintf.cpp
src/common/xlocale.cpp
src/common/xti.cpp
src/common/xtistrm.cpp
src/common/zipstrm.cpp
@@ -550,6 +551,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/wxcrtbase.h
wx/wxcrtvararg.h
wx/wxprec.h
wx/xlocale.h
wx/xti.h
wx/xtistrm.h
wx/zipstrm.h

View File

@@ -377,6 +377,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_wfstream.obj \
$(OBJS)\monodll_wxcrt.obj \
$(OBJS)\monodll_wxprintf.obj \
$(OBJS)\monodll_xlocale.obj \
$(OBJS)\monodll_xti.obj \
$(OBJS)\monodll_xtistrm.obj \
$(OBJS)\monodll_zipstrm.obj \
@@ -514,6 +515,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_wfstream.obj \
$(OBJS)\monolib_wxcrt.obj \
$(OBJS)\monolib_wxprintf.obj \
$(OBJS)\monolib_xlocale.obj \
$(OBJS)\monolib_xti.obj \
$(OBJS)\monolib_xtistrm.obj \
$(OBJS)\monolib_zipstrm.obj \
@@ -648,6 +650,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_wfstream.obj \
$(OBJS)\basedll_wxcrt.obj \
$(OBJS)\basedll_wxprintf.obj \
$(OBJS)\basedll_xlocale.obj \
$(OBJS)\basedll_xti.obj \
$(OBJS)\basedll_xtistrm.obj \
$(OBJS)\basedll_zipstrm.obj \
@@ -766,6 +769,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_wfstream.obj \
$(OBJS)\baselib_wxcrt.obj \
$(OBJS)\baselib_wxprintf.obj \
$(OBJS)\baselib_xlocale.obj \
$(OBJS)\baselib_xti.obj \
$(OBJS)\baselib_xtistrm.obj \
$(OBJS)\baselib_zipstrm.obj \
@@ -5387,6 +5391,9 @@ $(OBJS)\monodll_wxcrt.obj: ..\..\src\common\wxcrt.cpp
$(OBJS)\monodll_wxprintf.obj: ..\..\src\common\wxprintf.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\wxprintf.cpp
$(OBJS)\monodll_xlocale.obj: ..\..\src\common\xlocale.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\xlocale.cpp
$(OBJS)\monodll_xti.obj: ..\..\src\common\xti.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\xti.cpp
@@ -7490,6 +7497,9 @@ $(OBJS)\monolib_wxcrt.obj: ..\..\src\common\wxcrt.cpp
$(OBJS)\monolib_wxprintf.obj: ..\..\src\common\wxprintf.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\wxprintf.cpp
$(OBJS)\monolib_xlocale.obj: ..\..\src\common\xlocale.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\xlocale.cpp
$(OBJS)\monolib_xti.obj: ..\..\src\common\xti.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\xti.cpp
@@ -9593,6 +9603,9 @@ $(OBJS)\basedll_wxcrt.obj: ..\..\src\common\wxcrt.cpp
$(OBJS)\basedll_wxprintf.obj: ..\..\src\common\wxprintf.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\wxprintf.cpp
$(OBJS)\basedll_xlocale.obj: ..\..\src\common\xlocale.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\xlocale.cpp
$(OBJS)\basedll_xti.obj: ..\..\src\common\xti.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\xti.cpp
@@ -9896,6 +9909,9 @@ $(OBJS)\baselib_wxcrt.obj: ..\..\src\common\wxcrt.cpp
$(OBJS)\baselib_wxprintf.obj: ..\..\src\common\wxprintf.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\wxprintf.cpp
$(OBJS)\baselib_xlocale.obj: ..\..\src\common\xlocale.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\xlocale.cpp
$(OBJS)\baselib_xti.obj: ..\..\src\common\xti.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\xti.cpp

View File

@@ -364,6 +364,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_wfstream.o \
$(OBJS)\monodll_wxcrt.o \
$(OBJS)\monodll_wxprintf.o \
$(OBJS)\monodll_xlocale.o \
$(OBJS)\monodll_xti.o \
$(OBJS)\monodll_xtistrm.o \
$(OBJS)\monodll_zipstrm.o \
@@ -502,6 +503,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_wfstream.o \
$(OBJS)\monolib_wxcrt.o \
$(OBJS)\monolib_wxprintf.o \
$(OBJS)\monolib_xlocale.o \
$(OBJS)\monolib_xti.o \
$(OBJS)\monolib_xtistrm.o \
$(OBJS)\monolib_zipstrm.o \
@@ -638,6 +640,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_wfstream.o \
$(OBJS)\basedll_wxcrt.o \
$(OBJS)\basedll_wxprintf.o \
$(OBJS)\basedll_xlocale.o \
$(OBJS)\basedll_xti.o \
$(OBJS)\basedll_xtistrm.o \
$(OBJS)\basedll_zipstrm.o \
@@ -756,6 +759,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_wfstream.o \
$(OBJS)\baselib_wxcrt.o \
$(OBJS)\baselib_wxprintf.o \
$(OBJS)\baselib_xlocale.o \
$(OBJS)\baselib_xti.o \
$(OBJS)\baselib_xtistrm.o \
$(OBJS)\baselib_zipstrm.o \
@@ -5529,6 +5533,9 @@ $(OBJS)\monodll_wxcrt.o: ../../src/common/wxcrt.cpp
$(OBJS)\monodll_wxprintf.o: ../../src/common/wxprintf.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_xlocale.o: ../../src/common/xlocale.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_xti.o: ../../src/common/xti.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@@ -7734,6 +7741,9 @@ $(OBJS)\monolib_wxcrt.o: ../../src/common/wxcrt.cpp
$(OBJS)\monolib_wxprintf.o: ../../src/common/wxprintf.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_xlocale.o: ../../src/common/xlocale.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_xti.o: ../../src/common/xti.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -9939,6 +9949,9 @@ $(OBJS)\basedll_wxcrt.o: ../../src/common/wxcrt.cpp
$(OBJS)\basedll_wxprintf.o: ../../src/common/wxprintf.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\basedll_xlocale.o: ../../src/common/xlocale.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\basedll_xti.o: ../../src/common/xti.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -10242,6 +10255,9 @@ $(OBJS)\baselib_wxcrt.o: ../../src/common/wxcrt.cpp
$(OBJS)\baselib_wxprintf.o: ../../src/common/wxprintf.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\baselib_xlocale.o: ../../src/common/xlocale.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\baselib_xti.o: ../../src/common/xti.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -379,6 +379,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_wfstream.obj \
$(OBJS)\monodll_wxcrt.obj \
$(OBJS)\monodll_wxprintf.obj \
$(OBJS)\monodll_xlocale.obj \
$(OBJS)\monodll_xti.obj \
$(OBJS)\monodll_xtistrm.obj \
$(OBJS)\monodll_zipstrm.obj \
@@ -521,6 +522,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_wfstream.obj \
$(OBJS)\monolib_wxcrt.obj \
$(OBJS)\monolib_wxprintf.obj \
$(OBJS)\monolib_xlocale.obj \
$(OBJS)\monolib_xti.obj \
$(OBJS)\monolib_xtistrm.obj \
$(OBJS)\monolib_zipstrm.obj \
@@ -661,6 +663,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_wfstream.obj \
$(OBJS)\basedll_wxcrt.obj \
$(OBJS)\basedll_wxprintf.obj \
$(OBJS)\basedll_xlocale.obj \
$(OBJS)\basedll_xti.obj \
$(OBJS)\basedll_xtistrm.obj \
$(OBJS)\basedll_zipstrm.obj \
@@ -784,6 +787,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_wfstream.obj \
$(OBJS)\baselib_wxcrt.obj \
$(OBJS)\baselib_wxprintf.obj \
$(OBJS)\baselib_xlocale.obj \
$(OBJS)\baselib_xti.obj \
$(OBJS)\baselib_xtistrm.obj \
$(OBJS)\baselib_zipstrm.obj \
@@ -5719,6 +5723,9 @@ $(OBJS)\monodll_wxcrt.obj: ..\..\src\common\wxcrt.cpp
$(OBJS)\monodll_wxprintf.obj: ..\..\src\common\wxprintf.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\wxprintf.cpp
$(OBJS)\monodll_xlocale.obj: ..\..\src\common\xlocale.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\xlocale.cpp
$(OBJS)\monodll_xti.obj: ..\..\src\common\xti.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\xti.cpp
@@ -7822,6 +7829,9 @@ $(OBJS)\monolib_wxcrt.obj: ..\..\src\common\wxcrt.cpp
$(OBJS)\monolib_wxprintf.obj: ..\..\src\common\wxprintf.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\wxprintf.cpp
$(OBJS)\monolib_xlocale.obj: ..\..\src\common\xlocale.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\xlocale.cpp
$(OBJS)\monolib_xti.obj: ..\..\src\common\xti.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\xti.cpp
@@ -9925,6 +9935,9 @@ $(OBJS)\basedll_wxcrt.obj: ..\..\src\common\wxcrt.cpp
$(OBJS)\basedll_wxprintf.obj: ..\..\src\common\wxprintf.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\wxprintf.cpp
$(OBJS)\basedll_xlocale.obj: ..\..\src\common\xlocale.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\xlocale.cpp
$(OBJS)\basedll_xti.obj: ..\..\src\common\xti.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\xti.cpp
@@ -10228,6 +10241,9 @@ $(OBJS)\baselib_wxcrt.obj: ..\..\src\common\wxcrt.cpp
$(OBJS)\baselib_wxprintf.obj: ..\..\src\common\wxprintf.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\wxprintf.cpp
$(OBJS)\baselib_xlocale.obj: ..\..\src\common\xlocale.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\xlocale.cpp
$(OBJS)\baselib_xti.obj: ..\..\src\common\xti.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\xti.cpp

View File

@@ -3314,6 +3314,7 @@ MONODLL_OBJECTS = &
$(OBJS)\monodll_wfstream.obj &
$(OBJS)\monodll_wxcrt.obj &
$(OBJS)\monodll_wxprintf.obj &
$(OBJS)\monodll_xlocale.obj &
$(OBJS)\monodll_xti.obj &
$(OBJS)\monodll_xtistrm.obj &
$(OBJS)\monodll_zipstrm.obj &
@@ -3451,6 +3452,7 @@ MONOLIB_OBJECTS = &
$(OBJS)\monolib_wfstream.obj &
$(OBJS)\monolib_wxcrt.obj &
$(OBJS)\monolib_wxprintf.obj &
$(OBJS)\monolib_xlocale.obj &
$(OBJS)\monolib_xti.obj &
$(OBJS)\monolib_xtistrm.obj &
$(OBJS)\monolib_zipstrm.obj &
@@ -3586,6 +3588,7 @@ BASEDLL_OBJECTS = &
$(OBJS)\basedll_wfstream.obj &
$(OBJS)\basedll_wxcrt.obj &
$(OBJS)\basedll_wxprintf.obj &
$(OBJS)\basedll_xlocale.obj &
$(OBJS)\basedll_xti.obj &
$(OBJS)\basedll_xtistrm.obj &
$(OBJS)\basedll_zipstrm.obj &
@@ -3704,6 +3707,7 @@ BASELIB_OBJECTS = &
$(OBJS)\baselib_wfstream.obj &
$(OBJS)\baselib_wxcrt.obj &
$(OBJS)\baselib_wxprintf.obj &
$(OBJS)\baselib_xlocale.obj &
$(OBJS)\baselib_xti.obj &
$(OBJS)\baselib_xtistrm.obj &
$(OBJS)\baselib_zipstrm.obj &
@@ -5761,6 +5765,9 @@ $(OBJS)\monodll_wxcrt.obj : .AUTODEPEND ..\..\src\common\wxcrt.cpp
$(OBJS)\monodll_wxprintf.obj : .AUTODEPEND ..\..\src\common\wxprintf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
$(OBJS)\monodll_xlocale.obj : .AUTODEPEND ..\..\src\common\xlocale.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
$(OBJS)\monodll_xti.obj : .AUTODEPEND ..\..\src\common\xti.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
@@ -7966,6 +7973,9 @@ $(OBJS)\monolib_wxcrt.obj : .AUTODEPEND ..\..\src\common\wxcrt.cpp
$(OBJS)\monolib_wxprintf.obj : .AUTODEPEND ..\..\src\common\wxprintf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
$(OBJS)\monolib_xlocale.obj : .AUTODEPEND ..\..\src\common\xlocale.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
$(OBJS)\monolib_xti.obj : .AUTODEPEND ..\..\src\common\xti.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
@@ -10171,6 +10181,9 @@ $(OBJS)\basedll_wxcrt.obj : .AUTODEPEND ..\..\src\common\wxcrt.cpp
$(OBJS)\basedll_wxprintf.obj : .AUTODEPEND ..\..\src\common\wxprintf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
$(OBJS)\basedll_xlocale.obj : .AUTODEPEND ..\..\src\common\xlocale.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
$(OBJS)\basedll_xti.obj : .AUTODEPEND ..\..\src\common\xti.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
@@ -10474,6 +10487,9 @@ $(OBJS)\baselib_wxcrt.obj : .AUTODEPEND ..\..\src\common\wxcrt.cpp
$(OBJS)\baselib_wxprintf.obj : .AUTODEPEND ..\..\src\common\wxprintf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
$(OBJS)\baselib_xlocale.obj : .AUTODEPEND ..\..\src\common\xlocale.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
$(OBJS)\baselib_xti.obj : .AUTODEPEND ..\..\src\common\xti.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<

View File

@@ -551,6 +551,10 @@ SOURCE=..\..\src\common\wxprintf.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\common\xlocale.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\common\xti.cpp
# End Source File
# Begin Source File
@@ -1507,6 +1511,10 @@ SOURCE=..\..\include\wx\wxprec.h
# End Source File
# Begin Source File
SOURCE=..\..\include\wx\xlocale.h
# End Source File
# Begin Source File
SOURCE=..\..\include\wx\xti.h
# End Source File
# Begin Source File

View File

@@ -834,6 +834,8 @@
RelativePath="..\..\src\common\wxcrt.cpp"/>
<File
RelativePath="..\..\src\common\wxprintf.cpp"/>
<File
RelativePath="..\..\src\common\xlocale.cpp"/>
<File
RelativePath="..\..\src\common\xti.cpp"/>
<File
@@ -1374,6 +1376,8 @@
RelativePath="..\..\include\wx\wxcrtvararg.h"/>
<File
RelativePath="..\..\include\wx\wxprec.h"/>
<File
RelativePath="..\..\include\wx\xlocale.h"/>
<File
RelativePath="..\..\include\wx\xti.h"/>
<File

View File

@@ -1080,6 +1080,9 @@
<File
RelativePath="..\..\src\common\wxprintf.cpp"
/>
<File
RelativePath="..\..\src\common\xlocale.cpp"
/>
<File
RelativePath="..\..\src\common\xti.cpp"
/>
@@ -1841,6 +1844,9 @@
<File
RelativePath="..\..\include\wx\wxprec.h"
/>
<File
RelativePath="..\..\include\wx\xlocale.h"
/>
<File
RelativePath="..\..\include\wx\xti.h"
/>

118
configure vendored
View File

@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Id: configure.in 51582 2008-02-07 20:59:50Z DE .
# From configure.in Id: configure.in 51614 2008-02-09 14:40:26Z VZ .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for wxWidgets 2.9.0.
#
@@ -1669,6 +1669,7 @@ Optional Features:
--enable-objc_uniquifying enable Objective-C class name uniquifying
--disable-visibility disable use of ELF symbols visibility even if supported
--enable-intl use internationalization system
--enable-xlocale use x-locale support (requires wxLocale)
--enable-config use wxConfig (and derived) classes
--enable-protocols use wxProtocol and derived classes
--enable-ftp use wxFTP (requires wxProtocol
@@ -5611,6 +5612,50 @@ fi
echo "${ECHO_T}$result" >&6; }
enablestring=
defaultval=$wxUSE_ALL_FEATURES
if test -z "$defaultval"; then
if test x"$enablestring" = xdisable; then
defaultval=yes
else
defaultval=no
fi
fi
{ echo "$as_me:$LINENO: checking for --${enablestring:-enable}-xlocale" >&5
echo $ECHO_N "checking for --${enablestring:-enable}-xlocale... $ECHO_C" >&6; }
# Check whether --enable-xlocale was given.
if test "${enable_xlocale+set}" = set; then
enableval=$enable_xlocale;
if test "$enableval" = yes; then
wx_cv_use_xlocale='wxUSE_XLOCALE=yes'
else
wx_cv_use_xlocale='wxUSE_XLOCALE=no'
fi
else
wx_cv_use_xlocale='wxUSE_XLOCALE=${'DEFAULT_wxUSE_XLOCALE":-$defaultval}"
fi
eval "$wx_cv_use_xlocale"
if test x"$enablestring" = xdisable; then
if test $wxUSE_XLOCALE = yes; then
result=no
else
result=yes
fi
else
result=$wxUSE_XLOCALE
fi
{ echo "$as_me:$LINENO: result: $result" >&5
echo "${ECHO_T}$result" >&6; }
enablestring=
defaultval=$wxUSE_ALL_FEATURES
if test -z "$defaultval"; then
@@ -42726,6 +42771,77 @@ _ACEOF
fi
fi
if test "$wxUSE_XLOCALE" == "yes" ; then
cat >>confdefs.h <<\_ACEOF
#define wxUSE_XLOCALE 1
_ACEOF
{ echo "$as_me:$LINENO: checking for locale_t" >&5
echo $ECHO_N "checking for locale_t... $ECHO_C" >&6; }
if test "${ac_cv_type_locale_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <xlocale.h>
#include <locale.h>
typedef locale_t ac__type_new_;
int
main ()
{
if ((ac__type_new_ *) 0)
return 0;
if (sizeof (ac__type_new_))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_cv_type_locale_t=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_locale_t=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ echo "$as_me:$LINENO: result: $ac_cv_type_locale_t" >&5
echo "${ECHO_T}$ac_cv_type_locale_t" >&6; }
if test $ac_cv_type_locale_t = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LOCALE_T 1
_ACEOF
fi
fi
if test "$wxUSE_LOG" = "yes"; then
cat >>confdefs.h <<\_ACEOF
#define wxUSE_LOG 1

View File

@@ -664,6 +664,7 @@ dnl optional non GUI features
dnl ---------------------------------------------------------------------------
WX_ARG_FEATURE(intl, [ --enable-intl use internationalization system], wxUSE_INTL)
WX_ARG_FEATURE(xlocale, [ --enable-xlocale use x-locale support (requires wxLocale)], wxUSE_XLOCALE)
WX_ARG_FEATURE(config, [ --enable-config use wxConfig (and derived) classes], wxUSE_CONFIG)
WX_ARG_FEATURE(protocols, [ --enable-protocols use wxProtocol and derived classes], wxUSE_PROTOCOL)
@@ -5559,6 +5560,13 @@ if test "$wxUSE_INTL" = "yes" ; then
fi
fi
if test "$wxUSE_XLOCALE" == "yes" ; then
AC_DEFINE(wxUSE_XLOCALE)
AC_CHECK_TYPES(locale_t,,,
[#include <xlocale.h>
#include <locale.h>])
fi
if test "$wxUSE_LOG" = "yes"; then
AC_DEFINE(wxUSE_LOG)

View File

@@ -475,6 +475,7 @@
\input wizard.tex
\input wizevt.tex
\input wizpage.tex
\input xlocale.tex
\input xmldocument.tex
\input xmlnode.tex
\input xmlattr.tex

View File

@@ -49,7 +49,8 @@ No base class
\wxheading{See also}
\helpref{Internationalization overview}{internationalization},\\
\helpref{Internat sample}{sampleinternat}
\helpref{Internat sample}{sampleinternat},\\
\helpref{wxXLocale}{wxxlocale}
\wxheading{Include files}

View File

@@ -74,5 +74,14 @@
#define wxHAS_NATIVE_TAB_TRAVERSAL
#endif
/* This is defined when the compiler provides some type of extended locale
functions. Otherwise, we implement them ourselves to only support the
'C' locale */
#if defined(HAVE_LOCALE_T) || wxCHECK_VISUALC_VERSION(8)
#define wxHAS_XLOCALE_SUPPORT
#else
#undef wxHAS_XLOCALE_SUPPORT
#endif
#endif /* _WX_FEATURES_H_ */

View File

@@ -372,6 +372,21 @@
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
#define wxUSE_INTL 1
// Provide wxFoo_l() functions similar to standard foo() functions but taking
// an extra locale parameter.
//
// Notice that this is fully implemented only for the systems providing POSIX
// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary
// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will
// only work for the current user locale and "C" locale. You can use
// wxHAS_XLOCALE_SUPPORT to test whether the full support is available.
//
// Default is 1
//
// Recommended setting: 1 but may be disabled if you are writing programs
// running only in C locale anyhow
#define wxUSE_XLOCALE 1
// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards

View File

@@ -371,6 +371,21 @@
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
#define wxUSE_INTL 1
// Provide wxFoo_l() functions similar to standard foo() functions but taking
// an extra locale parameter.
//
// Notice that this is fully implemented only for the systems providing POSIX
// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary
// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will
// only work for the current user locale and "C" locale. You can use
// wxHAS_XLOCALE_SUPPORT to test whether the full support is available.
//
// Default is 1
//
// Recommended setting: 1 but may be disabled if you are writing programs
// running only in C locale anyhow
#define wxUSE_XLOCALE 1
// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards

View File

@@ -371,6 +371,21 @@
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
#define wxUSE_INTL 1
// Provide wxFoo_l() functions similar to standard foo() functions but taking
// an extra locale parameter.
//
// Notice that this is fully implemented only for the systems providing POSIX
// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary
// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will
// only work for the current user locale and "C" locale. You can use
// wxHAS_XLOCALE_SUPPORT to test whether the full support is available.
//
// Default is 1
//
// Recommended setting: 1 but may be disabled if you are writing programs
// running only in C locale anyhow
#define wxUSE_XLOCALE 1
// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards

View File

@@ -371,6 +371,21 @@
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
#define wxUSE_INTL 1
// Provide wxFoo_l() functions similar to standard foo() functions but taking
// an extra locale parameter.
//
// Notice that this is fully implemented only for the systems providing POSIX
// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary
// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will
// only work for the current user locale and "C" locale. You can use
// wxHAS_XLOCALE_SUPPORT to test whether the full support is available.
//
// Default is 1
//
// Recommended setting: 1 but may be disabled if you are writing programs
// running only in C locale anyhow
#define wxUSE_XLOCALE 1
// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards

View File

@@ -371,6 +371,21 @@
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
#define wxUSE_INTL 1
// Provide wxFoo_l() functions similar to standard foo() functions but taking
// an extra locale parameter.
//
// Notice that this is fully implemented only for the systems providing POSIX
// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary
// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will
// only work for the current user locale and "C" locale. You can use
// wxHAS_XLOCALE_SUPPORT to test whether the full support is available.
//
// Default is 1
//
// Recommended setting: 1 but may be disabled if you are writing programs
// running only in C locale anyhow
#define wxUSE_XLOCALE 1
// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards

View File

@@ -371,6 +371,21 @@
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
#define wxUSE_INTL 1
// Provide wxFoo_l() functions similar to standard foo() functions but taking
// an extra locale parameter.
//
// Notice that this is fully implemented only for the systems providing POSIX
// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary
// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will
// only work for the current user locale and "C" locale. You can use
// wxHAS_XLOCALE_SUPPORT to test whether the full support is available.
//
// Default is 1
//
// Recommended setting: 1 but may be disabled if you are writing programs
// running only in C locale anyhow
#define wxUSE_XLOCALE 1
// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards

View File

@@ -367,6 +367,21 @@
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
#define wxUSE_INTL 1
// Provide wxFoo_l() functions similar to standard foo() functions but taking
// an extra locale parameter.
//
// Notice that this is fully implemented only for the systems providing POSIX
// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary
// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will
// only work for the current user locale and "C" locale. You can use
// wxHAS_XLOCALE_SUPPORT to test whether the full support is available.
//
// Default is 1
//
// Recommended setting: 1 but may be disabled if you are writing programs
// running only in C locale anyhow
#define wxUSE_XLOCALE 1
// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards

View File

@@ -370,6 +370,21 @@
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
#define wxUSE_INTL 1
// Provide wxFoo_l() functions similar to standard foo() functions but taking
// an extra locale parameter.
//
// Notice that this is fully implemented only for the systems providing POSIX
// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary
// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will
// only work for the current user locale and "C" locale. You can use
// wxHAS_XLOCALE_SUPPORT to test whether the full support is available.
//
// Default is 1
//
// Recommended setting: 1 but may be disabled if you are writing programs
// running only in C locale anyhow
#define wxUSE_XLOCALE 1
// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards

292
include/wx/xlocale.h Normal file
View File

@@ -0,0 +1,292 @@
//////////////////////////////////////////////////////////////////////////////
// Name: wx/xlocale.h
// Purpose: Header to provide some xlocale wrappers
// Author: Brian Vanderburg II, Vadim Zeitlin
// Created: 2008-01-07
// RCS-ID: $Id$
// Copyright: (c) 2008 Brian Vanderburg II
// 2008 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/*
This header defines portable wrappers around xlocale foo_l() functions or
their MSVC proprietary _foo_l() equivalents when they are available and
implements these functions for the "C" locale [only] if they are not. This
allows the program running under the default user locale to still use "C"
locale for operations such as reading data from files where they are stored
using decimal point &c.
TODO: Currently only the character classification and transformation
functions are implemented, we also need at least
- numbers: atof_l(), strtod_l() &c
- formatted IO: scanf_l(), printf_l() &c
- time: strftime_l(), strptime_l()
*/
#ifndef _WX_XLOCALE_H_
#define _WX_XLOCALE_H_
#include "wx/defs.h" // wxUSE_XLOCALE
#if wxUSE_XLOCALE
#include "wx/crt.h" // Includes wx/chartype.h, wx/wxcrt.h(wx/string.h)
#include "wx/intl.h" // wxLanguage
// The platform-specific locale type
// If wxXLocale_t is not defined, then only "C" locale support is provided
#ifdef wxHAS_XLOCALE_SUPPORT
#if wxCHECK_VISUALC_VERSION(8)
typedef _locale_t wxXLocale_t;
#define wxXLOCALE_IDENT(name) _ ## name
#elif defined(HAVE_LOCALE_T)
#include <locale.h>
#include <xlocale.h>
#include <ctype.h>
#if wxUSE_UNICODE
#include <wctype.h>
#endif
// Locale type and identifier name
typedef locale_t wxXLocale_t;
#define wxXLOCALE_IDENT(name) name
#else
#error "Unknown xlocale support"
#endif
#endif // wxHAS_XLOCALE_SUPPORT
// wxXLocale is a wrapper around the native type representing a locale.
//
// It is not to be confused with wxLocale, which handles actually changing the
// locale, loading message catalogs, etc. This just stores a locale value.
// The similarity of names is unfortunate, but there doesn't seem to be any
// better alternative right now. Perhaps by wxWidgets 4.0 better naming could
// be used, or this class could become wxLocale (a wrapper for the value), and
// some other class could be used to load the language catalogs or something
// that would be clearer
#ifdef wxHAS_XLOCALE_SUPPORT
class WXDLLIMPEXP_BASE wxXLocale
{
public:
// Construct an uninitialized locale
wxXLocale() { m_locale = NULL; }
// Construct from a symbolic language constant
wxXLocale(wxLanguage lang);
// Construct from the given language string
wxXLocale(const char *loc) { Init(loc); }
// Destroy the locale
~wxXLocale() { Free(); }
// Get the global "C" locale object
static wxXLocale& GetCLocale();
// Check if the object represents a valid locale (notice that without
// wxHAS_XLOCALE_SUPPORT the only valid locale is the "C" one)
bool IsOk() const { return m_locale != NULL; }
// Get the type
wxXLocale_t Get() const { return m_locale; }
private:
// Special ctor for the "C" locale, it's only used internally as the user
// code is supposed to use GetCLocale()
wxXLocale(struct wxXLocaleCTag * WXUNUSED(dummy)) { Init("C"); }
// Create from the given language string (called from ctors)
void Init(const char *loc);
// Free the locale if it's non-NULL
void Free();
// The corresponding locale handle, NULL if invalid
wxXLocale_t m_locale;
// POSIX xlocale API provides a duplocale() function but MSVC locale API
// doesn't give us any means to copy a _locale_t object so we reduce the
// functionality to least common denominator here -- it shouldn't be a
// problem as copying the locale objects shouldn't be often needed
DECLARE_NO_COPY_CLASS(wxXLocale)
};
#else // !wxHAS_XLOCALE_SUPPORT
// Skeleton version supporting only the "C" locale for the systems without
// xlocale support
class WXDLLIMPEXP_BASE wxXLocale
{
public:
// Construct an uninitialized locale
wxXLocale() { m_isC = false; }
// Construct from a symbolic language constant: unless the language is
// wxLANGUAGE_ENGLISH_US (which we suppose to be the same as "C" locale)
// the object will be invalid
wxXLocale(wxLanguage lang)
{
m_isC = lang == wxLANGUAGE_ENGLISH_US;
}
// Construct from the given language string: unless the string is "C" or
// "POSIX" the object will be invalid
wxXLocale(const char *loc)
{
m_isC = loc && (strcmp(loc, "C") == 0 || strcmp(loc, "POSIX") == 0);
}
// Default copy ctor, assignment operator and dtor are ok (or would be if
// we didn't use DECLARE_NO_COPY_CLASS() for consistency with the xlocale
// version)
// Get the global "C" locale object
static wxXLocale& GetCLocale();
// Check if the object represents a valid locale (notice that without
// wxHAS_XLOCALE_SUPPORT the only valid locale is the "C" one)
bool IsOk() const { return m_isC; }
private:
// Special ctor for the "C" locale, it's only used internally as the user
// code is supposed to use GetCLocale()
wxXLocale(struct wxXLocaleCTag * WXUNUSED(dummy)) { m_isC = true; }
// Without xlocale support this class can only represent "C" locale, if
// this is false the object is invalid
bool m_isC;
// although it's not a problem to copy the objects of this class, we use
// this macro in this implementation for consistency with the xlocale-based
// one which can't be copied when using MSVC locale API
DECLARE_NO_COPY_CLASS(wxXLocale)
};
#endif // wxHAS_XLOCALE_SUPPORT/!wxHAS_XLOCALE_SUPPORT
// A shorter synonym for the most commonly used locale object
#define wxCLocale (wxXLocale::GetCLocale())
// Wrappers for various functions:
#ifdef wxHAS_XLOCALE_SUPPORT
// ctype functions
#define wxCRT_Isalnum_lA wxXLOCALE_IDENT(isalnum_l)
#define wxCRT_Isalpha_lA wxXLOCALE_IDENT(isalpha_l)
#define wxCRT_Iscntrl_lA wxXLOCALE_IDENT(iscntrl_l)
#define wxCRT_Isdigit_lA wxXLOCALE_IDENT(isdigit_l)
#define wxCRT_Isgraph_lA wxXLOCALE_IDENT(isgraph_l)
#define wxCRT_Islower_lA wxXLOCALE_IDENT(islower_l)
#define wxCRT_Isprint_lA wxXLOCALE_IDENT(isprint_l)
#define wxCRT_Ispunct_lA wxXLOCALE_IDENT(ispunct_l)
#define wxCRT_Isspace_lA wxXLOCALE_IDENT(isspace_l)
#define wxCRT_Isupper_lA wxXLOCALE_IDENT(isupper_l)
#define wxCRT_Isxdigit_lA wxXLOCALE_IDENT(isxdigit_l)
#define wxCRT_Tolower_lA wxXLOCALE_IDENT(tolower_l)
#define wxCRT_Toupper_lA wxXLOCALE_IDENT(toupper_l)
inline int wxIsalnum_l(char c, const wxXLocale& loc)
{ return wxCRT_Isalnum_lA(c, loc.Get()); }
inline int wxIsalpha_l(char c, const wxXLocale& loc)
{ return wxCRT_Isalpha_lA(c, loc.Get()); }
inline int wxIscntrl_l(char c, const wxXLocale& loc)
{ return wxCRT_Iscntrl_lA(c, loc.Get()); }
inline int wxIsdigit_l(char c, const wxXLocale& loc)
{ return wxCRT_Isdigit_lA(c, loc.Get()); }
inline int wxIsgraph_l(char c, const wxXLocale& loc)
{ return wxCRT_Isgraph_lA(c, loc.Get()); }
inline int wxIslower_l(char c, const wxXLocale& loc)
{ return wxCRT_Islower_lA(c, loc.Get()); }
inline int wxIsprint_l(char c, const wxXLocale& loc)
{ return wxCRT_Isprint_lA(c, loc.Get()); }
inline int wxIspunct_l(char c, const wxXLocale& loc)
{ return wxCRT_Ispunct_lA(c, loc.Get()); }
inline int wxIsspace_l(char c, const wxXLocale& loc)
{ return wxCRT_Isspace_lA(c, loc.Get()); }
inline int wxIsupper_l(char c, const wxXLocale& loc)
{ return wxCRT_Isupper_lA(c, loc.Get()); }
inline int wxIsxdigit_l(char c, const wxXLocale& loc)
{ return wxCRT_Isxdigit_lA(c, loc.Get()); }
inline char wxTolower_l(char c, const wxXLocale& loc)
{ return wxCRT_Tolower_lA(c, loc.Get()); }
inline char wxToupper_l(char c, const wxXLocale& loc)
{ return wxCRT_Toupper_lA(c, loc.Get()); }
#if wxUSE_UNICODE
#define wxCRT_Isalnum_lW wxXLOCALE_IDENT(iswalnum_l)
#define wxCRT_Isalpha_lW wxXLOCALE_IDENT(iswalpha_l)
#define wxCRT_Iscntrl_lW wxXLOCALE_IDENT(iswcntrl_l)
#define wxCRT_Isdigit_lW wxXLOCALE_IDENT(iswdigit_l)
#define wxCRT_Isgraph_lW wxXLOCALE_IDENT(iswgraph_l)
#define wxCRT_Islower_lW wxXLOCALE_IDENT(iswlower_l)
#define wxCRT_Isprint_lW wxXLOCALE_IDENT(iswprint_l)
#define wxCRT_Ispunct_lW wxXLOCALE_IDENT(iswpunct_l)
#define wxCRT_Isspace_lW wxXLOCALE_IDENT(iswspace_l)
#define wxCRT_Isupper_lW wxXLOCALE_IDENT(iswupper_l)
#define wxCRT_Isxdigit_lW wxXLOCALE_IDENT(iswxdigit_l)
#define wxCRT_Tolower_lW wxXLOCALE_IDENT(towlower_l)
#define wxCRT_Toupper_lW wxXLOCALE_IDENT(towupper_l)
inline int wxIsalnum_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isalnum_lW(c, loc.Get()); }
inline int wxIsalpha_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isalpha_lW(c, loc.Get()); }
inline int wxIscntrl_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Iscntrl_lW(c, loc.Get()); }
inline int wxIsdigit_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isdigit_lW(c, loc.Get()); }
inline int wxIsgraph_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isgraph_lW(c, loc.Get()); }
inline int wxIslower_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Islower_lW(c, loc.Get()); }
inline int wxIsprint_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isprint_lW(c, loc.Get()); }
inline int wxIspunct_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Ispunct_lW(c, loc.Get()); }
inline int wxIsspace_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isspace_lW(c, loc.Get()); }
inline int wxIsupper_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isupper_lW(c, loc.Get()); }
inline int wxIsxdigit_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isxdigit_lW(c, loc.Get()); }
inline wchar_t wxTolower_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Tolower_lW(c, loc.Get()); }
inline wchar_t wxToupper_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Toupper_lW(c, loc.Get()); }
#endif // wxUSE_UNICDE (ctype functions)
#else // !wxHAS_XLOCALE_SUPPORT
// ctype functions
int WXDLLIMPEXP_BASE wxIsalnum_l(const wxUniChar& c, const wxXLocale& loc);
int WXDLLIMPEXP_BASE wxIsalpha_l(const wxUniChar& c, const wxXLocale& loc);
int WXDLLIMPEXP_BASE wxIscntrl_l(const wxUniChar& c, const wxXLocale& loc);
int WXDLLIMPEXP_BASE wxIsdigit_l(const wxUniChar& c, const wxXLocale& loc);
int WXDLLIMPEXP_BASE wxIsgraph_l(const wxUniChar& c, const wxXLocale& loc);
int WXDLLIMPEXP_BASE wxIslower_l(const wxUniChar& c, const wxXLocale& loc);
int WXDLLIMPEXP_BASE wxIsprint_l(const wxUniChar& c, const wxXLocale& loc);
int WXDLLIMPEXP_BASE wxIspunct_l(const wxUniChar& c, const wxXLocale& loc);
int WXDLLIMPEXP_BASE wxIsspace_l(const wxUniChar& c, const wxXLocale& loc);
int WXDLLIMPEXP_BASE wxIsupper_l(const wxUniChar& c, const wxXLocale& loc);
int WXDLLIMPEXP_BASE wxIsxdigit_l(const wxUniChar& c, const wxXLocale& loc);
wxUniChar WXDLLIMPEXP_BASE wxTolower_l(const wxUniChar& c, const wxXLocale& loc);
wxUniChar WXDLLIMPEXP_BASE wxToupper_l(const wxUniChar& c, const wxXLocale& loc);
#endif // wxHAS_XLOCALE_SUPPORT/!wxHAS_XLOCALE_SUPPORT
#endif // wxUSE_XLOCALE
#endif // _WX_XLOCALE_H_

View File

@@ -231,6 +231,8 @@
#define wxUSE_INTL 0
#define wxUSE_XLOCALE 0
#define wxUSE_DATETIME 0
#define wxUSE_TIMER 0
@@ -1108,6 +1110,9 @@
/* Define if getgrgid_r is available. */
#undef HAVE_GETGRGID_R
/* Define if locale_t is available */
#undef HAVE_LOCALE_T
/* -------------------------------------------------------------------------
Win32 adjustments section
------------------------------------------------------------------------- */

228
src/common/xlocale.cpp Normal file
View File

@@ -0,0 +1,228 @@
//////////////////////////////////////////////////////////////////////////////
// Name: src/common/xlocale.cpp
// Purpose: xlocale wrappers/impl to provide some xlocale wrappers
// Author: Brian Vanderburg II, Vadim Zeitlin
// Created: 2008-01-07
// RCS-ID: $Id$
// Copyright: (c) 2008 Brian Vanderburg II
// 2008 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_XLOCALE
#ifndef WX_PRECOMP
#include "wx/module.h"
#endif
#include "wx/xlocale.h"
// ----------------------------------------------------------------------------
// module globals
// ----------------------------------------------------------------------------
// This is the C locale object, it is created on demand
static wxXLocale *gs_cLocale = NULL;
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// Module for gs_cLocale cleanup
// ----------------------------------------------------------------------------
class wxXLocaleModule : public wxModule
{
public:
virtual bool OnInit() { return true; }
virtual void OnExit() { wxDELETE(gs_cLocale); }
DECLARE_DYNAMIC_CLASS(wxXLocaleModule)
};
IMPLEMENT_DYNAMIC_CLASS(wxXLocaleModule, wxModule)
// ============================================================================
// wxXLocale implementation
// ============================================================================
// ----------------------------------------------------------------------------
// common parts
// ----------------------------------------------------------------------------
// Get the C locale
wxXLocale& wxXLocale::GetCLocale()
{
if ( !gs_cLocale )
{
gs_cLocale = new wxXLocale(wx_static_cast(wxXLocaleCTag *, NULL));
}
return *gs_cLocale;
}
wxXLocale::wxXLocale(wxLanguage lang)
{
const wxLanguageInfo * const info = wxLocale::GetLanguageInfo(lang);
if ( !info )
{
m_locale = NULL;
}
else
{
Init(info->CanonicalName);
}
}
#ifdef wxHAS_XLOCALE_SUPPORT
#if wxCHECK_VISUALC_VERSION(8)
// ----------------------------------------------------------------------------
// implementation using MSVC locale API
// ----------------------------------------------------------------------------
void wxXLocale::Init(const char *loc)
{
m_locale = _create_locale(LC_ALL, loc);
}
void wxXLocale::Free()
{
if ( m_locale )
_free_locale(m_locale);
}
#elif defined(HAVE_LOCALE_T)
// ----------------------------------------------------------------------------
// implementation using xlocale API
// ----------------------------------------------------------------------------
void wxXLocale::Init(const char *loc)
{
m_locale = newlocale(LC_ALL_MASK, loc, NULL);
}
void wxXLocale::Free()
{
if ( m_locale )
freelocale(m_locale);
}
#else
#error "Unknown xlocale support."
#endif
#endif // wxHAS_XLOCALE_SUPPORT
#ifndef wxHAS_XLOCALE_SUPPORT
// ============================================================================
// Implementation of wxFoo_l() functions for "C" locale without xlocale support
// ============================================================================
// ----------------------------------------------------------------------------
// character classification and transformation functions
// ----------------------------------------------------------------------------
// lookup table and macros for character type functions
#define CTYPE_ALNUM 0x0001
#define CTYPE_ALPHA 0x0002
#define CTYPE_CNTRL 0x0004
#define CTYPE_DIGIT 0x0008
#define CTYPE_GRAPH 0x0010
#define CTYPE_LOWER 0x0020
#define CTYPE_PRINT 0x0040
#define CTYPE_PUNCT 0x0080
#define CTYPE_SPACE 0x0100
#define CTYPE_UPPER 0x0200
#define CTYPE_XDIGIT 0x0400
static unsigned int gs_lookup[] =
{
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
0x0004, 0x0104, 0x0104, 0x0104, 0x0104, 0x0104, 0x0004, 0x0004,
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
0x0140, 0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x00D0,
0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x00D0,
0x0459, 0x0459, 0x0459, 0x0459, 0x0459, 0x0459, 0x0459, 0x0459,
0x0459, 0x0459, 0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x00D0,
0x00D0, 0x0653, 0x0653, 0x0653, 0x0653, 0x0653, 0x0653, 0x0253,
0x0253, 0x0253, 0x0253, 0x0253, 0x0253, 0x0253, 0x0253, 0x0253,
0x0253, 0x0253, 0x0253, 0x0253, 0x0253, 0x0253, 0x0253, 0x0253,
0x0253, 0x0253, 0x0253, 0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x00D0,
0x00D0, 0x0473, 0x0473, 0x0473, 0x0473, 0x0473, 0x0473, 0x0073,
0x0073, 0x0073, 0x0073, 0x0073, 0x0073, 0x0073, 0x0073, 0x0073,
0x0073, 0x0073, 0x0073, 0x0073, 0x0073, 0x0073, 0x0073, 0x0073,
0x0073, 0x0073, 0x0073, 0x00D0, 0x00D0, 0x00D0, 0x00D0, 0x0004
};
#define CTYPE_TEST(c, t) ( (c) <= 127 && (gs_lookup[(c)] & (t)) )
// ctype functions
#define GEN_ISFUNC(name, test) \
int name(const wxUniChar& c, const wxXLocale& loc) \
{ \
wxCHECK(loc.IsOk(), false); \
return CTYPE_TEST(c.GetValue(), test); \
}
GEN_ISFUNC(wxIsalnum_l, CTYPE_ALNUM)
GEN_ISFUNC(wxIsalpha_l, CTYPE_ALPHA)
GEN_ISFUNC(wxIscntrl_l, CTYPE_CNTRL)
GEN_ISFUNC(wxIsdigit_l, CTYPE_DIGIT)
GEN_ISFUNC(wxIsgraph_l, CTYPE_GRAPH)
GEN_ISFUNC(wxIslower_l, CTYPE_LOWER)
GEN_ISFUNC(wxIsprint_l, CTYPE_PRINT)
GEN_ISFUNC(wxIspunct_l, CTYPE_PUNCT)
GEN_ISFUNC(wxIsspace_l, CTYPE_SPACE)
GEN_ISFUNC(wxIsupper_l, CTYPE_UPPER)
GEN_ISFUNC(wxIsxdigit_l, CTYPE_XDIGIT)
wxUniChar wxTolower_l(const wxUniChar& c, const wxXLocale& loc)
{
wxCHECK(loc.IsOk(), false);
if(CTYPE_TEST(c, CTYPE_UPPER))
{
return c - 'A' + 'a';
}
return c;
}
wxUniChar wxToupper_l(const wxUniChar& c, const wxXLocale& loc)
{
wxCHECK(loc.IsOk(), false);
if(CTYPE_TEST(c, CTYPE_LOWER))
{
return c - 'a' + 'A';
}
return c;
}
#endif // !defined(wxHAS_XLOCALE_SUPPORT)
#endif // wxUSE_XLOCALE

View File

@@ -98,7 +98,8 @@ TEST_OBJECTS = \
test_uris.o \
test_vectors.o \
test_evtconnection.o \
test_weakref.o
test_weakref.o \
test_xlocale.o
TEST_ODEP = $(___pch_testprec_test_testprec_h_gch___depname)
TEST_GUI_CXXFLAGS = $(__test_gui_PCH_INC) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
@@ -465,6 +466,9 @@ test_evtconnection.o: $(srcdir)/weakref/evtconnection.cpp $(TEST_ODEP)
test_weakref.o: $(srcdir)/weakref/weakref.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/weakref/weakref.cpp
test_xlocale.o: $(srcdir)/xlocale/xlocale.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/xlocale/xlocale.cpp
test_gui_sample_rc.o: $(srcdir)/../samples/sample.rc $(TEST_GUI_ODEP)
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_5) $(__EXCEPTIONS_DEFINE_p_5) $(__RTTI_DEFINE_p_5) $(__THREAD_DEFINE_p_5) --include-dir $(srcdir) $(__DLLFLAG_p_5) --include-dir $(srcdir)/../samples $(__RCDEFDIR_p_1) --include-dir $(top_srcdir)/include

View File

@@ -85,7 +85,8 @@ TEST_OBJECTS = \
$(OBJS)\test_uris.obj \
$(OBJS)\test_vectors.obj \
$(OBJS)\test_evtconnection.obj \
$(OBJS)\test_weakref.obj
$(OBJS)\test_weakref.obj \
$(OBJS)\test_xlocale.obj
TEST_GUI_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \
$(__OPTIMIZEFLAG) $(__THREADSFLAG_1) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
@@ -497,6 +498,9 @@ $(OBJS)\test_evtconnection.obj: .\weakref\evtconnection.cpp
$(OBJS)\test_weakref.obj: .\weakref\weakref.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\weakref\weakref.cpp
$(OBJS)\test_xlocale.obj: .\xlocale\xlocale.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\xlocale\xlocale.cpp
$(OBJS)\test_gui_sample.res: .\..\samples\sample.rc
brcc32 -32 -r -fo$@ -i$(BCCDIR)\include -d__WXMSW__ $(__WXUNIV_DEFINE_p_3) $(__DEBUG_DEFINE_p_3) $(__EXCEPTIONS_DEFINE_p_3) $(__RTTI_DEFINE_p_3) $(__THREAD_DEFINE_p_3) $(__UNICODE_DEFINE_p_3) $(__MSLU_DEFINE_p_3) $(__GFXCTX_DEFINE_p_3) -i$(SETUPHDIR) -i.\..\include -i. $(__DLLFLAG_p_3) -i.\..\samples -dNOPCH .\..\samples\sample.rc

View File

@@ -77,7 +77,8 @@ TEST_OBJECTS = \
$(OBJS)\test_uris.o \
$(OBJS)\test_vectors.o \
$(OBJS)\test_evtconnection.o \
$(OBJS)\test_weakref.o
$(OBJS)\test_weakref.o \
$(OBJS)\test_xlocale.o
TEST_GUI_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \
$(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
@@ -475,6 +476,9 @@ $(OBJS)\test_evtconnection.o: ./weakref/evtconnection.cpp
$(OBJS)\test_weakref.o: ./weakref/weakref.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_xlocale.o: ./xlocale/xlocale.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_gui_sample_rc.o: ./../samples/sample.rc
windres --use-temp-file -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_3) $(__DEBUG_DEFINE_p_3) $(__EXCEPTIONS_DEFINE_p_3) $(__RTTI_DEFINE_p_3) $(__THREAD_DEFINE_p_3) $(__UNICODE_DEFINE_p_3) $(__MSLU_DEFINE_p_3) $(__GFXCTX_DEFINE_p_3) --include-dir $(SETUPHDIR) --include-dir ./../include --include-dir . $(__DLLFLAG_p_3) --include-dir ./../samples --define NOPCH

View File

@@ -78,7 +78,8 @@ TEST_OBJECTS = \
$(OBJS)\test_uris.obj \
$(OBJS)\test_vectors.obj \
$(OBJS)\test_evtconnection.obj \
$(OBJS)\test_weakref.obj
$(OBJS)\test_weakref.obj \
$(OBJS)\test_xlocale.obj
TEST_GUI_CXXFLAGS = /M$(__RUNTIME_LIBS_23)$(__DEBUGRUNTIME) /DWIN32 \
$(__DEBUGINFO) /Fd$(OBJS)\test_gui.pdb $(____DEBUGRUNTIME) \
$(__OPTIMIZEFLAG) $(__NO_VC_CRTDBG_p) /D__WXMSW__ $(__WXUNIV_DEFINE_p) \
@@ -582,6 +583,9 @@ $(OBJS)\test_evtconnection.obj: .\weakref\evtconnection.cpp
$(OBJS)\test_weakref.obj: .\weakref\weakref.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\weakref\weakref.cpp
$(OBJS)\test_xlocale.obj: .\xlocale\xlocale.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\xlocale\xlocale.cpp
$(OBJS)\test_gui_dummy.obj: .\dummy.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) /Yctestprec.h .\dummy.cpp

View File

@@ -285,7 +285,8 @@ TEST_OBJECTS = &
$(OBJS)\test_uris.obj &
$(OBJS)\test_vectors.obj &
$(OBJS)\test_evtconnection.obj &
$(OBJS)\test_weakref.obj
$(OBJS)\test_weakref.obj &
$(OBJS)\test_xlocale.obj
TEST_GUI_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) &
$(__RUNTIME_LIBS) -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) &
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) &
@@ -527,6 +528,9 @@ $(OBJS)\test_evtconnection.obj : .AUTODEPEND .\weakref\evtconnection.cpp
$(OBJS)\test_weakref.obj : .AUTODEPEND .\weakref\weakref.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_xlocale.obj : .AUTODEPEND .\xlocale\xlocale.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_gui_sample.res : .AUTODEPEND .\..\samples\sample.rc
wrc -q -ad -bt=nt -r -fo=$^@ -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__GFXCTX_DEFINE_p) -i=$(SETUPHDIR) -i=.\..\include -i=. $(__DLLFLAG_p) -i=.\..\samples -dNOPCH $<

View File

@@ -72,6 +72,7 @@
vectors/vectors.cpp
weakref/evtconnection.cpp
weakref/weakref.cpp
xlocale/xlocale.cpp
</sources>
<wx-lib>net</wx-lib>
<wx-lib>base</wx-lib>

View File

@@ -429,6 +429,10 @@ SOURCE=.\regex\wxregextest.cpp
# End Source File
# Begin Source File
SOURCE=.\xlocale\xlocale.cpp
# End Source File
# Begin Source File
SOURCE=.\archive\ziptest.cpp
# End Source File
# Begin Source File

View File

@@ -794,6 +794,8 @@
RelativePath=".\weakref\weakref.cpp"/>
<File
RelativePath=".\regex\wxregextest.cpp"/>
<File
RelativePath=".\xlocale\xlocale.cpp"/>
<File
RelativePath=".\archive\ziptest.cpp"/>
<File

View File

@@ -1016,6 +1016,9 @@
<File
RelativePath=".\regex\wxregextest.cpp"
/>
<File
RelativePath=".\xlocale\xlocale.cpp"
/>
<File
RelativePath=".\archive\ziptest.cpp"
/>

182
tests/xlocale/xlocale.cpp Normal file
View File

@@ -0,0 +1,182 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/xlocale/xlocale.cpp
// Purpose: wxXLocale & related unit test
// Author: Brian Vanderburg II, Vadim Zeitlin
// Created: 2008-01-16
// RCS-ID: $Id$
// Copyright: (c) 2008 Brian Vanderburg II
// 2008 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_XLOCALE
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif // WX_PRECOMP
#include "wx/xlocale.h"
// --------------------------------------------------------------------------
// test class
// --------------------------------------------------------------------------
class XLocaleTestCase : public CppUnit::TestCase
{
public:
XLocaleTestCase() { }
private:
CPPUNIT_TEST_SUITE( XLocaleTestCase );
CPPUNIT_TEST( TestCtor );
CPPUNIT_TEST( TestCtypeFunctions );
CPPUNIT_TEST_SUITE_END();
void TestCtor();
void TestCtypeFunctions();
void TestCtypeFunctionsWith(const wxXLocale& loc);
DECLARE_NO_COPY_CLASS(XLocaleTestCase)
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( XLocaleTestCase );
// also include in it's own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( XLocaleTestCase, "XLocaleTestCase" );
// test the different wxXLocale ctors
void XLocaleTestCase::TestCtor()
{
CPPUNIT_ASSERT( !wxXLocale().IsOk() );
CPPUNIT_ASSERT( wxCLocale.IsOk() );
CPPUNIT_ASSERT( wxXLocale("C").IsOk() );
#ifdef wxHAS_XLOCALE_SUPPORT
CPPUNIT_ASSERT( wxXLocale(wxLANGUAGE_FRENCH).IsOk() );
CPPUNIT_ASSERT( wxXLocale("fr_FR").IsOk() );
CPPUNIT_ASSERT( wxXLocale("french").IsOk() );
#endif
CPPUNIT_ASSERT( !wxXLocale("bloordyblop").IsOk() );
}
// test the ctype functions with the given locale
void XLocaleTestCase::TestCtypeFunctionsWith(const wxXLocale& loc)
{
// isalnum
CPPUNIT_ASSERT( wxIsalnum_l('0', loc) );
CPPUNIT_ASSERT( wxIsalnum_l('9', loc) );
CPPUNIT_ASSERT( wxIsalnum_l('A', loc) );
CPPUNIT_ASSERT( wxIsalnum_l('Z', loc) );
CPPUNIT_ASSERT( wxIsalnum_l('a', loc) );
CPPUNIT_ASSERT( wxIsalnum_l('z', loc) );
CPPUNIT_ASSERT( !wxIsalnum_l('*', loc) );
CPPUNIT_ASSERT( !wxIsalnum_l('@', loc) );
CPPUNIT_ASSERT( !wxIsalnum_l('+', loc) );
// isalpha
CPPUNIT_ASSERT( !wxIsalpha_l('0', loc) );
CPPUNIT_ASSERT( !wxIsalpha_l('9', loc) );
CPPUNIT_ASSERT( wxIsalpha_l('A', loc) );
CPPUNIT_ASSERT( wxIsalpha_l('Z', loc) );
CPPUNIT_ASSERT( wxIsalpha_l('a', loc) );
CPPUNIT_ASSERT( wxIsalpha_l('z', loc) );
CPPUNIT_ASSERT( !wxIsalpha_l('*', loc) );
CPPUNIT_ASSERT( !wxIsalpha_l('@', loc) );
CPPUNIT_ASSERT( !wxIsalpha_l('+', loc) );
// TODO: iscntrl
// isdigit
CPPUNIT_ASSERT( wxIsdigit_l('0', loc) );
CPPUNIT_ASSERT( wxIsdigit_l('9', loc) );
CPPUNIT_ASSERT( !wxIsdigit_l('A', loc) );
CPPUNIT_ASSERT( !wxIsdigit_l('Z', loc) );
CPPUNIT_ASSERT( !wxIsdigit_l('a', loc) );
CPPUNIT_ASSERT( !wxIsdigit_l('z', loc) );
// TODO: isgraph
// islower
CPPUNIT_ASSERT( !wxIslower_l('A', loc) );
CPPUNIT_ASSERT( !wxIslower_l('Z', loc) );
CPPUNIT_ASSERT( wxIslower_l('a', loc) );
CPPUNIT_ASSERT( wxIslower_l('z', loc) );
CPPUNIT_ASSERT( !wxIslower_l('0', loc) );
CPPUNIT_ASSERT( !wxIslower_l('9', loc) );
// TODO: isprint
// TODO: ispunct
// isspace
CPPUNIT_ASSERT( wxIsspace_l(' ', loc) );
CPPUNIT_ASSERT( wxIsspace_l('\t', loc) );
CPPUNIT_ASSERT( wxIsspace_l('\r', loc) );
CPPUNIT_ASSERT( wxIsspace_l('\n', loc) );
CPPUNIT_ASSERT( !wxIsspace_l('0', loc) );
CPPUNIT_ASSERT( !wxIsspace_l('a', loc) );
CPPUNIT_ASSERT( !wxIsspace_l('A', loc) );
// isupper
CPPUNIT_ASSERT( !wxIsupper_l('0', loc) );
CPPUNIT_ASSERT( !wxIsupper_l('9', loc) );
CPPUNIT_ASSERT( wxIsupper_l('A', loc) );
CPPUNIT_ASSERT( wxIsupper_l('Z', loc) );
CPPUNIT_ASSERT( !wxIsupper_l('a', loc) );
CPPUNIT_ASSERT( !wxIsupper_l('z', loc) );
// isxdigit
CPPUNIT_ASSERT( wxIsxdigit_l('0', loc) );
CPPUNIT_ASSERT( wxIsxdigit_l('9', loc) );
CPPUNIT_ASSERT( wxIsxdigit_l('A', loc) );
CPPUNIT_ASSERT( wxIsxdigit_l('F', loc) );
CPPUNIT_ASSERT( !wxIsxdigit_l('Z', loc) );
CPPUNIT_ASSERT( wxIsxdigit_l('a', loc) );
CPPUNIT_ASSERT( wxIsxdigit_l('f', loc) );
CPPUNIT_ASSERT( !wxIsxdigit_l('z', loc) );
// tolower
CPPUNIT_ASSERT_EQUAL( 'a', wxTolower_l('A', loc) );
CPPUNIT_ASSERT_EQUAL( 'a', wxTolower_l('a', loc) );
CPPUNIT_ASSERT_EQUAL( 'z', wxTolower_l('Z', loc) );
CPPUNIT_ASSERT_EQUAL( 'z', wxTolower_l('z', loc) );
CPPUNIT_ASSERT_EQUAL( '0', wxTolower_l('0', loc) );
CPPUNIT_ASSERT_EQUAL( '9', wxTolower_l('9', loc) );
// toupper
CPPUNIT_ASSERT_EQUAL( 'A', wxToupper_l('A', loc) );
CPPUNIT_ASSERT_EQUAL( 'A', wxToupper_l('a', loc) );
CPPUNIT_ASSERT_EQUAL( 'Z', wxToupper_l('Z', loc) );
CPPUNIT_ASSERT_EQUAL( 'Z', wxToupper_l('z', loc) );
CPPUNIT_ASSERT_EQUAL( '0', wxToupper_l('0', loc) );
CPPUNIT_ASSERT_EQUAL( '9', wxToupper_l('9', loc) );
}
void XLocaleTestCase::TestCtypeFunctions()
{
TestCtypeFunctionsWith(wxCLocale);
#ifdef wxHAS_XLOCALE_SUPPORT
wxXLocale locFR("fr_FR");
TestCtypeFunctionsWith(locFR);
CPPUNIT_ASSERT( wxIsalpha_l('<EFBFBD>', locFR) );
CPPUNIT_ASSERT( wxIslower_l('<EFBFBD>', locFR) );
CPPUNIT_ASSERT( !wxIslower_l('<EFBFBD>', locFR) );
CPPUNIT_ASSERT( wxIsupper_l('<EFBFBD>', locFR) );
#endif
}
#endif // wxUSE_XLOCALE

View File

@@ -327,6 +327,7 @@ wx/wxcrt.h
wx/wxcrtbase.h
wx/wxcrtvararg.h
wx/wxprec.h
wx/xlocale.h
wx/xti.h
wx/xtistrm.h
wx/zipstrm.h
@@ -344,11 +345,11 @@ wx/unix/chkconf.h
wx/unix/evtloop.h
wx/unix/pipe.h
wx/unix/stdpaths.h
wx/unix/stackwalk.h
wx/unix/execute.h
wx/unix/mimetype.h
wx/unix/private.h
wx/private/gsocketiohandler.h
wx/unix/stackwalk.h
wx/fs_inet.h
wx/gsocket.h
wx/protocol/file.h

View File

@@ -232,6 +232,7 @@ wx/wxcrt.h
wx/wxcrtbase.h
wx/wxcrtvararg.h
wx/wxprec.h
wx/xlocale.h
wx/xti.h
wx/xtistrm.h
wx/zipstrm.h
@@ -249,11 +250,11 @@ wx/unix/chkconf.h
wx/unix/evtloop.h
wx/unix/pipe.h
wx/unix/stdpaths.h
wx/unix/stackwalk.h
wx/unix/execute.h
wx/unix/mimetype.h
wx/unix/private.h
wx/private/gsocketiohandler.h
wx/unix/stackwalk.h
wx/fs_inet.h
wx/gsocket.h
wx/protocol/file.h

View File

@@ -256,6 +256,7 @@ wx/wxcrt.h
wx/wxcrtbase.h
wx/wxcrtvararg.h
wx/wxprec.h
wx/xlocale.h
wx/xti.h
wx/xtistrm.h
wx/zipstrm.h
@@ -273,11 +274,11 @@ wx/unix/chkconf.h
wx/unix/evtloop.h
wx/unix/pipe.h
wx/unix/stdpaths.h
wx/unix/stackwalk.h
wx/unix/execute.h
wx/unix/mimetype.h
wx/unix/private.h
wx/private/gsocketiohandler.h
wx/unix/stackwalk.h
wx/fs_inet.h
wx/gsocket.h
wx/protocol/file.h