X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=protocol%2Famcp%2FAMCPProtocolStrategy.h;h=559b9d44f1f09042135033c1a5dbd8b8003e6fb1;hb=a660f13c38fbd89c3db2169449baa5e2268db815;hp=4454b01e621d11d12f5936abbe54a42e89c09ea3;hpb=6853b5cf1073f6d3696e5842d994ba89d88dc126;p=casparcg diff --git a/protocol/amcp/AMCPProtocolStrategy.h b/protocol/amcp/AMCPProtocolStrategy.h index 4454b01e6..559b9d44f 100644 --- a/protocol/amcp/AMCPProtocolStrategy.h +++ b/protocol/amcp/AMCPProtocolStrategy.h @@ -1,71 +1,56 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ -#pragma once - -#include "../util/protocolstrategy.h" -#include - -#include "AMCPCommand.h" -#include "AMCPCommandQueue.h" - -#include - -namespace caspar { namespace protocol { namespace amcp { - -class AMCPProtocolStrategy : public IO::IProtocolStrategy, boost::noncopyable -{ - enum MessageParserState { - New = 0, - GetSwitch, - GetCommand, - GetParameters, - GetChannel, - Done - }; - - AMCPProtocolStrategy(const AMCPProtocolStrategy&); - AMCPProtocolStrategy& operator=(const AMCPProtocolStrategy&); - -public: - AMCPProtocolStrategy(const std::vector>& channels); - virtual ~AMCPProtocolStrategy(); - - virtual void Parse(const TCHAR* pData, int charCount, IO::ClientInfoPtr pClientInfo); - virtual UINT GetCodepage() { - return CP_UTF8; - } - - AMCPCommandPtr InterpretCommandString(const std::wstring& str, MessageParserState* pOutState=0); - -private: - friend class AMCPCommand; - - void ProcessMessage(const std::wstring& message, IO::ClientInfoPtr& pClientInfo); - std::size_t TokenizeMessage(const std::wstring& message, std::vector* pTokenVector); - AMCPCommandPtr CommandFactory(const std::wstring& str); - - bool QueueCommand(AMCPCommandPtr); - - std::vector> channels_; - std::vector commandQueues_; - static const std::wstring MessageDelimiter; -}; - -}}} +/* +* Copyright (c) 2011 Sveriges Television AB +* +* This file is part of CasparCG (www.casparcg.com). +* +* CasparCG is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* CasparCG is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with CasparCG. If not, see . +* +* Author: Nicklas P Andersson +*/ + +#pragma once + +#include "../util/ProtocolStrategy.h" + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +namespace caspar { namespace protocol { namespace amcp { + +class AMCPProtocolStrategy : public IO::IProtocolStrategy, boost::noncopyable +{ +public: + AMCPProtocolStrategy(const std::wstring& name, const spl::shared_ptr& repo); + + virtual ~AMCPProtocolStrategy(); + + virtual void Parse(const std::wstring& msg, IO::ClientInfoPtr pClientInfo); + virtual std::string GetCodepage() const { return "UTF-8"; } + +private: + struct impl; + spl::unique_ptr impl_; +}; + +}}}