]> git.saurik.com Git - wxWidgets.git/commitdiff
Moved declaratrions of wxPyInputStream and etc. into it's own header
authorRobin Dunn <robin@alldunn.com>
Thu, 28 Feb 2002 15:53:14 +0000 (15:53 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 28 Feb 2002 15:53:14 +0000 (15:53 +0000)
file.

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

wxPython/src/filesys.i
wxPython/src/helpers.cpp
wxPython/src/helpers.h
wxPython/src/msw/filesys.cpp
wxPython/src/msw/streams.cpp
wxPython/src/pyistream.h [new file with mode: 0644]
wxPython/src/streams.i

index 9380577a212a15ff716c9b5a177ce67f22bc6333..2bab95dee8c2e1d5e706b90f97b4272320ffd010 100644 (file)
@@ -14,6 +14,7 @@
 
 %{
 #include "helpers.h"
+#include "pyistream.h"
 #include <wx/filesys.h>
 #include <wx/fs_inet.h>
 #include <wx/fs_mem.h>
index 065e70e0ba891f5528f442bd63775c67653d9413..f653ed1c417440f5e844318dda13919b4fa9d4d6 100644 (file)
@@ -15,6 +15,7 @@
 #undef DEBUG
 #include <Python.h>
 #include "helpers.h"
+#include "pyistream.h"
 
 #ifdef __WXMSW__
 #include <wx/msw/private.h>
index 5ae8cc62d8fdd15c7e5dc0110d9dd8b884075d43..a39d69429c5b1768977ddccf2975a8860ff73d12 100644 (file)
@@ -76,75 +76,6 @@ void           wxPyEndAllowThreads(PyThreadState* state);
 void wxPyBeginBlockThreads();
 void wxPyEndBlockThreads();
 
-//----------------------------------------------------------------------
-// Handling of wxInputStreams by Joerg Baumann
-// See stream.i for implementations
-
-// list class for return list of strings, e.g. readlines()
-WX_DECLARE_LIST(wxString, wxStringPtrList);
-
-
-// C++ class wxPyInputStream to act as base for python class wxInputStream
-// You can use it in python like a python file object.
-class wxPyInputStream {
-public:
-    // underlying wxInputStream
-    wxInputStream* m_wxis;
-
-public:
-    wxPyInputStream(wxInputStream* wxis) : m_wxis(wxis) {}
-    ~wxPyInputStream();
-
-    // python file object interface for input files (most of it)
-    void close();
-    void flush();
-    bool eof();
-    wxString* read(int size=-1);
-    wxString* readline(int size=-1);
-    wxStringPtrList* readlines(int sizehint=-1);
-    void seek(int offset, int whence=0);
-    int tell();
-
-    /*   do these later?
-      bool isatty();
-      int fileno();
-      void truncate(int size=-1);
-      void write(wxString data);
-      void writelines(wxStringPtrList);
-    */
-};
-
-
-
-// This is a wxInputStream that wraps a Python file-like
-// object and calls the Python methods as needed.
-class wxPyCBInputStream : public wxInputStream {
-public:
-    ~wxPyCBInputStream();
-    virtual size_t GetSize() const;
-
-    // factory function
-    static wxPyCBInputStream* create(PyObject *py, bool block=TRUE);
-
-protected:
-    // can only be created via the factory
-    wxPyCBInputStream(PyObject *r, PyObject *s, PyObject *t, bool block);
-
-    // wxStreamBase methods
-    virtual size_t OnSysRead(void *buffer, size_t bufsize);
-    virtual size_t OnSysWrite(const void *buffer, size_t bufsize);
-    virtual off_t OnSysSeek(off_t off, wxSeekMode mode);
-    virtual off_t OnSysTell() const;
-
-    // helper
-    static PyObject* getMethod(PyObject* py, char* name);
-
-    PyObject* m_read;
-    PyObject* m_seek;
-    PyObject* m_tell;
-    bool      m_block;
-};
-
 //----------------------------------------------------------------------
 // These are helpers used by the typemaps
 
index 1a48238faeab4cfb0dd96df3c04a40aec742ce74..0cbdf473d1b1ca644677ebf1573b59d0c063b2f4 100644 (file)
@@ -56,6 +56,7 @@ extern PyObject *SWIG_newvarlink(void);
 #define SWIG_name    "filesysc"
 
 #include "helpers.h"
+#include "pyistream.h"
 #include <wx/filesys.h>
 #include <wx/fs_inet.h>
 #include <wx/fs_mem.h>
index e06a968f1f97c9fe46d3c978cf0f02eb3424fcbd..95a8a665799f5a5a22a0152ada6b71004c58b72b 100644 (file)
@@ -56,6 +56,7 @@ extern PyObject *SWIG_newvarlink(void);
 #define SWIG_name    "streamsc"
 
 #include "helpers.h"
+#include "pyistream.h"
 #include <wx/stream.h>
 #include <wx/list.h>
 
diff --git a/wxPython/src/pyistream.h b/wxPython/src/pyistream.h
new file mode 100644 (file)
index 0000000..ab43fa8
--- /dev/null
@@ -0,0 +1,87 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        pyistream.h
+// Purpose:     Classes for managing wxInputStream <--> Python streams
+//
+// Author:      Robin Dunn
+//
+// Created:     25-Sept-2000
+// RCS-ID:      $Id$
+// Copyright:   (c) 2000 by Total Control Software
+// Licence:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __PYISTREAM__
+#define __PYISTREAM__
+
+
+//----------------------------------------------------------------------
+// Handling of wxInputStreams by Joerg Baumann
+// See stream.i for implementations
+
+// list class for return list of strings, e.g. readlines()
+WX_DECLARE_LIST(wxString, wxStringPtrList);
+
+
+// C++ class wxPyInputStream to act as base for python class wxInputStream
+// You can use it in python like a python file object.
+class wxPyInputStream {
+public:
+    // underlying wxInputStream
+    wxInputStream* m_wxis;
+
+public:
+    wxPyInputStream(wxInputStream* wxis) : m_wxis(wxis) {}
+    ~wxPyInputStream();
+
+    // python file object interface for input files (most of it)
+    void close();
+    void flush();
+    bool eof();
+    wxString* read(int size=-1);
+    wxString* readline(int size=-1);
+    wxStringPtrList* readlines(int sizehint=-1);
+    void seek(int offset, int whence=0);
+    int tell();
+
+    /*   do these later?
+      bool isatty();
+      int fileno();
+      void truncate(int size=-1);
+      void write(wxString data);
+      void writelines(wxStringPtrList);
+    */
+};
+
+
+
+// This is a wxInputStream that wraps a Python file-like
+// object and calls the Python methods as needed.
+class wxPyCBInputStream : public wxInputStream {
+public:
+    ~wxPyCBInputStream();
+    virtual size_t GetSize() const;
+
+    // factory function
+    static wxPyCBInputStream* create(PyObject *py, bool block=TRUE);
+
+protected:
+    // can only be created via the factory
+    wxPyCBInputStream(PyObject *r, PyObject *s, PyObject *t, bool block);
+
+    // wxStreamBase methods
+    virtual size_t OnSysRead(void *buffer, size_t bufsize);
+    virtual size_t OnSysWrite(const void *buffer, size_t bufsize);
+    virtual off_t OnSysSeek(off_t off, wxSeekMode mode);
+    virtual off_t OnSysTell() const;
+
+    // helper
+    static PyObject* getMethod(PyObject* py, char* name);
+
+    PyObject* m_read;
+    PyObject* m_seek;
+    PyObject* m_tell;
+    bool      m_block;
+};
+
+//----------------------------------------------------------------------
+#endif
index 4122cf2fceacda431cf628d8abbe113cacc2aba1..376b22d0f40241b602b7907f763d70e37f2675d7 100644 (file)
@@ -2,7 +2,7 @@
 // Name:        streams.i
 // Purpose:     SWIG definitions of the wxFileSystem family of classes
 //
-// Author:      Joerg Baumann
+// Author:      Joerg Baumann and Robin Dunn
 //
 // Created:     25-Sept-2000
 // RCS-ID:      $Id$
@@ -14,6 +14,7 @@
 
 %{
 #include "helpers.h"
+#include "pyistream.h"
 #include <wx/stream.h>
 #include <wx/list.h>
 %}