Commit efde62745cc593c7754fc3e9ad1e345488a38608
1 parent
8abb791d
Refactor `Common` constructor: add `Doc`-based overload, update `Linearization`,…
… `Objects`, and `Pages` to use it, and streamline initialization logic.
Showing
1 changed file
with
10 additions
and
4 deletions
libqpdf/qpdf/QPDF_private.hh
| ... | ... | @@ -291,6 +291,7 @@ class QPDF::Doc |
| 291 | 291 | ~Common() = default; |
| 292 | 292 | |
| 293 | 293 | inline Common(QPDF& qpdf, QPDF::Members* m); |
| 294 | + inline Common(Doc& doc); | |
| 294 | 295 | |
| 295 | 296 | void stopOnError(std::string const& message); |
| 296 | 297 | void warn(QPDFExc const& e); |
| ... | ... | @@ -551,7 +552,7 @@ class QPDF::Doc::Linearization: Common |
| 551 | 552 | ~Linearization() = default; |
| 552 | 553 | |
| 553 | 554 | Linearization(Doc& doc) : |
| 554 | - Common(doc.qpdf, doc.m) | |
| 555 | + Common(doc) | |
| 555 | 556 | { |
| 556 | 557 | } |
| 557 | 558 | |
| ... | ... | @@ -945,7 +946,7 @@ class QPDF::Doc::Objects: Common |
| 945 | 946 | ~Objects() = default; |
| 946 | 947 | |
| 947 | 948 | Objects(Doc& doc) : |
| 948 | - Common(doc.qpdf, doc.m), | |
| 949 | + Common(doc), | |
| 949 | 950 | foreign_(*this), |
| 950 | 951 | streams_(*this) |
| 951 | 952 | { |
| ... | ... | @@ -1065,7 +1066,7 @@ class QPDF::Doc::Pages: Common |
| 1065 | 1066 | ~Pages() = default; |
| 1066 | 1067 | |
| 1067 | 1068 | Pages(Doc& doc) : |
| 1068 | - Common(doc.qpdf, doc.m) | |
| 1069 | + Common(doc) | |
| 1069 | 1070 | { |
| 1070 | 1071 | } |
| 1071 | 1072 | |
| ... | ... | @@ -1219,6 +1220,11 @@ inline QPDF::Doc::Common::Common(QPDF& qpdf, QPDF::Members* m) : |
| 1219 | 1220 | { |
| 1220 | 1221 | } |
| 1221 | 1222 | |
| 1223 | +inline QPDF::Doc::Common::Common(Doc& doc) : | |
| 1224 | + Common(doc.qpdf, doc.m) | |
| 1225 | +{ | |
| 1226 | +} | |
| 1227 | + | |
| 1222 | 1228 | inline QPDF::Doc::Linearization& |
| 1223 | 1229 | QPDF::Doc::linearization() |
| 1224 | 1230 | { |
| ... | ... | @@ -1250,7 +1256,7 @@ QPDF::doc() |
| 1250 | 1256 | } |
| 1251 | 1257 | |
| 1252 | 1258 | inline QPDF::Doc::Objects::Foreign::Copier::Copier(QPDF& qpdf) : |
| 1253 | - Common(qpdf, qpdf.doc().m) | |
| 1259 | + Common(qpdf.doc()) | |
| 1254 | 1260 | { |
| 1255 | 1261 | } |
| 1256 | 1262 | ... | ... |