From 615d2ec911dd3eb2b5ed0290038bdb5e6fa0eab2 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 22 Jun 2012 20:58:33 +0000 Subject: Added super handy readAllObjects slot. --- c++-qt/src/gatsstream.cpp | 5 +++++ c++-qt/src/gatsstream.h | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'c++-qt/src') diff --git a/c++-qt/src/gatsstream.cpp b/c++-qt/src/gatsstream.cpp index 3874de2..920b2d6 100644 --- a/c++-qt/src/gatsstream.cpp +++ b/c++-qt/src/gatsstream.cpp @@ -69,6 +69,11 @@ Gats::Object *Gats::GatsStream::readObject() return pObj; } +void Gats::GatsStream::readAllObjects() +{ + while( readObject() ) { } +} + void Gats::GatsStream::writeObject( Gats::Object *pObject ) { QIODevice *pTmp; diff --git a/c++-qt/src/gatsstream.h b/c++-qt/src/gatsstream.h index f1c0625..90e0514 100644 --- a/c++-qt/src/gatsstream.h +++ b/c++-qt/src/gatsstream.h @@ -32,6 +32,14 @@ namespace Gats * non-null then hasReadBuffer should return false on it's next call. */ Gats::Object *readObject(); + + /** + * Works exactly like readObject, except it reads all pending objects + * and emits a objectRead signal for each one read. It doesn't return + * anything. This is perfect for connecting to a QIODevice's readRead + * signal. + */ + void readAllObjects(); public: /** -- cgit v1.2.3