X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/772c017b2c30f5cb8072d7b22f39da175e101e9a..cbf60e091efac7f407a650f7ec0fa169be89abd5:/wxPython/src/helpers.h diff --git a/wxPython/src/helpers.h b/wxPython/src/helpers.h index 5ae8cc62d8..a39d69429c 100644 --- a/wxPython/src/helpers.h +++ b/wxPython/src/helpers.h @@ -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