From 52bac339b6267aa9aaa3e2e0d02c2a62e47f83e4 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 6 Apr 2012 06:57:51 +0000 Subject: Qt is tested more thoroughly, some read bugs are fixed. It also works better with qt principles. You can hook up the readyRead signal to the readObject slot on GatsStream, and connect the GatsStream objectRead signal to your own functions, and you'll be notified whenever a new gats object is read. Cool. --- c++-qt/src/gatsstream.cpp | 3 +++ c++-qt/src/gatsstream.h | 7 +++++++ 2 files changed, 10 insertions(+) (limited to 'c++-qt/src') diff --git a/c++-qt/src/gatsstream.cpp b/c++-qt/src/gatsstream.cpp index ae53d0d..3874de2 100644 --- a/c++-qt/src/gatsstream.cpp +++ b/c++-qt/src/gatsstream.cpp @@ -62,6 +62,9 @@ Gats::Object *Gats::GatsStream::readObject() rTmp.open( QIODevice::ReadOnly ); rTmp.seek( 5 ); Gats::Object *pObj = Gats::Object::read( rTmp ); + qbRead.clear(); + + emit objectRead( pObj ); return pObj; } diff --git a/c++-qt/src/gatsstream.h b/c++-qt/src/gatsstream.h index 3cf1081..f1c0625 100644 --- a/c++-qt/src/gatsstream.h +++ b/c++-qt/src/gatsstream.h @@ -15,6 +15,7 @@ namespace Gats GatsStream( QIODevice &rStream ); virtual ~GatsStream(); + public slots: /** * Read an object packet from the assosiated stream. This will make * every effort to only read exactly enough data to describe one packet, @@ -32,6 +33,7 @@ namespace Gats */ Gats::Object *readObject(); + public: /** * Write an object */ @@ -45,6 +47,11 @@ namespace Gats bool hasReadBuffer() { return qbRead.size() > 0; } int getReadBufferSize() { return qbRead.size(); } + QIODevice &getIODevice() { return rStream; } + + signals: + void objectRead( Gats::Object *pObj ); + private: bool skipReadNulls(); -- cgit v1.2.3