From f1c6bb97db659faf84e59dbe973b969e9fc1a066 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 3 May 2022 17:58:58 -0400 Subject: Add new Pipeline convenience methods --- libqpdf/Pipeline.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'libqpdf') diff --git a/libqpdf/Pipeline.cc b/libqpdf/Pipeline.cc index b63dff9f..12a98d04 100644 --- a/libqpdf/Pipeline.cc +++ b/libqpdf/Pipeline.cc @@ -25,3 +25,35 @@ 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(data), len); +} -- cgit v1.2.3-70-g09d2