]> git.saurik.com Git - wxWidgets.git/blame - src/common/sckstrm.cpp
Shell version of dllar, needed for building DLLs while generating
[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)
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
14f355c2 11#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
f4ada568
GL
12#pragma implementation "sckstrm.h"
13#endif
14
fcc6dddd
JS
15// For compilers that support precompilation, includes "wx.h".
16#include "wx/wxprec.h"
17
18#ifdef __BORLANDC__
ce4169a4 19 #pragma hdrstop
fcc6dddd
JS
20#endif
21
22#ifndef WX_PRECOMP
ce4169a4 23 #include "wx/defs.h"
fcc6dddd
JS
24#endif
25
ce4169a4
RR
26#if wxUSE_SOCKETS && wxUSE_STREAMS
27
f4ada568
GL
28#include "wx/stream.h"
29#include "wx/socket.h"
30#include "wx/sckstrm.h"
31
32// ---------------------------------------------------------------------------
33// wxSocketOutputStream
34// ---------------------------------------------------------------------------
35
36wxSocketOutputStream::wxSocketOutputStream(wxSocketBase& s)
37 : m_o_socket(&s)
38{
39}
40
41wxSocketOutputStream::~wxSocketOutputStream()
42{
43}
44
375abe3d
GL
45size_t wxSocketOutputStream::OnSysWrite(const void *buffer, size_t size)
46{
2b5f62a0 47 size_t ret = m_o_socket->Write((const char *)buffer, size).LastCount();
a324a7bc 48
2b5f62a0 49 m_lasterror = m_o_socket->Error() ? wxSTREAM_WRITE_ERROR : wxSTREAM_NO_ERROR;
a0378c28 50
a324a7bc 51 return ret;
375abe3d
GL
52}
53
f4ada568
GL
54// ---------------------------------------------------------------------------
55// wxSocketInputStream
56// ---------------------------------------------------------------------------
57
58wxSocketInputStream::wxSocketInputStream(wxSocketBase& s)
59 : m_i_socket(&s)
60{
61}
62
63wxSocketInputStream::~wxSocketInputStream()
64{
65}
66
375abe3d
GL
67size_t wxSocketInputStream::OnSysRead(void *buffer, size_t size)
68{
2b5f62a0 69 size_t ret = m_i_socket->Read((char *)buffer, size).LastCount();
a0378c28 70
2b5f62a0 71 m_lasterror = m_i_socket->Error() ? wxSTREAM_READ_ERROR : wxSTREAM_NO_ERROR;
a0378c28 72
a324a7bc 73 return ret;
375abe3d
GL
74}
75
f4ada568 76// ---------------------------------------------------------------------------
75ed1d15 77// wxSocketStream
f4ada568 78// ---------------------------------------------------------------------------
f4ada568
GL
79
80wxSocketStream::wxSocketStream(wxSocketBase& s)
81 : wxSocketInputStream(s), wxSocketOutputStream(s)
82{
83}
75ed1d15
GL
84
85wxSocketStream::~wxSocketStream()
86{
87}
35a4dab7
GL
88
89#endif
ce4169a4 90 // wxUSE_STREAMS && wxUSE_SOCKETS