Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / debian / libwx-perl / usr / lib / perl5 / Wx / cpp / streams.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        cpp/streams.h
3 // Purpose:     wrappers to pass streams from Perl to wxWidgets
4 //              (see also XS/Streams.xs)
5 // Author:      Mattia Barbon
6 // Modified by:
7 // Created:     30/03/2001
8 // RCS-ID:      $Id: streams.h 2057 2007-06-18 23:03:00Z mbarbon $
9 // Copyright:   (c) 2001-2002, 2004, 2006 Mattia Barbon
10 // Licence:     This program is free software; you can redistribute it and/or
11 //              modify it under the same terms as Perl itself
12 /////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WXPERL_STREAMS_H
15 #define _WXPERL_STREAMS_H
16
17 #include <wx/stream.h>
18
19 // for wxWidgets use: store a Perl object and
20 // read from/write to it using wxWidgets functions
21
22 class wxPliInputStream:public wxInputStream
23 {
24 public:
25     wxPliInputStream():m_fh( 0 ) {}
26     wxPliInputStream( SV* fh );
27     wxPliInputStream( const wxPliInputStream& stream );
28
29     ~wxPliInputStream();
30
31     const wxPliInputStream& operator =( const wxPliInputStream& stream );
32 protected:
33     wxFileOffset GetLength() const;
34     size_t OnSysRead( void* buffer, size_t bufsize );
35
36     size_t GetSize() const;
37
38 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
39     wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
40     wxFileOffset OnSysTell() const;
41 #else
42     off_t OnSysSeek(off_t seek, wxSeekMode mode);
43     off_t OnSysTell() const;
44 #endif
45 protected:
46     SV* m_fh;
47 };
48
49 class wxPliOutputStream:public wxOutputStream
50 {
51 public:
52     wxPliOutputStream():m_fh( 0 ) {}
53     wxPliOutputStream( SV* fh );
54     wxPliOutputStream( const wxPliOutputStream& stream );
55     ~wxPliOutputStream();
56
57     const wxPliOutputStream& operator = ( const wxPliOutputStream& stream );
58 protected:
59     wxFileOffset GetLength() const;
60     size_t OnSysWrite( const void* buffer, size_t size );
61
62     size_t GetSize() const;
63
64 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
65     wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
66     wxFileOffset OnSysTell() const;
67 #else
68     off_t OnSysSeek(off_t seek, wxSeekMode mode);
69     off_t OnSysTell() const;
70 #endif
71 protected:
72     SV* m_fh;
73 };
74
75 #endif
76     // _WXPERL_STREAMS_H
77
78 // Local variables: //
79 // mode: c++ //
80 // End: //