2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-15 17:17:08 +00:00
qpdf/libqpdf/Pl_MD5.cc
Jay Berkenbilt 492db82f6f more dll exports
git-svn-id: svn+q:///qpdf/trunk@697 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-26 15:15:33 +00:00

49 lines
754 B
C++

#include <qpdf/Pl_MD5.hh>
#include <qpdf/QEXC.hh>
DLL_EXPORT
Pl_MD5::Pl_MD5(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
in_progress(false)
{
}
DLL_EXPORT
Pl_MD5::~Pl_MD5()
{
}
DLL_EXPORT
void
Pl_MD5::write(unsigned char* buf, int len)
{
if (! this->in_progress)
{
this->md5.reset();
this->in_progress = true;
}
this->md5.encodeDataIncrementally((char*) buf, len);
this->getNext()->write(buf, len);
}
DLL_EXPORT
void
Pl_MD5::finish()
{
this->getNext()->finish();
this->in_progress = false;
}
DLL_EXPORT
std::string
Pl_MD5::getHexDigest()
{
if (this->in_progress)
{
throw QEXC::General("digest requested for in-progress MD5 Pipeline");
}
return this->md5.unparse();
}