From a473bb0923b0f7800bb95ef96ba20f5cf6cbe5b4 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 27 Aug 2011 14:06:46 +0000 Subject: Combine client and server protocols to make way for an offline/local protocol. Rename ProtocolObject to Message. --- test/basicserver/TestCommands.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'test/basicserver/TestCommands.cpp') diff --git a/test/basicserver/TestCommands.cpp b/test/basicserver/TestCommands.cpp index 657e79ea..5238819f 100644 --- a/test/basicserver/TestCommands.cpp +++ b/test/basicserver/TestCommands.cpp @@ -5,34 +5,34 @@ #include #endif -#include "autogen_TestProtocolServer.h" +#include "autogen_TestProtocol.h" #include "CollectInBufferStream.h" #include "MemLeakFindOn.h" -std::auto_ptr TestProtocolServerHello::DoCommand(TestProtocolServer &rProtocol, TestContext &rContext) +std::auto_ptr TestProtocolHello::DoCommand(TestProtocolReplyable &rProtocol, TestContext &rContext) const { if(mNumber32 != 41 || mNumber16 != 87 || mNumber8 != 11 || mText != "pingu") { - return std::auto_ptr(new TestProtocolServerError(0, 0)); + return std::auto_ptr(new TestProtocolError(0, 0)); } - return std::auto_ptr(new TestProtocolServerHello(12,89,22,std::string("Hello world!"))); + return std::auto_ptr(new TestProtocolHello(12,89,22,std::string("Hello world!"))); } -std::auto_ptr TestProtocolServerLists::DoCommand(TestProtocolServer &rProtocol, TestContext &rContext) +std::auto_ptr TestProtocolLists::DoCommand(TestProtocolReplyable &rProtocol, TestContext &rContext) const { - return std::auto_ptr(new TestProtocolServerListsReply(mLotsOfText.size())); + return std::auto_ptr(new TestProtocolListsReply(mLotsOfText.size())); } -std::auto_ptr TestProtocolServerQuit::DoCommand(TestProtocolServer &rProtocol, TestContext &rContext) +std::auto_ptr TestProtocolQuit::DoCommand(TestProtocolReplyable &rProtocol, TestContext &rContext) const { - return std::auto_ptr(new TestProtocolServerQuit); + return std::auto_ptr(new TestProtocolQuit); } -std::auto_ptr TestProtocolServerSimple::DoCommand(TestProtocolServer &rProtocol, TestContext &rContext) +std::auto_ptr TestProtocolSimple::DoCommand(TestProtocolReplyable &rProtocol, TestContext &rContext) const { - return std::auto_ptr(new TestProtocolServerSimpleReply(mValue+1)); + return std::auto_ptr(new TestProtocolSimpleReply(mValue+1)); } class UncertainBufferStream : public CollectInBufferStream @@ -45,7 +45,7 @@ public: } }; -std::auto_ptr TestProtocolServerGetStream::DoCommand(TestProtocolServer &rProtocol, TestContext &rContext) +std::auto_ptr TestProtocolGetStream::DoCommand(TestProtocolReplyable &rProtocol, TestContext &rContext) const { // make a new stream object CollectInBufferStream *pstream = mUncertainSize?(new UncertainBufferStream):(new CollectInBufferStream); @@ -68,14 +68,14 @@ std::auto_ptr TestProtocolServerGetStream::DoCommand(TestProtoco // Get it to be sent rProtocol.SendStreamAfterCommand(pstream); - return std::auto_ptr(new TestProtocolServerGetStream(mStartingValue, mUncertainSize)); + return std::auto_ptr(new TestProtocolGetStream(mStartingValue, mUncertainSize)); } -std::auto_ptr TestProtocolServerSendStream::DoCommand(TestProtocolServer &rProtocol, TestContext &rContext) +std::auto_ptr TestProtocolSendStream::DoCommand(TestProtocolReplyable &rProtocol, TestContext &rContext) const { if(mValue != 0x73654353298ffLL) { - return std::auto_ptr(new TestProtocolServerError(0, 0)); + return std::auto_ptr(new TestProtocolError(0, 0)); } // Get a stream @@ -91,11 +91,11 @@ std::auto_ptr TestProtocolServerSendStream::DoCommand(TestProtoc } // tell the caller how many bytes there were - return std::auto_ptr(new TestProtocolServerGetStream(bytes, uncertain)); + return std::auto_ptr(new TestProtocolGetStream(bytes, uncertain)); } -std::auto_ptr TestProtocolServerString::DoCommand(TestProtocolServer &rProtocol, TestContext &rContext) +std::auto_ptr TestProtocolString::DoCommand(TestProtocolReplyable &rProtocol, TestContext &rContext) const { - return std::auto_ptr(new TestProtocolServerString(mTest)); + return std::auto_ptr(new TestProtocolString(mTest)); } -- cgit v1.2.3