/src/qpdf/libqpdf/Pl_String.cc
Line | Count | Source (jump to first uncovered line) |
1 | | #include <qpdf/Pl_String.hh> |
2 | | |
3 | | #include <stdexcept> |
4 | | |
5 | | class Pl_String::Members |
6 | | { |
7 | | public: |
8 | | Members(std::string& s) : |
9 | 0 | s(s) |
10 | 0 | { |
11 | 0 | } |
12 | | Members(Members const&) = delete; |
13 | | ~Members() = default; |
14 | | |
15 | | std::string& s; |
16 | | }; |
17 | | |
18 | | Pl_String::Pl_String(char const* identifier, Pipeline* next, std::string& s) : |
19 | 0 | Pipeline(identifier, next), |
20 | 0 | m(std::make_unique<Members>(s)) |
21 | 0 | { |
22 | 0 | } |
23 | | |
24 | | // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer |
25 | 0 | Pl_String::~Pl_String() = default; |
26 | | |
27 | | void |
28 | | Pl_String::write(unsigned char const* buf, size_t len) |
29 | 0 | { |
30 | 0 | if (!len) { |
31 | 0 | return; |
32 | 0 | } |
33 | 0 | m->s.append(reinterpret_cast<char const*>(buf), len); |
34 | 0 | if (next()) { |
35 | 0 | next()->write(buf, len); |
36 | 0 | } |
37 | 0 | } |
38 | | |
39 | | void |
40 | | Pl_String::finish() |
41 | 0 | { |
42 | 0 | if (next()) { |
43 | 0 | next()->finish(); |
44 | 0 | } |
45 | 0 | } |