blob: a5881721f73a2e9b37ca192fc2ae6eaf3400405c (
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
45
|
// -*- mode: c++; c-basic-offset: 2; -*-
#include "common.hh"
#include "gui_plainattrtext.hh"
namespace {
class PlainAttributedTextImpl : public PlainAttributedText {
public:
void append(const char* str, size_t len, Attribute const& UNUSED(attr),
size_t start, size_t length) override {
if (!str || start >= len) return;
length = std::min(len - start, length);
if (length == 0) return;
text_.append(str + start, length);
}
void add(Attribute const& UNUSED(attr), size_t UNUSED(start),
size_t UNUSED(length)) override {
}
void set(Attribute const& UNUSED(attr), size_t UNUSED(start),
size_t UNUSED(length)) override {
}
void clear(size_t UNUSED(start), size_t UNUSED(length)) override {
}
std::string text() const override {
return text_;
}
void reset() override {
text_.clear();
}
private:
std::string text_;
};
} // namespace
// static
PlainAttributedText* PlainAttributedText::create() {
return new PlainAttributedTextImpl();
}
|