From 21c897aad0c3edc6e47e88754ab279e0f076cd06 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 25 Jan 2022 11:07:53 -0500 Subject: QPDFJob: convert a flag in other than the main table --- libqpdf/QPDFJob_config.cc | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'libqpdf/QPDFJob_config.cc') diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc index ac038aa9..923d9302 100644 --- a/libqpdf/QPDFJob_config.cc +++ b/libqpdf/QPDFJob_config.cc @@ -489,3 +489,46 @@ QPDFJob::Config::withImages() o.show_page_images = true; return *this; } + +std::shared_ptr +QPDFJob::Config::copyAttachmentsFrom() +{ + return std::shared_ptr(new CopyAttConfig(*this)); +} + +QPDFJob::CopyAttConfig::CopyAttConfig(Config& c) : + config(c) +{ +} + +QPDFJob::CopyAttConfig& +QPDFJob::CopyAttConfig::filename(char const* parameter) +{ + this->caf.path = parameter; + return *this; +} + +QPDFJob::CopyAttConfig& +QPDFJob::CopyAttConfig::prefix(char const* parameter) +{ + this->caf.prefix = parameter; + return *this; +} + +QPDFJob::CopyAttConfig& +QPDFJob::CopyAttConfig::password(char const* parameter) +{ + this->caf.password = parameter; + return *this; +} + +QPDFJob::Config& +QPDFJob::CopyAttConfig::end() +{ + if (this->caf.path.empty()) + { + throw std::runtime_error("copy attachments: no path specified"); + } + this->config.o.attachments_to_copy.push_back(this->caf); + return this->config; +} -- cgit v1.2.3-54-g00ecf