// -*- mode: c++; c-basic-offset: 2; -*- #ifndef PROTOCOL_HH #define PROTOCOL_HH #include #include class AttributedText; class Protocol { public: class Match { public: virtual ~Match() {} virtual std::string const& name() const = 0; virtual void full(void const* data, size_t size, AttributedText* text) = 0; virtual void append(void const* data, size_t /* offset */, size_t size, AttributedText* text) { full(data, size, text); } virtual bool content(void const* /* data */, size_t /* size */, std::ostream* /* out */) { return false; } protected: Match() {} Match(Match const&) = delete; Match& operator=(Match const&) = delete; }; virtual ~Protocol() {} virtual Match* match(void const* data, size_t size) const = 0; protected: Protocol() {} Protocol(Protocol const&) = delete; Protocol& operator=(Protocol const&) = delete; }; #endif // PROTOCOL_HH