summaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-05-13 21:11:47 +0000
committerMike Buland <eichlan@xagasoft.com>2010-05-13 21:11:47 +0000
commit7ad392ce0426a040cc55713691bf6fdbf53c3d31 (patch)
treea50a7cb05f0d8550a7a37aa0cc3f3090250148e7 /src/client.h
parent093ef85e95d1b37e4a87ffc2a51433b2f1ed24e0 (diff)
downloadlibbu++-7ad392ce0426a040cc55713691bf6fdbf53c3d31.tar.gz
libbu++-7ad392ce0426a040cc55713691bf6fdbf53c3d31.tar.bz2
libbu++-7ad392ce0426a040cc55713691bf6fdbf53c3d31.tar.xz
libbu++-7ad392ce0426a040cc55713691bf6fdbf53c3d31.zip
QueueBuf is updated, and everything else uses it now, including Client.
Unfortunately this breaks some programs that accessed the client internal buffer directly. Overall it's much, much more efficient, so it's worth it, maybe we'll find a good workaround later.
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/client.h b/src/client.h
index aecb16c..5a933ca 100644
--- a/src/client.h
+++ b/src/client.h
@@ -11,6 +11,7 @@
11#include <stdint.h> 11#include <stdint.h>
12 12
13#include "bu/fstring.h" 13#include "bu/fstring.h"
14#include "bu/queuebuf.h"
14 15
15namespace Bu 16namespace Bu
16{ 17{
@@ -31,8 +32,8 @@ namespace Bu
31 void processInput(); 32 void processInput();
32 void processOutput(); 33 void processOutput();
33 34
34 Bu::FString &getInput(); 35 //Bu::FString &getInput();
35 Bu::FString &getOutput(); 36 //Bu::FString &getOutput();
36 void write( const Bu::FString &sData ); 37 void write( const Bu::FString &sData );
37 void write( const void *pData, int nBytes ); 38 void write( const void *pData, int nBytes );
38 void write( int8_t nData ); 39 void write( int8_t nData );
@@ -47,6 +48,7 @@ namespace Bu
47 int peek( void *pData, int nBytes, int nOffset=0 ); 48 int peek( void *pData, int nBytes, int nOffset=0 );
48 void seek( int nBytes ); 49 void seek( int nBytes );
49 long getInputSize(); 50 long getInputSize();
51 long getOutputSize();
50 52
51 void setProtocol( Protocol *pProto ); 53 void setProtocol( Protocol *pProto );
52 Bu::Protocol *getProtocol(); 54 Bu::Protocol *getProtocol();
@@ -65,7 +67,8 @@ namespace Bu
65 67
66 void onMessage( const Bu::FString &sMsg ); 68 void onMessage( const Bu::FString &sMsg );
67 69
68 bool hasOutput() { return !sWriteBuf.isEmpty(); } 70 bool hasOutput() { return qbWrite.getSize() > 0; }
71 bool hasInput() { return qbRead.getSize() > 0; }
69 72
70 template<typename filter> 73 template<typename filter>
71 void pushFilter() 74 void pushFilter()
@@ -97,9 +100,8 @@ namespace Bu
97 Bu::Stream *pTopStream; 100 Bu::Stream *pTopStream;
98 Bu::Socket *pSocket; 101 Bu::Socket *pSocket;
99 Bu::Protocol *pProto; 102 Bu::Protocol *pProto;
100 Bu::FString sReadBuf; 103 Bu::QueueBuf qbRead;
101 int nRBOffset; 104 Bu::QueueBuf qbWrite;
102 Bu::FString sWriteBuf;
103 bool bWantsDisconnect; 105 bool bWantsDisconnect;
104 class Bu::ClientLinkFactory *pfLink; 106 class Bu::ClientLinkFactory *pfLink;
105 }; 107 };