]> git.saurik.com Git - wxWidgets.git/blame - src/common/sckstrm.cpp
use proper dllexport declaration with _WX_LIST_HELPER_
[wxWidgets.git] / src / common / sckstrm.cpp
CommitLineData
f4ada568
GL
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)
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__
ce4169a4 16 #pragma hdrstop
fcc6dddd
JS
17#endif
18
19#ifndef WX_PRECOMP
ce4169a4 20 #include "wx/defs.h"
fcc6dddd
JS
21#endif
22
ce4169a4
RR
23#if wxUSE_SOCKETS && wxUSE_STREAMS
24
f4ada568
GL
25#include "wx/stream.h"
26#include "wx/socket.h"
27#include "wx/sckstrm.h"
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{
2b5f62a0 44 size_t ret = m_o_socket->Write((const char *)buffer, size).LastCount();
a324a7bc 45
2b5f62a0 46 m_lasterror = m_o_socket->Error() ? wxSTREAM_WRITE_ERROR : wxSTREAM_NO_ERROR;
a0378c28 47
a324a7bc 48 return ret;
375abe3d
GL
49}
50
f4ada568
GL
51// ---------------------------------------------------------------------------
52// wxSocketInputStream
53// ---------------------------------------------------------------------------
54
55wxSocketInputStream::wxSocketInputStream(wxSocketBase& s)
56 : m_i_socket(&s)
57{
58}
59
60wxSocketInputStream::~wxSocketInputStream()
61{
62}
63
375abe3d
GL
64size_t wxSocketInputStream::OnSysRead(void *buffer, size_t size)
65{
2b5f62a0 66 size_t ret = m_i_socket->Read((char *)buffer, size).LastCount();
a0378c28 67
2b5f62a0 68 m_lasterror = m_i_socket->Error() ? wxSTREAM_READ_ERROR : wxSTREAM_NO_ERROR;
a0378c28 69
a324a7bc 70 return ret;
375abe3d
GL
71}
72
f4ada568 73// ---------------------------------------------------------------------------
75ed1d15 74// wxSocketStream
f4ada568 75// ---------------------------------------------------------------------------
f4ada568
GL
76
77wxSocketStream::wxSocketStream(wxSocketBase& s)
78 : wxSocketInputStream(s), wxSocketOutputStream(s)
79{
80}
75ed1d15
GL
81
82wxSocketStream::~wxSocketStream()
83{
84}
35a4dab7
GL
85
86#endif
ce4169a4 87 // wxUSE_STREAMS && wxUSE_SOCKETS