2008-04-29 12:55:25 +00:00
|
|
|
#include <qpdf/Pl_Count.hh>
|
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::Members::~Members()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Pl_Count::Pl_Count(char const* identifier, Pipeline* next) :
|
|
|
|
Pipeline(identifier, next),
|
|
|
|
m(new Members())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
Pl_Count::~Pl_Count()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-20 15:20:57 +00:00
|
|
|
Pl_Count::write(unsigned char* buf, size_t len)
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
|
|
|
if (len)
|
|
|
|
{
|
2019-06-22 01:32:47 +00:00
|
|
|
this->m->count += QIntC::to_offset(len);
|
2008-04-29 12:55:25 +00:00
|
|
|
getNext()->write(buf, len);
|
2019-06-22 01:32:47 +00:00
|
|
|
this->m->last_char = buf[len - 1];
|
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
|
|
|
|
{
|
2019-06-22 01:32:47 +00:00
|
|
|
return this->m->count;
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char
|
|
|
|
Pl_Count::getLastChar() const
|
|
|
|
{
|
2019-06-22 01:32:47 +00:00
|
|
|
return this->m->last_char;
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|