]> git.saurik.com Git - wxWidgets.git/blame - src/common/sckstrm.cpp
Unicode compilation fix
[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/////////////////////////////////////////////////////////////////////////////
11#ifdef __GNUG__
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{
a324a7bc
GL
47 size_t ret;
48
49 ret = m_o_socket->Write((const char *)buffer, size).LastCount();
a0378c28 50
7c235f09
GRG
51 if (m_o_socket->Error())
52 m_lasterror = wxStream_WRITE_ERR;
a0378c28 53 else
7c235f09 54 m_lasterror = wxStream_NOERROR;
a0378c28 55
a324a7bc
GL
56 return ret;
57
375abe3d
GL
58}
59
f4ada568
GL
60// ---------------------------------------------------------------------------
61// wxSocketInputStream
62// ---------------------------------------------------------------------------
63
64wxSocketInputStream::wxSocketInputStream(wxSocketBase& s)
65 : m_i_socket(&s)
66{
67}
68
69wxSocketInputStream::~wxSocketInputStream()
70{
71}
72
375abe3d
GL
73size_t wxSocketInputStream::OnSysRead(void *buffer, size_t size)
74{
a324a7bc
GL
75 size_t ret;
76
77 ret = m_i_socket->Read((char *)buffer, size).LastCount();
a0378c28 78
7c235f09 79 if (m_i_socket->Error())
a0378c28 80 m_lasterror = wxStream_READ_ERR;
7c235f09
GRG
81 else
82 m_lasterror = wxStream_NOERROR;
a0378c28 83
a324a7bc 84 return ret;
375abe3d
GL
85}
86
f4ada568 87// ---------------------------------------------------------------------------
75ed1d15 88// wxSocketStream
f4ada568 89// ---------------------------------------------------------------------------
f4ada568
GL
90
91wxSocketStream::wxSocketStream(wxSocketBase& s)
92 : wxSocketInputStream(s), wxSocketOutputStream(s)
93{
94}
75ed1d15
GL
95
96wxSocketStream::~wxSocketStream()
97{
98}
35a4dab7
GL
99
100#endif
ce4169a4 101 // wxUSE_STREAMS && wxUSE_SOCKETS