From d534a56d95bca7bdd812be024d9eacba4734e2b7 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 9 Nov 2012 17:20:11 +0000 Subject: Many changes: tabconv'd the C++ code, added a license, BSD, and docs. --- c++-libbu++/src/protocolgats.cpp | 63 ++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 28 deletions(-) (limited to 'c++-libbu++/src/protocolgats.cpp') diff --git a/c++-libbu++/src/protocolgats.cpp b/c++-libbu++/src/protocolgats.cpp index 827eb65..f9d9e04 100644 --- a/c++-libbu++/src/protocolgats.cpp +++ b/c++-libbu++/src/protocolgats.cpp @@ -1,3 +1,10 @@ +/* + * Copyright (C) 2007-2012 Xagasoft, All rights reserved. + * + * This file is part of the libgats library and is released under the + * terms of the license contained in the file LICENSE. + */ + #include "gats/protocolgats.h" #include "gats/gatsstream.h" @@ -7,50 +14,50 @@ using namespace Bu; Gats::ProtocolGats::ProtocolGats() : - pStream( NULL ), - pUsedClient( NULL ) + pStream( NULL ), + pUsedClient( NULL ) { } Gats::ProtocolGats::~ProtocolGats() { - delete pStream; - pStream = NULL; + delete pStream; + pStream = NULL; } void Gats::ProtocolGats::onNewConnection( Bu::Client *pClient ) { - if( pStream == NULL ) - { - pStream = new Gats::GatsStream( *pClient ); - pUsedClient = pClient; - } + if( pStream == NULL ) + { + pStream = new Gats::GatsStream( *pClient ); + pUsedClient = pClient; + } } void Gats::ProtocolGats::onNewData( Bu::Client *pClient ) { - if( pStream == NULL ) - { - pStream = new Gats::GatsStream( *pClient ); - pUsedClient = pClient; - } - else if( pClient != pUsedClient ) - { - throw Bu::ExceptionBase("ProtocolGats requires that you maintain a " - "1:1 relationship between client and protocol objects."); - } - - for(;;) - { - Gats::Object *pObj = pStream->readObject(); - if( pObj == NULL ) - break; - onNewObject( pClient, pObj ); - } + if( pStream == NULL ) + { + pStream = new Gats::GatsStream( *pClient ); + pUsedClient = pClient; + } + else if( pClient != pUsedClient ) + { + throw Bu::ExceptionBase("ProtocolGats requires that you maintain a " + "1:1 relationship between client and protocol objects."); + } + + for(;;) + { + Gats::Object *pObj = pStream->readObject(); + if( pObj == NULL ) + break; + onNewObject( pClient, pObj ); + } } void Gats::ProtocolGats::writeObject( Gats::Object *pObj ) { - pStream->writeObject( pObj ); + pStream->writeObject( pObj ); } -- cgit v1.2.3