2022-05-03 22:54:44 +00:00
|
|
|
#include <qpdf/Pl_String.hh>
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
Pl_String::Members::Members(std::string& s) :
|
|
|
|
s(s)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-05-06 21:37:25 +00:00
|
|
|
Pl_String::Pl_String(char const* identifier, Pipeline* next, std::string& s) :
|
|
|
|
Pipeline(identifier, next),
|
2022-05-03 22:54:44 +00:00
|
|
|
m(new Members(s))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-06-01 13:47:36 +00:00
|
|
|
Pl_String::~Pl_String() // NOLINT (modernize-use-equals-default)
|
2022-05-03 22:54:44 +00:00
|
|
|
{
|
|
|
|
// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Pl_String::write(unsigned char const* buf, size_t len)
|
|
|
|
{
|
2024-08-07 15:19:16 +00:00
|
|
|
if (!len) {
|
|
|
|
return;
|
|
|
|
}
|
2022-05-03 22:54:44 +00:00
|
|
|
m->s.append(reinterpret_cast<char const*>(buf), len);
|
2022-05-06 21:37:25 +00:00
|
|
|
if (getNext(true)) {
|
|
|
|
getNext()->write(buf, len);
|
|
|
|
}
|
2022-05-03 22:54:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Pl_String::finish()
|
|
|
|
{
|
2022-05-06 21:37:25 +00:00
|
|
|
if (getNext(true)) {
|
|
|
|
getNext()->finish();
|
|
|
|
}
|
2022-05-03 22:54:44 +00:00
|
|
|
}
|