]> git.saurik.com Git - wxWidgets.git/blame - src/common/sckstrm.cpp
minor cleanup 2 - reformatting
[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
fcc6dddd
JS
21#ifndef WX_PRECOMP
22#endif
23
f4ada568
GL
24#include "wx/stream.h"
25#include "wx/socket.h"
26#include "wx/sckstrm.h"
27
28// ---------------------------------------------------------------------------
29// wxSocketOutputStream
30// ---------------------------------------------------------------------------
31
32wxSocketOutputStream::wxSocketOutputStream(wxSocketBase& s)
33 : m_o_socket(&s)
34{
35}
36
37wxSocketOutputStream::~wxSocketOutputStream()
38{
39}
40
375abe3d
GL
41size_t wxSocketOutputStream::OnSysWrite(const void *buffer, size_t size)
42{
8898456d 43 size_t ret = m_o_socket->Write((const char *)buffer, size).LastCount();
a324a7bc 44
8898456d 45 m_lasterror = m_o_socket->Error() ? wxSTREAM_WRITE_ERROR : wxSTREAM_NO_ERROR;
a0378c28 46
8898456d 47 return ret;
375abe3d
GL
48}
49
f4ada568
GL
50// ---------------------------------------------------------------------------
51// wxSocketInputStream
52// ---------------------------------------------------------------------------
53
54wxSocketInputStream::wxSocketInputStream(wxSocketBase& s)
55 : m_i_socket(&s)
56{
57}
58
59wxSocketInputStream::~wxSocketInputStream()
60{
61}
62
375abe3d
GL
63size_t wxSocketInputStream::OnSysRead(void *buffer, size_t size)
64{
8898456d 65 size_t ret = m_i_socket->Read((char *)buffer, size).LastCount();
a0378c28 66
8898456d 67 m_lasterror = m_i_socket->Error() ? wxSTREAM_READ_ERROR : wxSTREAM_NO_ERROR;
a0378c28 68
8898456d 69 return ret;
375abe3d
GL
70}
71
f4ada568 72// ---------------------------------------------------------------------------
75ed1d15 73// wxSocketStream
f4ada568 74// ---------------------------------------------------------------------------
f4ada568
GL
75
76wxSocketStream::wxSocketStream(wxSocketBase& s)
77 : wxSocketInputStream(s), wxSocketOutputStream(s)
78{
79}
75ed1d15
GL
80
81wxSocketStream::~wxSocketStream()
82{
83}
35a4dab7
GL
84
85#endif
ce4169a4 86 // wxUSE_STREAMS && wxUSE_SOCKETS