mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-02 11:46:35 +00:00
60 lines
1.0 KiB
C++
60 lines
1.0 KiB
C++
#include <qpdf/Pipeline.hh>
|
|
|
|
#include <cstring>
|
|
#include <stdexcept>
|
|
|
|
Pipeline::Pipeline(char const* identifier, Pipeline* next) :
|
|
identifier(identifier),
|
|
next(next)
|
|
{
|
|
}
|
|
|
|
Pipeline*
|
|
Pipeline::getNext(bool allow_null)
|
|
{
|
|
if ((this->next == 0) && (!allow_null)) {
|
|
throw std::logic_error(
|
|
this->identifier +
|
|
": Pipeline::getNext() called on pipeline with no next");
|
|
}
|
|
return this->next;
|
|
}
|
|
|
|
std::string
|
|
Pipeline::getIdentifier() const
|
|
{
|
|
return this->identifier;
|
|
}
|
|
|
|
void
|
|
Pipeline::writeCStr(char const* cstr)
|
|
{
|
|
this->write(cstr, strlen(cstr));
|
|
}
|
|
|
|
void
|
|
Pipeline::writeString(std::string const& str)
|
|
{
|
|
this->write(str.c_str(), str.length());
|
|
}
|
|
|
|
Pipeline&
|
|
Pipeline::operator<<(char const* cstr)
|
|
{
|
|
this->writeCStr(cstr);
|
|
return *this;
|
|
}
|
|
|
|
Pipeline&
|
|
Pipeline::operator<<(std::string const& str)
|
|
{
|
|
this->writeString(str);
|
|
return *this;
|
|
}
|
|
|
|
void
|
|
Pipeline::write(char const* data, size_t len)
|
|
{
|
|
this->write(reinterpret_cast<unsigned char const*>(data), len);
|
|
}
|