diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-01-20 18:09:04 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-20 18:09:04 +0000 |
| commit | 393f1b414746a7f1977971dd7659dd2b47092b11 (patch) | |
| tree | 81d0ca1ee70ab86a7d79c1991abe5c387b655fb2 /src/client.cpp | |
| parent | c259f95bd0e58b247940a339bb9b4b401b4e9438 (diff) | |
| parent | 7e25a863325dc3e9762397e700030969e093b087 (diff) | |
| download | libbu++-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 '')
| -rw-r--r-- | src/client.cpp | 63 |
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() | |||
| 40 | void Bu::Client::processInput() | 40 | void 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 | /* |
| 112 | Bu::FString &Bu::Client::getInput() | 112 | Bu::String &Bu::Client::getInput() |
| 113 | { | 113 | { |
| 114 | return sReadBuf; | 114 | return sReadBuf; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | Bu::FString &Bu::Client::getOutput() | 117 | Bu::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 | ||
| 129 | size_t Bu::Client::write( const Bu::FString &sData ) | 129 | Bu::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 | ||
| 134 | size_t Bu::Client::write( const void *pData, size_t nBytes ) | 134 | Bu::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 | ||
| 139 | size_t Bu::Client::write( int8_t nData ) | 139 | Bu::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 | ||
| 144 | size_t Bu::Client::write( int16_t nData ) | 144 | Bu::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 | ||
| 149 | size_t Bu::Client::write( int32_t nData ) | 149 | Bu::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 | ||
| 154 | size_t Bu::Client::write( int64_t nData ) | 154 | Bu::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 | ||
| 159 | size_t Bu::Client::write( uint8_t nData ) | 159 | Bu::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 | ||
| 164 | size_t Bu::Client::write( uint16_t nData ) | 164 | Bu::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 | ||
| 169 | size_t Bu::Client::write( uint32_t nData ) | 169 | Bu::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 | ||
| 174 | size_t Bu::Client::write( uint64_t nData ) | 174 | Bu::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 | ||
| 179 | size_t Bu::Client::read( void *pData, size_t nBytes ) | 179 | Bu::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 | ||
| 184 | size_t Bu::Client::peek( void *pData, int nBytes, int nOffset ) | 184 | Bu::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 | ||
| 189 | long Bu::Client::getInputSize() | 189 | Bu::size Bu::Client::getInputSize() |
| 190 | { | 190 | { |
| 191 | return qbRead.getSize(); | 191 | return qbRead.getSize(); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | long Bu::Client::getOutputSize() | 194 | Bu::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 | ||
| 224 | void Bu::Client::onMessage( const Bu::FString &sMsg ) | 224 | void 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 | ||
| 236 | long Bu::Client::tell() | 236 | Bu::size Bu::Client::tell() |
| 237 | { | 237 | { |
| 238 | return 0; | 238 | return 0; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | void Bu::Client::seek( long offset ) | 241 | void Bu::Client::seek( Bu::size offset ) |
| 242 | { | 242 | { |
| 243 | return qbRead.seek( offset ); | 243 | return qbRead.seek( offset ); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | void Bu::Client::setPos( long ) | 246 | void Bu::Client::setPos( Bu::size ) |
| 247 | { | 247 | { |
| 248 | throw Bu::ExceptionBase(); | 248 | throw Bu::ExceptionBase(); |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | void Bu::Client::setPosEnd( long ) | 251 | void 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 | ||
| 301 | void Bu::Client::setSize( long ) | 301 | void Bu::Client::setSize( Bu::size ) |
| 302 | { | 302 | { |
| 303 | throw Bu::ExceptionBase(); | 303 | throw Bu::ExceptionBase(); |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | Bu::size Bu::Client::getSize() const | ||
| 307 | { | ||
| 308 | return 0; | ||
| 309 | } | ||
| 310 | |||
| 311 | Bu::size Bu::Client::getBlockSize() const | ||
| 312 | { | ||
| 313 | return pSocket->getBlockSize(); | ||
| 314 | } | ||
| 315 | |||
| 316 | Bu::String Bu::Client::getLocation() const | ||
| 317 | { | ||
| 318 | return pSocket->getLocation(); | ||
| 319 | } | ||
| 320 | |||
