aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFJob.cc14
-rw-r--r--libqpdf/QPDFJob_argv.cc11
-rw-r--r--libqpdf/QPDFJob_config.cc7
3 files changed, 24 insertions, 8 deletions
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc
index 8c185366..487201f8 100644
--- a/libqpdf/QPDFJob.cc
+++ b/libqpdf/QPDFJob.cc
@@ -324,7 +324,8 @@ QPDFJob::Members::Members() :
warnings(false),
cout(&std::cout),
cerr(&std::cerr),
- encryption_status(0)
+ encryption_status(0),
+ verbose(false)
{
}
@@ -333,7 +334,6 @@ QPDFJob::QPDFJob() :
linearize(false),
decrypt(false),
split_pages(0),
- verbose(false),
progress(false),
suppress_warnings(false),
warnings_exit_zero(false),
@@ -447,12 +447,18 @@ void
QPDFJob::doIfVerbose(
std::function<void(std::ostream&, std::string const& prefix)> fn)
{
- if (this->verbose && (this->m->cout != nullptr))
+ if (this->m->verbose && (this->m->cout != nullptr))
{
fn(*(this->m->cout), this->m->message_prefix);
}
}
+QPDFJob::Config
+QPDFJob::config()
+{
+ return Config(*this);
+}
+
void
QPDFJob::run()
{
@@ -596,7 +602,7 @@ QPDFJob::checkConfiguration()
usage("--split-pages may not be used when"
" writing to standard output");
}
- if (o.verbose)
+ if (this->m->verbose)
{
usage("--verbose may not be used when"
" writing to standard output");
diff --git a/libqpdf/QPDFJob_argv.cc b/libqpdf/QPDFJob_argv.cc
index f19026d1..87f5af2a 100644
--- a/libqpdf/QPDFJob_argv.cc
+++ b/libqpdf/QPDFJob_argv.cc
@@ -26,7 +26,7 @@ namespace
class ArgParser
{
public:
- ArgParser(QPDFArgParser& ap, QPDFJob& o);
+ ArgParser(QPDFArgParser& ap, QPDFJob::Config& jc, QPDFJob& o);
void parseOptions();
private:
@@ -42,14 +42,16 @@ namespace
QPDFArgParser ap;
QPDFJob& o;
+ QPDFJob::Config& jc;
std::vector<char*> accumulated_args; // points to member in ap
char* pages_password;
};
}
-ArgParser::ArgParser(QPDFArgParser& ap, QPDFJob& o) :
+ArgParser::ArgParser(QPDFArgParser& ap, QPDFJob::Config& jc, QPDFJob& o) :
ap(ap),
o(o),
+ jc(jc),
pages_password(nullptr)
{
initOptionTables();
@@ -803,7 +805,7 @@ void
ArgParser::argVerbose()
{
// QXXXQ @TRIVIAL
- o.verbose = true;
+ jc.verbose(true);
}
void
@@ -1558,7 +1560,8 @@ QPDFJob::initializeFromArgv(int argc, char* argv[], char const* progname_env)
}
QPDFArgParser qap(argc, argv, progname_env);
setMessagePrefix(qap.getProgname());
- ArgParser ap(qap, *this);
+ auto jc = config();
+ ArgParser ap(qap, jc, *this);
ap.parseOptions();
}
diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc
index 0dfc7e14..07500f05 100644
--- a/libqpdf/QPDFJob_config.cc
+++ b/libqpdf/QPDFJob_config.cc
@@ -1 +1,8 @@
#include <qpdf/QPDFJob.hh>
+
+QPDFJob::Config&
+QPDFJob::Config::verbose(bool)
+{
+ o.m->verbose = true;
+ return *this;
+}