aboutsummaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 05:30:43 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 05:30:43 +0000
commit7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2 (patch)
treee2d4bfccd81070adf7294ee54db2399df0c7171f /src/client.cpp
parentf5aca1a1b402bd7ebc944dc6e6fe65828d863365 (diff)
downloadlibbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.tar.gz
libbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.tar.bz2
libbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.tar.xz
libbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.zip
Wow, got the Stream changes propegated, all tests build with string instead of
fstring, and updated the copyright notice to extend to 2011
Diffstat (limited to '')
-rw-r--r--src/client.cpp57
1 files changed, 36 insertions, 21 deletions
diff --git a/src/client.cpp b/src/client.cpp
index c8d5dd4..02e51de 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2010 Xagasoft, All rights reserved. 2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 * 3 *
4 * This file is part of the libbu++ library and is released under the 4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
@@ -40,7 +40,7 @@ Bu::Client::~Client()
40void Bu::Client::processInput() 40void Bu::Client::processInput()
41{ 41{
42 char buf[RBS]; 42 char buf[RBS];
43 size_t nRead, nTotal=0; 43 Bu::size nRead, nTotal=0;
44 44
45 for(;;) 45 for(;;)
46 { 46 {
@@ -126,72 +126,72 @@ bool Bu::Client::isOpen()
126 return pTopStream->isOpen(); 126 return pTopStream->isOpen();
127} 127}
128 128
129size_t Bu::Client::write( const Bu::String &sData ) 129Bu::size Bu::Client::write( const Bu::String &sData )
130{ 130{
131 return qbWrite.write( sData.getStr(), sData.getSize() ); 131 return qbWrite.write( sData.getStr(), sData.getSize() );
132} 132}
133 133
134size_t Bu::Client::write( const void *pData, size_t nBytes ) 134Bu::size Bu::Client::write( const void *pData, Bu::size nBytes )
135{ 135{
136 return qbWrite.write( pData, nBytes ); 136 return qbWrite.write( pData, nBytes );
137} 137}
138 138
139size_t Bu::Client::write( int8_t nData ) 139Bu::size Bu::Client::write( int8_t nData )
140{ 140{
141 return qbWrite.write( (const char *)&nData, sizeof(nData) ); 141 return qbWrite.write( (const char *)&nData, sizeof(nData) );
142} 142}
143 143
144size_t Bu::Client::write( int16_t nData ) 144Bu::size Bu::Client::write( int16_t nData )
145{ 145{
146 return qbWrite.write( (const char *)&nData, sizeof(nData) ); 146 return qbWrite.write( (const char *)&nData, sizeof(nData) );
147} 147}
148 148
149size_t Bu::Client::write( int32_t nData ) 149Bu::size Bu::Client::write( int32_t nData )
150{ 150{
151 return qbWrite.write( (const char *)&nData, sizeof(nData) ); 151 return qbWrite.write( (const char *)&nData, sizeof(nData) );
152} 152}
153 153
154size_t Bu::Client::write( int64_t nData ) 154Bu::size Bu::Client::write( int64_t nData )
155{ 155{
156 return qbWrite.write( (const char *)&nData, sizeof(nData) ); 156 return qbWrite.write( (const char *)&nData, sizeof(nData) );
157} 157}
158 158
159size_t Bu::Client::write( uint8_t nData ) 159Bu::size Bu::Client::write( uint8_t nData )
160{ 160{
161 return qbWrite.write( (const char *)&nData, sizeof(nData) ); 161 return qbWrite.write( (const char *)&nData, sizeof(nData) );
162} 162}
163 163
164size_t Bu::Client::write( uint16_t nData ) 164Bu::size Bu::Client::write( uint16_t nData )
165{ 165{
166 return qbWrite.write( (const char *)&nData, sizeof(nData) ); 166 return qbWrite.write( (const char *)&nData, sizeof(nData) );
167} 167}
168 168
169size_t Bu::Client::write( uint32_t nData ) 169Bu::size Bu::Client::write( uint32_t nData )
170{ 170{
171 return qbWrite.write( (const char *)&nData, sizeof(nData) ); 171 return qbWrite.write( (const char *)&nData, sizeof(nData) );
172} 172}
173 173
174size_t Bu::Client::write( uint64_t nData ) 174Bu::size Bu::Client::write( uint64_t nData )
175{ 175{
176 return qbWrite.write( (const char *)&nData, sizeof(nData) ); 176 return qbWrite.write( (const char *)&nData, sizeof(nData) );
177} 177}
178 178
179size_t Bu::Client::read( void *pData, size_t nBytes ) 179Bu::size Bu::Client::read( void *pData, Bu::size nBytes )
180{ 180{
181 return qbRead.read( pData, nBytes ); 181 return qbRead.read( pData, nBytes );
182} 182}
183 183
184size_t Bu::Client::peek( void *pData, int nBytes, int nOffset ) 184Bu::size Bu::Client::peek( void *pData, int nBytes, int nOffset )
185{ 185{
186 return qbRead.peek( pData, nBytes, nOffset ); 186 return qbRead.peek( pData, nBytes, nOffset );
187} 187}
188 188
189long Bu::Client::getInputSize() 189Bu::size Bu::Client::getInputSize()
190{ 190{
191 return qbRead.getSize(); 191 return qbRead.getSize();
192} 192}
193 193
194long Bu::Client::getOutputSize() 194Bu::size Bu::Client::getOutputSize()
195{ 195{
196 return qbWrite.getSize(); 196 return qbWrite.getSize();
197} 197}
@@ -233,22 +233,22 @@ void Bu::Client::tick()
233 pProto->onTick( this ); 233 pProto->onTick( this );
234} 234}
235 235
236long Bu::Client::tell() 236Bu::size Bu::Client::tell()
237{ 237{
238 return 0; 238 return 0;
239} 239}
240 240
241void Bu::Client::seek( long offset ) 241void Bu::Client::seek( Bu::size offset )
242{ 242{
243 return qbRead.seek( offset ); 243 return qbRead.seek( offset );
244} 244}
245 245
246void Bu::Client::setPos( long ) 246void Bu::Client::setPos( Bu::size )
247{ 247{
248 throw Bu::ExceptionBase(); 248 throw Bu::ExceptionBase();
249} 249}
250 250
251void Bu::Client::setPosEnd( long ) 251void Bu::Client::setPosEnd( Bu::size )
252{ 252{
253 throw Bu::ExceptionBase(); 253 throw Bu::ExceptionBase();
254} 254}
@@ -298,8 +298,23 @@ void Bu::Client::setBlocking( bool )
298 throw Bu::ExceptionBase(); 298 throw Bu::ExceptionBase();
299} 299}
300 300
301void Bu::Client::setSize( long ) 301void Bu::Client::setSize( Bu::size )
302{ 302{
303 throw Bu::ExceptionBase(); 303 throw Bu::ExceptionBase();
304} 304}
305 305
306Bu::size Bu::Client::getSize() const
307{
308 return 0;
309}
310
311Bu::size Bu::Client::getBlockSize() const
312{
313 return pSocket->getBlockSize();
314}
315
316Bu::String Bu::Client::getLocation() const
317{
318 return pSocket->getLocation();
319}
320