Commit Graph

229 Commits

Author SHA1 Message Date
Jay Berkenbilt 25ccc7eae4 Rename QPDFValueProxy.hh and QPDFValueProxy.cc
Preparing to change the class name back to QPDFObject
2022-09-08 11:19:49 -04:00
Jay Berkenbilt c7a4967d10 Change reset to disconnect and clarify comments
I decided that it's actually fine to copy a direct object to another
QPDF. Even if we eventually prevent a QPDFObject from having multiple
parents, this could happen if an object is moved.
2022-09-08 11:06:15 -04:00
Jay Berkenbilt dba61da1bf Create a special "destroyed" type rather than using null
When a QPDF is destroyed, changing indirect objects to direct nulls
makes them effectively disappear silently when they sneak into other
places. Instead, we should treat this as an error. Adding a destroyed
object type makes this possible.
2022-09-08 10:36:39 -04:00
Jay Berkenbilt 264e25f391 Clear owning QPDF information for all objects, not just indirect 2022-09-08 10:19:38 -04:00
Jay Berkenbilt 0132261ee0 Revert getOwningQPDF, and add getQPDF that returns a reference 2022-09-07 17:26:39 -04:00
Jay Berkenbilt c1def4ead4 Implement QPDFObjectHandle equality 2022-09-06 18:34:23 -04:00
Jay Berkenbilt 6c61be00e8 Rename QPDFObject -> QPDFValueProxy
This is in preparation for restoring a QPDFObject.hh to ease the
transition on qpdf_object_type_e.

This commit was created by
* Renaming QPDFObject.cc and QPDFObject.hh
* Replacing QPDFObject\b with QPDFValueProxy (where \b is word
  boundary)
* Running format-code
* Manually resorting files in libqpdf/CMakeLists.txt
* Manually refilling the comment in QPDF.hh near class Resolver
2022-09-05 18:52:59 -04:00
m-holger 9c86ba40d8 Fix commit 805c1ad : Reset QPDFValue::qpdf and QPDFValue::og when ...
On destruction of the QPDF object replace all indirect object references
with direct nulls.

Remove all existing code to release resolved references.

Fixes performance issue due to interaction of resetting QPDFValue::qpdf and
og members and prior code.
2022-09-04 10:41:18 +01:00
Jay Berkenbilt 6d62662e2d Make QPDFObject::releaseResolved public
Now that QPDFObject.hh is out of the public API, we don't really need
QPDFObjAccessor. Also, the function didn't have to be virtual anymore.
2022-09-01 18:19:47 -04:00
Jay Berkenbilt f772c43de8 Stop including QPDFObject.hh from other than private files
This required moving some newly inlined functions back to the cc file,
but that seems to have had no measurable performance impact.
2022-09-01 18:19:47 -04:00
Jay Berkenbilt b663926538 Remove QPDFObject::object_type_e as alias for qpdf_object_type_e 2022-09-01 18:11:22 -04:00
m-holger 2b7e9ba2f5 Remove methods and parameters obsoleted by the last two commits 2022-09-01 17:20:02 +01:00
m-holger 1bb40238e0 Add method QPDFObject::getObjGen and remove QPDFObjectHandle::og 2022-09-01 17:19:40 +01:00
m-holger 5033e3b215 Add method QPDFObject::getQPDF and remove QPDFObjectHandle::qpdf 2022-09-01 17:19:31 +01:00
m-holger 4a8515912c Add method QPDFObject::resolve 2022-09-01 17:19:06 +01:00
m-holger ae6e484e23 Change return type of QPDF::resolve to void 2022-09-01 17:08:45 +01:00
m-holger 356b582cec Remove QPDFObjectHandle::newIndirect
Modify QPDFParser::parse to call QPDF::getObject instead.
2022-09-01 16:59:01 +01:00
m-holger c0cd72a3ee Add private methods QPDF::isCached and QPDF::isUnresolved 2022-09-01 14:29:53 +01:00
m-holger 23d50a2f14 Remove QPDFObjectHandle::initialized 2022-09-01 14:29:38 +01:00
m-holger 27fae2b55e Remove QPDF::ObjectChanged
Also change QPDF::replaceObject and QPDF::swapObjects such that the
QPDFObject assigned to an og in the obj_cache is never replaced; only
QPDFObject::value is updated.
2022-09-01 14:27:46 +01:00
m-holger 431bd666c0 Split QPDFObject into QPDFObject and QPDFValue 2022-09-01 14:19:34 +01:00
m-holger 43983109f2 Change QPDFObjectHandle::shallowCopyInternal to copy scalars 2022-09-01 00:11:05 +01:00
m-holger 114bffa089 Add private methods QPDFObjectHandle::asArray etc
Centralise casting of QPDFObjects and reduce repeated dereferencing.
2022-09-01 00:10:04 +01:00
m-holger 2a2eebcaea Modify newIndirect to set QPDFObjectHandle::obj 2022-08-31 22:47:11 +01:00
m-holger 16841bec32 Remove QPDFObjectHandle::makeReserved 2022-08-31 22:46:55 +01:00
m-holger 07b66eb0b6 Remove QPDFObjectHandle::reserved 2022-08-31 22:46:25 +01:00
m-holger 9532dca3a5 Inline QPDFObjectHandle::setParsedOffset
Part of #729
2022-08-30 14:55:45 +01:00
m-holger 6fc982b71a Move QPDFObjectHandle::setObjectDescriptionFromInput to QPDFParser
Part of #729
2022-08-30 06:42:46 +01:00
m-holger 6670c685ab Move QPDFObjectHandle::parseInternal to new class QPDFParser
Part of #729
2022-08-30 05:56:23 +01:00
m-holger c53d54b13d Add optional parameter allow_nullptr to QPDFObjectHandle::getOwningQPDF
Also, inline method and add optional parameter error_msg.
2022-08-28 22:15:59 +01:00
Jay Berkenbilt b90adb1c6c
Merge pull request #746 from m-holger/smart
Code tidy: remove redundant calls to smart_ptrs get() method
2022-08-07 08:41:50 -04:00
m-holger 7c6901bce5 Code tidy: remove redundant calls to smart_ptrs get() method 2022-08-07 10:33:25 +01:00
m-holger 407b0766b8 Inline QPDFObjectHandle::getObjGen etc
Also, make QPDFObjectHandle::isIndirect const.
2022-08-01 15:08:48 +01:00
Jay Berkenbilt 4feb10fdaf
Merge pull request #734 from m-holger/nullptr
Code tidy : replace 0 with nullptr or true
2022-07-31 08:33:45 -04:00
m-holger 073808aa50 Code tidy : replace 0 with nullptr or true 2022-07-26 13:40:13 +01:00
Jay Berkenbilt b3e6d445cb Tweak "AndGet" mutator functions again
Remove any ambiguity around whether old or new value is being
returned.
2022-07-24 15:42:23 -04:00
m-holger afd35f9a30 Overload StreamDataProvider::provideStreamData
Use 'QPDFObjGen const&' instead of 'int, int' in signature.
2022-07-24 16:02:35 +01:00
m-holger 4b73d057fb QPDFObjGen : tidy QPDF_Stream
Change method signatures to use QPDFObjGen.
Replace QPDF_Stream::objid and generation with QPDF_Stream::og.
2022-07-24 16:02:35 +01:00
m-holger f7978db1f6 QPDFObjGen : tidy QPDF private methods
Change method signatures to use QPDFObjGen.
Use QPDFObjGen methods where possible.
Remove redundant QPDF::objGenToIndirect.
2022-07-24 16:02:35 +01:00
m-holger 3404ca8ac8 QPDFObjGen : tidy QPDFObjectHandle private methods
Change method signature to use QPDFObjGen.
2022-07-24 15:59:49 +01:00
m-holger b123f79dfd Replace QPDFObjectHandle::objid and generation with QPDFObjectHandle::og 2022-07-24 15:59:49 +01:00
m-holger eeb6162f76 Add optional parameter separator to QPDFObjGen::unparse
Also, revert inlining of unparse and operator << from commit 4c6640c in
order to avoid exposing QUtil.
2022-07-24 15:41:48 +01:00
Jay Berkenbilt a603c1e395 Run format-code 2022-06-27 12:50:35 -04:00
m-holger f0a8178091 Refactor QPDFObject creation and cloning
Move responsibility for creating shared pointers to objects and cloning from QPDFObjectHandle to QPDFObject.
2022-06-27 12:47:02 -04:00
m-holger 5aa8225f49 Refactor QPDFObjectTypeAccessor and QPDFObjectHandle::dereference 2022-06-27 10:39:04 -04:00
Jay Berkenbilt 6c4537885e Reformat code 2022-06-25 11:11:24 -04:00
m-holger e9c1637353 Add private method QPDFObjectHandle::getObjGenAsStr
Also, use methods to access objid and generation.
2022-06-25 08:25:32 -04:00
Jay Berkenbilt e0720eaa78 Use the default logger for other writes to stdout/stderr
When there is no context for writing output or error messages, use the
default logger.
2022-06-18 10:38:50 -04:00
m-holger 6c69a747b9 Code clean up: use range-style for loops wherever possible
Remove variables obsoleted by commit 4f24617.
2022-05-21 16:06:29 -04:00
Jay Berkenbilt 5a2aa59479 Bug fix: isReserved() true for indirect reference to reserved object 2022-05-20 09:16:25 -04:00