2008-04-29 12:55:25 +00:00
|
|
|
#include <qpdf/Pl_Count.hh>
|
2022-02-04 21:31:31 +00:00
|
|
|
|
2019-06-21 03:35:23 +00:00
|
|
|
#include <qpdf/QIntC.hh>
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2019-06-22 01:32:47 +00:00
|
|
|
Pl_Count::Members::Members() :
|
2008-04-29 12:55:25 +00:00
|
|
|
count(0),
|
|
|
|
last_char('\0')
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-06-22 01:32:47 +00:00
|
|
|
Pl_Count::Pl_Count(char const* identifier, Pipeline* next) :
|
|
|
|
Pipeline(identifier, next),
|
|
|
|
m(new Members())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-06-01 13:47:36 +00:00
|
|
|
Pl_Count::~Pl_Count() // NOLINT (modernize-use-equals-default)
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
2023-05-27 17:19:52 +00:00
|
|
|
// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-05-03 21:43:07 +00:00
|
|
|
Pl_Count::write(unsigned char const* buf, size_t len)
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
2022-04-02 21:14:10 +00:00
|
|
|
if (len) {
|
2023-05-21 13:42:34 +00:00
|
|
|
m->count += QIntC::to_offset(len);
|
|
|
|
m->last_char = buf[len - 1];
|
2022-02-08 14:18:08 +00:00
|
|
|
getNext()->write(buf, len);
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Pl_Count::finish()
|
|
|
|
{
|
|
|
|
getNext()->finish();
|
|
|
|
}
|
|
|
|
|
2012-06-21 23:32:21 +00:00
|
|
|
qpdf_offset_t
|
2008-04-29 12:55:25 +00:00
|
|
|
Pl_Count::getCount() const
|
|
|
|
{
|
2023-05-21 13:42:34 +00:00
|
|
|
return m->count;
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char
|
|
|
|
Pl_Count::getLastChar() const
|
|
|
|
{
|
2023-05-21 13:42:34 +00:00
|
|
|
return m->last_char;
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|