]> git.saurik.com Git - wxWidgets.git/blame - src/common/sckstrm.cpp
Fix assert during separator items creation introduced by r64226.
[wxWidgets.git] / src / common / sckstrm.cpp
CommitLineData
f4ada568 1/////////////////////////////////////////////////////////////////////////////
8898456d 2// Name: src/common/sckstrm.cpp
f4ada568
GL
3// Purpose: wxSocket*Stream
4// Author: Guilhem Lavaux
5// Modified by:
6// Created: 17/07/97
7// RCS-ID: $Id$
8// Copyright: (c)
65571936 9// Licence: wxWindows licence
f4ada568 10/////////////////////////////////////////////////////////////////////////////
f4ada568 11
fcc6dddd
JS
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
8898456d 16 #pragma hdrstop
fcc6dddd
JS
17#endif
18
8898456d
WS
19#if wxUSE_SOCKETS && wxUSE_STREAMS
20
530ecef0
WS
21#include "wx/sckstrm.h"
22
fcc6dddd 23#ifndef WX_PRECOMP
530ecef0 24 #include "wx/stream.h"
fcc6dddd
JS
25#endif
26
f4ada568 27#include "wx/socket.h"
f4ada568
GL
28
29// ---------------------------------------------------------------------------
30// wxSocketOutputStream
31// ---------------------------------------------------------------------------
32
33wxSocketOutputStream::wxSocketOutputStream(wxSocketBase& s)
34 : m_o_socket(&s)
35{
36}
37
38wxSocketOutputStream::~wxSocketOutputStream()
39{
40}
41
375abe3d
GL
42size_t wxSocketOutputStream::OnSysWrite(const void *buffer, size_t size)
43{
c9157492
VZ
44 const size_t ret = m_o_socket->Write(buffer, size).LastCount();
45 m_lasterror = m_o_socket->Error()
46 ? m_o_socket->IsClosed() ? wxSTREAM_EOF
47 : wxSTREAM_WRITE_ERROR
48 : wxSTREAM_NO_ERROR;
7e134dc1 49 return ret;
375abe3d
GL
50}
51
f4ada568
GL
52// ---------------------------------------------------------------------------
53// wxSocketInputStream
54// ---------------------------------------------------------------------------
55
56wxSocketInputStream::wxSocketInputStream(wxSocketBase& s)
57 : m_i_socket(&s)
58{
59}
60
61wxSocketInputStream::~wxSocketInputStream()
62{
63}
64
375abe3d
GL
65size_t wxSocketInputStream::OnSysRead(void *buffer, size_t size)
66{
c9157492
VZ
67 const size_t ret = m_i_socket->Read(buffer, size).LastCount();
68 m_lasterror = m_i_socket->Error()
69 ? m_i_socket->IsClosed() ? wxSTREAM_EOF
70 : wxSTREAM_READ_ERROR
71 : wxSTREAM_NO_ERROR;
7e134dc1 72 return ret;
375abe3d
GL
73}
74
f4ada568 75// ---------------------------------------------------------------------------
75ed1d15 76// wxSocketStream
f4ada568 77// ---------------------------------------------------------------------------
f4ada568
GL
78
79wxSocketStream::wxSocketStream(wxSocketBase& s)
80 : wxSocketInputStream(s), wxSocketOutputStream(s)
81{
82}
75ed1d15
GL
83
84wxSocketStream::~wxSocketStream()
85{
86}
35a4dab7 87
74a50e49 88#endif // wxUSE_STREAMS && wxUSE_SOCKETS