summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 18:09:04 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 18:09:04 +0000
commit393f1b414746a7f1977971dd7659dd2b47092b11 (patch)
tree81d0ca1ee70ab86a7d79c1991abe5c387b655fb2 /src/client.cpp
parentc259f95bd0e58b247940a339bb9b4b401b4e9438 (diff)
parent7e25a863325dc3e9762397e700030969e093b087 (diff)
downloadlibbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.gz
libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.bz2
libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.xz
libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.zip
Wow! Merged the branch, streams are updated, and there's no more FString, run
the fixstrings.sh script in the support directory to (hopefully) automatically update your projects.
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp63
1 files changed, 39 insertions, 24 deletions
diff --git a/src/client.cpp b/src/client.cpp
index b635c8b..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 {
@@ -109,12 +109,12 @@ void Bu::Client::clearProtocol()
109 pProto = NULL; 109 pProto = NULL;
110} 110}
111/* 111/*
112Bu::FString &Bu::Client::getInput() 112Bu::String &Bu::Client::getInput()
113{ 113{
114 return sReadBuf; 114 return sReadBuf;
115} 115}
116 116
117Bu::FString &Bu::Client::getOutput() 117Bu::String &Bu::Client::getOutput()
118{ 118{
119 return sWriteBuf; 119 return sWriteBuf;
120} 120}
@@ -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::FString &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}
@@ -221,7 +221,7 @@ Bu::ClientLink *Bu::Client::getLink()
221 return pfLink->createLink( this ); 221 return pfLink->createLink( this );
222} 222}
223 223
224void Bu::Client::onMessage( const Bu::FString &sMsg ) 224void Bu::Client::onMessage( const Bu::String &sMsg )
225{ 225{
226 if( pProto ) 226 if( pProto )
227 pProto->onMessage( this, sMsg ); 227 pProto->onMessage( this, sMsg );
@@ -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