mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Use QPDFNameTreeObjectHelper's iterator directly
This commit is contained in:
parent
5f0708418a
commit
ba814703fb
@ -1,5 +1,13 @@
|
||||
2021-01-16 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* Re-implement QPDFNameTreeObjectHelper and
|
||||
QPDFNumberTreeObjectHelper to be much more efficient and to have
|
||||
an iterator-based API in addition to the existing one. This makes
|
||||
it possible to use "range-for" loops over these helpers and to
|
||||
iterate through name and number trees without creating a map
|
||||
containing all the keys and values, which is slow and potentially
|
||||
consumes a lot of memory.
|
||||
|
||||
* Add warn() to QPDF's public API.
|
||||
|
||||
2021-01-11 Jay Berkenbilt <ejb@ql.org>
|
||||
|
@ -53,7 +53,7 @@ class QPDFNameTreeObjectHelper: public QPDFObjectHelper
|
||||
bool hasName(std::string const& utf8);
|
||||
|
||||
// Find an object by name. If found, returns true and initializes
|
||||
// oh.
|
||||
// oh. See also find().
|
||||
QPDF_DLL
|
||||
bool findObject(std::string const& utf8, QPDFObjectHandle& oh);
|
||||
|
||||
|
@ -60,7 +60,7 @@ class QPDFNumberTreeObjectHelper: public QPDFObjectHelper
|
||||
bool hasIndex(numtree_number idx);
|
||||
|
||||
// Find an object with a specific index. If found, returns true
|
||||
// and initializes oh.
|
||||
// and initializes oh. See also find().
|
||||
QPDF_DLL
|
||||
bool findObject(numtree_number idx, QPDFObjectHandle& oh);
|
||||
// Find the object at the index or, if not found, the object whose
|
||||
@ -70,7 +70,8 @@ class QPDFNumberTreeObjectHelper: public QPDFObjectHelper
|
||||
// offset to the difference between the requested index and the
|
||||
// actual index. For example, if a number tree has values for 3
|
||||
// and 6 and idx is 5, this method would return true, initialize
|
||||
// oh to the value with index 3, and set offset to 2 (5 - 3).
|
||||
// oh to the value with index 3, and set offset to 2 (5 - 3). See
|
||||
// also find().
|
||||
QPDF_DLL
|
||||
bool findObjectAtOrBelow(numtree_number idx, QPDFObjectHandle& oh,
|
||||
numtree_number& offset);
|
||||
|
@ -3011,8 +3011,7 @@ QPDF::findAttachmentStreams()
|
||||
return;
|
||||
}
|
||||
QPDFNameTreeObjectHelper ef_tree(embedded_files);
|
||||
auto ef_tree_map = ef_tree.getAsMap();
|
||||
for (auto& i: ef_tree_map)
|
||||
for (auto i: ef_tree)
|
||||
{
|
||||
QPDFObjectHandle item = i.second;
|
||||
if (item.isDictionary() &&
|
||||
|
@ -4833,6 +4833,13 @@ print "\n";
|
||||
<classname>QPDF</classname>'s public API.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Re-implement <classname>QPDFNameTreeObjectHelper</classname>
|
||||
and <classname>QPDFNumberTreeObjectHelper</classname> to be
|
||||
more efficient, and add an iterator-based API.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
Loading…
Reference in New Issue
Block a user