2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-10-31 19:02:30 +00:00
Commit Graph

112 Commits

Author SHA1 Message Date
m-holger
f8e6274a2e Move QPDF inner class definitions to new QPDF_private.hh 2024-09-18 10:25:37 +01:00
m-holger
0afaaea22a Deprecate QPDFObjectHandle::isInitialized and remove from library 2024-09-17 09:59:00 +01:00
m-holger
83e0f8da88 Tidy QPDF_Stream
1. Make class final
2. Pass og parameter by value
3. Properly initialize qpdf and og

Also, tweak QPDF::replaceObject to allow stream replacement without
violating the requirement that streams must always be indirect objects.

Also, remove QPDF::reserveStream as it does not do what the name implies
and having this as a separate methods does not aid code readability.
2024-09-04 16:00:57 +01:00
m-holger
64f9b7b242 Refactor QPDFObjectHandle::getTypeName 2024-08-27 10:39:33 +01:00
m-holger
b15d0bf6e1 Add new method QPDF_Stream::writeStreamJSON
(Replacing the temporary implementation from the last commit.)
2024-02-16 11:37:50 +00:00
m-holger
920e929864 Reimplement QPDF_Stream::getStreamJSON in terms of writeStreamJSON
writeStreamJSON is a temporary implementation minimally adapted from
getStreamJSON.
2024-02-16 11:07:20 +00:00
m-holger
9589fad1e5 Reimplement QPDFObjectHandle::getJSON in terms of writeJSON 2024-02-16 11:00:20 +00:00
m-holger
e2737ab646 Add new writeJSON methods
Create an alternative to getJSON to allow an object handle to be written as JSON without the overhead of creating a JSON object.
2024-02-16 10:51:25 +00:00
m-holger
4c71c8680a Refactor QPDF_Stream::getStreamJSON 2023-11-26 12:22:36 +00:00
m-holger
698a70e6a8 Code tidy - reflow comments and strings 2023-05-27 10:54:19 +01:00
Jay Berkenbilt
60965d5f4d Rerun clang-format 2023-05-21 13:35:09 -04:00
m-holger
e6577a1323 Replace 'virtual' specifier with 'override' 2023-05-20 15:41:56 +01:00
m-holger
2fa581537b Use auto when initializing with a cast 2023-05-20 15:41:44 +01:00
m-holger
32907fc14c Change type of QPDFValue::object_description to std::shared_ptr<std::variant>
Also, name the type QPDFValue::Description.
2023-02-18 08:33:08 +00:00
m-holger
ec35156ab0 Refactor QPDFValue::getDescription
Remove parameters and return the description.
2022-12-31 10:23:59 -05:00
m-holger
e684d8169b Make QPDFValue::object_description a shared pointer 2022-12-31 10:23:59 -05:00
m-holger
d03ca88275 Refactor QPDFParser::setDescriptionFromInput and rename to setDescription
Set parsed offset at the same time as setting description.
2022-12-31 10:23:59 -05:00
m-holger
b1eb1a9584 Refactor QPDFObjectHandle::copyObject1 2022-11-20 12:07:22 -05:00
m-holger
dbc5f07b90 Rename QPDFObject::shallowCopy to copy
Add optional parameter shallow. Change logic errors to runtime errors.
2022-11-20 12:07:22 -05:00
m-holger
d79a823d66 Remove QPDF_Stream::getOffset and QPDF_Stream::setObjGen 2022-11-19 14:10:42 -05:00
m-holger
6350cf16e6 Remove QPDF_Stream::offset 2022-11-19 14:10:42 -05:00
m-holger
3a86b893f7 Remove redundant parameters from QPDF_Stream::warn 2022-11-19 14:10:42 -05:00
m-holger
69e67b45bb Remove QPDF_Stream qpdf and og data members 2022-11-19 14:10:42 -05:00
Jay Berkenbilt
d94e6958ef Fix stray formatting error 2022-10-08 17:05:11 -04:00
m-holger
d44bba3914 Fix typos in error message 2022-10-03 11:42:27 -04:00
m-holger
2e6869483b Replace calls to QUtil::int_to_string with std::to_string 2022-09-21 15:57:14 -04:00
Jay Berkenbilt
18a583e8d9 Rename QPDFValueProxy back to QPDFObject
QPDFValueProxy wasn't a good name for it. We decided the evil of
having the header file be named QPDFObject_private.hh was less than
the evil of having the class be named something other than what it
should have been named.
2022-09-08 11:29:23 -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
264e25f391 Clear owning QPDF information for all objects, not just indirect 2022-09-08 10:19:38 -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
m-holger
c7005e8a6d Remove virtual methods QPDFValue::getTypeCode and getTypeName 2022-09-01 14:29:02 +01:00
m-holger
431bd666c0 Split QPDFObject into QPDFObject and QPDFValue 2022-09-01 14:19:34 +01:00
m-holger
073808aa50 Code tidy : replace 0 with nullptr or true 2022-07-26 13:40:13 +01: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
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
3b3bcab349 Remove QPDF_Stream::setStreamDescription 2022-06-25 08:26:46 -04:00
Jay Berkenbilt
ef955b04b5 Bug fix: don't clobber stream length with replaceDict 2022-05-20 11:09:45 -04:00
Jay Berkenbilt
63c7eefe9d replaceStreamData: accept uninitialized filter/decode_parms
These mean to leave the original values alone. This is needed for
reconstructing streams from JSON given that the stream data and stream
dictionary may appear in any order in the JSON.
2022-05-20 09:16:25 -04:00
Jay Berkenbilt
56f1b411fe Back out fluent QPDFObjectHandle methods. Keep the andGet methods.
I decided these were confusing and inconsistent with how JSON works.
They muddle the API rather than improving it.
2022-05-20 09:16:25 -04:00
Jay Berkenbilt
c76536dd9a Implement JSON v2 output 2022-05-08 13:45:20 -04:00
Jay Berkenbilt
1bc8abfdd3 Implement JSON v2 for Stream
Not fully exercised in this commit
2022-05-08 13:45:20 -04:00
Jay Berkenbilt
16f4f94cd9 Prepare code for JSON v2
Update getJSON() methods and calls to them
2022-05-07 11:12:01 -04:00
Jay Berkenbilt
7f023701dd Formatting: remove space in range-style for loops
Change .clang-format and commit automated changes from a fresh run of
format-code
2022-04-30 13:26:43 -04:00
Jay Berkenbilt
ab9d557cb0 Use fluent replaceKey 2022-04-29 20:39:54 -04:00
Jay Berkenbilt
4be2f36049 Deprecate replaceOrRemoveKey -- it's the same as replaceKey 2022-04-24 09:31:32 -04:00