]> git.saurik.com Git - wxWidgets.git/blob - include/wx/sckstrm.h
* Added wxsocket lib and sample (I hope I don't forget some file)
[wxWidgets.git] / include / wx / sckstrm.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/stream.h"
19 #include "wx/socket.h"
20
21 class WXDLLEXPORT wxSocketOutputStream : public wxOutputStream
22 {
23 public:
24 wxSocketOutputStream(wxSocketBase& s);
25 virtual ~wxSocketOutputStream();
26
27 wxOutputStream& Write(const void *buffer, size_t size);
28 off_t SeekO(off_t pos, wxSeekMode mode) { return -1; }
29 off_t TellO() { return -1; }
30
31 bool Bad() { return m_o_socket->IsDisconnected(); }
32 size_t LastWrite() { return m_o_socket->LastCount(); }
33 protected:
34 wxSocketBase *m_o_socket;
35 };
36
37 class WXDLLEXPORT wxSocketInputStream : public wxInputStream
38 {
39 public:
40 wxSocketInputStream(wxSocketBase& s);
41 ~wxSocketInputStream();
42
43 wxInputStream& Read(void *buffer, size_t size);
44 off_t SeekI(off_t pos, wxSeekMode mode) { return -1; }
45 off_t TellI() { return -1; }
46
47 bool Eof() { return m_i_socket->IsDisconnected(); }
48 size_t LastRead() { return m_i_socket->LastCount(); }
49 protected:
50 wxSocketBase *m_i_socket;
51 };
52
53 class WXDLLEXPORT wxSocketStream : public wxSocketInputStream,
54 public wxSocketOutputStream,
55 public wxStream {
56
57 public:
58 wxSocketStream(wxSocketBase& i_s, wxSocketBase& o_s);
59 wxSocketStream(wxSocketBase& s);
60 };
61
62 #endif