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
#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.
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_WXMMSTREAM_H__
#define _WX_WXMMSTREAM_H__
#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;
+ size_t OnSysRead(void *buffer, size_t nbytes);
+ off_t OnSysSeek(off_t pos, wxSeekMode mode);
+ off_t OnSysTell() const;
- protected:
- 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
//#define TEST_DIR
//#define TEST_DLLLOADER
//#define TEST_EXECUTE
-#define TEST_FILE
+//#define TEST_FILE
//#define TEST_FILECONF
//#define TEST_HASH
//#define TEST_LIST
//#define TEST_MIME
//#define TEST_INFO_FUNCTIONS
//#define TEST_SOCKETS
+#define TEST_STREAMS
//#define TEST_STRINGS
//#define TEST_THREADS
//#define TEST_TIMER
#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
// ----------------------------------------------------------------------------
TestProtocolFtpUpload();
#endif // TEST_SOCKETS
+#ifdef TEST_STREAMS
+ TestMemoryStream();
+#endif // TEST_STREAMS
+
#ifdef TEST_TIMER
TestStopWatch();
#endif // TEST_TIMER
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)
-# 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 \
common/textfile.cpp \
common/timercmn.cpp \
common/tokenzr.cpp \
- common/treebase.cpp \
common/txtstrm.cpp \
common/unzip.c \
common/url.cpp \
textfile.o \
timercmn.o \
tokenzr.o \
- treebase.o \
txtstrm.o \
unzip.o \
url.o \
textfile.d \
timercmn.d \
tokenzr.d \
- treebase.d \
txtstrm.d \
unzip.d \
url.d \
textfile.d \
timercmn.d \
tokenzr.d \
- treebase.d \
txtstrm.d \
unzip.d \
url.d \
-# 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 \
-# 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 \
-# 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 \
generic/tbarsmpl.cpp \
generic/textdlgg.cpp \
generic/tipdlg.cpp \
+ generic/tipwin.cpp \
generic/treectlg.cpp \
generic/treelay.cpp \
generic/wizard.cpp \
time.h \
timer.h \
tipdlg.h \
+ tipwin.h \
tokenzr.h \
toolbar.h \
tooltip.h \
tbarsmpl.o \
textdlgg.o \
tipdlg.o \
+ tipwin.o \
treectlg.o \
treelay.o \
wizard.o
tbarsmpl.d \
textdlgg.d \
tipdlg.d \
+ tipwin.d \
treectlg.d \
treelay.d \
wizard.d
-# 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!
#
-# 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!
#
-# 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!
#
-# 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!
#
-# 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
-# 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
#!/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!
#