]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/sckstrm.h | |
3 | // Purpose: wxSocket*Stream | |
4 | // Author: Guilhem Lavaux | |
5 | // Modified by: | |
6 | // Created: 17/07/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | #ifndef __SCK_STREAM_H__ | |
12 | #define __SCK_STREAM_H__ | |
13 | ||
14 | #include "wx/stream.h" | |
15 | ||
16 | #if wxUSE_SOCKETS && wxUSE_STREAMS | |
17 | ||
18 | #include "wx/socket.h" | |
19 | ||
20 | class WXDLLIMPEXP_NET wxSocketOutputStream : public wxOutputStream | |
21 | { | |
22 | public: | |
23 | wxSocketOutputStream(wxSocketBase& s); | |
24 | virtual ~wxSocketOutputStream(); | |
25 | ||
26 | protected: | |
27 | wxSocketBase *m_o_socket; | |
28 | ||
29 | size_t OnSysWrite(const void *buffer, size_t bufsize); | |
30 | ||
31 | // socket streams are both un-seekable and size-less streams: | |
32 | wxFileOffset OnSysTell() const | |
33 | { return wxInvalidOffset; } | |
34 | wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) | |
35 | { return wxInvalidOffset; } | |
36 | ||
37 | wxDECLARE_NO_COPY_CLASS(wxSocketOutputStream); | |
38 | }; | |
39 | ||
40 | class WXDLLIMPEXP_NET wxSocketInputStream : public wxInputStream | |
41 | { | |
42 | public: | |
43 | wxSocketInputStream(wxSocketBase& s); | |
44 | virtual ~wxSocketInputStream(); | |
45 | ||
46 | protected: | |
47 | wxSocketBase *m_i_socket; | |
48 | ||
49 | size_t OnSysRead(void *buffer, size_t bufsize); | |
50 | ||
51 | // socket streams are both un-seekable and size-less streams: | |
52 | ||
53 | wxFileOffset OnSysTell() const | |
54 | { return wxInvalidOffset; } | |
55 | wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) | |
56 | { return wxInvalidOffset; } | |
57 | ||
58 | wxDECLARE_NO_COPY_CLASS(wxSocketInputStream); | |
59 | }; | |
60 | ||
61 | class WXDLLIMPEXP_NET wxSocketStream : public wxSocketInputStream, | |
62 | public wxSocketOutputStream | |
63 | { | |
64 | public: | |
65 | wxSocketStream(wxSocketBase& s); | |
66 | virtual ~wxSocketStream(); | |
67 | ||
68 | wxDECLARE_NO_COPY_CLASS(wxSocketStream); | |
69 | }; | |
70 | ||
71 | #endif | |
72 | // wxUSE_SOCKETS && wxUSE_STREAMS | |
73 | ||
74 | #endif | |
75 | // __SCK_STREAM_H__ |