1. removed 'B' flag from treebase.cpp and regenerated the makefiles

2. fixed wxMemoryInputStream::Eof()


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8340 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2000-09-12 15:15:44 +00:00
parent 5100cabffa
commit 83141d3a74
16 changed files with 100 additions and 53 deletions

View File

@ -195,7 +195,7 @@ textcmn.cpp C
textfile.cpp C B
timercmn.cpp C B
tokenzr.cpp C B
treebase.cpp C B
treebase.cpp C
txtstrm.cpp C B
unzip.c C B
url.cpp C S,B

View File

@ -18,6 +18,7 @@
#endif
#include "wx/utils.h"
/* This is a small class which can be used by all ports
to temporarily suspend the busy cursor. Useful in modal
dialogs.

View File

@ -8,6 +8,7 @@
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WXMMSTREAM_H__
#define _WX_WXMMSTREAM_H__
@ -15,45 +16,47 @@
#if wxUSE_STREAMS
class WXDLLEXPORT wxMemoryInputStream: public wxInputStream {
private:
size_t m_length;
public:
wxMemoryInputStream(const char *data, size_t length);
virtual ~wxMemoryInputStream();
virtual size_t GetSize() const { return m_length; }
class WXDLLEXPORT wxMemoryInputStream : public wxInputStream
{
public:
wxMemoryInputStream(const char *data, size_t length);
virtual ~wxMemoryInputStream();
virtual size_t GetSize() const { return m_length; }
virtual bool Eof() const;
char Peek();
char Peek();
wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; }
wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; }
protected:
wxStreamBuffer *m_i_streambuf;
protected:
wxStreamBuffer *m_i_streambuf;
protected:
size_t OnSysRead(void *buffer, size_t nbytes);
off_t OnSysSeek(off_t pos, wxSeekMode mode);
off_t OnSysTell() const;
size_t OnSysRead(void *buffer, size_t nbytes);
off_t OnSysSeek(off_t pos, wxSeekMode mode);
off_t OnSysTell() const;
private:
size_t m_length;
};
class WXDLLEXPORT wxMemoryOutputStream: public wxOutputStream {
public:
wxMemoryOutputStream(char *data = NULL, size_t length = 0);
virtual ~wxMemoryOutputStream();
virtual size_t GetSize() const { return m_o_streambuf->GetLastAccess(); }
class WXDLLEXPORT wxMemoryOutputStream : public wxOutputStream
{
public:
wxMemoryOutputStream(char *data = NULL, size_t length = 0);
virtual ~wxMemoryOutputStream();
virtual size_t GetSize() const { return m_o_streambuf->GetLastAccess(); }
wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
size_t CopyTo(char *buffer, size_t len) const;
size_t CopyTo(char *buffer, size_t len) const;
protected:
wxStreamBuffer *m_o_streambuf;
protected:
wxStreamBuffer *m_o_streambuf;
protected:
size_t OnSysWrite(const void *buffer, size_t nbytes);
off_t OnSysSeek(off_t pos, wxSeekMode mode);
off_t OnSysTell() const;
protected:
size_t OnSysWrite(const void *buffer, size_t nbytes);
off_t OnSysSeek(off_t pos, wxSeekMode mode);
off_t OnSysTell() const;
};
#endif

View File

@ -41,7 +41,7 @@
//#define TEST_DIR
//#define TEST_DLLLOADER
//#define TEST_EXECUTE
#define TEST_FILE
//#define TEST_FILE
//#define TEST_FILECONF
//#define TEST_HASH
//#define TEST_LIST
@ -50,6 +50,7 @@
//#define TEST_MIME
//#define TEST_INFO_FUNCTIONS
//#define TEST_SOCKETS
#define TEST_STREAMS
//#define TEST_STRINGS
//#define TEST_THREADS
//#define TEST_TIMER
@ -1301,6 +1302,33 @@ static void TestProtocolFtpUpload()
#endif // TEST_SOCKETS
// ----------------------------------------------------------------------------
// streams
// ----------------------------------------------------------------------------
#ifdef TEST_STREAMS
#include <wx/mstream.h>
static void TestMemoryStream()
{
puts("*** Testing wxMemoryInputStream ***");
wxChar buf[1024];
wxStrncpy(buf, _T("Hello, stream!"), WXSIZEOF(buf));
wxMemoryInputStream memInpStream(buf, wxStrlen(buf));
printf(_T("Memory stream size: %u\n"), memInpStream.GetSize());
while ( !memInpStream.Eof() )
{
putchar(memInpStream.GetC());
}
puts("\n*** wxMemoryInputStream test done ***");
}
#endif // TEST_STREAMS
// ----------------------------------------------------------------------------
// timers
// ----------------------------------------------------------------------------
@ -3594,6 +3622,10 @@ int main(int argc, char **argv)
TestProtocolFtpUpload();
#endif // TEST_SOCKETS
#ifdef TEST_STREAMS
TestMemoryStream();
#endif // TEST_STREAMS
#ifdef TEST_TIMER
TestStopWatch();
#endif // TEST_TIMER

View File

@ -51,14 +51,25 @@ char wxMemoryInputStream::Peek()
return m_i_streambuf->GetBufferStart()[m_i_streambuf->GetIntPosition()];
}
bool wxMemoryInputStream::Eof() const
{
return m_i_streambuf->GetBufferPos() == m_i_streambuf->GetBufferEnd();
}
size_t wxMemoryInputStream::OnSysRead(void *buffer, size_t nbytes)
{
size_t bufsize = m_i_streambuf->GetBufferEnd() - m_i_streambuf->GetBufferStart();
size_t oldpos = m_i_streambuf->GetIntPosition();
m_i_streambuf->Read(buffer, nbytes);
size_t newpos = m_i_streambuf->GetIntPosition();
if (newpos == 0) return bufsize - oldpos;
else return newpos - oldpos;
{
size_t pos = m_i_streambuf->GetIntPosition();
if ( pos == m_length )
{
m_lasterror = wxSTREAM_EOF;
return 0;
}
m_i_streambuf->Read(buffer, nbytes);
m_lasterror = wxSTREAM_NOERROR;
return m_i_streambuf->GetIntPosition() - pos;
}
off_t wxMemoryInputStream::OnSysSeek(off_t pos, wxSeekMode mode)

View File

@ -1,4 +1,4 @@
# This file was automatically generated by tmake at 19:28, 2000/09/10
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BASE.T!
ALL_SOURCES = \
common/init.cpp \
@ -48,7 +48,6 @@ ALL_SOURCES = \
common/textfile.cpp \
common/timercmn.cpp \
common/tokenzr.cpp \
common/treebase.cpp \
common/txtstrm.cpp \
common/unzip.c \
common/url.cpp \
@ -191,7 +190,6 @@ BASE_OBJS = \
textfile.o \
timercmn.o \
tokenzr.o \
treebase.o \
txtstrm.o \
unzip.o \
url.o \
@ -250,7 +248,6 @@ BASE_DEPS = \
textfile.d \
timercmn.d \
tokenzr.d \
treebase.d \
txtstrm.d \
unzip.d \
url.d \
@ -316,7 +313,6 @@ BASE_DEPS = \
textfile.d \
timercmn.d \
tokenzr.d \
treebase.d \
txtstrm.d \
unzip.d \
url.d \

View File

@ -1,4 +1,4 @@
# This file was automatically generated by tmake at 19:28, 2000/09/10
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
generic/busyinfo.cpp \

View File

@ -1,4 +1,4 @@
# This file was automatically generated by tmake at 19:28, 2000/09/10
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
generic/busyinfo.cpp \

View File

@ -1,4 +1,4 @@
# This file was automatically generated by tmake at 11:57, 2000/09/08
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MOTIF.T!
ALL_SOURCES = \
generic/busyinfo.cpp \
@ -42,6 +42,7 @@ ALL_SOURCES = \
generic/tbarsmpl.cpp \
generic/textdlgg.cpp \
generic/tipdlg.cpp \
generic/tipwin.cpp \
generic/treectlg.cpp \
generic/treelay.cpp \
generic/wizard.cpp \
@ -410,6 +411,7 @@ ALL_HEADERS = \
time.h \
timer.h \
tipdlg.h \
tipwin.h \
tokenzr.h \
toolbar.h \
tooltip.h \
@ -807,6 +809,7 @@ GENERICOBJS = \
tbarsmpl.o \
textdlgg.o \
tipdlg.o \
tipwin.o \
treectlg.o \
treelay.o \
wizard.o
@ -853,6 +856,7 @@ GENERICDEPS = \
tbarsmpl.d \
textdlgg.d \
tipdlg.d \
tipwin.d \
treectlg.d \
treelay.d \
wizard.d

View File

@ -1,6 +1,6 @@
# This file was automatically generated by tmake at 19:28, 2000/09/10
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T!
#

View File

@ -1,6 +1,6 @@
# This file was automatically generated by tmake at 19:28, 2000/09/10
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T!
#

View File

@ -1,4 +1,4 @@
# This file was automatically generated by tmake at 19:28, 2000/09/10
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T!
#

View File

@ -1,4 +1,4 @@
# This file was automatically generated by tmake at 19:28, 2000/09/10
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T!
#

View File

@ -1,6 +1,6 @@
# This file was automatically generated by tmake at 19:28, 2000/09/10
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T!
# Symantec C++ makefile for the msw objects

View File

@ -1,4 +1,4 @@
# This file was automatically generated by tmake at 19:28, 2000/09/10
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T!
# File: makefile.vc

View File

@ -1,6 +1,6 @@
#!/binb/wmake.exe
# This file was automatically generated by tmake at 19:28, 2000/09/10
# This file was automatically generated by tmake at 18:13, 2000/09/12
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T!
#