mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-15 09:14:03 +00:00
40 lines
673 B
C++
40 lines
673 B
C++
|
#include <qpdf/Pl_Function.hh>
|
||
|
|
||
|
#include <qpdf/QUtil.hh>
|
||
|
#include <errno.h>
|
||
|
#include <stdexcept>
|
||
|
|
||
|
Pl_Function::Members::Members(writer_t fn) :
|
||
|
fn(fn)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
Pl_Function::Pl_Function(char const* identifier, Pipeline* next, writer_t fn) :
|
||
|
Pipeline(identifier, next),
|
||
|
m(new Members(fn))
|
||
|
{
|
||
|
}
|
||
|
|
||
|
Pl_Function::~Pl_Function()
|
||
|
{
|
||
|
// Must be explicit and not inline -- see QPDF_DLL_CLASS in
|
||
|
// README-maintainer
|
||
|
}
|
||
|
|
||
|
void
|
||
|
Pl_Function::write(unsigned char const* buf, size_t len)
|
||
|
{
|
||
|
this->m->fn(buf, len);
|
||
|
if (getNext(true)) {
|
||
|
getNext()->write(buf, len);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void
|
||
|
Pl_Function::finish()
|
||
|
{
|
||
|
if (getNext(true)) {
|
||
|
getNext()->finish();
|
||
|
}
|
||
|
}
|