added wxStd{In,Out}putStream classes (closes #10637)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60483 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-05-02 18:29:33 +00:00
parent 574be073c0
commit 72a7c55982
29 changed files with 1198 additions and 13 deletions

View File

@ -405,6 +405,7 @@ ALL_BASE_HEADERS = \
wx/stack.h \
wx/stackwalk.h \
wx/stdpaths.h \
wx/stdstream.h \
wx/stockitem.h \
wx/stopwatch.h \
wx/strconv.h \
@ -564,6 +565,7 @@ ALL_PORTS_BASE_HEADERS = \
wx/stack.h \
wx/stackwalk.h \
wx/stdpaths.h \
wx/stdstream.h \
wx/stockitem.h \
wx/stopwatch.h \
wx/strconv.h \
@ -714,6 +716,7 @@ ALL_BASE_SOURCES = \
src/common/regex.cpp \
src/common/stdpbase.cpp \
src/common/sstream.cpp \
src/common/stdstream.cpp \
src/common/stopwatch.cpp \
src/common/strconv.cpp \
src/common/stream.cpp \
@ -901,6 +904,7 @@ MONODLL_OBJECTS = \
monodll_regex.o \
monodll_stdpbase.o \
monodll_sstream.o \
monodll_stdstream.o \
monodll_stopwatch.o \
monodll_strconv.o \
monodll_stream.o \
@ -1025,6 +1029,7 @@ MONOLIB_OBJECTS = \
monolib_regex.o \
monolib_stdpbase.o \
monolib_sstream.o \
monolib_stdstream.o \
monolib_stopwatch.o \
monolib_strconv.o \
monolib_stream.o \
@ -1146,6 +1151,7 @@ BASEDLL_OBJECTS = \
basedll_regex.o \
basedll_stdpbase.o \
basedll_sstream.o \
basedll_stdstream.o \
basedll_stopwatch.o \
basedll_strconv.o \
basedll_stream.o \
@ -1249,6 +1255,7 @@ BASELIB_OBJECTS = \
baselib_regex.o \
baselib_stdpbase.o \
baselib_sstream.o \
baselib_stdstream.o \
baselib_stopwatch.o \
baselib_strconv.o \
baselib_stream.o \
@ -14162,6 +14169,9 @@ monodll_stdpbase.o: $(srcdir)/src/common/stdpbase.cpp $(MONODLL_ODEP)
monodll_sstream.o: $(srcdir)/src/common/sstream.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/sstream.cpp
monodll_stdstream.o: $(srcdir)/src/common/stdstream.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/stdstream.cpp
monodll_stopwatch.o: $(srcdir)/src/common/stopwatch.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/stopwatch.cpp
@ -18848,6 +18858,9 @@ monolib_stdpbase.o: $(srcdir)/src/common/stdpbase.cpp $(MONOLIB_ODEP)
monolib_sstream.o: $(srcdir)/src/common/sstream.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/sstream.cpp
monolib_stdstream.o: $(srcdir)/src/common/stdstream.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/stdstream.cpp
monolib_stopwatch.o: $(srcdir)/src/common/stopwatch.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/stopwatch.cpp
@ -23534,6 +23547,9 @@ basedll_stdpbase.o: $(srcdir)/src/common/stdpbase.cpp $(BASEDLL_ODEP)
basedll_sstream.o: $(srcdir)/src/common/sstream.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/sstream.cpp
basedll_stdstream.o: $(srcdir)/src/common/stdstream.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/stdstream.cpp
basedll_stopwatch.o: $(srcdir)/src/common/stopwatch.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/stopwatch.cpp
@ -23996,6 +24012,9 @@ baselib_stdpbase.o: $(srcdir)/src/common/stdpbase.cpp $(BASELIB_ODEP)
baselib_sstream.o: $(srcdir)/src/common/sstream.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/sstream.cpp
baselib_stdstream.o: $(srcdir)/src/common/stdstream.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/stdstream.cpp
baselib_stopwatch.o: $(srcdir)/src/common/stopwatch.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/stopwatch.cpp

View File

@ -354,6 +354,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/common/regex.cpp
src/common/stdpbase.cpp
src/common/sstream.cpp
src/common/stdstream.cpp
src/common/stopwatch.cpp
src/common/strconv.cpp
src/common/stream.cpp
@ -485,6 +486,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/stack.h
wx/stackwalk.h
wx/stdpaths.h
wx/stdstream.h
wx/stockitem.h
wx/stopwatch.h
wx/strconv.h

View File

@ -358,6 +358,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_regex.obj \
$(OBJS)\monodll_stdpbase.obj \
$(OBJS)\monodll_sstream.obj \
$(OBJS)\monodll_stdstream.obj \
$(OBJS)\monodll_stopwatch.obj \
$(OBJS)\monodll_strconv.obj \
$(OBJS)\monodll_stream.obj \
@ -497,6 +498,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_regex.obj \
$(OBJS)\monolib_stdpbase.obj \
$(OBJS)\monolib_sstream.obj \
$(OBJS)\monolib_stdstream.obj \
$(OBJS)\monolib_stopwatch.obj \
$(OBJS)\monolib_strconv.obj \
$(OBJS)\monolib_stream.obj \
@ -633,6 +635,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_regex.obj \
$(OBJS)\basedll_stdpbase.obj \
$(OBJS)\basedll_sstream.obj \
$(OBJS)\basedll_stdstream.obj \
$(OBJS)\basedll_stopwatch.obj \
$(OBJS)\basedll_strconv.obj \
$(OBJS)\basedll_stream.obj \
@ -754,6 +757,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_regex.obj \
$(OBJS)\baselib_stdpbase.obj \
$(OBJS)\baselib_sstream.obj \
$(OBJS)\baselib_stdstream.obj \
$(OBJS)\baselib_stopwatch.obj \
$(OBJS)\baselib_strconv.obj \
$(OBJS)\baselib_stream.obj \
@ -5558,6 +5562,9 @@ $(OBJS)\monodll_stdpbase.obj: ..\..\src\common\stdpbase.cpp
$(OBJS)\monodll_sstream.obj: ..\..\src\common\sstream.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\sstream.cpp
$(OBJS)\monodll_stdstream.obj: ..\..\src\common\stdstream.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\stdstream.cpp
$(OBJS)\monodll_stopwatch.obj: ..\..\src\common\stopwatch.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\stopwatch.cpp
@ -7784,6 +7791,9 @@ $(OBJS)\monolib_stdpbase.obj: ..\..\src\common\stdpbase.cpp
$(OBJS)\monolib_sstream.obj: ..\..\src\common\sstream.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\sstream.cpp
$(OBJS)\monolib_stdstream.obj: ..\..\src\common\stdstream.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\stdstream.cpp
$(OBJS)\monolib_stopwatch.obj: ..\..\src\common\stopwatch.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\stopwatch.cpp
@ -10010,6 +10020,9 @@ $(OBJS)\basedll_stdpbase.obj: ..\..\src\common\stdpbase.cpp
$(OBJS)\basedll_sstream.obj: ..\..\src\common\sstream.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\sstream.cpp
$(OBJS)\basedll_stdstream.obj: ..\..\src\common\stdstream.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\stdstream.cpp
$(OBJS)\basedll_stopwatch.obj: ..\..\src\common\stopwatch.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\stopwatch.cpp
@ -10322,6 +10335,9 @@ $(OBJS)\baselib_stdpbase.obj: ..\..\src\common\stdpbase.cpp
$(OBJS)\baselib_sstream.obj: ..\..\src\common\sstream.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\sstream.cpp
$(OBJS)\baselib_stdstream.obj: ..\..\src\common\stdstream.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\stdstream.cpp
$(OBJS)\baselib_stopwatch.obj: ..\..\src\common\stopwatch.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\stopwatch.cpp

View File

@ -344,6 +344,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_regex.o \
$(OBJS)\monodll_stdpbase.o \
$(OBJS)\monodll_sstream.o \
$(OBJS)\monodll_stdstream.o \
$(OBJS)\monodll_stopwatch.o \
$(OBJS)\monodll_strconv.o \
$(OBJS)\monodll_stream.o \
@ -484,6 +485,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_regex.o \
$(OBJS)\monolib_stdpbase.o \
$(OBJS)\monolib_sstream.o \
$(OBJS)\monolib_stdstream.o \
$(OBJS)\monolib_stopwatch.o \
$(OBJS)\monolib_strconv.o \
$(OBJS)\monolib_stream.o \
@ -622,6 +624,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_regex.o \
$(OBJS)\basedll_stdpbase.o \
$(OBJS)\basedll_sstream.o \
$(OBJS)\basedll_stdstream.o \
$(OBJS)\basedll_stopwatch.o \
$(OBJS)\basedll_strconv.o \
$(OBJS)\basedll_stream.o \
@ -743,6 +746,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_regex.o \
$(OBJS)\baselib_stdpbase.o \
$(OBJS)\baselib_sstream.o \
$(OBJS)\baselib_stdstream.o \
$(OBJS)\baselib_stopwatch.o \
$(OBJS)\baselib_strconv.o \
$(OBJS)\baselib_stream.o \
@ -5710,6 +5714,9 @@ $(OBJS)\monodll_stdpbase.o: ../../src/common/stdpbase.cpp
$(OBJS)\monodll_sstream.o: ../../src/common/sstream.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_stdstream.o: ../../src/common/stdstream.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_stopwatch.o: ../../src/common/stopwatch.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@ -8048,6 +8055,9 @@ $(OBJS)\monolib_stdpbase.o: ../../src/common/stdpbase.cpp
$(OBJS)\monolib_sstream.o: ../../src/common/sstream.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_stdstream.o: ../../src/common/stdstream.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_stopwatch.o: ../../src/common/stopwatch.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@ -10386,6 +10396,9 @@ $(OBJS)\basedll_stdpbase.o: ../../src/common/stdpbase.cpp
$(OBJS)\basedll_sstream.o: ../../src/common/sstream.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\basedll_stdstream.o: ../../src/common/stdstream.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\basedll_stopwatch.o: ../../src/common/stopwatch.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
@ -10698,6 +10711,9 @@ $(OBJS)\baselib_stdpbase.o: ../../src/common/stdpbase.cpp
$(OBJS)\baselib_sstream.o: ../../src/common/sstream.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\baselib_stdstream.o: ../../src/common/stdstream.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\baselib_stopwatch.o: ../../src/common/stopwatch.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<

View File

@ -359,6 +359,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_regex.obj \
$(OBJS)\monodll_stdpbase.obj \
$(OBJS)\monodll_sstream.obj \
$(OBJS)\monodll_stdstream.obj \
$(OBJS)\monodll_stopwatch.obj \
$(OBJS)\monodll_strconv.obj \
$(OBJS)\monodll_stream.obj \
@ -503,6 +504,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_regex.obj \
$(OBJS)\monolib_stdpbase.obj \
$(OBJS)\monolib_sstream.obj \
$(OBJS)\monolib_stdstream.obj \
$(OBJS)\monolib_stopwatch.obj \
$(OBJS)\monolib_strconv.obj \
$(OBJS)\monolib_stream.obj \
@ -645,6 +647,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_regex.obj \
$(OBJS)\basedll_stdpbase.obj \
$(OBJS)\basedll_sstream.obj \
$(OBJS)\basedll_stdstream.obj \
$(OBJS)\basedll_stopwatch.obj \
$(OBJS)\basedll_strconv.obj \
$(OBJS)\basedll_stream.obj \
@ -771,6 +774,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_regex.obj \
$(OBJS)\baselib_stdpbase.obj \
$(OBJS)\baselib_sstream.obj \
$(OBJS)\baselib_stdstream.obj \
$(OBJS)\baselib_stopwatch.obj \
$(OBJS)\baselib_strconv.obj \
$(OBJS)\baselib_stream.obj \
@ -5904,6 +5908,9 @@ $(OBJS)\monodll_stdpbase.obj: ..\..\src\common\stdpbase.cpp
$(OBJS)\monodll_sstream.obj: ..\..\src\common\sstream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\sstream.cpp
$(OBJS)\monodll_stdstream.obj: ..\..\src\common\stdstream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\stdstream.cpp
$(OBJS)\monodll_stopwatch.obj: ..\..\src\common\stopwatch.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\stopwatch.cpp
@ -8130,6 +8137,9 @@ $(OBJS)\monolib_stdpbase.obj: ..\..\src\common\stdpbase.cpp
$(OBJS)\monolib_sstream.obj: ..\..\src\common\sstream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\sstream.cpp
$(OBJS)\monolib_stdstream.obj: ..\..\src\common\stdstream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\stdstream.cpp
$(OBJS)\monolib_stopwatch.obj: ..\..\src\common\stopwatch.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\stopwatch.cpp
@ -10356,6 +10366,9 @@ $(OBJS)\basedll_stdpbase.obj: ..\..\src\common\stdpbase.cpp
$(OBJS)\basedll_sstream.obj: ..\..\src\common\sstream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\sstream.cpp
$(OBJS)\basedll_stdstream.obj: ..\..\src\common\stdstream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\stdstream.cpp
$(OBJS)\basedll_stopwatch.obj: ..\..\src\common\stopwatch.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\stopwatch.cpp
@ -10668,6 +10681,9 @@ $(OBJS)\baselib_stdpbase.obj: ..\..\src\common\stdpbase.cpp
$(OBJS)\baselib_sstream.obj: ..\..\src\common\sstream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\sstream.cpp
$(OBJS)\baselib_stdstream.obj: ..\..\src\common\stdstream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\stdstream.cpp
$(OBJS)\baselib_stopwatch.obj: ..\..\src\common\stopwatch.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\stopwatch.cpp

View File

@ -3464,6 +3464,7 @@ MONODLL_OBJECTS = &
$(OBJS)\monodll_regex.obj &
$(OBJS)\monodll_stdpbase.obj &
$(OBJS)\monodll_sstream.obj &
$(OBJS)\monodll_stdstream.obj &
$(OBJS)\monodll_stopwatch.obj &
$(OBJS)\monodll_strconv.obj &
$(OBJS)\monodll_stream.obj &
@ -3603,6 +3604,7 @@ MONOLIB_OBJECTS = &
$(OBJS)\monolib_regex.obj &
$(OBJS)\monolib_stdpbase.obj &
$(OBJS)\monolib_sstream.obj &
$(OBJS)\monolib_stdstream.obj &
$(OBJS)\monolib_stopwatch.obj &
$(OBJS)\monolib_strconv.obj &
$(OBJS)\monolib_stream.obj &
@ -3740,6 +3742,7 @@ BASEDLL_OBJECTS = &
$(OBJS)\basedll_regex.obj &
$(OBJS)\basedll_stdpbase.obj &
$(OBJS)\basedll_sstream.obj &
$(OBJS)\basedll_stdstream.obj &
$(OBJS)\basedll_stopwatch.obj &
$(OBJS)\basedll_strconv.obj &
$(OBJS)\basedll_stream.obj &
@ -3861,6 +3864,7 @@ BASELIB_OBJECTS = &
$(OBJS)\baselib_regex.obj &
$(OBJS)\baselib_stdpbase.obj &
$(OBJS)\baselib_sstream.obj &
$(OBJS)\baselib_stdstream.obj &
$(OBJS)\baselib_stopwatch.obj &
$(OBJS)\baselib_strconv.obj &
$(OBJS)\baselib_stream.obj &
@ -5959,6 +5963,9 @@ $(OBJS)\monodll_stdpbase.obj : .AUTODEPEND ..\..\src\common\stdpbase.cpp
$(OBJS)\monodll_sstream.obj : .AUTODEPEND ..\..\src\common\sstream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
$(OBJS)\monodll_stdstream.obj : .AUTODEPEND ..\..\src\common\stdstream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
$(OBJS)\monodll_stopwatch.obj : .AUTODEPEND ..\..\src\common\stopwatch.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
@ -8297,6 +8304,9 @@ $(OBJS)\monolib_stdpbase.obj : .AUTODEPEND ..\..\src\common\stdpbase.cpp
$(OBJS)\monolib_sstream.obj : .AUTODEPEND ..\..\src\common\sstream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
$(OBJS)\monolib_stdstream.obj : .AUTODEPEND ..\..\src\common\stdstream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
$(OBJS)\monolib_stopwatch.obj : .AUTODEPEND ..\..\src\common\stopwatch.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
@ -10635,6 +10645,9 @@ $(OBJS)\basedll_stdpbase.obj : .AUTODEPEND ..\..\src\common\stdpbase.cpp
$(OBJS)\basedll_sstream.obj : .AUTODEPEND ..\..\src\common\sstream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
$(OBJS)\basedll_stdstream.obj : .AUTODEPEND ..\..\src\common\stdstream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
$(OBJS)\basedll_stopwatch.obj : .AUTODEPEND ..\..\src\common\stopwatch.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
@ -10947,6 +10960,9 @@ $(OBJS)\baselib_stdpbase.obj : .AUTODEPEND ..\..\src\common\stdpbase.cpp
$(OBJS)\baselib_sstream.obj : .AUTODEPEND ..\..\src\common\sstream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
$(OBJS)\baselib_stdstream.obj : .AUTODEPEND ..\..\src\common\stdstream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
$(OBJS)\baselib_stopwatch.obj : .AUTODEPEND ..\..\src\common\stopwatch.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<

View File

@ -467,6 +467,10 @@ SOURCE=..\..\src\common\stdpbase.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\common\stdstream.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\common\stopwatch.cpp
# End Source File
# Begin Source File
@ -1419,6 +1423,10 @@ SOURCE=..\..\include\wx\stdpaths.h
# End Source File
# Begin Source File
SOURCE=..\..\include\wx\stdstream.h
# End Source File
# Begin Source File
SOURCE=..\..\include\wx\stockitem.h
# End Source File
# Begin Source File

View File

@ -785,6 +785,9 @@
<File
RelativePath="..\..\src\common\stdpbase.cpp">
</File>
<File
RelativePath="..\..\src\common\stdstream.cpp">
</File>
<File
RelativePath="..\..\src\common\stopwatch.cpp">
</File>
@ -1490,6 +1493,9 @@
<File
RelativePath="..\..\include\wx\stdpaths.h">
</File>
<File
RelativePath="..\..\include\wx\stdstream.h">
</File>
<File
RelativePath="..\..\include\wx\stockitem.h">
</File>

View File

@ -1082,6 +1082,10 @@
RelativePath="..\..\src\common\stdpbase.cpp"
>
</File>
<File
RelativePath="..\..\src\common\stdstream.cpp"
>
</File>
<File
RelativePath="..\..\src\common\stopwatch.cpp"
>
@ -2007,6 +2011,10 @@
RelativePath="..\..\include\wx\stdpaths.h"
>
</File>
<File
RelativePath="..\..\include\wx\stdstream.h"
>
</File>
<File
RelativePath="..\..\include\wx\stockitem.h"
>

View File

@ -1078,6 +1078,10 @@
RelativePath="..\..\src\common\stdpbase.cpp"
>
</File>
<File
RelativePath="..\..\src\common\stdstream.cpp"
>
</File>
<File
RelativePath="..\..\src\common\stopwatch.cpp"
>
@ -2003,6 +2007,10 @@
RelativePath="..\..\include\wx\stdpaths.h"
>
</File>
<File
RelativePath="..\..\include\wx\stdstream.h"
>
</File>
<File
RelativePath="..\..\include\wx\stockitem.h"
>

View File

@ -328,6 +328,7 @@ Major new features in this release
All:
- Added wxStd{Input,Output}Stream classes (Jonathan Liu).
- Include port number in host header in wxHTTP (Marcin 'Malcom' Malich).
All (GUI):

View File

@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: stream.h
// Purpose: topic overview
// Purpose: stream classes overview
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
@ -33,16 +33,25 @@ Classes:
@section overview_stream_intro Introduction
wxWidgets provides its own set of stream classes in order to be
independent of the standard C++ stream class and their different
implementations.
@subsection overview_stream_intro_std wxWidgets and Standard Streams
Besides, using @c std::iostream on Linux makes impossible to write programs that are
binary compatible across different Linux distributions.
wxWidgets provides its own set of stream classes in order to support platforms
not providing standard C++ streams implementation and also to make it possible
to provide binary versions of wxWidgets application not depending on any
particular standard library version. The wxWidgets stream classes also provide
some functionality not available in the standard library such as support for
several compression formats and possibility to work with sockets or text
controls (for output only in the latter case).
Therefore, wxStreams have been added to wxWidgets so that an applications can
reliably compile and run on all supported platforms without dependence on a
particular release of libg++.
Nevertheless wxWidgets programs can also use standard stream classes and are
encouraged to do so if the above considerations don't apply. Moreover,
wxStdInputStream and wxStdOutputStream classes are provided to provide a degree
of interoperability between the two and make it possible to use any wxWidgets
stream as a standard stream (the converse possibility to use a standard stream
as a wxWidgets stream is planned for a future release).
@subsection overview_stream_intro_overview Stream Classes
wxStream classes are divided in two main groups:

111
include/wx/stdstream.h Normal file
View File

@ -0,0 +1,111 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/stdstream.h
// Purpose: Header of std::istream and std::ostream derived wrappers for
// wxInputStream and wxOutputStream
// Author: Jonathan Liu <net147@gmail.com>
// Created: 2009-05-02
// RCS-ID: $Id$
// Copyright: (c) 2009 Jonathan Liu
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STDSTREAM_H_
#define _WX_STDSTREAM_H_
#include "wx/defs.h" // wxUSE_STD_IOSTREAM
#if wxUSE_STD_IOSTREAM
#include <iosfwd>
#include <wx/defs.h>
#include <wx/stream.h>
// ==========================================================================
// wxStdInputStreamBuffer
// ==========================================================================
class WXDLLIMPEXP_BASE wxStdInputStreamBuffer : public std::streambuf
{
public:
wxStdInputStreamBuffer(wxInputStream& stream);
virtual ~wxStdInputStreamBuffer() { }
protected:
virtual std::streambuf *setbuf(char *s, std::streamsize n);
virtual std::streampos seekoff(std::streamoff off,
std::ios_base::seekdir way,
std::ios_base::openmode which =
std::ios_base::in |
std::ios_base::out);
virtual std::streampos seekpos(std::streampos sp,
std::ios_base::openmode which =
std::ios_base::in |
std::ios_base::out);
virtual std::streamsize showmanyc();
virtual std::streamsize xsgetn(char *s, std::streamsize n);
virtual int underflow();
virtual int uflow();
virtual int pbackfail(int c = EOF);
wxInputStream& m_stream;
int m_lastChar;
};
// ==========================================================================
// wxStdInputStream
// ==========================================================================
class WXDLLIMPEXP_BASE wxStdInputStream : public std::istream
{
public:
wxStdInputStream(wxInputStream& stream);
virtual ~wxStdInputStream() { }
protected:
wxStdInputStreamBuffer m_streamBuffer;
};
// ==========================================================================
// wxStdOutputStreamBuffer
// ==========================================================================
class WXDLLIMPEXP_BASE wxStdOutputStreamBuffer : public std::streambuf
{
public:
wxStdOutputStreamBuffer(wxOutputStream& stream);
virtual ~wxStdOutputStreamBuffer() { }
protected:
virtual std::streambuf *setbuf(char *s, std::streamsize n);
virtual std::streampos seekoff(std::streamoff off,
std::ios_base::seekdir way,
std::ios_base::openmode which =
std::ios_base::in |
std::ios_base::out);
virtual std::streampos seekpos(std::streampos sp,
std::ios_base::openmode which =
std::ios_base::in |
std::ios_base::out);
virtual std::streamsize xsputn(const char *s, std::streamsize n);
virtual int overflow(int c);
wxOutputStream& m_stream;
};
// ==========================================================================
// wxStdOutputStream
// ==========================================================================
class WXDLLIMPEXP_BASE wxStdOutputStream : public std::ostream
{
public:
wxStdOutputStream(wxOutputStream& stream);
virtual ~wxStdOutputStream() { }
protected:
wxStdOutputStreamBuffer m_streamBuffer;
};
#endif // wxUSE_STD_IOSTREAM
#endif // _WX_STDSTREAM_H_

190
interface/wx/stdstream.h Normal file
View File

@ -0,0 +1,190 @@
/////////////////////////////////////////////////////////////////////////////
// Name: stdstream.h
// Purpose: interface of wxStdInputStream, wxStdInputStreamBuffer,
// wxStdOutputStream, wxStdOutputStreamBuffer
// Author: Jonathan Liu <net147@gmail.com>
// RCS-ID: $Id$
// Copyright: (c) 2009 Jonathan Liu
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
@class wxStdInputStreamBuffer
wxStdInputStreamBuffer is a std::streambuf derived stream buffer which
reads from a wxInputStream.
Example:
@code
wxFFileInputStream file("input.txt.gz");
wxZlibInputStream gzipInput(file, wxZLIB_GZIP);
wxStdInputStreamBuffer gzipStreamBuffer(gzipInput);
// redirect std::cin to read from compressed file
std::streambuf* streamBufferOld = std::cin.rdbuf(&gzipStreamBuffer);
// prompt for integer
int number;
std::cout << "Enter an integer: " << std::flush;
std::cin >> number;
std::cout << std::endl;
std::cout << "You entered the integer " << number << "." << std::endl;
// restore std::cin
std::cin.rdbuf(streamBufferOld);
@endcode
@library{wxbase}
@category{streams}
@see wxInputStream, wxStdInputStream
*/
class wxStdInputStreamBuffer : public std::streambuf
{
public:
/**
Creates a std::steambuf derived stream buffer which reads from a
wxInputStream.
@param stream
Stream to read from.
*/
wxStdInputStreamBuffer(wxInputStream& stream);
/**
Destructor.
*/
virtual ~wxStdInputStreamBuffer() { }
};
/**
@class wxStdInputStream
wxStdInputStream is a std::istream derived stream buffer which reads from
a wxInputStream.
Example:
@code
wxFFileInputStream file("words.txt");
wxStdInputStream in(file);
std::vector<std::string> words;
// read words from stdin
std::copy(std::istream_iterator<std::string>(in),
std::istream_iterator<std::string>(),
std::back_inserter(words));
// sort and remove duplicates
std::sort(words.begin(), words.end());
words.resize(std::unique(words.begin(), words.end()) - words.begin());
// print words
std::copy(words.begin(), words.end(),
std::ostream_iterator<std::string>(std::cout, "\n"));
@endcode
@library{wxbase}
@category{streams}
@see wxInputStream, wxStdInputStreamBuffer
*/
class wxStdInputStream : public std::istream
{
public:
/**
Creates a std::istream derived stream which reads from a
wxInputStream.
@param stream
Stream to read from.
*/
wxStdInputStream(wxInputStream& stream);
/**
Destructor.
*/
virtual ~wxStdInputStream() { }
};
/**
@class wxStdOutputStreamBuffer
wxStdOutputStreamBuffer is a std::streambuf derived stream buffer which
writes to a wxOutputStream.
Example:
@code
wxFFileOutputStream file("cout.txt.gz");
wxZlibOutputStream gzipOutput(file, -1, wxZLIB_GZIP);
wxStdOutputStreamBuffer gzipStreamBuffer(gzipOutput);
// redirect std::cout to cout.txt.gz using GZIP compression
std::streambuf* streamBufferOld = std::cout.rdbuf(&gzipStreamBuffer);
// write to std::cout
std::cout << "Hello world!" << std::endl;
// restore std::cout
std::cout.rdbuf(streamBufferOld);
@endcode
@library{wxbase}
@category{streams}
@see wxOutputStream, wxStdOutputStream
*/
class wxStdOutputStreamBuffer : public std::streambuf
{
public:
/**
Creates a std::steambuf derived stream buffer which writes to a
wxOutputStream.
@param stream
Stream to write to.
*/
wxStdOutputStreamBuffer(wxOutputStream& stream);
/**
Destructor.
*/
virtual ~wxStdOutputStreamBuffer() { }
};
/**
@class wxStdOutputStream
wxStdOutputStream is a std::ostream derived stream which writes to a
wxOutputStream.
Example:
@code
wxFFileOutputStream file("out.txt.gz");
wxZlibOutputStream gzipOutput(file, -1, wxZLIB_GZIP);
wxStdOutputStream out(gzipOutput);
out << "Hello world!" << std::endl;
@endcode
@library{wxbase}
@category{streams}
@see wxOutputStream, wxStdOutputStreamBuffer
*/
class wxStdOutputStream : public std::ostream
{
public:
/**
Creates a std::ostream derived stream which writes to a
wxOutputStream.
@param stream
Stream to write to.
*/
wxStdOutputStream(wxOutputStream& stream);
/**
Destructor.
*/
virtual ~wxStdOutputStream() { }
};

272
src/common/stdstream.cpp Normal file
View File

@ -0,0 +1,272 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/stdstream.h
// Purpose: Implementation of std::istream and std::ostream derived
// wrappers for wxInputStream and wxOutputStream
// Author: Jonathan Liu <net147@gmail.com>
// Created: 2009-05-02
// RCS-ID: $Id$
// Copyright: (c) 2009 Jonathan Liu
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ==========================================================================
// Declarations
// ==========================================================================
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_STD_IOSTREAM
#ifndef WX_PRECOMP
#endif
#include "wx/stdstream.h"
#include <ios>
#include <istream>
#include <ostream>
#include <streambuf>
// ==========================================================================
// Helpers
// ==========================================================================
namespace
{
inline bool
IosSeekDirToWxSeekMode(std::ios_base::seekdir way,
wxSeekMode& seekMode)
{
switch ( way )
{
case std::ios_base::beg:
seekMode = wxFromStart;
break;
case std::ios_base::cur:
seekMode = wxFromCurrent;
break;
case std::ios_base::end:
seekMode = wxFromEnd;
break;
default:
return false;
}
return true;
}
} // anonymous namespace
// ==========================================================================
// wxStdInputStreamBuffer
// ==========================================================================
wxStdInputStreamBuffer::wxStdInputStreamBuffer(wxInputStream& stream) :
m_stream(stream), m_lastChar(EOF)
{
}
std::streambuf *
wxStdInputStreamBuffer::setbuf(char *WXUNUSED(s),
std::streamsize WXUNUSED(n))
{
return NULL;
}
std::streampos
wxStdInputStreamBuffer::seekoff(std::streamoff off,
std::ios_base::seekdir way,
std::ios_base::openmode which)
{
wxSeekMode seekMode;
if ( !IosSeekDirToWxSeekMode(way, seekMode) )
return -1;
if ( !(which & std::ios_base::in) )
return -1;
off_t newPos = m_stream.SeekI((off_t) off, seekMode);
if ( newPos != wxInvalidOffset )
return (std::streampos) newPos;
else
return -1;
}
std::streampos
wxStdInputStreamBuffer::seekpos(std::streampos sp,
std::ios_base::openmode which)
{
if ( !(which & std::ios_base::in) )
return -1;
off_t newPos = m_stream.SeekI((off_t) sp);
if ( newPos != wxInvalidOffset )
return (std::streampos) newPos;
else
return -1;
}
std::streamsize
wxStdInputStreamBuffer::showmanyc()
{
if ( m_stream.CanRead() && (off_t) m_stream.GetSize() > m_stream.TellI() )
return m_stream.GetSize() - m_stream.TellI();
else
return 0;
}
std::streamsize
wxStdInputStreamBuffer::xsgetn(char *s, std::streamsize n)
{
m_stream.Read((void *) s, (size_t) n);
std::streamsize read = m_stream.LastRead();
if ( read > 0 )
m_lastChar = (unsigned char) s[read - 1];
return read;
}
int
wxStdInputStreamBuffer::underflow()
{
int ch = m_stream.GetC();
if ( m_stream.LastRead() == 1 )
{
m_stream.Ungetch((char) ch);
return ch;
}
else
{
return EOF;
}
}
int
wxStdInputStreamBuffer::uflow()
{
int ch = m_stream.GetC();
if ( m_stream.LastRead() == 1 )
{
m_lastChar = ch;
return ch;
}
else
{
return EOF;
}
}
int
wxStdInputStreamBuffer::pbackfail(int c)
{
if ( c == EOF )
{
if ( m_lastChar == EOF )
return EOF;
c = m_lastChar;
m_lastChar = EOF;
}
return m_stream.Ungetch((char) c) ? c : EOF;
}
// ==========================================================================
// wxStdInputStream
// ==========================================================================
wxStdInputStream::wxStdInputStream(wxInputStream& stream) :
std::istream(NULL), m_streamBuffer(stream)
{
std::ios::init(&m_streamBuffer);
}
// ==========================================================================
// wxStdOutputStreamBuffer
// ==========================================================================
wxStdOutputStreamBuffer::wxStdOutputStreamBuffer(wxOutputStream& stream) :
m_stream(stream)
{
}
std::streambuf *
wxStdOutputStreamBuffer::setbuf(char *WXUNUSED(s),
std::streamsize WXUNUSED(n))
{
return NULL;
}
std::streampos
wxStdOutputStreamBuffer::seekoff(std::streamoff off,
std::ios_base::seekdir way,
std::ios_base::openmode which)
{
wxSeekMode seekMode;
if ( !IosSeekDirToWxSeekMode(way, seekMode) )
return -1;
if ( !(which & std::ios_base::out) )
return -1;
off_t newPos = m_stream.SeekO((off_t) off, seekMode);
if ( newPos != wxInvalidOffset )
return (std::streampos) newPos;
else
return -1;
}
std::streampos
wxStdOutputStreamBuffer::seekpos(std::streampos sp,
std::ios_base::openmode which)
{
if ( !(which & std::ios_base::out) )
return -1;
off_t newPos = m_stream.SeekO((off_t) sp);
if ( newPos != wxInvalidOffset )
return (std::streampos) newPos;
else
return -1;
}
std::streamsize
wxStdOutputStreamBuffer::xsputn(const char *s,
std::streamsize n)
{
m_stream.Write((const void *) s, (size_t) n);
return (std::streamsize) m_stream.LastWrite();
}
int
wxStdOutputStreamBuffer::overflow(int c)
{
m_stream.PutC(c);
return m_stream.IsOk() ? c : EOF;
}
// ==========================================================================
// wxStdOutputStream
// ==========================================================================
wxStdOutputStream::wxStdOutputStream(wxOutputStream& stream) :
std::ostream(NULL), m_streamBuffer(stream)
{
std::ios::init(&m_streamBuffer);
}
#endif // wxUSE_STD_IOSTREAM

View File

@ -1,6 +1,6 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.5 (http://www.bakefile.org)
# Bakefile 0.2.6 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
@ -14,6 +14,7 @@ INSTALL = @INSTALL@
EXEEXT = @EXEEXT@
WINDRES = @WINDRES@
SETFILE = @SETFILE@
ICC_PCH_USE_SWITCH = @ICC_PCH_USE_SWITCH@
BK_DEPS = @BK_DEPS@
BK_MAKE_PCH = @BK_MAKE_PCH@
srcdir = @srcdir@
@ -100,6 +101,7 @@ TEST_OBJECTS = \
test_memstream.o \
test_socketstream.o \
test_sstream.o \
test_stdstream.o \
test_tempfile.o \
test_textstreamtest.o \
test_zlibstream.o \
@ -174,7 +176,7 @@ PRINTFBENCH_ODEP = $(_____pch_testprec_printfbench_testprec_h_gch___depname)
@COND_PLATFORM_MAC_1@__test___mac_setfilecmd = \
@COND_PLATFORM_MAC_1@ $(SETFILE) -t APPL test$(EXEEXT)
@COND_GCC_PCH_1@__test_PCH_INC = -I./.pch/testprec_test
@COND_ICC_PCH_1@__test_PCH_INC = -use_pch \
@COND_ICC_PCH_1@__test_PCH_INC = $(ICC_PCH_USE_SWITCH) \
@COND_ICC_PCH_1@ ./.pch/testprec_test/testprec.h.gch
@COND_USE_PCH_1@_____pch_testprec_test_testprec_h_gch___depname \
@COND_USE_PCH_1@ = ./.pch/testprec_test/testprec.h.gch
@ -207,7 +209,7 @@ PRINTFBENCH_ODEP = $(_____pch_testprec_printfbench_testprec_h_gch___depname)
@COND_TOOLKIT_COCOA@____test_gui_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_COCOA@ $(__test_gui_app_Contents_PkgInfo___depname)
@COND_GCC_PCH_1@__test_gui_PCH_INC = -I./.pch/testprec_test_gui
@COND_ICC_PCH_1@__test_gui_PCH_INC = -use_pch \
@COND_ICC_PCH_1@__test_gui_PCH_INC = $(ICC_PCH_USE_SWITCH) \
@COND_ICC_PCH_1@ ./.pch/testprec_test_gui/testprec.h.gch
@COND_USE_PCH_1@_____pch_testprec_test_gui_testprec_h_gch___depname \
@COND_USE_PCH_1@ = ./.pch/testprec_test_gui/testprec.h.gch
@ -239,7 +241,8 @@ COND_MONOLITHIC_0___WXLIB_CORE_p = \
@COND_PLATFORM_MAC_1@__printfbench___mac_setfilecmd = \
@COND_PLATFORM_MAC_1@ $(SETFILE) -t APPL printfbench$(EXEEXT)
@COND_GCC_PCH_1@__printfbench_PCH_INC = -I./.pch/testprec_printfbench
@COND_ICC_PCH_1@__printfbench_PCH_INC = -use_pch \
@COND_ICC_PCH_1@__printfbench_PCH_INC = \
@COND_ICC_PCH_1@ $(ICC_PCH_USE_SWITCH) \
@COND_ICC_PCH_1@ ./.pch/testprec_printfbench/testprec.h.gch
@COND_USE_PCH_1@_____pch_testprec_printfbench_testprec_h_gch___depname \
@COND_USE_PCH_1@ = ./.pch/testprec_printfbench/testprec.h.gch
@ -503,6 +506,9 @@ test_socketstream.o: $(srcdir)/streams/socketstream.cpp $(TEST_ODEP)
test_sstream.o: $(srcdir)/streams/sstream.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/streams/sstream.cpp
test_stdstream.o: $(srcdir)/streams/stdstream.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/streams/stdstream.cpp
test_tempfile.o: $(srcdir)/streams/tempfile.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/streams/tempfile.cpp

View File

@ -85,6 +85,7 @@ TEST_OBJECTS = \
$(OBJS)\test_memstream.obj \
$(OBJS)\test_socketstream.obj \
$(OBJS)\test_sstream.obj \
$(OBJS)\test_stdstream.obj \
$(OBJS)\test_tempfile.obj \
$(OBJS)\test_textstreamtest.obj \
$(OBJS)\test_zlibstream.obj \
@ -544,6 +545,9 @@ $(OBJS)\test_socketstream.obj: .\streams\socketstream.cpp
$(OBJS)\test_sstream.obj: .\streams\sstream.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\streams\sstream.cpp
$(OBJS)\test_stdstream.obj: .\streams\stdstream.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\streams\stdstream.cpp
$(OBJS)\test_tempfile.obj: .\streams\tempfile.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\streams\tempfile.cpp

View File

@ -77,6 +77,7 @@ TEST_OBJECTS = \
$(OBJS)\test_memstream.o \
$(OBJS)\test_socketstream.o \
$(OBJS)\test_sstream.o \
$(OBJS)\test_stdstream.o \
$(OBJS)\test_tempfile.o \
$(OBJS)\test_textstreamtest.o \
$(OBJS)\test_zlibstream.o \
@ -524,6 +525,9 @@ $(OBJS)\test_socketstream.o: ./streams/socketstream.cpp
$(OBJS)\test_sstream.o: ./streams/sstream.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_stdstream.o: ./streams/stdstream.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_tempfile.o: ./streams/tempfile.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<

View File

@ -78,6 +78,7 @@ TEST_OBJECTS = \
$(OBJS)\test_memstream.obj \
$(OBJS)\test_socketstream.obj \
$(OBJS)\test_sstream.obj \
$(OBJS)\test_stdstream.obj \
$(OBJS)\test_tempfile.obj \
$(OBJS)\test_textstreamtest.obj \
$(OBJS)\test_zlibstream.obj \
@ -629,6 +630,9 @@ $(OBJS)\test_socketstream.obj: .\streams\socketstream.cpp
$(OBJS)\test_sstream.obj: .\streams\sstream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\streams\sstream.cpp
$(OBJS)\test_stdstream.obj: .\streams\stdstream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\streams\stdstream.cpp
$(OBJS)\test_tempfile.obj: .\streams\tempfile.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\streams\tempfile.cpp

View File

@ -316,6 +316,7 @@ TEST_OBJECTS = &
$(OBJS)\test_memstream.obj &
$(OBJS)\test_socketstream.obj &
$(OBJS)\test_sstream.obj &
$(OBJS)\test_stdstream.obj &
$(OBJS)\test_tempfile.obj &
$(OBJS)\test_textstreamtest.obj &
$(OBJS)\test_zlibstream.obj &
@ -585,6 +586,9 @@ $(OBJS)\test_socketstream.obj : .AUTODEPEND .\streams\socketstream.cpp
$(OBJS)\test_sstream.obj : .AUTODEPEND .\streams\sstream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_stdstream.obj : .AUTODEPEND .\streams\stdstream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_tempfile.obj : .AUTODEPEND .\streams\tempfile.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<

446
tests/streams/stdstream.cpp Normal file
View File

@ -0,0 +1,446 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/streams/stdstream.cpp
// Purpose: Test wxStdInputStreamBuffer/wxStdOutputStreamBuffer
// Author: Jonathan Liu <net147@gmail.com>
// RCS-ID: $Id$
// Copyright: (c) 2009 Jonathan Liu
// Licence: wxWidgets licence
///////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
// and "wx/cppunit.h"
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#if wxUSE_STD_IOSTREAM
#include "wx/stdstream.h"
#include <string.h>
#include "wx/mstream.h"
// when std::streamoff is simply long we don't need this as we already allow
// comparisons between int and long but we do need it otherwise -- and we don't
// have any way to detect it so for now just assume that all 64 bit builds use
// long as streamoff and if this is wrong we'll add a check to configure later
#if SIZEOF_SIZE_T != 8
WX_CPPUNIT_ALLOW_EQUALS_TO_INT(std::streamoff)
#endif
// ==========================================================================
// Definitions
// ==========================================================================
const int TEST_SIZE = 384;
// ==========================================================================
// Test class
// ==========================================================================
class StdStreamTestCase : public CppUnit::TestCase
{
public:
StdStreamTestCase();
private:
CPPUNIT_TEST_SUITE( StdStreamTestCase );
// Input buffer management and positioning
CPPUNIT_TEST( InputBuffer_pubsetbuf );
CPPUNIT_TEST( InputBuffer_pubseekoff );
CPPUNIT_TEST( InputBuffer_pubseekpos );
CPPUNIT_TEST( InputBuffer_pubsync );
// Input functions
CPPUNIT_TEST( InputBuffer_in_avail );
CPPUNIT_TEST( InputBuffer_snextc );
CPPUNIT_TEST( InputBuffer_sbumpc );
CPPUNIT_TEST( InputBuffer_sgetc );
CPPUNIT_TEST( InputBuffer_sgetn );
CPPUNIT_TEST( InputBuffer_sputbackc );
CPPUNIT_TEST( InputBuffer_sungetc );
// Output buffer management and positioning
CPPUNIT_TEST( OutputBuffer_pubsetbuf );
CPPUNIT_TEST( OutputBuffer_pubseekoff );
CPPUNIT_TEST( OutputBuffer_pubseekpos );
CPPUNIT_TEST( OutputBuffer_pubsync );
// Output functions
CPPUNIT_TEST( OutputBuffer_sputc );
CPPUNIT_TEST( OutputBuffer_sputn );
CPPUNIT_TEST_SUITE_END();
// Input buffer management and positioning
void InputBuffer_pubsetbuf();
void InputBuffer_pubseekoff();
void InputBuffer_pubseekpos();
void InputBuffer_pubsync();
// Input functions
void InputBuffer_in_avail();
void InputBuffer_snextc();
void InputBuffer_sbumpc();
void InputBuffer_sgetc();
void InputBuffer_sgetn();
void InputBuffer_sputbackc();
void InputBuffer_sungetc();
// Output buffer management and positioning
void OutputBuffer_pubsetbuf();
void OutputBuffer_pubseekoff();
void OutputBuffer_pubseekpos();
void OutputBuffer_pubsync();
// Output functions
void OutputBuffer_sputc();
void OutputBuffer_sputn();
char m_testData[TEST_SIZE];
DECLARE_NO_COPY_CLASS(StdStreamTestCase)
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( StdStreamTestCase );
// also include in it's own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( StdStreamTestCase,
"StdStreamTestCase" );
// ==========================================================================
// Implementation
// ==========================================================================
StdStreamTestCase::StdStreamTestCase()
{
for (int i = 0; i < TEST_SIZE; ++i)
m_testData[i] = (i & 0xFF);
}
// --------------------------------------------------------------------------
// Input buffer management and positioning
// --------------------------------------------------------------------------
void StdStreamTestCase::InputBuffer_pubsetbuf()
{
wxMemoryInputStream stream(m_testData, TEST_SIZE);
wxStdInputStreamBuffer buffer(stream);
char testBuffer[TEST_SIZE];
CPPUNIT_ASSERT(buffer.pubsetbuf(testBuffer, TEST_SIZE) == NULL);
}
void StdStreamTestCase::InputBuffer_pubseekoff()
{
const char *testData = "0123456789";
wxMemoryInputStream stream(testData, 10);
wxStdInputStreamBuffer buffer(stream);
CPPUNIT_ASSERT_EQUAL(2,
buffer.pubseekoff(2, std::ios_base::beg,
std::ios_base::in));
CPPUNIT_ASSERT_EQUAL(-1,
buffer.pubseekoff(2, std::ios_base::beg,
std::ios_base::out));
CPPUNIT_ASSERT_EQUAL(4,
buffer.pubseekoff(2, std::ios_base::cur));
CPPUNIT_ASSERT_EQUAL(-1,
buffer.pubseekoff(2, std::ios_base::cur,
std::ios_base::out));
CPPUNIT_ASSERT_EQUAL(8,
buffer.pubseekoff(-2, std::ios_base::end));
CPPUNIT_ASSERT_EQUAL(-1,
buffer.pubseekoff(-2, std::ios_base::end,
std::ios_base::out));
CPPUNIT_ASSERT_EQUAL(-1,
buffer.pubseekoff(3, std::ios_base::cur));
CPPUNIT_ASSERT_EQUAL(-1,
buffer.pubseekoff(3, std::ios_base::cur,
std::ios_base::out));
}
void StdStreamTestCase::InputBuffer_pubseekpos()
{
const char *testData = "0123456789";
wxMemoryInputStream stream(testData, 10);
wxStdInputStreamBuffer buffer(stream);
for (int i = 9; i >= 0; --i)
{
if (i % 2 == 0)
CPPUNIT_ASSERT_EQUAL(i, buffer.pubseekpos(i));
else
CPPUNIT_ASSERT_EQUAL(i, buffer.pubseekpos(i, std::ios_base::in));
CPPUNIT_ASSERT_EQUAL('0' + i, buffer.sgetc());
}
}
void StdStreamTestCase::InputBuffer_pubsync()
{
wxMemoryInputStream stream(m_testData, TEST_SIZE);
wxStdInputStreamBuffer buffer(stream);
CPPUNIT_ASSERT(buffer.pubsync() == 0);
}
// --------------------------------------------------------------------------
// Input functions
// --------------------------------------------------------------------------
void StdStreamTestCase::InputBuffer_in_avail()
{
wxMemoryInputStream stream(m_testData, TEST_SIZE);
wxStdInputStreamBuffer buffer(stream);
CPPUNIT_ASSERT(buffer.sgetc() != EOF);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, buffer.in_avail());
char data[TEST_SIZE / 2];
buffer.sgetn(data, TEST_SIZE / 2);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE - TEST_SIZE / 2, buffer.in_avail());
}
void StdStreamTestCase::InputBuffer_snextc()
{
wxMemoryInputStream stream(m_testData, TEST_SIZE);
wxStdInputStreamBuffer buffer(stream);
CPPUNIT_ASSERT(buffer.sgetc() != EOF);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, buffer.in_avail());
char data[TEST_SIZE];
data[0] = buffer.sgetc();
for (int i = 1; i < TEST_SIZE; ++i)
data[i] = buffer.snextc();
CPPUNIT_ASSERT(memcmp(data, m_testData, TEST_SIZE) == 0);
CPPUNIT_ASSERT_EQUAL((int)(unsigned char) (m_testData[TEST_SIZE - 1]),
buffer.sbumpc());
CPPUNIT_ASSERT(buffer.sgetc() == EOF);
}
void StdStreamTestCase::InputBuffer_sbumpc()
{
wxMemoryInputStream stream(m_testData, TEST_SIZE);
wxStdInputStreamBuffer buffer(stream);
CPPUNIT_ASSERT(buffer.sgetc() != EOF);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, buffer.in_avail());
char data[TEST_SIZE];
for (int i = 0; i < TEST_SIZE; ++i)
data[i] = buffer.sbumpc();
CPPUNIT_ASSERT(memcmp(data, m_testData, TEST_SIZE) == 0);
CPPUNIT_ASSERT(buffer.sgetc() == EOF);
}
void StdStreamTestCase::InputBuffer_sgetc()
{
wxMemoryInputStream stream(m_testData, TEST_SIZE);
wxStdInputStreamBuffer buffer(stream);
CPPUNIT_ASSERT(buffer.sgetc() != EOF);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, buffer.in_avail());
char data[TEST_SIZE];
for (int i = 0; i < TEST_SIZE; ++i) {
data[i] = buffer.sgetc();
buffer.sbumpc();
}
CPPUNIT_ASSERT(memcmp(data, m_testData, TEST_SIZE) == 0);
CPPUNIT_ASSERT(buffer.sgetc() == EOF);
}
void StdStreamTestCase::InputBuffer_sgetn()
{
wxMemoryInputStream stream(m_testData, TEST_SIZE);
wxStdInputStreamBuffer buffer(stream);
CPPUNIT_ASSERT(buffer.sgetc() != EOF);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, buffer.in_avail());
char data[TEST_SIZE * 2];
std::streamsize read = buffer.sgetn(data, TEST_SIZE * 2);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, read);
CPPUNIT_ASSERT(memcmp(data, m_testData, TEST_SIZE) == 0);
CPPUNIT_ASSERT(buffer.sgetc() == EOF);
}
void StdStreamTestCase::InputBuffer_sputbackc()
{
wxMemoryInputStream stream(m_testData, TEST_SIZE);
wxStdInputStreamBuffer buffer(stream);
CPPUNIT_ASSERT(buffer.sgetc() != EOF);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, buffer.in_avail());
char data[TEST_SIZE];
std::streamsize read = buffer.sgetn(data, TEST_SIZE);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, read);
CPPUNIT_ASSERT(memcmp(data, m_testData, TEST_SIZE) == 0);
CPPUNIT_ASSERT(buffer.sgetc() == EOF);
char putBackChar = m_testData[TEST_SIZE - 1] + 147;
CPPUNIT_ASSERT_EQUAL((int) putBackChar, buffer.sputbackc(putBackChar));
CPPUNIT_ASSERT_EQUAL((int) putBackChar, buffer.sgetc());
CPPUNIT_ASSERT_EQUAL((int) putBackChar, buffer.sbumpc());
CPPUNIT_ASSERT(buffer.sgetc() == EOF);
}
void StdStreamTestCase::InputBuffer_sungetc()
{
wxMemoryInputStream stream(m_testData, TEST_SIZE);
wxStdInputStreamBuffer buffer(stream);
CPPUNIT_ASSERT(buffer.sgetc() != EOF);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, buffer.in_avail());
char data[TEST_SIZE];
std::streamsize read = buffer.sgetn(data, TEST_SIZE);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, read);
CPPUNIT_ASSERT(memcmp(data, m_testData, TEST_SIZE) == 0);
CPPUNIT_ASSERT(buffer.sgetc() == EOF);
CPPUNIT_ASSERT_EQUAL((int) m_testData[TEST_SIZE - 1], buffer.sungetc());
CPPUNIT_ASSERT_EQUAL((int) m_testData[TEST_SIZE - 1], buffer.sgetc());
CPPUNIT_ASSERT_EQUAL((int) m_testData[TEST_SIZE - 1], buffer.sbumpc());
CPPUNIT_ASSERT(buffer.sgetc() == EOF);
}
// --------------------------------------------------------------------------
// Output buffer management and positioning
// --------------------------------------------------------------------------
void StdStreamTestCase::OutputBuffer_pubsetbuf()
{
wxMemoryOutputStream stream;
wxStdOutputStreamBuffer buffer(stream);
char testBuffer[TEST_SIZE];
CPPUNIT_ASSERT(buffer.pubsetbuf(testBuffer, TEST_SIZE) == NULL);
}
void StdStreamTestCase::OutputBuffer_pubseekoff()
{
char testData[] = "0123456789";
wxMemoryOutputStream stream(testData, 10);
wxStdOutputStreamBuffer buffer(stream);
CPPUNIT_ASSERT_EQUAL(2,
buffer.pubseekoff(2, std::ios_base::beg,
std::ios_base::out));
CPPUNIT_ASSERT_EQUAL(-1,
buffer.pubseekoff(2, std::ios_base::beg,
std::ios_base::in));
CPPUNIT_ASSERT_EQUAL(4,
buffer.pubseekoff(2, std::ios_base::cur));
CPPUNIT_ASSERT_EQUAL(-1,
buffer.pubseekoff(2, std::ios_base::cur,
std::ios_base::in));
CPPUNIT_ASSERT_EQUAL(8,
buffer.pubseekoff(-2, std::ios_base::end));
CPPUNIT_ASSERT_EQUAL(-1,
buffer.pubseekoff(-2, std::ios_base::end,
std::ios_base::in));
CPPUNIT_ASSERT_EQUAL(-1,
buffer.pubseekoff(3, std::ios_base::cur));
CPPUNIT_ASSERT_EQUAL(-1,
buffer.pubseekoff(3, std::ios_base::cur,
std::ios_base::in));
}
void StdStreamTestCase::OutputBuffer_pubseekpos()
{
char testData[] = "0123456789";
wxMemoryOutputStream stream(testData, 10);
wxStdOutputStreamBuffer buffer(stream);
for (int i = 9; i >= 0; --i)
{
if (i % 2 == 0)
{
CPPUNIT_ASSERT_EQUAL(i, buffer.pubseekpos(i));
}
else
{
CPPUNIT_ASSERT_EQUAL(i,
buffer.pubseekpos(i, std::ios_base::out));
}
CPPUNIT_ASSERT_EQUAL('0' + (9 - i), buffer.sputc('0' + (9 - i)));
}
CPPUNIT_ASSERT(memcmp(testData, "9876543210", 10) == 0);
CPPUNIT_ASSERT_EQUAL(-1, buffer.pubseekpos(5, std::ios_base::in));
}
void StdStreamTestCase::OutputBuffer_pubsync()
{
wxMemoryOutputStream stream;
wxStdOutputStreamBuffer buffer(stream);
CPPUNIT_ASSERT(buffer.pubsync() == 0);
}
// --------------------------------------------------------------------------
// Output functions
// --------------------------------------------------------------------------
void StdStreamTestCase::OutputBuffer_sputc()
{
wxMemoryOutputStream stream;
wxStdOutputStreamBuffer buffer(stream);
for (int i = 0; i < TEST_SIZE; ++i)
buffer.sputc(m_testData[i]);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, stream.GetSize());
char result[TEST_SIZE];
stream.CopyTo(result, TEST_SIZE);
CPPUNIT_ASSERT(memcmp(result, m_testData, TEST_SIZE) == 0);
}
void StdStreamTestCase::OutputBuffer_sputn()
{
wxMemoryOutputStream stream;
wxStdOutputStreamBuffer buffer(stream);
buffer.sputn(m_testData, TEST_SIZE);
CPPUNIT_ASSERT_EQUAL(TEST_SIZE, stream.GetSize());
char result[TEST_SIZE];
stream.CopyTo(result, TEST_SIZE);
CPPUNIT_ASSERT(memcmp(result, m_testData, TEST_SIZE) == 0);
}
#endif // wxUSE_STD_IOSTREAM

View File

@ -76,6 +76,7 @@
streams/memstream.cpp
streams/socketstream.cpp
streams/sstream.cpp
streams/stdstream.cpp
streams/tempfile.cpp
streams/textstreamtest.cpp
streams/zlibstream.cpp

View File

@ -397,6 +397,10 @@ SOURCE=.\streams\sstream.cpp
# End Source File
# Begin Source File
SOURCE=.\streams\stdstream.cpp
# End Source File
# Begin Source File
SOURCE=.\strings\stdstrings.cpp
# End Source File
# Begin Source File

View File

@ -725,6 +725,9 @@
<File
RelativePath=".\streams\sstream.cpp">
</File>
<File
RelativePath=".\streams\stdstream.cpp">
</File>
<File
RelativePath=".\strings\stdstrings.cpp">
</File>

View File

@ -1043,6 +1043,10 @@
RelativePath=".\streams\sstream.cpp"
>
</File>
<File
RelativePath=".\streams\stdstream.cpp"
>
</File>
<File
RelativePath=".\strings\stdstrings.cpp"
>

View File

@ -1015,6 +1015,10 @@
RelativePath=".\streams\sstream.cpp"
>
</File>
<File
RelativePath=".\streams\stdstream.cpp"
>
</File>
<File
RelativePath=".\strings\stdstrings.cpp"
>

View File

@ -301,6 +301,7 @@ wx/sstream.h
wx/stack.h
wx/stackwalk.h
wx/stdpaths.h
wx/stdstream.h
wx/stockitem.h
wx/stopwatch.h
wx/strconv.h

View File

@ -206,6 +206,7 @@ wx/sstream.h
wx/stack.h
wx/stackwalk.h
wx/stdpaths.h
wx/stdstream.h
wx/stockitem.h
wx/stopwatch.h
wx/strconv.h

View File

@ -230,6 +230,7 @@ wx/sstream.h
wx/stack.h
wx/stackwalk.h
wx/stdpaths.h
wx/stdstream.h
wx/stockitem.h
wx/stopwatch.h
wx/strconv.h