aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2017-08-22 03:33:44 +0200
committerJay Berkenbilt <ejb@ql.org>2017-08-22 03:35:11 +0200
commita8c93bd324d0362a26c1e6591eead5c52f865c0d (patch)
treeb3eda018bb384479c109640f442c94bc3d84ac0b /include
parent8288a4eb3a326acced6f07b0caf75f6ada53150d (diff)
downloadqpdf-a8c93bd324d0362a26c1e6591eead5c52f865c0d.tar.zst
Push QPDF member variables into a nested class
Pushing member variables into a nested class enables addition of new member variables without breaking binary compatibility.
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDF.hh164
1 files changed, 90 insertions, 74 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
index af38c32e..72e02754 100644
--- a/include/qpdf/QPDF.hh
+++ b/include/qpdf/QPDF.hh
@@ -635,11 +635,11 @@ class QPDF
qpdf(qpdf),
og(og)
{
- qpdf->resolving.insert(og);
+ qpdf->m->resolving.insert(og);
}
virtual ~ResolveRecorder()
{
- this->qpdf->resolving.erase(og);
+ this->qpdf->m->resolving.erase(og);
}
private:
QPDF* qpdf;
@@ -1113,79 +1113,95 @@ class QPDF
std::set<QPDFObjGen>& visited, bool top);
void filterCompressedObjects(std::map<int, int> const& object_stream_data);
+ class Members
+ {
+ friend class QPDF;
+
+ public:
+ ~Members();
+
+ private:
+ Members();
+ Members(Members const&);
+
+ QPDFTokenizer tokenizer;
+ PointerHolder<InputSource> file;
+ std::string last_object_description;
+ bool encrypted;
+ bool encryption_initialized;
+ bool ignore_xref_streams;
+ bool suppress_warnings;
+ std::ostream* out_stream;
+ std::ostream* err_stream;
+ bool attempt_recovery;
+ int encryption_V;
+ int encryption_R;
+ bool encrypt_metadata;
+ std::map<std::string, encryption_method_e> crypt_filters;
+ encryption_method_e cf_stream;
+ encryption_method_e cf_string;
+ encryption_method_e cf_file;
+ std::string provided_password;
+ std::string user_password;
+ std::string encryption_key;
+ std::string cached_object_encryption_key;
+ int cached_key_objid;
+ int cached_key_generation;
+ std::string pdf_version;
+ std::map<QPDFObjGen, QPDFXRefEntry> xref_table;
+ std::set<int> deleted_objects;
+ std::map<QPDFObjGen, ObjCache> obj_cache;
+ std::set<QPDFObjGen> resolving;
+ QPDFObjectHandle trailer;
+ std::vector<QPDFObjectHandle> all_pages;
+ std::map<QPDFObjGen, int> pageobj_to_pages_pos;
+ bool pushed_inherited_attributes_to_pages;
+ std::vector<QPDFExc> warnings;
+ std::map<QPDF*, ObjCopier> object_copiers;
+ PointerHolder<QPDFObjectHandle::StreamDataProvider> copied_streams;
+ // copied_stream_data_provider is owned by copied_streams
+ CopiedStreamDataProvider* copied_stream_data_provider;
+ std::set<QPDFObjGen> attachment_streams;
+ bool reconstructed_xref;
+
+ // Linearization data
+ qpdf_offset_t first_xref_item_offset; // actual value from file
+ bool uncompressed_after_compressed;
+
+ // Linearization parameter dictionary and hint table data: may be
+ // read from file or computed prior to writing a linearized file
+ QPDFObjectHandle lindict;
+ LinParameters linp;
+ HPageOffset page_offset_hints;
+ HSharedObject shared_object_hints;
+ HGeneric outline_hints;
+
+ // Computed linearization data: used to populate above tables
+ // during writing and to compare with them during validation.
+ // c_ means computed.
+ LinParameters c_linp;
+ CHPageOffset c_page_offset_data;
+ CHSharedObject c_shared_object_data;
+ HGeneric c_outline_data;
+
+ // Object ordering data for linearized files: initialized by
+ // calculateLinearizationData(). Part numbers refer to the PDF
+ // 1.4 specification.
+ std::vector<QPDFObjectHandle> part4;
+ std::vector<QPDFObjectHandle> part6;
+ std::vector<QPDFObjectHandle> part7;
+ std::vector<QPDFObjectHandle> part8;
+ std::vector<QPDFObjectHandle> part9;
+
+ // Optimization data
+ std::map<ObjUser, std::set<QPDFObjGen> > obj_user_to_objects;
+ std::map<QPDFObjGen, std::set<ObjUser> > object_to_obj_users;
+ };
- QPDFTokenizer tokenizer;
- PointerHolder<InputSource> file;
- std::string last_object_description;
- bool encrypted;
- bool encryption_initialized;
- bool ignore_xref_streams;
- bool suppress_warnings;
- std::ostream* out_stream;
- std::ostream* err_stream;
- bool attempt_recovery;
- int encryption_V;
- int encryption_R;
- bool encrypt_metadata;
- std::map<std::string, encryption_method_e> crypt_filters;
- encryption_method_e cf_stream;
- encryption_method_e cf_string;
- encryption_method_e cf_file;
- std::string provided_password;
- std::string user_password;
- std::string encryption_key;
- std::string cached_object_encryption_key;
- int cached_key_objid;
- int cached_key_generation;
- std::string pdf_version;
- std::map<QPDFObjGen, QPDFXRefEntry> xref_table;
- std::set<int> deleted_objects;
- std::map<QPDFObjGen, ObjCache> obj_cache;
- std::set<QPDFObjGen> resolving;
- QPDFObjectHandle trailer;
- std::vector<QPDFObjectHandle> all_pages;
- std::map<QPDFObjGen, int> pageobj_to_pages_pos;
- bool pushed_inherited_attributes_to_pages;
- std::vector<QPDFExc> warnings;
- std::map<QPDF*, ObjCopier> object_copiers;
- PointerHolder<QPDFObjectHandle::StreamDataProvider> copied_streams;
- // copied_stream_data_provider is owned by copied_streams
- CopiedStreamDataProvider* copied_stream_data_provider;
- std::set<QPDFObjGen> attachment_streams;
- bool reconstructed_xref;
-
- // Linearization data
- qpdf_offset_t first_xref_item_offset; // actual value from file
- bool uncompressed_after_compressed;
-
- // Linearization parameter dictionary and hint table data: may be
- // read from file or computed prior to writing a linearized file
- QPDFObjectHandle lindict;
- LinParameters linp;
- HPageOffset page_offset_hints;
- HSharedObject shared_object_hints;
- HGeneric outline_hints;
-
- // Computed linearization data: used to populate above tables
- // during writing and to compare with them during validation. c_
- // means computed.
- LinParameters c_linp;
- CHPageOffset c_page_offset_data;
- CHSharedObject c_shared_object_data;
- HGeneric c_outline_data;
-
- // Object ordering data for linearized files: initialized by
- // calculateLinearizationData(). Part numbers refer to the PDF
- // 1.4 specification.
- std::vector<QPDFObjectHandle> part4;
- std::vector<QPDFObjectHandle> part6;
- std::vector<QPDFObjectHandle> part7;
- std::vector<QPDFObjectHandle> part8;
- std::vector<QPDFObjectHandle> part9;
-
- // Optimization data
- std::map<ObjUser, std::set<QPDFObjGen> > obj_user_to_objects;
- std::map<QPDFObjGen, std::set<ObjUser> > object_to_obj_users;
+ // Keep all member variables inside the Members object, which we
+ // dynamically allocate. This makes it possible to add new private
+ // members without breaking binary compatibility.
+ PointerHolder<Members> m;
};
#endif // __QPDF_HH__