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