Added wxBackingFile and wxBackedInputStream.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42279 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell 2006-10-23 14:47:07 +00:00
parent c06469f66f
commit f8f6c91a0f
23 changed files with 685 additions and 9 deletions

View File

@ -252,6 +252,7 @@ ALL_BASE_HEADERS = \
wx/features.h \
wx/ffile.h \
wx/file.h \
wx/fileback.h \
wx/fileconf.h \
wx/filefn.h \
wx/filename.h \
@ -383,6 +384,7 @@ ALL_PORTS_BASE_HEADERS = \
wx/features.h \
wx/ffile.h \
wx/file.h \
wx/fileback.h \
wx/fileconf.h \
wx/filefn.h \
wx/filename.h \
@ -534,6 +536,7 @@ ALL_BASE_SOURCES = \
src/common/extended.c \
src/common/ffile.cpp \
src/common/file.cpp \
src/common/fileback.cpp \
src/common/fileconf.cpp \
src/common/filefn.cpp \
src/common/filename.cpp \
@ -682,6 +685,7 @@ MONODLL_OBJECTS = \
monodll_extended.o \
monodll_ffile.o \
monodll_file.o \
monodll_fileback.o \
monodll_fileconf.o \
monodll_filefn.o \
monodll_filename.o \
@ -774,6 +778,7 @@ MONOLIB_OBJECTS = \
monolib_extended.o \
monolib_ffile.o \
monolib_file.o \
monolib_fileback.o \
monolib_fileconf.o \
monolib_filefn.o \
monolib_filename.o \
@ -868,6 +873,7 @@ BASEDLL_OBJECTS = \
basedll_extended.o \
basedll_ffile.o \
basedll_file.o \
basedll_fileback.o \
basedll_fileconf.o \
basedll_filefn.o \
basedll_filename.o \
@ -945,6 +951,7 @@ BASELIB_OBJECTS = \
baselib_extended.o \
baselib_ffile.o \
baselib_file.o \
baselib_fileback.o \
baselib_fileconf.o \
baselib_filefn.o \
baselib_filename.o \
@ -12126,6 +12133,9 @@ monodll_ffile.o: $(srcdir)/src/common/ffile.cpp $(MONODLL_ODEP)
monodll_file.o: $(srcdir)/src/common/file.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/file.cpp
monodll_fileback.o: $(srcdir)/src/common/fileback.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/fileback.cpp
monodll_fileconf.o: $(srcdir)/src/common/fileconf.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/fileconf.cpp
@ -16194,6 +16204,9 @@ monolib_ffile.o: $(srcdir)/src/common/ffile.cpp $(MONOLIB_ODEP)
monolib_file.o: $(srcdir)/src/common/file.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/file.cpp
monolib_fileback.o: $(srcdir)/src/common/fileback.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/fileback.cpp
monolib_fileconf.o: $(srcdir)/src/common/fileconf.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/fileconf.cpp
@ -20265,6 +20278,9 @@ basedll_ffile.o: $(srcdir)/src/common/ffile.cpp $(BASEDLL_ODEP)
basedll_file.o: $(srcdir)/src/common/file.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/file.cpp
basedll_fileback.o: $(srcdir)/src/common/fileback.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/fileback.cpp
basedll_fileconf.o: $(srcdir)/src/common/fileconf.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/fileconf.cpp
@ -20829,6 +20845,9 @@ baselib_ffile.o: $(srcdir)/src/common/ffile.cpp $(BASELIB_ODEP)
baselib_file.o: $(srcdir)/src/common/file.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/file.cpp
baselib_fileback.o: $(srcdir)/src/common/fileback.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/fileback.cpp
baselib_fileconf.o: $(srcdir)/src/common/fileconf.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/fileconf.cpp

View File

@ -304,6 +304,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/common/extended.c
src/common/ffile.cpp
src/common/file.cpp
src/common/fileback.cpp
src/common/fileconf.cpp
src/common/filefn.cpp
src/common/filename.cpp
@ -387,6 +388,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/features.h
wx/ffile.h
wx/file.h
wx/fileback.h
wx/fileconf.h
wx/filefn.h
wx/filename.h

View File

@ -218,6 +218,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_extended.obj \
$(OBJS)\monodll_ffile.obj \
$(OBJS)\monodll_file.obj \
$(OBJS)\monodll_fileback.obj \
$(OBJS)\monodll_fileconf.obj \
$(OBJS)\monodll_filefn.obj \
$(OBJS)\monodll_filename.obj \
@ -331,6 +332,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_extended.obj \
$(OBJS)\monolib_ffile.obj \
$(OBJS)\monolib_file.obj \
$(OBJS)\monolib_fileback.obj \
$(OBJS)\monolib_fileconf.obj \
$(OBJS)\monolib_filefn.obj \
$(OBJS)\monolib_filename.obj \
@ -445,6 +447,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_extended.obj \
$(OBJS)\basedll_ffile.obj \
$(OBJS)\basedll_file.obj \
$(OBJS)\basedll_fileback.obj \
$(OBJS)\basedll_fileconf.obj \
$(OBJS)\basedll_filefn.obj \
$(OBJS)\basedll_filename.obj \
@ -543,6 +546,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_extended.obj \
$(OBJS)\baselib_ffile.obj \
$(OBJS)\baselib_file.obj \
$(OBJS)\baselib_fileback.obj \
$(OBJS)\baselib_fileconf.obj \
$(OBJS)\baselib_filefn.obj \
$(OBJS)\baselib_filename.obj \
@ -4497,6 +4501,9 @@ $(OBJS)\monodll_ffile.obj: ..\..\src\common\ffile.cpp
$(OBJS)\monodll_file.obj: ..\..\src\common\file.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
$(OBJS)\monodll_fileback.obj: ..\..\src\common\fileback.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
$(OBJS)\monodll_fileconf.obj: ..\..\src\common\fileconf.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
@ -6439,6 +6446,9 @@ $(OBJS)\monolib_ffile.obj: ..\..\src\common\ffile.cpp
$(OBJS)\monolib_file.obj: ..\..\src\common\file.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
$(OBJS)\monolib_fileback.obj: ..\..\src\common\fileback.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
$(OBJS)\monolib_fileconf.obj: ..\..\src\common\fileconf.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
@ -8384,6 +8394,9 @@ $(OBJS)\basedll_ffile.obj: ..\..\src\common\ffile.cpp
$(OBJS)\basedll_file.obj: ..\..\src\common\file.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) $**
$(OBJS)\basedll_fileback.obj: ..\..\src\common\fileback.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) $**
$(OBJS)\basedll_fileconf.obj: ..\..\src\common\fileconf.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) $**
@ -8630,6 +8643,9 @@ $(OBJS)\baselib_ffile.obj: ..\..\src\common\ffile.cpp
$(OBJS)\baselib_file.obj: ..\..\src\common\file.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) $**
$(OBJS)\baselib_fileback.obj: ..\..\src\common\fileback.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) $**
$(OBJS)\baselib_fileconf.obj: ..\..\src\common\fileconf.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) $**

View File

@ -204,6 +204,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_extended.o \
$(OBJS)\monodll_ffile.o \
$(OBJS)\monodll_file.o \
$(OBJS)\monodll_fileback.o \
$(OBJS)\monodll_fileconf.o \
$(OBJS)\monodll_filefn.o \
$(OBJS)\monodll_filename.o \
@ -317,6 +318,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_extended.o \
$(OBJS)\monolib_ffile.o \
$(OBJS)\monolib_file.o \
$(OBJS)\monolib_fileback.o \
$(OBJS)\monolib_fileconf.o \
$(OBJS)\monolib_filefn.o \
$(OBJS)\monolib_filename.o \
@ -432,6 +434,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_extended.o \
$(OBJS)\basedll_ffile.o \
$(OBJS)\basedll_file.o \
$(OBJS)\basedll_fileback.o \
$(OBJS)\basedll_fileconf.o \
$(OBJS)\basedll_filefn.o \
$(OBJS)\basedll_filename.o \
@ -530,6 +533,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_extended.o \
$(OBJS)\baselib_ffile.o \
$(OBJS)\baselib_file.o \
$(OBJS)\baselib_fileback.o \
$(OBJS)\baselib_fileconf.o \
$(OBJS)\baselib_filefn.o \
$(OBJS)\baselib_filename.o \
@ -4614,6 +4618,9 @@ $(OBJS)\monodll_ffile.o: ../../src/common/ffile.cpp
$(OBJS)\monodll_file.o: ../../src/common/file.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_fileback.o: ../../src/common/fileback.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_fileconf.o: ../../src/common/fileconf.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@ -6656,6 +6663,9 @@ $(OBJS)\monolib_ffile.o: ../../src/common/ffile.cpp
$(OBJS)\monolib_file.o: ../../src/common/file.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_fileback.o: ../../src/common/fileback.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_fileconf.o: ../../src/common/fileconf.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@ -8701,6 +8711,9 @@ $(OBJS)\basedll_ffile.o: ../../src/common/ffile.cpp
$(OBJS)\basedll_file.o: ../../src/common/file.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\basedll_fileback.o: ../../src/common/fileback.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\basedll_fileconf.o: ../../src/common/fileconf.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
@ -8947,6 +8960,9 @@ $(OBJS)\baselib_ffile.o: ../../src/common/ffile.cpp
$(OBJS)\baselib_file.o: ../../src/common/file.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\baselib_fileback.o: ../../src/common/fileback.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\baselib_fileconf.o: ../../src/common/fileconf.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<

View File

@ -2905,6 +2905,7 @@ MONODLL_OBJECTS = &
$(OBJS)\monodll_extended.obj &
$(OBJS)\monodll_ffile.obj &
$(OBJS)\monodll_file.obj &
$(OBJS)\monodll_fileback.obj &
$(OBJS)\monodll_fileconf.obj &
$(OBJS)\monodll_filefn.obj &
$(OBJS)\monodll_filename.obj &
@ -3018,6 +3019,7 @@ MONOLIB_OBJECTS = &
$(OBJS)\monolib_extended.obj &
$(OBJS)\monolib_ffile.obj &
$(OBJS)\monolib_file.obj &
$(OBJS)\monolib_fileback.obj &
$(OBJS)\monolib_fileconf.obj &
$(OBJS)\monolib_filefn.obj &
$(OBJS)\monolib_filename.obj &
@ -3133,6 +3135,7 @@ BASEDLL_OBJECTS = &
$(OBJS)\basedll_extended.obj &
$(OBJS)\basedll_ffile.obj &
$(OBJS)\basedll_file.obj &
$(OBJS)\basedll_fileback.obj &
$(OBJS)\basedll_fileconf.obj &
$(OBJS)\basedll_filefn.obj &
$(OBJS)\basedll_filename.obj &
@ -3232,6 +3235,7 @@ BASELIB_OBJECTS = &
$(OBJS)\baselib_extended.obj &
$(OBJS)\baselib_ffile.obj &
$(OBJS)\baselib_file.obj &
$(OBJS)\baselib_fileback.obj &
$(OBJS)\baselib_fileconf.obj &
$(OBJS)\baselib_filefn.obj &
$(OBJS)\baselib_filename.obj &
@ -4842,6 +4846,9 @@ $(OBJS)\monodll_ffile.obj : .AUTODEPEND ..\..\src\common\ffile.cpp
$(OBJS)\monodll_file.obj : .AUTODEPEND ..\..\src\common\file.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
$(OBJS)\monodll_fileback.obj : .AUTODEPEND ..\..\src\common\fileback.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
$(OBJS)\monodll_fileconf.obj : .AUTODEPEND ..\..\src\common\fileconf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
@ -6884,6 +6891,9 @@ $(OBJS)\monolib_ffile.obj : .AUTODEPEND ..\..\src\common\ffile.cpp
$(OBJS)\monolib_file.obj : .AUTODEPEND ..\..\src\common\file.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
$(OBJS)\monolib_fileback.obj : .AUTODEPEND ..\..\src\common\fileback.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
$(OBJS)\monolib_fileconf.obj : .AUTODEPEND ..\..\src\common\fileconf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
@ -8929,6 +8939,9 @@ $(OBJS)\basedll_ffile.obj : .AUTODEPEND ..\..\src\common\ffile.cpp
$(OBJS)\basedll_file.obj : .AUTODEPEND ..\..\src\common\file.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
$(OBJS)\basedll_fileback.obj : .AUTODEPEND ..\..\src\common\fileback.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
$(OBJS)\basedll_fileconf.obj : .AUTODEPEND ..\..\src\common\fileconf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
@ -9175,6 +9188,9 @@ $(OBJS)\baselib_ffile.obj : .AUTODEPEND ..\..\src\common\ffile.cpp
$(OBJS)\baselib_file.obj : .AUTODEPEND ..\..\src\common\file.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
$(OBJS)\baselib_fileback.obj : .AUTODEPEND ..\..\src\common\fileback.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
$(OBJS)\baselib_fileconf.obj : .AUTODEPEND ..\..\src\common\fileconf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<

View File

@ -527,6 +527,10 @@ SOURCE=..\..\src\common\file.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\common\fileback.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\common\fileconf.cpp
# End Source File
# Begin Source File
@ -1499,6 +1503,10 @@ SOURCE=..\..\include\wx\file.h
# End Source File
# Begin Source File
SOURCE=..\..\include\wx\fileback.h
# End Source File
# Begin Source File
SOURCE=..\..\include\wx\fileconf.h
# End Source File
# Begin Source File

152
configure vendored
View File

@ -981,6 +981,7 @@ Optional Features:
--enable-ipc use interprocess communication (wxSocket etc.)
--enable-apple_ieee use the Apple IEEE codec
--enable-arcstream use wxArchive streams
--enable-backingfile use wxBackingFile
--enable-backtrace use wxStackWalker class for getting backtraces
--enable-catch_segvs catch signals in wxApp::OnFatalException (Unix only)
--enable-cmdline use wxCmdLineParser class
@ -2316,6 +2317,7 @@ if test $DEBUG_CONFIGURE = 1; then
DEFAULT_wxUSE_BUSYINFO=no
DEFAULT_wxUSE_ARCHIVE_STREAMS=no
DEFAULT_wxUSE_ZIPSTREAM=no
DEFAULT_wxUSE_BACKINGFILE=no
DEFAULT_wxUSE_VALIDATORS=no
DEFAULT_wxUSE_ACCEL=no
@ -2534,6 +2536,7 @@ else
DEFAULT_wxUSE_BUSYINFO=yes
DEFAULT_wxUSE_ARCHIVE_STREAMS=yes
DEFAULT_wxUSE_ZIPSTREAM=yes
DEFAULT_wxUSE_BACKINGFILE=yes
DEFAULT_wxUSE_VALIDATORS=yes
DEFAULT_wxUSE_ACCEL=yes
@ -5059,6 +5062,47 @@ echo "${ECHO_T}no" >&6
fi
enablestring=
echo "$as_me:$LINENO: checking for --${enablestring:-enable}-backingfile" >&5
echo $ECHO_N "checking for --${enablestring:-enable}-backingfile... $ECHO_C" >&6
no_cache=0
# Check whether --enable-backingfile or --disable-backingfile was given.
if test "${enable_backingfile+set}" = set; then
enableval="$enable_backingfile"
if test "$enableval" = yes; then
ac_cv_use_backingfile='wxUSE_BACKINGFILE=yes'
else
ac_cv_use_backingfile='wxUSE_BACKINGFILE=no'
fi
else
LINE=`grep "wxUSE_BACKINGFILE" ${wx_arg_cache_file}`
if test "x$LINE" != x ; then
eval "DEFAULT_$LINE"
else
no_cache=1
fi
ac_cv_use_backingfile='wxUSE_BACKINGFILE='$DEFAULT_wxUSE_BACKINGFILE
fi;
eval "$ac_cv_use_backingfile"
if test "$no_cache" != 1; then
echo $ac_cv_use_backingfile >> ${wx_arg_cache_file}.tmp
fi
if test "$wxUSE_BACKINGFILE" = yes; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
enablestring=
echo "$as_me:$LINENO: checking for --${enablestring:-enable}-backtrace" >&5
echo $ECHO_N "checking for --${enablestring:-enable}-backtrace... $ECHO_C" >&6
@ -29523,7 +29567,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@ -29550,7 +29594,7 @@ else
sed 's/^/| /' conftest.$ac_ext >&5
for ac_dir in $ac_x_header_dirs; do
if test -r "$ac_dir/X11/Xlib.h"; then
if test -r "$ac_dir/X11/Intrinsic.h"; then
ac_x_includes=$ac_dir
break
fi
@ -29564,18 +29608,18 @@ if test "$ac_x_libraries" = no; then
# See if we find them without any special options.
# Don't add to $LIBS permanently.
ac_save_LIBS=$LIBS
LIBS="-lX11 $LIBS"
LIBS="-lXt $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
int
main ()
{
XrmInitialize ()
XtMalloc (0)
;
return 0;
}
@ -29613,7 +29657,7 @@ for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
# Don't even attempt the hair of trying to link an X program!
for ac_extension in a so sl; do
if test -r $ac_dir/libX11.$ac_extension; then
if test -r $ac_dir/libXt.$ac_extension; then
ac_x_libraries=$ac_dir
break 2
fi
@ -38538,7 +38582,91 @@ _ACEOF
INET_LINK=" -l$INET_LINK"
fi
for wx_func in fdopen
do
echo "$as_me:$LINENO: checking for $wx_func" >&5
echo $ECHO_N "checking for $wx_func... $ECHO_C" >&6
if eval "test \"\${wx_cv_func_$wx_func+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. */
$ac_includes_default
int
main ()
{
#ifndef $wx_func
&$wx_func;
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 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); } &&
{ ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval wx_cv_func_$wx_func=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval wx_cv_func_$wx_func=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'wx_cv_func_$wx_func'}'`" >&5
echo "${ECHO_T}`eval echo '${'wx_cv_func_$wx_func'}'`" >&6
if eval test \$wx_cv_func_$wx_func = yes
then
cat >>confdefs.h <<_ACEOF
#define HAVE_`echo $wx_func | tr 'a-z' 'A-Z'` 1
_ACEOF
else
:
fi
done
fi
@ -43015,6 +43143,18 @@ _ACEOF
fi
fi
if test "$wxUSE_BACKINGFILE" = "yes"; then
if test "$wxUSE_STREAMS" != yes -o \( "$wxUSE_FILE" != yes -a "$wxUSE_FFILE" != yes \); then
{ echo "$as_me:$LINENO: WARNING: wxBackingFile requires wxStreams and wxFile or wxFFile... disabled" >&5
echo "$as_me: WARNING: wxBackingFile requires wxStreams and wxFile or wxFFile... disabled" >&2;}
else
cat >>confdefs.h <<\_ACEOF
#define wxUSE_BACKINGFILE 1
_ACEOF
fi
fi
if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
if test "$USE_UNIX" != 1; then
{ echo "$as_me:$LINENO: WARNING: Catching fatal exceptions not currently supported on this system, wxApp::OnFatalException will not be called" >&5

View File

@ -506,6 +506,7 @@ if test $DEBUG_CONFIGURE = 1; then
DEFAULT_wxUSE_BUSYINFO=no
DEFAULT_wxUSE_ARCHIVE_STREAMS=no
DEFAULT_wxUSE_ZIPSTREAM=no
DEFAULT_wxUSE_BACKINGFILE=no
DEFAULT_wxUSE_VALIDATORS=no
DEFAULT_wxUSE_ACCEL=no
@ -724,6 +725,7 @@ else
DEFAULT_wxUSE_BUSYINFO=yes
DEFAULT_wxUSE_ARCHIVE_STREAMS=yes
DEFAULT_wxUSE_ZIPSTREAM=yes
DEFAULT_wxUSE_BACKINGFILE=yes
DEFAULT_wxUSE_VALIDATORS=yes
DEFAULT_wxUSE_ACCEL=yes
@ -945,6 +947,7 @@ WX_ARG_ENABLE(ipc, [ --enable-ipc use interprocess communi
dnl please keep the settings below in alphabetical order
WX_ARG_ENABLE(apple_ieee, [ --enable-apple_ieee use the Apple IEEE codec], wxUSE_APPLE_IEEE)
WX_ARG_ENABLE(arcstream, [ --enable-arcstream use wxArchive streams], wxUSE_ARCHIVE_STREAMS)
WX_ARG_ENABLE(backingfile, [ --enable-backingfile use wxBackingFile], wxUSE_BACKINGFILE)
WX_ARG_ENABLE(backtrace, [ --enable-backtrace use wxStackWalker class for getting backtraces], wxUSE_STACKWALKER)
WX_ARG_ENABLE(catch_segvs, [ --enable-catch_segvs catch signals in wxApp::OnFatalException (Unix only)], wxUSE_ON_FATAL_EXCEPTION)
WX_ARG_ENABLE(cmdline, [ --enable-cmdline use wxCmdLineParser class], wxUSE_CMDLINE_PARSER)
@ -5722,6 +5725,14 @@ if test "$wxUSE_ZIPSTREAM" = "yes"; then
fi
fi
if test "$wxUSE_BACKINGFILE" = "yes"; then
if test "$wxUSE_STREAMS" != yes -o \( "$wxUSE_FILE" != yes -a "$wxUSE_FFILE" != yes \); then
AC_MSG_WARN(wxBackingFile requires wxStreams and wxFile or wxFFile... disabled)
else
AC_DEFINE(wxUSE_BACKINGFILE)
fi
fi
if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
if test "$USE_UNIX" != 1; then
AC_MSG_WARN([Catching fatal exceptions not currently supported on this system, wxApp::OnFatalException will not be called])

View File

@ -64,6 +64,11 @@ Major new features in 2.7 release
2.7.2
-----
All:
- Added wxFFile overload to wxFileName::CreateTemporaryFileName().
- Added wxBackingFile and wxBackedInputStream
All (GUI):
- wxMemoryDC constructor now optionally accepts a wxBitmap parameter,

View File

@ -83,6 +83,14 @@
please keep the options in alphabetical order!
*/
#ifndef wxUSE_BACKINGFILE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_BACKINGFILE must be defined."
# else
# define wxUSE_BACKINGFILE 0
# endif
#endif /* !defined(wxUSE_BACKINGFILE) */
#ifndef wxUSE_CRASHREPORT
/* this one is special: as currently it is Windows-only, don't force it
to be defined on other platforms */
@ -1160,6 +1168,17 @@
# endif
#endif /* wxUSE_ZIPSTREAM */
#if wxUSE_BACKINGFILE
# if !wxUSE_STREAMS || (!wxUSE_FILE && !wxUSE_FFILE)
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxBackingFile requires wxStream and wxFile or wxFFile"
# else
# undef wxUSE_BACKINGFILE
# define wxUSE_BACKINGFILE 1
# endif
# endif
#endif /* wxUSE_ZIPSTREAM */
/* the rest of the tests is for the GUI settings only */
#if wxUSE_GUI

75
include/wx/fileback.h Normal file
View File

@ -0,0 +1,75 @@
/////////////////////////////////////////////////////////////////////////////
// Name: include/wx/fileback.h
// Purpose: Back an input stream with memory or a file
// Author: Mike Wetherell
// RCS-ID: $Id$
// Copyright: (c) 2006 Mike Wetherell
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FILEBACK_H__
#define _WX_FILEBACK_H__
#include "wx/defs.h"
#if wxUSE_BACKINGFILE
// ----------------------------------------------------------------------------
// Backs an input stream with memory or a file to make it seekable.
//
// One or more wxBackedInputStreams can be used to read it's data. The data is
// reference counted, so stays alive until the last wxBackingFile or
// wxBackedInputStream using it is destroyed.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxBackingFile
{
public:
enum { DefaultBufSize = 16384 };
// Takes ownership of stream. If the stream is smaller than bufsize, the
// backing file is never created and the backing is done with memory.
wxBackingFile(wxInputStream *stream,
size_t bufsize = DefaultBufSize,
const wxString& prefix = _T("wxbf"));
wxBackingFile() : m_impl(NULL) { }
~wxBackingFile();
wxBackingFile(const wxBackingFile& backer);
wxBackingFile& operator=(const wxBackingFile& backer);
operator bool() const { return m_impl != NULL; }
private:
class wxBackingFileImpl *m_impl;
friend class wxBackedInputStream;
};
// ----------------------------------------------------------------------------
// An input stream to read from a wxBackingFile.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxBackedInputStream : public wxInputStream
{
public:
wxBackedInputStream(const wxBackingFile& backer);
wxFileOffset GetLength() const;
bool IsSeekable() const { return true; }
protected:
size_t OnSysRead(void *buffer, size_t size);
wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
wxFileOffset OnSysTell() const;
private:
wxBackingFile m_backer;
wxFileOffset m_pos;
DECLARE_NO_COPY_CLASS(wxBackedInputStream)
};
#endif // wxUSE_BACKINGFILE
#endif // _WX_FILEBACK_H__

View File

@ -436,6 +436,9 @@
// Set to 1 to compile wxZipInput/OutputStream classes.
#define wxUSE_ZIPSTREAM 1
// Set to 1 to compile wxBackingFile and wxBackedInputStream
#define wxUSE_BACKINGFILE 1
// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1
@ -561,7 +564,7 @@
//
// Recommended setting: 1
#ifndef wxUSE_GRAPHICS_CONTEXT
#define wxUSE_GRAPHICS_CONTEXT 1
#define wxUSE_GRAPHICS_CONTEXT 0
#endif
// ----------------------------------------------------------------------------

View File

@ -435,6 +435,9 @@
// Set to 1 to compile wxZipInput/OutputStream classes.
#define wxUSE_ZIPSTREAM 1
// Set to 1 to compile wxBackingFile and wxBackedInputStream
#define wxUSE_BACKINGFILE 1
// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1

View File

@ -435,6 +435,9 @@
// Set to 1 to compile wxZipInput/OutputStream classes.
#define wxUSE_ZIPSTREAM 1
// Set to 1 to compile wxBackingFile and wxBackedInputStream
#define wxUSE_BACKINGFILE 1
// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1

View File

@ -435,6 +435,9 @@
// Set to 1 to compile wxZipInput/OutputStream classes.
#define wxUSE_ZIPSTREAM 1
// Set to 1 to compile wxBackingFile and wxBackedInputStream
#define wxUSE_BACKINGFILE 1
// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1

View File

@ -435,6 +435,9 @@
// Set to 1 to compile wxZipInput/OutputStream classes.
#define wxUSE_ZIPSTREAM 1
// Set to 1 to compile wxBackingFile and wxBackedInputStream
#define wxUSE_BACKINGFILE 1
// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1

View File

@ -435,6 +435,9 @@
// Set to 1 to compile wxZipInput/OutputStream classes.
#define wxUSE_ZIPSTREAM 1
// Set to 1 to compile wxBackingFile and wxBackedInputStream
#define wxUSE_BACKINGFILE 1
// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1

View File

@ -251,6 +251,8 @@
#define wxUSE_ZIPSTREAM 0
#define wxUSE_BACKINGFILE 0
#define wxUSE_ZLIB 0
#define wxUSE_APPLE_IEEE 0
@ -375,8 +377,6 @@
#define wxUSE_DISPLAY 0
#define wxUSE_DETECT_SM 0
#define wxUSE_GEOMETRY 0
#define wxUSE_IMAGLIST 0

320
src/common/fileback.cpp Normal file
View File

@ -0,0 +1,320 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/common/fileback.cpp
// Purpose: Back an input stream with memory or a file
// Author: Mike Wetherell
// RCS-ID: $Id$
// Copyright: (c) 2006 Mike Wetherell
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_BACKINGFILE
#ifndef WX_PRECOMP
#include "wx/stream.h"
#include "wx/utils.h"
#include "wx/log.h"
#endif
#include "wx/fileback.h"
#include "wx/private/filename.h"
// Prefer wxFFile unless wxFile has large file support but wxFFile does not.
//
#if wxUSE_FFILE && (defined WXFFILE_LARGEFILE || !defined WXFILE_LARGEFILE)
typedef wxFFile wxBFFile;
static const bool wxBadSeek = false;
#else
typedef wxFile wxBFFile;
static const wxFileOffset wxBadSeek = wxInvalidOffset;
#endif
/////////////////////////////////////////////////////////////////////////////
// Backing file implementation
class wxBackingFileImpl
{
public:
wxBackingFileImpl(wxInputStream *stream,
size_t bufsize,
const wxString& prefix);
~wxBackingFileImpl();
void Release() { if (--m_refcount == 0) delete this; }
wxBackingFileImpl *AddRef() { m_refcount++; return this; }
wxStreamError ReadAt(wxFileOffset pos, void *buffer, size_t *size);
wxFileOffset GetLength() const;
private:
int m_refcount;
wxInputStream *m_stream;
wxStreamError m_parenterror;
char *m_buf;
size_t m_bufsize;
size_t m_buflen;
wxString m_prefix;
wxString m_filename;
wxBFFile m_file;
wxFileOffset m_filelen;
};
wxBackingFileImpl::wxBackingFileImpl(wxInputStream *stream,
size_t bufsize,
const wxString& prefix)
: m_refcount(1),
m_stream(stream),
m_parenterror(wxSTREAM_NO_ERROR),
m_buf(NULL),
m_bufsize(bufsize),
m_buflen(0),
m_prefix(prefix),
m_filelen(0)
{
wxFileOffset len = m_stream->GetLength();
if (len >= 0 && len + size_t(0) < m_bufsize)
m_bufsize = len;
if (m_bufsize)
m_buf = new char[m_bufsize];
}
wxBackingFileImpl::~wxBackingFileImpl()
{
delete m_stream;
delete [] m_buf;
if (!m_filename.empty())
wxRemoveFile(m_filename);
}
wxStreamError wxBackingFileImpl::ReadAt(wxFileOffset pos,
void *buffer,
size_t *size)
{
size_t reqestedSize = *size;
*size = 0;
// size1 is the number of bytes it will read directly from the backing
// file. size2 is any remaining bytes not yet backed, these are returned
// from the buffer or read from the parent stream.
size_t size1, size2;
if (pos + reqestedSize <= m_filelen + size_t(0)) {
size1 = reqestedSize;
size2 = 0;
} else if (pos < m_filelen) {
size1 = m_filelen - pos;
size2 = reqestedSize - size1;
} else {
size1 = 0;
size2 = reqestedSize;
}
if (pos < 0)
return wxSTREAM_READ_ERROR;
// read the backing file
if (size1) {
if (m_file.Seek(pos) == wxBadSeek)
return wxSTREAM_READ_ERROR;
ssize_t n = m_file.Read(buffer, size1);
if (n > 0) {
*size = n;
pos += n;
}
if (*size < size1)
return wxSTREAM_READ_ERROR;
}
// read from the buffer or parent stream
if (size2)
{
while (*size < reqestedSize)
{
// if pos is further ahead than the parent has been read so far,
// then read forward in the parent stream
while (pos - m_filelen + size_t(0) >= m_buflen)
{
// if the parent is small enough, don't use a backing file
// just the buffer memory
if (!m_stream && m_filelen == 0)
return m_parenterror;
// before refilling the buffer write out the current buffer
// to the backing file if there is anything in it
if (m_buflen)
{
if (!m_file.IsOpened())
if (!wxCreateTempFile(m_prefix, &m_file, &m_filename))
return wxSTREAM_READ_ERROR;
if (m_file.Seek(m_filelen) == wxBadSeek)
return wxSTREAM_READ_ERROR;
size_t count = m_file.Write(m_buf, m_buflen);
m_filelen += count;
if (count < m_buflen) {
delete m_stream;
m_stream = NULL;
if (count > 0) {
delete m_buf;
m_buf = NULL;
m_buflen = 0;
}
m_parenterror = wxSTREAM_READ_ERROR;
return m_parenterror;
}
m_buflen = 0;
if (!m_stream) {
delete m_buf;
m_buf = NULL;
}
}
if (!m_stream)
return m_parenterror;
// refill buffer
m_buflen = m_stream->Read(m_buf, m_bufsize).LastRead();
if (m_buflen < m_bufsize) {
m_parenterror = m_stream->GetLastError();
if (m_parenterror == wxSTREAM_NO_ERROR)
m_parenterror = wxSTREAM_EOF;
delete m_stream;
m_stream = NULL;
}
}
// copy to the user's buffer
size_t start = pos - m_filelen;
size_t len = wxMin(m_buflen - start, reqestedSize - *size);
memcpy((char*)buffer + *size, m_buf + start, len);
*size += len;
pos += len;
}
}
return wxSTREAM_NO_ERROR;
}
wxFileOffset wxBackingFileImpl::GetLength() const
{
if (m_parenterror != wxSTREAM_EOF) {
wxLogNull nolog;
return m_stream->GetLength();
}
return m_filelen + m_buflen;
}
/////////////////////////////////////////////////////////////////////////////
// Backing File, the handle part
wxBackingFile::wxBackingFile(wxInputStream *stream,
size_t bufsize,
const wxString& prefix)
: m_impl(new wxBackingFileImpl(stream, bufsize, prefix))
{
}
wxBackingFile::wxBackingFile(const wxBackingFile& backer)
: m_impl(backer.m_impl ? backer.m_impl->AddRef() : NULL)
{
}
wxBackingFile& wxBackingFile::operator=(const wxBackingFile& backer)
{
if (backer.m_impl != m_impl) {
if (m_impl)
m_impl->Release();
m_impl = backer.m_impl;
if (m_impl)
m_impl->AddRef();
}
return *this;
}
wxBackingFile::~wxBackingFile()
{
if (m_impl)
m_impl->Release();
}
/////////////////////////////////////////////////////////////////////////////
// Input stream
wxBackedInputStream::wxBackedInputStream(const wxBackingFile& backer)
: m_backer(backer),
m_pos(0)
{
}
size_t wxBackedInputStream::OnSysRead(void *buffer, size_t size)
{
if (!IsOk())
return 0;
m_lasterror = m_backer.m_impl->ReadAt(m_pos, buffer, &size);
m_pos += size;
return size;
}
wxFileOffset wxBackedInputStream::GetLength() const
{
return m_backer.m_impl->GetLength();
}
wxFileOffset wxBackedInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
switch (mode) {
case wxFromCurrent:
{
m_pos += pos;
break;
}
case wxFromEnd:
{
wxFileOffset len = GetLength();
if (len == wxInvalidOffset)
return wxInvalidOffset;
m_pos = len + pos;
break;
}
default:
{
m_pos = pos;
break;
}
}
return m_pos;
}
wxFileOffset wxBackedInputStream::OnSysTell() const
{
return m_pos;
}
#endif // wxUSE_BACKINGFILE

View File

@ -519,6 +519,10 @@ SOURCE=.\common\file.cpp
# End Source File
# Begin Source File
SOURCE=.\common\fileback.cpp
# End Source File
# Begin Source File
SOURCE=.\common\fileconf.cpp
# End Source File
# Begin Source File
@ -2587,6 +2591,10 @@ SOURCE=..\include\wx\file.h
# End Source File
# Begin Source File
SOURCE=..\include\wx\fileback.h
# End Source File
# Begin Source File
SOURCE=..\include\wx\fileconf.h
# End Source File
# Begin Source File

View File

@ -240,6 +240,7 @@ wx/except.h
wx/features.h
wx/ffile.h
wx/file.h
wx/fileback.h
wx/fileconf.h
wx/filefn.h
wx/filename.h

View File

@ -143,6 +143,7 @@ wx/except.h
wx/features.h
wx/ffile.h
wx/file.h
wx/fileback.h
wx/fileconf.h
wx/filefn.h
wx/filename.h

View File

@ -168,6 +168,7 @@ wx/except.h
wx/features.h
wx/ffile.h
wx/file.h
wx/fileback.h
wx/fileconf.h
wx/filefn.h
wx/filename.h