2008-04-29 12:55:25 +00:00
|
|
|
#include <qpdf/Pipeline.hh>
|
2022-02-04 21:31:31 +00:00
|
|
|
|
2022-05-03 21:43:07 +00:00
|
|
|
#include <cstring>
|
2009-09-26 18:36:04 +00:00
|
|
|
#include <stdexcept>
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
Pipeline::Pipeline(char const* identifier, Pipeline* next) :
|
|
|
|
identifier(identifier),
|
2020-04-03 15:59:29 +00:00
|
|
|
next(next)
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Pipeline*
|
|
|
|
Pipeline::getNext(bool allow_null)
|
|
|
|
{
|
2022-07-26 11:37:50 +00:00
|
|
|
if ((this->next == nullptr) && (!allow_null)) {
|
2022-02-08 14:18:08 +00:00
|
|
|
throw std::logic_error(
|
2023-05-21 17:35:09 +00:00
|
|
|
this->identifier + ": Pipeline::getNext() called on pipeline with no next");
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
2020-04-03 15:59:29 +00:00
|
|
|
return this->next;
|
2008-04-29 12:55:25 +00:00
|
|
|
}
|
2019-08-28 02:10:11 +00:00
|
|
|
|
|
|
|
std::string
|
|
|
|
Pipeline::getIdentifier() const
|
|
|
|
{
|
|
|
|
return this->identifier;
|
|
|
|
}
|
2022-05-03 21:58:58 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2022-06-05 16:33:36 +00:00
|
|
|
Pipeline&
|
|
|
|
Pipeline::operator<<(short i)
|
|
|
|
{
|
2022-09-21 16:49:21 +00:00
|
|
|
this->writeString(std::to_string(i));
|
2022-06-05 16:33:36 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Pipeline&
|
|
|
|
Pipeline::operator<<(int i)
|
|
|
|
{
|
2022-09-21 16:49:21 +00:00
|
|
|
this->writeString(std::to_string(i));
|
2022-06-05 16:33:36 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Pipeline&
|
|
|
|
Pipeline::operator<<(long i)
|
|
|
|
{
|
2022-09-21 16:49:21 +00:00
|
|
|
this->writeString(std::to_string(i));
|
2022-06-05 16:33:36 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Pipeline&
|
|
|
|
Pipeline::operator<<(long long i)
|
|
|
|
{
|
2022-09-21 16:49:21 +00:00
|
|
|
this->writeString(std::to_string(i));
|
2022-06-05 16:33:36 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Pipeline&
|
|
|
|
Pipeline::operator<<(unsigned short i)
|
|
|
|
{
|
2022-09-21 16:49:21 +00:00
|
|
|
this->writeString(std::to_string(i));
|
2022-06-05 16:33:36 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Pipeline&
|
|
|
|
Pipeline::operator<<(unsigned int i)
|
|
|
|
{
|
2022-09-21 16:49:21 +00:00
|
|
|
this->writeString(std::to_string(i));
|
2022-06-05 16:33:36 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Pipeline&
|
|
|
|
Pipeline::operator<<(unsigned long i)
|
|
|
|
{
|
2022-09-21 16:49:21 +00:00
|
|
|
this->writeString(std::to_string(i));
|
2022-06-05 16:33:36 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Pipeline&
|
|
|
|
Pipeline::operator<<(unsigned long long i)
|
|
|
|
{
|
2022-09-21 16:49:21 +00:00
|
|
|
this->writeString(std::to_string(i));
|
2022-06-05 16:33:36 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2022-05-03 21:58:58 +00:00
|
|
|
void
|
|
|
|
Pipeline::write(char const* data, size_t len)
|
|
|
|
{
|
|
|
|
this->write(reinterpret_cast<unsigned char const*>(data), len);
|
|
|
|
}
|