no changes, just removed broken #if 0'd out code
[wxWidgets.git] / src / common / sckstrm.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/sckstrm.cpp
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
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #if wxUSE_SOCKETS && wxUSE_STREAMS
20
21 #include "wx/sckstrm.h"
22
23 #ifndef WX_PRECOMP
24 #include "wx/stream.h"
25 #endif
26
27 #include "wx/socket.h"
28
29 // ---------------------------------------------------------------------------
30 // wxSocketOutputStream
31 // ---------------------------------------------------------------------------
32
33 wxSocketOutputStream::wxSocketOutputStream(wxSocketBase& s)
34 : m_o_socket(&s)
35 {
36 }
37
38 wxSocketOutputStream::~wxSocketOutputStream()
39 {
40 }
41
42 size_t wxSocketOutputStream::OnSysWrite(const void *buffer, size_t size)
43 {
44 size_t ret = m_o_socket->Write((const char *)buffer, size).LastCount();
45 m_lasterror = m_o_socket->Error() ? wxSTREAM_WRITE_ERROR : wxSTREAM_NO_ERROR;
46 return ret;
47 }
48
49 // ---------------------------------------------------------------------------
50 // wxSocketInputStream
51 // ---------------------------------------------------------------------------
52
53 wxSocketInputStream::wxSocketInputStream(wxSocketBase& s)
54 : m_i_socket(&s)
55 {
56 }
57
58 wxSocketInputStream::~wxSocketInputStream()
59 {
60 }
61
62 size_t wxSocketInputStream::OnSysRead(void *buffer, size_t size)
63 {
64 size_t ret = m_i_socket->Read((char *)buffer, size).LastCount();
65 m_lasterror = m_i_socket->Error() ? wxSTREAM_READ_ERROR : wxSTREAM_NO_ERROR;
66 return ret;
67 }
68
69 // ---------------------------------------------------------------------------
70 // wxSocketStream
71 // ---------------------------------------------------------------------------
72
73 wxSocketStream::wxSocketStream(wxSocketBase& s)
74 : wxSocketInputStream(s), wxSocketOutputStream(s)
75 {
76 }
77
78 wxSocketStream::~wxSocketStream()
79 {
80 }
81
82 #endif // wxUSE_STREAMS && wxUSE_SOCKETS