summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-07-16 21:52:57 +0000
committerMike Buland <eichlan@xagasoft.com>2009-07-16 21:52:57 +0000
commitff5688b09c21242c2a0bee70cdfd1ea50b06f4f0 (patch)
treea7f3d393ff8176b491f87fa6caf490df138a5844 /src
parent89df61f21e525c7a36846ce1a960ffba5501cdca (diff)
downloadlibbu++-ff5688b09c21242c2a0bee70cdfd1ea50b06f4f0.tar.gz
libbu++-ff5688b09c21242c2a0bee70cdfd1ea50b06f4f0.tar.bz2
libbu++-ff5688b09c21242c2a0bee70cdfd1ea50b06f4f0.tar.xz
libbu++-ff5688b09c21242c2a0bee70cdfd1ea50b06f4f0.zip
Client code is even cooler, it supports flushing data in case of buffering in
the filter chain, I'm going to go ahead and make that optional coming up.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp1
-rw-r--r--src/client.h16
2 files changed, 17 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 24f9bfb..729526e 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -85,6 +85,7 @@ void Bu::Client::processOutput()
85 { 85 {
86 int nAmnt = (sWriteBuf.getSize()<2048)?(sWriteBuf.getSize()):(2048); 86 int nAmnt = (sWriteBuf.getSize()<2048)?(sWriteBuf.getSize()):(2048);
87 int nReal = pTopStream->write( sWriteBuf.getStr(), nAmnt ); 87 int nReal = pTopStream->write( sWriteBuf.getStr(), nAmnt );
88 pTopStream->flush();
88 sWriteBuf.trimFront( nReal ); 89 sWriteBuf.trimFront( nReal );
89 //sWriteBuf.clear(); 90 //sWriteBuf.clear();
90 } 91 }
diff --git a/src/client.h b/src/client.h
index 7ba1ac5..72b1b05 100644
--- a/src/client.h
+++ b/src/client.h
@@ -73,6 +73,22 @@ namespace Bu
73 pTopStream = pFlt; 73 pTopStream = pFlt;
74 lFilts.prepend( pFlt ); 74 lFilts.prepend( pFlt );
75 } 75 }
76
77 template<typename filter, typename p1t>
78 void pushFilter( p1t p1 )
79 {
80 filter *pFlt = new filter( *pTopStream, p1 );
81 pTopStream = pFlt;
82 lFilts.prepend( pFlt );
83 }
84
85 template<typename filter, typename p1t, typename p2t>
86 void pushFilter( p1t p1, p2t p2 )
87 {
88 filter *pFlt = new filter( *pTopStream, p1, p2 );
89 pTopStream = pFlt;
90 lFilts.prepend( pFlt );
91 }
76 92
77 private: 93 private:
78 typedef Bu::List<Bu::Stream *> FilterList; 94 typedef Bu::List<Bu::Stream *> FilterList;