* Added wxsocket lib and sample (I hope I don't forget some file)
[wxWidgets.git] / src / common / sckstrm.cpp
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 #ifdef __GNUG__
12 #pragma implementation "sckstrm.h"
13 #endif
14
15 #include "wx/stream.h"
16 #include "wx/socket.h"
17 #include "wx/sckstrm.h"
18
19 // ---------------------------------------------------------------------------
20 // wxSocketOutputStream
21 // ---------------------------------------------------------------------------
22
23 wxSocketOutputStream::wxSocketOutputStream(wxSocketBase& s)
24 : m_o_socket(&s)
25 {
26 }
27
28 wxSocketOutputStream::~wxSocketOutputStream()
29 {
30 }
31
32 wxOutputStream& wxSocketOutputStream::Write(const void *buffer, size_t size)
33 {
34 m_o_socket->Write((const char *)buffer, size);
35 return *this;
36 }
37
38 // ---------------------------------------------------------------------------
39 // wxSocketInputStream
40 // ---------------------------------------------------------------------------
41
42 wxSocketInputStream::wxSocketInputStream(wxSocketBase& s)
43 : m_i_socket(&s)
44 {
45 }
46
47 wxSocketInputStream::~wxSocketInputStream()
48 {
49 }
50
51 wxInputStream& wxSocketInputStream::Read(void *buffer, size_t size)
52 {
53 m_i_socket->Read((char *)buffer, size);
54 return *this;
55 }
56
57 // ---------------------------------------------------------------------------
58 // wxSocketStream (IO)
59 // ---------------------------------------------------------------------------
60 wxSocketStream::wxSocketStream(wxSocketBase& i_s, wxSocketBase& o_s)
61 : wxSocketInputStream(i_s), wxSocketOutputStream(o_s)
62 {
63 }
64
65 wxSocketStream::wxSocketStream(wxSocketBase& s)
66 : wxSocketInputStream(s), wxSocketOutputStream(s)
67 {
68 }