aboutsummaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-06-30 04:28:47 +0000
committerMike Buland <eichlan@xagasoft.com>2009-06-30 04:28:47 +0000
commit89df61f21e525c7a36846ce1a960ffba5501cdca (patch)
tree0789e81c229b8f55521ca1c14e01c74165bae99b /src/client.h
parent4556c5f625ed143a2334acc26505b658b719b451 (diff)
downloadlibbu++-89df61f21e525c7a36846ce1a960ffba5501cdca.tar.gz
libbu++-89df61f21e525c7a36846ce1a960ffba5501cdca.tar.bz2
libbu++-89df61f21e525c7a36846ce1a960ffba5501cdca.tar.xz
libbu++-89df61f21e525c7a36846ce1a960ffba5501cdca.zip
Bu::Client now gives you the option to add additional filters to the filter
chain on the base stream, which for the moment is a socket. I also demonstrate this in the new rot13 test, with a rot13 filter, and a simple echo protocol.
Diffstat (limited to '')
-rw-r--r--src/client.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client.h b/src/client.h
index b11774e..7ba1ac5 100644
--- a/src/client.h
+++ b/src/client.h
@@ -66,7 +66,18 @@ namespace Bu
66 66
67 bool hasOutput() { return !sWriteBuf.isEmpty(); } 67 bool hasOutput() { return !sWriteBuf.isEmpty(); }
68 68
69 template<typename filter>
70 void pushFilter()
71 {
72 filter *pFlt = new filter( *pTopStream );
73 pTopStream = pFlt;
74 lFilts.prepend( pFlt );
75 }
76
69 private: 77 private:
78 typedef Bu::List<Bu::Stream *> FilterList;
79 FilterList lFilts;
80 Bu::Stream *pTopStream;
70 Bu::Socket *pSocket; 81 Bu::Socket *pSocket;
71 Bu::Protocol *pProto; 82 Bu::Protocol *pProto;
72 Bu::FString sReadBuf; 83 Bu::FString sReadBuf;