diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2009-06-30 04:28:47 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2009-06-30 04:28:47 +0000 |
| commit | 89df61f21e525c7a36846ce1a960ffba5501cdca (patch) | |
| tree | 0789e81c229b8f55521ca1c14e01c74165bae99b /src/client.h | |
| parent | 4556c5f625ed143a2334acc26505b658b719b451 (diff) | |
| download | libbu++-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 'src/client.h')
| -rw-r--r-- | src/client.h | 11 |
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; |
