diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2010-08-21 04:39:47 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2010-08-21 04:39:47 +0000 |
| commit | 7f17eeb7fccd52b7049f9f598121130dfd1b55ae (patch) | |
| tree | 8afca1e4459f0bc719941514009f046cd77f88ed /src/client.cpp | |
| parent | a83e9babede7ab5bc8e1ac6c7ee3784b91bd8452 (diff) | |
| download | libbu++-7f17eeb7fccd52b7049f9f598121130dfd1b55ae.tar.gz libbu++-7f17eeb7fccd52b7049f9f598121130dfd1b55ae.tar.bz2 libbu++-7f17eeb7fccd52b7049f9f598121130dfd1b55ae.tar.xz libbu++-7f17eeb7fccd52b7049f9f598121130dfd1b55ae.zip | |
Client now inherits from stream. This could be cool, it could really mess\nthings up. We shall see. In other news, I'm adding a Bu::StreamStack class\nthat will let you easily manage dynamic stream/filter sets.
Diffstat (limited to 'src/client.cpp')
| -rw-r--r-- | src/client.cpp | 107 |
1 files changed, 85 insertions, 22 deletions
diff --git a/src/client.cpp b/src/client.cpp index 095dd91..789cda4 100644 --- a/src/client.cpp +++ b/src/client.cpp | |||
| @@ -125,62 +125,62 @@ bool Bu::Client::isOpen() | |||
| 125 | return pTopStream->isOpen(); | 125 | return pTopStream->isOpen(); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | void Bu::Client::write( const Bu::FString &sData ) | 128 | size_t Bu::Client::write( const Bu::FString &sData ) |
| 129 | { | 129 | { |
| 130 | qbWrite.write( sData.getStr(), sData.getSize() ); | 130 | return qbWrite.write( sData.getStr(), sData.getSize() ); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | void Bu::Client::write( const void *pData, int nBytes ) | 133 | size_t Bu::Client::write( const void *pData, size_t nBytes ) |
| 134 | { | 134 | { |
| 135 | qbWrite.write( pData, nBytes ); | 135 | return qbWrite.write( pData, nBytes ); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | void Bu::Client::write( int8_t nData ) | 138 | size_t Bu::Client::write( int8_t nData ) |
| 139 | { | 139 | { |
| 140 | qbWrite.write( (const char *)&nData, sizeof(nData) ); | 140 | return qbWrite.write( (const char *)&nData, sizeof(nData) ); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | void Bu::Client::write( int16_t nData ) | 143 | size_t Bu::Client::write( int16_t nData ) |
| 144 | { | 144 | { |
| 145 | qbWrite.write( (const char *)&nData, sizeof(nData) ); | 145 | return qbWrite.write( (const char *)&nData, sizeof(nData) ); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | void Bu::Client::write( int32_t nData ) | 148 | size_t Bu::Client::write( int32_t nData ) |
| 149 | { | 149 | { |
| 150 | qbWrite.write( (const char *)&nData, sizeof(nData) ); | 150 | return qbWrite.write( (const char *)&nData, sizeof(nData) ); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | void Bu::Client::write( int64_t nData ) | 153 | size_t Bu::Client::write( int64_t nData ) |
| 154 | { | 154 | { |
| 155 | qbWrite.write( (const char *)&nData, sizeof(nData) ); | 155 | return qbWrite.write( (const char *)&nData, sizeof(nData) ); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | void Bu::Client::write( uint8_t nData ) | 158 | size_t Bu::Client::write( uint8_t nData ) |
| 159 | { | 159 | { |
| 160 | qbWrite.write( (const char *)&nData, sizeof(nData) ); | 160 | return qbWrite.write( (const char *)&nData, sizeof(nData) ); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | void Bu::Client::write( uint16_t nData ) | 163 | size_t Bu::Client::write( uint16_t nData ) |
| 164 | { | 164 | { |
| 165 | qbWrite.write( (const char *)&nData, sizeof(nData) ); | 165 | return qbWrite.write( (const char *)&nData, sizeof(nData) ); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | void Bu::Client::write( uint32_t nData ) | 168 | size_t Bu::Client::write( uint32_t nData ) |
| 169 | { | 169 | { |
| 170 | qbWrite.write( (const char *)&nData, sizeof(nData) ); | 170 | return qbWrite.write( (const char *)&nData, sizeof(nData) ); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | void Bu::Client::write( uint64_t nData ) | 173 | size_t Bu::Client::write( uint64_t nData ) |
| 174 | { | 174 | { |
| 175 | qbWrite.write( (const char *)&nData, sizeof(nData) ); | 175 | return qbWrite.write( (const char *)&nData, sizeof(nData) ); |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | int Bu::Client::read( void *pData, int nBytes ) | 178 | size_t Bu::Client::read( void *pData, size_t nBytes ) |
| 179 | { | 179 | { |
| 180 | return qbRead.read( pData, nBytes ); | 180 | return qbRead.read( pData, nBytes ); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | int Bu::Client::peek( void *pData, int nBytes, int nOffset ) | 183 | size_t Bu::Client::peek( void *pData, int nBytes, int nOffset ) |
| 184 | { | 184 | { |
| 185 | return qbRead.peek( pData, nBytes, nOffset ); | 185 | return qbRead.peek( pData, nBytes, nOffset ); |
| 186 | } | 186 | } |
| @@ -237,3 +237,66 @@ void Bu::Client::tick() | |||
| 237 | pProto->onTick( this ); | 237 | pProto->onTick( this ); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | long Bu::Client::tell() | ||
| 241 | { | ||
| 242 | } | ||
| 243 | |||
| 244 | void Bu::Client::seek( long offset ) | ||
| 245 | { | ||
| 246 | } | ||
| 247 | |||
| 248 | void Bu::Client::setPos( long pos ) | ||
| 249 | { | ||
| 250 | } | ||
| 251 | |||
| 252 | void Bu::Client::setPosEnd( long pos ) | ||
| 253 | { | ||
| 254 | } | ||
| 255 | |||
| 256 | bool Bu::Client::isEos() | ||
| 257 | { | ||
| 258 | return true; | ||
| 259 | } | ||
| 260 | |||
| 261 | void Bu::Client::flush() | ||
| 262 | { | ||
| 263 | } | ||
| 264 | |||
| 265 | bool Bu::Client::canRead() | ||
| 266 | { | ||
| 267 | return qbRead.getSize() > 0; | ||
| 268 | } | ||
| 269 | |||
| 270 | bool Bu::Client::canWrite() | ||
| 271 | { | ||
| 272 | return true; | ||
| 273 | } | ||
| 274 | |||
| 275 | bool Bu::Client::isReadable() | ||
| 276 | { | ||
| 277 | return true; | ||
| 278 | } | ||
| 279 | |||
| 280 | bool Bu::Client::isWritable() | ||
| 281 | { | ||
| 282 | return true; | ||
| 283 | } | ||
| 284 | |||
| 285 | bool Bu::Client::isSeekable() | ||
| 286 | { | ||
| 287 | return false; | ||
| 288 | } | ||
| 289 | |||
| 290 | bool Bu::Client::isBlocking() | ||
| 291 | { | ||
| 292 | return false; | ||
| 293 | } | ||
| 294 | |||
| 295 | void Bu::Client::setBlocking( bool bBlocking ) | ||
| 296 | { | ||
| 297 | } | ||
| 298 | |||
| 299 | void Bu::Client::setSize( long iSize ) | ||
| 300 | { | ||
| 301 | } | ||
| 302 | |||
