2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-09 23:00:57 +00:00
Commit Graph

75 Commits

Author SHA1 Message Date
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
Jay Berkenbilt
7caa9ddf5a Format code 2024-02-04 16:12:01 -05:00
Jay Berkenbilt
ebb10f3256 Fix null pointer issue on array copy 2024-01-12 08:05:22 -05:00
m-holger
5e9de5cd50 Tune handling of sparse arrays in QPDF_Array
Sparse arrays are rare. Dynamically create the variables needed to manage
them only when needed.
2024-01-10 09:36:18 +00:00
m-holger
7bc0f1d828 Code tidy - Clang-Tidy rule modernize-use-emplace 2023-06-09 15:42:11 +01:00
m-holger
3c5700c255 Code tidy - reflow comments and strings 2023-06-02 16:00:40 +01:00
Jay Berkenbilt
60965d5f4d Rerun clang-format 2023-05-21 13:35:09 -04:00
m-holger
41ec7eda54 Use auto when initialializing with new 2023-05-20 15:41:40 +01:00
m-holger
0b53b648ab Refactor QPDF_Array::unparse 2023-04-01 13:58:21 +01:00
m-holger
c2ab0441b5 Refactor QPDF_Array::getJSON 2023-04-01 13:58:15 +01:00
m-holger
a7b6975132 Remove SparseOHArray 2023-04-01 13:58:06 +01:00
m-holger
d3f2dc322b Refactor QPDF_Array::copy 2023-04-01 13:57:47 +01:00
m-holger
a171ebb942 Refactor QPDF_Array::disconnect 2023-04-01 13:57:35 +01:00
m-holger
0aae54d383 Refactor QPDF_Array::setFromVector 2023-04-01 13:57:28 +01:00
m-holger
5072238867 Refactor QPDF_Array::getAsVector 2023-04-01 13:57:22 +01:00
m-holger
e186da1721 Remove SparseOHArray::at, setAt and append 2023-04-01 13:57:15 +01:00
m-holger
1c85e7ece4 Remove SparseOHArray::erase 2023-04-01 13:56:54 +01:00
m-holger
6295da436f Remove SparseOHArray::insert 2023-04-01 13:56:47 +01:00
m-holger
182c2480df Refactor QPDF_Array::setItem and rename to setAt 2023-04-01 13:56:29 +01:00
m-holger
4d37389bef Refactor QPDF_Array::eraseItem and rename to erase 2023-04-01 13:56:16 +01:00
m-holger
1bb23d0545 Refactor QPDF_Array::insertItem and rename to insert 2023-04-01 13:56:10 +01:00
m-holger
cedb37caa1 Refactor QPDF_Array::appendItem and rename to push_back 2023-04-01 13:55:14 +01:00
m-holger
c6179da961 Add new method QPDFValue::checkOwnership 2023-04-01 13:54:44 +01:00
m-holger
a1a8f35b63 Refactor QPDF_Array::getItem and rename to at 2023-04-01 13:54:17 +01:00
m-holger
51d350c98c Inline QPDF_Array::getNItems and rename to size 2023-04-01 12:25:15 +01:00
m-holger
e6db8ddeba Change SparseOHArray index type to int and elements type to map
There are no reasons other than historical to use size_t.
On balance, using map is more efficient. Hold shared pointers to
QPDFObjects rather than QPDFObjectHandles for consistencey with
QPDF_Array.
2023-04-01 12:25:06 +01:00
m-holger
ea5164938e Remove temporary OHArray 2023-04-01 12:24:52 +01:00
m-holger
9e30de8032 Remove temporary OHArray::erase, insert and copy 2023-03-29 13:15:39 +01:00
m-holger
0db65e7912 Remove temporary OHArray::disconnect and setAt 2023-03-29 13:06:26 +01:00
m-holger
1367226002 Remove temporary OHArray::at 2023-03-29 13:00:28 +01:00
m-holger
ad2875a4aa Remove temporary OHArray::size, append and remove_last
Also, add const overload of QPDFObjectHandle::getObj
2023-03-29 12:34:07 +01:00
m-holger
8fdc3f0964 Optimize QPDFParser for non-sparse QPDF_Arrays
Stop using nullptr to represent null objects.
Count null array elements and trigger creation of sparse arrays if null count is
greater than 100.
2023-03-29 12:10:19 +01:00
m-holger
18c1ffe0df Change underlying data structure of QPDF_Array in non-sparse mode to std::vector 2023-03-29 12:01:24 +01:00
m-holger
38cf7c1628 Add separate sparse mode to QPDF_Array
Add temporary clone of SparseOHArray  to implement non-sparse mode.
2023-03-29 11:48:21 +01:00
m-holger
de29fd56c4 Remove redundant QPDF_Array::addExplicitElementsToList 2023-03-29 10:47:37 +01:00
m-holger
8391022416 Avoid inserting direct null objects into olist 2022-12-31 14:37:35 -05:00
m-holger
9da50ca360 Change olist variable in QPDFParser::parse to vector<shared_ptr<QPDFObject>> 2022-12-31 14:37:35 -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
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
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
9eda1fdc41 Remove redundant QPDF_Array::setDescription and QPDF_Dictionary::setDescription 2022-06-25 08:25:58 -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