X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=protocol%2Futil%2FClientInfo.h;h=1aa2ae6a09cabb1f7619b1f717b4ef0fc725f4d3;hb=726897adbf881d3b75f171fff24f2b917ba5f05a;hp=392195fd9590cf365798074df0a020da645c08f5;hpb=5bee5deb850c0744be543105f04e880012b6012a;p=casparcg diff --git a/protocol/util/ClientInfo.h b/protocol/util/ClientInfo.h index 392195fd9..1aa2ae6a0 100644 --- a/protocol/util/ClientInfo.h +++ b/protocol/util/ClientInfo.h @@ -1,54 +1,47 @@ -/* -* 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 -#include -#include - -namespace caspar { namespace IO { - -class ClientInfo -{ -protected: - ClientInfo(){} - -public: - virtual ~ClientInfo(){} - - virtual void Send(const std::wstring& data) = 0; - virtual void Disconnect() = 0; - - std::wstring currentMessage_; -}; -typedef std::shared_ptr ClientInfoPtr; - -struct ConsoleClientInfo : public caspar::IO::ClientInfo -{ - void Send(const std::wstring& data) - { - std::wcout << (L"\n--------------------\n" + data + L"--------------------\n"); - } - void Disconnect(){} -}; - -}} +/* +* 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 +#include +#include + +#include +#include "protocol_strategy.h" + +namespace caspar { namespace IO { + +typedef spl::shared_ptr> ClientInfoPtr; + +struct ConsoleClientInfo : public client_connection +{ + void send(std::wstring&& data) override + { + std::wcout << (L"#" + caspar::log::replace_nonprintable_copy(data, L'?')) << std::flush; + } + void disconnect() override {} + std::wstring address() const override { return L"Console"; } + void add_lifecycle_bound_object(const std::wstring& key, const std::shared_ptr& lifecycle_bound) override {} + std::shared_ptr remove_lifecycle_bound_object(const std::wstring& key) override { return std::shared_ptr(); } +}; + +}}