2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-09-20 00:59:17 +00:00
qpdf/libqpdf/Pl_MD5.cc
Jay Berkenbilt 44cbd3d4b4 do DLL_EXPORT only in header files and only at the class or top-level function level
git-svn-id: svn+q:///qpdf/trunk@796 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-12 01:15:55 +00:00

43 lines
703 B
C++

#include <qpdf/Pl_MD5.hh>
#include <stdexcept>
Pl_MD5::Pl_MD5(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
in_progress(false)
{
}
Pl_MD5::~Pl_MD5()
{
}
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);
}
void
Pl_MD5::finish()
{
this->getNext()->finish();
this->in_progress = false;
}
std::string
Pl_MD5::getHexDigest()
{
if (this->in_progress)
{
throw std::logic_error(
"digest requested for in-progress MD5 Pipeline");
}
return this->md5.unparse();
}