]> git.saurik.com Git - wxWidgets.git/commitdiff
1. removed 'B' flag from treebase.cpp and regenerated the makefiles
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 12 Sep 2000 15:15:44 +0000 (15:15 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 12 Sep 2000 15:15:44 +0000 (15:15 +0000)
2. fixed wxMemoryInputStream::Eof()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8340 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

16 files changed:
distrib/msw/tmake/filelist.txt
include/wx/cursor.h
include/wx/mstream.h
samples/console/console.cpp
src/common/mstream.cpp
src/files.lst
src/gtk/files.lst
src/gtk1/files.lst
src/motif/files.lst
src/msw/makefile.b32
src/msw/makefile.bcc
src/msw/makefile.dos
src/msw/makefile.g95
src/msw/makefile.sc
src/msw/makefile.vc
src/msw/makefile.wat

index 488c004db631c4c220e9ffb6702cfae8ac1ad1c1..c23655e71ec5273b3d710ab35dd67aebb2751011 100644 (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
index 10bc6a0cc3d58f8041b42c93a7b91922ad830cdc..e4cf1106dfbdfcd82a3cba18c9e1dbf31e1ed230 100644 (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.
index 85e0b30e35479f4903f0d54235254486caf13998..bdb4a659974d8a4c15fb0629c5c2136a14d2d2bf 100644 (file)
@@ -8,6 +8,7 @@
 // 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
index a935db655f1da7741ad2d345687ee3c15a3137f6..e33f32e87c61986119b1e649a7bd109ca6d35eb9 100644 (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
index b0819a26ce0ff91a404f349c49222b75429986d2..b0f1ab6a1a443dbe88df1b387bc6393a51a807ad 100644 (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)
index 8a7b8b0fb2e543a7fedffc0ba61135459129f575..c2d6bf252112263b1a8c633b90c801148f9c6ec9 100644 (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 \
index 56c215bf58fe1c99d56b981495aa79d70541c88c..ac24d8ecbf969fa955d6408c1ea001abfc6ce9c6 100644 (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 \
index 56c215bf58fe1c99d56b981495aa79d70541c88c..ac24d8ecbf969fa955d6408c1ea001abfc6ce9c6 100644 (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 \
index 23f375dabf8cfdc00c9cc5b05ad7e75bc8c5e726..accc9725a270d23fa93c7d3fbe1f846a8c62a4ca 100644 (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
index 8e2465b4d0be36e426137a5b798db9eb0c321157..3e2c329a811c3f6bd46f61faceeb5cd8c22da0f6 100644 (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!
 
 #
index a364ab42a5211590b65de3a850bd07492eaa45dc..6638c396ccd7b599afe32c8068444da17f0eaf86 100644 (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!
 
 #
index 916ace01b2aabfb75d60f847bb17d37b676155a1..de7986e759292fb8a9afd9323f4b113dd6be6ef8 100644 (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!
 
 #
index 0240840c68b74e8cfd632f9b067fdeab0492f355..416097f0bf8fdd0aa6075973e164cd3dfa0c413d 100644 (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!
 
 #
index 25562cbae315738399ab8d4d8169611773a5fe89..90fd9ac53ef8b3f7832a92750b46f54faff06689 100644 (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
index f719d708d0640d65fac48a1d2d4424039797aea8..a6a1bc883b732d4dc408da519f5f2e571e3b0ce4 100644 (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
index a6f93a7178ef032d21c83d542b8b4965283417ea..2227c9090e9b529255302b7606f27c7dcb79ba23 100644 (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!
 
 #