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