blob: e010092c84ea6f3feab010cefc36162a5072e427 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// -*- mode: c++; c-basic-offset: 2; -*-
#ifndef PROTOCOL_HH
#define PROTOCOL_HH
#include <stddef.h>
#include <ostream>
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
|