Commit 564dc036072803d2ee9018f892e2d3a6570387fa

Authored by Jay Berkenbilt
1 parent 1d099ab7

QPDFJob: start real API

Create QPDFJob_options.cc to hold API implementation functions.
Reorganize a little in preparation for moving public member variables
private and creating the real QPDFJob API that will be used by callers
as well as the argv/json initialization methods.
include/qpdf/QPDFJob.hh
... ... @@ -45,6 +45,8 @@ class QPDFJob
45 45 QPDF_DLL
46 46 QPDFJob();
47 47  
  48 + // SETUP FUNCTIONS
  49 +
48 50 // Initialize a QPDFJob object from argv. The progname_env
49 51 // argument is the name of an environment variable which, if set,
50 52 // overrides the name of the executable for purposes of generating
... ... @@ -83,37 +85,46 @@ class QPDFJob
83 85 QPDF_DLL
84 86 void setOutputStreams(std::ostream* out_stream, std::ostream* err_stream);
85 87  
86   - // If in verbose mode, call the given function, passing in the
87   - // output stream and message prefix.
88   - QPDF_DLL
89   - void doIfVerbose(
90   - std::function<void(std::ostream&, std::string const& prefix)> fn);
  88 + // QXXXQ set options -- implemented in QPDFJob_options.cc
91 89  
  90 + // QXXXQ these will not be in the final interface
92 91 QPDF_DLL
93   - void run();
94   -
  92 + bool suppressWarnings();
95 93 QPDF_DLL
96   - bool hasWarnings();
97   -
  94 + bool warningsExitZero();
98 95 QPDF_DLL
99   - bool createsOutput();
100   -
  96 + bool checkRequiresPassword();
101 97 QPDF_DLL
102   - bool suppressWarnings();
  98 + bool checkIsEncrypted();
  99 + // /QXXXQ
103 100  
  101 + // Execute the job
104 102 QPDF_DLL
105   - bool warningsExitZero();
  103 + void run();
  104 +
  105 + // CHECK STATUS -- these methods provide information known after
  106 + // run() is called.
106 107  
107 108 QPDF_DLL
108   - bool checkRequiresPassword();
  109 + bool hasWarnings();
109 110  
110 111 QPDF_DLL
111   - bool checkIsEncrypted();
  112 + bool createsOutput(); // QXXXQ need better name
112 113  
113 114 // Return value is bitwise OR of values from qpdf_encryption_status_e
114 115 QPDF_DLL
115 116 unsigned long getEncryptionStatus();
116 117  
  118 + // HELPER FUNCTIONS -- methods useful for calling in handlers that
  119 + // interact with QPDFJob during run or initialization.
  120 +
  121 + // If in verbose mode, call the given function, passing in the
  122 + // output stream and message prefix.
  123 + QPDF_DLL
  124 + void doIfVerbose(
  125 + std::function<void(std::ostream&, std::string const& prefix)> fn);
  126 +
  127 +
117 128 // QXXXQ From here to END-PUBLIC should all be private or
118 129 // different somehow
119 130 public:
... ...
libqpdf/QPDFJob_config.cc 0 → 100644
  1 +#include <qpdf/QPDFJob.hh>
... ...
libqpdf/build.mk
... ... @@ -73,6 +73,7 @@ SRCS_libqpdf = \
73 73 libqpdf/QPDFFormFieldObjectHelper.cc \
74 74 libqpdf/QPDFJob.cc \
75 75 libqpdf/QPDFJob_argv.cc \
  76 + libqpdf/QPDFJob_config.cc \
76 77 libqpdf/QPDFMatrix.cc \
77 78 libqpdf/QPDFNameTreeObjectHelper.cc \
78 79 libqpdf/QPDFNumberTreeObjectHelper.cc \
... ...