2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

QPDFJob: move private members into Members

This commit is contained in:
Jay Berkenbilt 2022-01-26 14:56:24 -05:00
parent 98f25fdfa1
commit 01969c78a8
3 changed files with 580 additions and 612 deletions

View File

@ -345,7 +345,7 @@ class QPDFJob
enum password_mode_e { pm_bytes, pm_hex_bytes, pm_unicode, pm_auto };
public: // QXXXQ
public: // QXXXQ begin public
struct UnderOverlay
{
UnderOverlay(char const* which) :
@ -367,10 +367,99 @@ class QPDFJob
std::vector<int> from_pagenos;
std::vector<int> repeat_pagenos;
};
private: // QXXXQ
size_t oi_min_width;
size_t oi_min_height;
size_t oi_min_area;
// QXXXQ END-PUBLIC
private:
// Helper functions
void parseRotationParameter(std::string const&);
std::vector<int> parseNumrange(char const* range, int max);
// Basic file processing
std::shared_ptr<QPDF> processFile(
char const* filename, char const* password);
std::shared_ptr<QPDF> processInputSource(
PointerHolder<InputSource> is, char const* password);
std::shared_ptr<QPDF> doProcess(
std::function<void(QPDF*, char const*)> fn,
char const* password, bool empty);
std::shared_ptr<QPDF> doProcessOnce(
std::function<void(QPDF*, char const*)> fn,
char const* password, bool empty);
// Transformations
void setQPDFOptions(QPDF& pdf);
void handlePageSpecs(
QPDF& pdf, bool& warnings,
std::vector<std::shared_ptr<QPDF>>& page_heap);
bool shouldRemoveUnreferencedResources(QPDF& pdf);
void handleRotations(QPDF& pdf);
void handleUnderOverlay(QPDF& pdf);
void doUnderOverlayForPage(
QPDF& pdf,
QPDFJob::UnderOverlay& uo,
std::map<int, std::vector<int> >& pagenos,
size_t page_idx,
std::map<int, QPDFObjectHandle>& fo,
std::vector<QPDFPageObjectHelper>& pages,
QPDFPageObjectHelper& dest_page,
bool before);
void validateUnderOverlay(QPDF& pdf, QPDFJob::UnderOverlay* uo);
void handleTransformations(QPDF& pdf);
void addAttachments(QPDF& pdf);
void copyAttachments(QPDF& pdf);
// Inspection
void doInspection(QPDF& pdf);
void doCheck(QPDF& pdf);
void showEncryption(QPDF& pdf);
void doShowObj(QPDF& pdf);
void doShowPages(QPDF& pdf);
void doListAttachments(QPDF& pdf);
void doShowAttachment(QPDF& pdf);
// Output generation
void doSplitPages(QPDF& pdf, bool& warnings);
void setWriterOptions(QPDF& pdf, QPDFWriter& w);
void setEncryptionOptions(QPDF&, QPDFWriter&);
void maybeFixWritePassword(int R, std::string& password);
void writeOutfile(QPDF& pdf);
// JSON
void doJSON(QPDF& pdf);
std::set<QPDFObjGen> getWantedJSONObjects();
void doJSONObjects(QPDF& pdf, JSON& j);
void doJSONObjectinfo(QPDF& pdf, JSON& j);
void doJSONPages(QPDF& pdf, JSON& j);
void doJSONPageLabels(QPDF& pdf, JSON& j);
void doJSONOutlines(QPDF& pdf, JSON& j);
void doJSONAcroform(QPDF& pdf, JSON& j);
void doJSONEncrypt(QPDF& pdf, JSON& j);
void doJSONAttachments(QPDF& pdf, JSON& j);
enum remove_unref_e { re_auto, re_yes, re_no };
class Members
{
friend class QPDFJob;
public:
QPDF_DLL
~Members() = default;
private:
Members();
Members(Members const&) = delete;
std::string message_prefix;
bool warnings;
std::ostream* cout;
std::ostream* cerr;
unsigned long encryption_status;
bool verbose;
std::shared_ptr<char> password;
bool linearize;
bool decrypt;
@ -467,12 +556,7 @@ class QPDFJob
bool externalize_inline_images;
bool keep_inline_images;
bool remove_page_labels;
public: // QXXXQ
size_t oi_min_width;
size_t oi_min_height;
size_t oi_min_area;
size_t ii_min_bytes;
private: // QXXXQ
UnderOverlay underlay;
UnderOverlay overlay;
UnderOverlay* under_overlay;
@ -484,93 +568,6 @@ class QPDFJob
bool check_requires_password;
std::shared_ptr<char> infilename;
std::shared_ptr<char> outfilename;
// QXXXQ END-PUBLIC
private:
// Helper functions
void parseRotationParameter(std::string const&);
std::vector<int> parseNumrange(char const* range, int max);
// Basic file processing
std::shared_ptr<QPDF> processFile(
char const* filename, char const* password);
std::shared_ptr<QPDF> processInputSource(
PointerHolder<InputSource> is, char const* password);
std::shared_ptr<QPDF> doProcess(
std::function<void(QPDF*, char const*)> fn,
char const* password, bool empty);
std::shared_ptr<QPDF> doProcessOnce(
std::function<void(QPDF*, char const*)> fn,
char const* password, bool empty);
// Transformations
void setQPDFOptions(QPDF& pdf);
void handlePageSpecs(
QPDF& pdf, bool& warnings,
std::vector<std::shared_ptr<QPDF>>& page_heap);
bool shouldRemoveUnreferencedResources(QPDF& pdf);
void handleRotations(QPDF& pdf);
void handleUnderOverlay(QPDF& pdf);
void doUnderOverlayForPage(
QPDF& pdf,
QPDFJob::UnderOverlay& uo,
std::map<int, std::vector<int> >& pagenos,
size_t page_idx,
std::map<int, QPDFObjectHandle>& fo,
std::vector<QPDFPageObjectHelper>& pages,
QPDFPageObjectHelper& dest_page,
bool before);
void validateUnderOverlay(QPDF& pdf, QPDFJob::UnderOverlay* uo);
void handleTransformations(QPDF& pdf);
void addAttachments(QPDF& pdf);
void copyAttachments(QPDF& pdf);
// Inspection
void doInspection(QPDF& pdf);
void doCheck(QPDF& pdf);
void showEncryption(QPDF& pdf);
void doShowObj(QPDF& pdf);
void doShowPages(QPDF& pdf);
void doListAttachments(QPDF& pdf);
void doShowAttachment(QPDF& pdf);
// Output generation
void doSplitPages(QPDF& pdf, bool& warnings);
void setWriterOptions(QPDF& pdf, QPDFWriter& w);
void setEncryptionOptions(QPDF&, QPDFWriter&);
void maybeFixWritePassword(int R, std::string& password);
void writeOutfile(QPDF& pdf);
// JSON
void doJSON(QPDF& pdf);
std::set<QPDFObjGen> getWantedJSONObjects();
void doJSONObjects(QPDF& pdf, JSON& j);
void doJSONObjectinfo(QPDF& pdf, JSON& j);
void doJSONPages(QPDF& pdf, JSON& j);
void doJSONPageLabels(QPDF& pdf, JSON& j);
void doJSONOutlines(QPDF& pdf, JSON& j);
void doJSONAcroform(QPDF& pdf, JSON& j);
void doJSONEncrypt(QPDF& pdf, JSON& j);
void doJSONAttachments(QPDF& pdf, JSON& j);
class Members
{
friend class QPDFJob;
public:
QPDF_DLL
~Members() = default;
private:
Members();
Members(Members const&) = delete;
std::string message_prefix;
bool warnings;
std::ostream* cout;
std::ostream* cerr;
unsigned long encryption_status;
bool verbose;
};
std::shared_ptr<Members> m;
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff