From acfc9db0515559cdcc56104ba1ec2082b09b0b8f Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 28 Jan 2023 13:23:18 -0500 Subject: QPDFJob: switch to C++11-style field initializers --- include/qpdf/QPDFJob.hh | 215 +++++++++++++++++++++++++----------------------- 1 file changed, 111 insertions(+), 104 deletions(-) (limited to 'include') diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh index b12c052a..c5cc70b9 100644 --- a/include/qpdf/QPDFJob.hh +++ b/include/qpdf/QPDFJob.hh @@ -586,135 +586,142 @@ class QPDFJob ~Members() = default; 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 const&) = delete; std::shared_ptr log; - std::string message_prefix; - bool warnings; - unsigned long encryption_status; - bool verbose; + std::string message_prefix{"qpdf"}; + bool warnings{false}; + unsigned long encryption_status{0}; + bool verbose{false}; std::shared_ptr password; - bool linearize; - bool decrypt; - int split_pages; - bool progress; - std::function progress_handler; - bool suppress_warnings; - bool warnings_exit_zero; - bool copy_encryption; + bool linearize{false}; + bool decrypt{false}; + int split_pages{0}; + bool progress{false}; + std::function progress_handler{nullptr}; + bool suppress_warnings{false}; + bool warnings_exit_zero{false}; + bool copy_encryption{false}; std::string encryption_file; std::shared_ptr encryption_file_password; - bool encrypt; - bool password_is_hex_key; - bool suppress_password_recovery; - password_mode_e password_mode; - bool allow_insecure; - bool allow_weak_crypto; + bool encrypt{false}; + bool password_is_hex_key{false}; + bool suppress_password_recovery{false}; + password_mode_e password_mode{pm_auto}; + bool allow_insecure{false}; + bool allow_weak_crypto{false}; std::string user_password; std::string owner_password; - int keylen; - bool r2_print; - bool r2_modify; - bool r2_extract; - bool r2_annotate; - bool r3_accessibility; - bool r3_extract; - bool r3_assemble; - bool r3_annotate_and_form; - bool r3_form_filling; - bool r3_modify_other; - qpdf_r3_print_e r3_print; - bool force_V4; - bool force_R5; - bool cleartext_metadata; - bool use_aes; - bool stream_data_set; - qpdf_stream_data_e stream_data_mode; - bool compress_streams; - bool compress_streams_set; - bool recompress_flate; - bool recompress_flate_set; - int compression_level; - qpdf_stream_decode_level_e decode_level; - bool decode_level_set; - bool normalize_set; - bool normalize; - bool suppress_recovery; - bool object_stream_set; - qpdf_object_stream_e object_stream_mode; - bool ignore_xref_streams; - bool qdf_mode; - bool preserve_unreferenced_objects; - remove_unref_e remove_unreferenced_page_resources; - bool keep_files_open; - bool keep_files_open_set; - size_t keep_files_open_threshold; - bool newline_before_endstream; + int keylen{0}; + bool r2_print{true}; + bool r2_modify{true}; + bool r2_extract{true}; + bool r2_annotate{true}; + bool r3_accessibility{true}; + bool r3_extract{true}; + bool r3_assemble{true}; + bool r3_annotate_and_form{true}; + bool r3_form_filling{true}; + bool r3_modify_other{true}; + qpdf_r3_print_e r3_print{qpdf_r3p_full}; + bool force_V4{false}; + bool force_R5{false}; + bool cleartext_metadata{false}; + bool use_aes{false}; + bool stream_data_set{false}; + qpdf_stream_data_e stream_data_mode{qpdf_s_compress}; + bool compress_streams{true}; + bool compress_streams_set{false}; + bool recompress_flate{false}; + bool recompress_flate_set{false}; + int compression_level{-1}; + qpdf_stream_decode_level_e decode_level{qpdf_dl_generalized}; + bool decode_level_set{false}; + bool normalize_set{false}; + bool normalize{false}; + bool suppress_recovery{false}; + bool object_stream_set{false}; + qpdf_object_stream_e object_stream_mode{qpdf_o_preserve}; + bool ignore_xref_streams{false}; + bool qdf_mode{false}; + bool preserve_unreferenced_objects{false}; + remove_unref_e remove_unreferenced_page_resources{re_auto}; + bool keep_files_open{true}; + bool keep_files_open_set{false}; + size_t keep_files_open_threshold{DEFAULT_KEEP_FILES_OPEN_THRESHOLD}; + bool newline_before_endstream{false}; std::string linearize_pass1; - bool coalesce_contents; - bool flatten_annotations; - int flatten_annotations_required; - int flatten_annotations_forbidden; - bool generate_appearances; + bool coalesce_contents{false}; + bool flatten_annotations{false}; + int flatten_annotations_required{0}; + int flatten_annotations_forbidden{an_invisible | an_hidden}; + bool generate_appearances{false}; PDFVersion max_input_version; std::string min_version; std::string force_version; - bool show_npages; - bool deterministic_id; - bool static_id; - bool static_aes_iv; - bool suppress_original_object_id; - bool show_encryption; - bool show_encryption_key; - bool check_linearization; - bool show_linearization; - bool show_xref; - bool show_trailer; - int show_obj; - int show_gen; - bool show_raw_stream_data; - bool show_filtered_stream_data; - bool show_pages; - bool show_page_images; - size_t collate; - bool flatten_rotation; - bool list_attachments; + bool show_npages{false}; + bool deterministic_id{false}; + bool static_id{false}; + bool static_aes_iv{false}; + bool suppress_original_object_id{false}; + bool show_encryption{false}; + bool show_encryption_key{false}; + bool check_linearization{false}; + bool show_linearization{false}; + bool show_xref{false}; + bool show_trailer{false}; + int show_obj{0}; + int show_gen{0}; + bool show_raw_stream_data{false}; + bool show_filtered_stream_data{false}; + bool show_pages{false}; + bool show_page_images{false}; + size_t collate{0}; + bool flatten_rotation{false}; + bool list_attachments{false}; std::string attachment_to_show; std::list attachments_to_remove; std::list attachments_to_add; std::list attachments_to_copy; - int json_version; + int json_version{0}; std::set json_keys; std::set json_objects; - qpdf_json_stream_data_e json_stream_data; - bool json_stream_data_set; + qpdf_json_stream_data_e json_stream_data{qpdf_sj_none}; + bool json_stream_data_set{false}; std::string json_stream_prefix; - bool test_json_schema; - bool check; - bool optimize_images; - bool externalize_inline_images; - bool keep_inline_images; - bool remove_page_labels; - size_t oi_min_width; - size_t oi_min_height; - size_t oi_min_area; - size_t ii_min_bytes; - UnderOverlay underlay; - UnderOverlay overlay; - UnderOverlay* under_overlay; + bool test_json_schema{false}; + bool check{false}; + bool optimize_images{false}; + bool externalize_inline_images{false}; + bool keep_inline_images{false}; + bool remove_page_labels{false}; + size_t oi_min_width{DEFAULT_OI_MIN_WIDTH}; + size_t oi_min_height{DEFAULT_OI_MIN_HEIGHT}; + size_t oi_min_area{DEFAULT_OI_MIN_AREA}; + size_t ii_min_bytes{DEFAULT_II_MIN_BYTES}; + UnderOverlay underlay{"underlay"}; + UnderOverlay overlay{"overlay"}; + UnderOverlay* under_overlay{nullptr}; std::vector page_specs; std::map rotations; - bool require_outfile; - bool replace_input; - bool check_is_encrypted; - bool check_requires_password; + bool require_outfile{true}; + bool replace_input{false}; + bool check_is_encrypted{false}; + bool check_requires_password{false}; std::shared_ptr infilename; std::shared_ptr outfilename; - bool json_input; - bool json_output; + bool json_input{false}; + bool json_output{false}; std::string update_from_json; - bool report_mem_usage; + bool report_mem_usage{false}; }; std::shared_ptr m; }; -- cgit v1.2.3-54-g00ecf