mirror of
https://github.com/qpdf/qpdf.git
synced 2024-06-07 12:50:52 +00:00
QPDFJob: switch to C++11-style field initializers
This commit is contained in:
parent
d16308b3f5
commit
acfc9db051
|
@ -586,135 +586,142 @@ class QPDFJob
|
||||||
~Members() = default;
|
~Members() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// These default values are duplicated in help and docs.
|
||||||
|
static int constexpr DEFAULT_KEEP_FILES_OPEN_THRESHOLD = 200;
|
||||||
|
static int constexpr DEFAULT_OI_MIN_WIDTH = 128;
|
||||||
|
static int constexpr DEFAULT_OI_MIN_HEIGHT = 128;
|
||||||
|
static int constexpr DEFAULT_OI_MIN_AREA = 16384;
|
||||||
|
static int constexpr DEFAULT_II_MIN_BYTES = 1024;
|
||||||
|
|
||||||
Members();
|
Members();
|
||||||
Members(Members const&) = delete;
|
Members(Members const&) = delete;
|
||||||
|
|
||||||
std::shared_ptr<QPDFLogger> log;
|
std::shared_ptr<QPDFLogger> log;
|
||||||
std::string message_prefix;
|
std::string message_prefix{"qpdf"};
|
||||||
bool warnings;
|
bool warnings{false};
|
||||||
unsigned long encryption_status;
|
unsigned long encryption_status{0};
|
||||||
bool verbose;
|
bool verbose{false};
|
||||||
std::shared_ptr<char> password;
|
std::shared_ptr<char> password;
|
||||||
bool linearize;
|
bool linearize{false};
|
||||||
bool decrypt;
|
bool decrypt{false};
|
||||||
int split_pages;
|
int split_pages{0};
|
||||||
bool progress;
|
bool progress{false};
|
||||||
std::function<void(int)> progress_handler;
|
std::function<void(int)> progress_handler{nullptr};
|
||||||
bool suppress_warnings;
|
bool suppress_warnings{false};
|
||||||
bool warnings_exit_zero;
|
bool warnings_exit_zero{false};
|
||||||
bool copy_encryption;
|
bool copy_encryption{false};
|
||||||
std::string encryption_file;
|
std::string encryption_file;
|
||||||
std::shared_ptr<char> encryption_file_password;
|
std::shared_ptr<char> encryption_file_password;
|
||||||
bool encrypt;
|
bool encrypt{false};
|
||||||
bool password_is_hex_key;
|
bool password_is_hex_key{false};
|
||||||
bool suppress_password_recovery;
|
bool suppress_password_recovery{false};
|
||||||
password_mode_e password_mode;
|
password_mode_e password_mode{pm_auto};
|
||||||
bool allow_insecure;
|
bool allow_insecure{false};
|
||||||
bool allow_weak_crypto;
|
bool allow_weak_crypto{false};
|
||||||
std::string user_password;
|
std::string user_password;
|
||||||
std::string owner_password;
|
std::string owner_password;
|
||||||
int keylen;
|
int keylen{0};
|
||||||
bool r2_print;
|
bool r2_print{true};
|
||||||
bool r2_modify;
|
bool r2_modify{true};
|
||||||
bool r2_extract;
|
bool r2_extract{true};
|
||||||
bool r2_annotate;
|
bool r2_annotate{true};
|
||||||
bool r3_accessibility;
|
bool r3_accessibility{true};
|
||||||
bool r3_extract;
|
bool r3_extract{true};
|
||||||
bool r3_assemble;
|
bool r3_assemble{true};
|
||||||
bool r3_annotate_and_form;
|
bool r3_annotate_and_form{true};
|
||||||
bool r3_form_filling;
|
bool r3_form_filling{true};
|
||||||
bool r3_modify_other;
|
bool r3_modify_other{true};
|
||||||
qpdf_r3_print_e r3_print;
|
qpdf_r3_print_e r3_print{qpdf_r3p_full};
|
||||||
bool force_V4;
|
bool force_V4{false};
|
||||||
bool force_R5;
|
bool force_R5{false};
|
||||||
bool cleartext_metadata;
|
bool cleartext_metadata{false};
|
||||||
bool use_aes;
|
bool use_aes{false};
|
||||||
bool stream_data_set;
|
bool stream_data_set{false};
|
||||||
qpdf_stream_data_e stream_data_mode;
|
qpdf_stream_data_e stream_data_mode{qpdf_s_compress};
|
||||||
bool compress_streams;
|
bool compress_streams{true};
|
||||||
bool compress_streams_set;
|
bool compress_streams_set{false};
|
||||||
bool recompress_flate;
|
bool recompress_flate{false};
|
||||||
bool recompress_flate_set;
|
bool recompress_flate_set{false};
|
||||||
int compression_level;
|
int compression_level{-1};
|
||||||
qpdf_stream_decode_level_e decode_level;
|
qpdf_stream_decode_level_e decode_level{qpdf_dl_generalized};
|
||||||
bool decode_level_set;
|
bool decode_level_set{false};
|
||||||
bool normalize_set;
|
bool normalize_set{false};
|
||||||
bool normalize;
|
bool normalize{false};
|
||||||
bool suppress_recovery;
|
bool suppress_recovery{false};
|
||||||
bool object_stream_set;
|
bool object_stream_set{false};
|
||||||
qpdf_object_stream_e object_stream_mode;
|
qpdf_object_stream_e object_stream_mode{qpdf_o_preserve};
|
||||||
bool ignore_xref_streams;
|
bool ignore_xref_streams{false};
|
||||||
bool qdf_mode;
|
bool qdf_mode{false};
|
||||||
bool preserve_unreferenced_objects;
|
bool preserve_unreferenced_objects{false};
|
||||||
remove_unref_e remove_unreferenced_page_resources;
|
remove_unref_e remove_unreferenced_page_resources{re_auto};
|
||||||
bool keep_files_open;
|
bool keep_files_open{true};
|
||||||
bool keep_files_open_set;
|
bool keep_files_open_set{false};
|
||||||
size_t keep_files_open_threshold;
|
size_t keep_files_open_threshold{DEFAULT_KEEP_FILES_OPEN_THRESHOLD};
|
||||||
bool newline_before_endstream;
|
bool newline_before_endstream{false};
|
||||||
std::string linearize_pass1;
|
std::string linearize_pass1;
|
||||||
bool coalesce_contents;
|
bool coalesce_contents{false};
|
||||||
bool flatten_annotations;
|
bool flatten_annotations{false};
|
||||||
int flatten_annotations_required;
|
int flatten_annotations_required{0};
|
||||||
int flatten_annotations_forbidden;
|
int flatten_annotations_forbidden{an_invisible | an_hidden};
|
||||||
bool generate_appearances;
|
bool generate_appearances{false};
|
||||||
PDFVersion max_input_version;
|
PDFVersion max_input_version;
|
||||||
std::string min_version;
|
std::string min_version;
|
||||||
std::string force_version;
|
std::string force_version;
|
||||||
bool show_npages;
|
bool show_npages{false};
|
||||||
bool deterministic_id;
|
bool deterministic_id{false};
|
||||||
bool static_id;
|
bool static_id{false};
|
||||||
bool static_aes_iv;
|
bool static_aes_iv{false};
|
||||||
bool suppress_original_object_id;
|
bool suppress_original_object_id{false};
|
||||||
bool show_encryption;
|
bool show_encryption{false};
|
||||||
bool show_encryption_key;
|
bool show_encryption_key{false};
|
||||||
bool check_linearization;
|
bool check_linearization{false};
|
||||||
bool show_linearization;
|
bool show_linearization{false};
|
||||||
bool show_xref;
|
bool show_xref{false};
|
||||||
bool show_trailer;
|
bool show_trailer{false};
|
||||||
int show_obj;
|
int show_obj{0};
|
||||||
int show_gen;
|
int show_gen{0};
|
||||||
bool show_raw_stream_data;
|
bool show_raw_stream_data{false};
|
||||||
bool show_filtered_stream_data;
|
bool show_filtered_stream_data{false};
|
||||||
bool show_pages;
|
bool show_pages{false};
|
||||||
bool show_page_images;
|
bool show_page_images{false};
|
||||||
size_t collate;
|
size_t collate{0};
|
||||||
bool flatten_rotation;
|
bool flatten_rotation{false};
|
||||||
bool list_attachments;
|
bool list_attachments{false};
|
||||||
std::string attachment_to_show;
|
std::string attachment_to_show;
|
||||||
std::list<std::string> attachments_to_remove;
|
std::list<std::string> attachments_to_remove;
|
||||||
std::list<AddAttachment> attachments_to_add;
|
std::list<AddAttachment> attachments_to_add;
|
||||||
std::list<CopyAttachmentFrom> attachments_to_copy;
|
std::list<CopyAttachmentFrom> attachments_to_copy;
|
||||||
int json_version;
|
int json_version{0};
|
||||||
std::set<std::string> json_keys;
|
std::set<std::string> json_keys;
|
||||||
std::set<std::string> json_objects;
|
std::set<std::string> json_objects;
|
||||||
qpdf_json_stream_data_e json_stream_data;
|
qpdf_json_stream_data_e json_stream_data{qpdf_sj_none};
|
||||||
bool json_stream_data_set;
|
bool json_stream_data_set{false};
|
||||||
std::string json_stream_prefix;
|
std::string json_stream_prefix;
|
||||||
bool test_json_schema;
|
bool test_json_schema{false};
|
||||||
bool check;
|
bool check{false};
|
||||||
bool optimize_images;
|
bool optimize_images{false};
|
||||||
bool externalize_inline_images;
|
bool externalize_inline_images{false};
|
||||||
bool keep_inline_images;
|
bool keep_inline_images{false};
|
||||||
bool remove_page_labels;
|
bool remove_page_labels{false};
|
||||||
size_t oi_min_width;
|
size_t oi_min_width{DEFAULT_OI_MIN_WIDTH};
|
||||||
size_t oi_min_height;
|
size_t oi_min_height{DEFAULT_OI_MIN_HEIGHT};
|
||||||
size_t oi_min_area;
|
size_t oi_min_area{DEFAULT_OI_MIN_AREA};
|
||||||
size_t ii_min_bytes;
|
size_t ii_min_bytes{DEFAULT_II_MIN_BYTES};
|
||||||
UnderOverlay underlay;
|
UnderOverlay underlay{"underlay"};
|
||||||
UnderOverlay overlay;
|
UnderOverlay overlay{"overlay"};
|
||||||
UnderOverlay* under_overlay;
|
UnderOverlay* under_overlay{nullptr};
|
||||||
std::vector<PageSpec> page_specs;
|
std::vector<PageSpec> page_specs;
|
||||||
std::map<std::string, RotationSpec> rotations;
|
std::map<std::string, RotationSpec> rotations;
|
||||||
bool require_outfile;
|
bool require_outfile{true};
|
||||||
bool replace_input;
|
bool replace_input{false};
|
||||||
bool check_is_encrypted;
|
bool check_is_encrypted{false};
|
||||||
bool check_requires_password;
|
bool check_requires_password{false};
|
||||||
std::shared_ptr<char> infilename;
|
std::shared_ptr<char> infilename;
|
||||||
std::shared_ptr<char> outfilename;
|
std::shared_ptr<char> outfilename;
|
||||||
bool json_input;
|
bool json_input{false};
|
||||||
bool json_output;
|
bool json_output{false};
|
||||||
std::string update_from_json;
|
std::string update_from_json;
|
||||||
bool report_mem_usage;
|
bool report_mem_usage{false};
|
||||||
};
|
};
|
||||||
std::shared_ptr<Members> m;
|
std::shared_ptr<Members> m;
|
||||||
};
|
};
|
||||||
|
|
|
@ -304,121 +304,8 @@ ProgressReporter::reportProgress(int percentage)
|
||||||
<< "%\n";
|
<< "%\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// These default values are duplicated in help and docs.
|
|
||||||
static int constexpr DEFAULT_KEEP_FILES_OPEN_THRESHOLD = 200;
|
|
||||||
static int constexpr DEFAULT_OI_MIN_WIDTH = 128;
|
|
||||||
static int constexpr DEFAULT_OI_MIN_HEIGHT = 128;
|
|
||||||
static int constexpr DEFAULT_OI_MIN_AREA = 16384;
|
|
||||||
static int constexpr DEFAULT_II_MIN_BYTES = 1024;
|
|
||||||
|
|
||||||
QPDFJob::Members::Members() :
|
QPDFJob::Members::Members() :
|
||||||
log(QPDFLogger::defaultLogger()),
|
log(QPDFLogger::defaultLogger())
|
||||||
message_prefix("qpdf"),
|
|
||||||
warnings(false),
|
|
||||||
encryption_status(0),
|
|
||||||
verbose(false),
|
|
||||||
password(nullptr),
|
|
||||||
linearize(false),
|
|
||||||
decrypt(false),
|
|
||||||
split_pages(0),
|
|
||||||
progress(false),
|
|
||||||
progress_handler(nullptr),
|
|
||||||
suppress_warnings(false),
|
|
||||||
warnings_exit_zero(false),
|
|
||||||
copy_encryption(false),
|
|
||||||
encryption_file_password(nullptr),
|
|
||||||
encrypt(false),
|
|
||||||
password_is_hex_key(false),
|
|
||||||
suppress_password_recovery(false),
|
|
||||||
password_mode(pm_auto),
|
|
||||||
allow_insecure(false),
|
|
||||||
allow_weak_crypto(false),
|
|
||||||
keylen(0),
|
|
||||||
r2_print(true),
|
|
||||||
r2_modify(true),
|
|
||||||
r2_extract(true),
|
|
||||||
r2_annotate(true),
|
|
||||||
r3_accessibility(true),
|
|
||||||
r3_extract(true),
|
|
||||||
r3_assemble(true),
|
|
||||||
r3_annotate_and_form(true),
|
|
||||||
r3_form_filling(true),
|
|
||||||
r3_modify_other(true),
|
|
||||||
r3_print(qpdf_r3p_full),
|
|
||||||
force_V4(false),
|
|
||||||
force_R5(false),
|
|
||||||
cleartext_metadata(false),
|
|
||||||
use_aes(false),
|
|
||||||
stream_data_set(false),
|
|
||||||
stream_data_mode(qpdf_s_compress),
|
|
||||||
compress_streams(true),
|
|
||||||
compress_streams_set(false),
|
|
||||||
recompress_flate(false),
|
|
||||||
recompress_flate_set(false),
|
|
||||||
compression_level(-1),
|
|
||||||
decode_level(qpdf_dl_generalized),
|
|
||||||
decode_level_set(false),
|
|
||||||
normalize_set(false),
|
|
||||||
normalize(false),
|
|
||||||
suppress_recovery(false),
|
|
||||||
object_stream_set(false),
|
|
||||||
object_stream_mode(qpdf_o_preserve),
|
|
||||||
ignore_xref_streams(false),
|
|
||||||
qdf_mode(false),
|
|
||||||
preserve_unreferenced_objects(false),
|
|
||||||
remove_unreferenced_page_resources(re_auto),
|
|
||||||
keep_files_open(true),
|
|
||||||
keep_files_open_set(false),
|
|
||||||
keep_files_open_threshold(DEFAULT_KEEP_FILES_OPEN_THRESHOLD),
|
|
||||||
newline_before_endstream(false),
|
|
||||||
coalesce_contents(false),
|
|
||||||
flatten_annotations(false),
|
|
||||||
flatten_annotations_required(0),
|
|
||||||
flatten_annotations_forbidden(an_invisible | an_hidden),
|
|
||||||
generate_appearances(false),
|
|
||||||
show_npages(false),
|
|
||||||
deterministic_id(false),
|
|
||||||
static_id(false),
|
|
||||||
static_aes_iv(false),
|
|
||||||
suppress_original_object_id(false),
|
|
||||||
show_encryption(false),
|
|
||||||
show_encryption_key(false),
|
|
||||||
check_linearization(false),
|
|
||||||
show_linearization(false),
|
|
||||||
show_xref(false),
|
|
||||||
show_trailer(false),
|
|
||||||
show_obj(0),
|
|
||||||
show_gen(0),
|
|
||||||
show_raw_stream_data(false),
|
|
||||||
show_filtered_stream_data(false),
|
|
||||||
show_pages(false),
|
|
||||||
show_page_images(false),
|
|
||||||
collate(0),
|
|
||||||
flatten_rotation(false),
|
|
||||||
list_attachments(false),
|
|
||||||
json_version(0),
|
|
||||||
json_stream_data(qpdf_sj_none),
|
|
||||||
json_stream_data_set(false),
|
|
||||||
test_json_schema(false),
|
|
||||||
check(false),
|
|
||||||
optimize_images(false),
|
|
||||||
externalize_inline_images(false),
|
|
||||||
keep_inline_images(false),
|
|
||||||
remove_page_labels(false),
|
|
||||||
oi_min_width(DEFAULT_OI_MIN_WIDTH),
|
|
||||||
oi_min_height(DEFAULT_OI_MIN_HEIGHT),
|
|
||||||
oi_min_area(DEFAULT_OI_MIN_AREA),
|
|
||||||
ii_min_bytes(DEFAULT_II_MIN_BYTES),
|
|
||||||
underlay("underlay"),
|
|
||||||
overlay("overlay"),
|
|
||||||
under_overlay(nullptr),
|
|
||||||
require_outfile(true),
|
|
||||||
replace_input(false),
|
|
||||||
check_is_encrypted(false),
|
|
||||||
check_requires_password(false),
|
|
||||||
json_input(false),
|
|
||||||
json_output(false),
|
|
||||||
report_mem_usage(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user