Use new QPDF{Name,Number}TreeObjectHelper API

This commit is contained in:
Jay Berkenbilt 2021-01-17 17:54:52 -05:00
parent d61ffb65d0
commit 63e5cb533d
3 changed files with 8 additions and 8 deletions

View File

@ -3010,7 +3010,7 @@ QPDF::findAttachmentStreams()
{
return;
}
QPDFNameTreeObjectHelper ef_tree(embedded_files);
QPDFNameTreeObjectHelper ef_tree(embedded_files, *this);
for (auto i: ef_tree)
{
QPDFObjectHandle item = i.second;

View File

@ -6,9 +6,9 @@
static bool any_failures = false;
bool report(QPDFObjectHandle oh, long long item, long long exp_item)
bool report(QPDF& q, QPDFObjectHandle oh, long long item, long long exp_item)
{
QPDFNumberTreeObjectHelper nh(oh);
QPDFNumberTreeObjectHelper nh(oh, q);
QPDFObjectHandle o1;
long long offset = 0;
bool f1 = nh.findObjectAtOrBelow(item, o1, offset);
@ -81,8 +81,8 @@ void test_bsearch()
return node;
};
auto r = [](QPDFObjectHandle& oh, int item, int exp) {
if (report(oh, item, exp))
auto r = [&q](QPDFObjectHandle& oh, int item, int exp) {
if (report(q, oh, item, exp))
{
any_failures = true;
}
@ -218,7 +218,7 @@ void test_depth()
.getArrayItem(1));
}
QPDFNameTreeObjectHelper nh(n0);
QPDFNameTreeObjectHelper nh(n0, q);
std::cout << "--- forward ---" << std::endl;
for (auto i: nh)
{

View File

@ -1748,7 +1748,7 @@ void runtest(int n, char const* filename1, char const* arg2)
// Test number tree. This test is crafted to work with
// number-tree.pdf
QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest");
QPDFNumberTreeObjectHelper ntoh(qtest);
QPDFNumberTreeObjectHelper ntoh(qtest, pdf);
for (auto iter: ntoh)
{
std::cout << iter.first << " "
@ -1806,7 +1806,7 @@ void runtest(int n, char const* filename1, char const* arg2)
// Test name tree. This test is crafted to work with
// name-tree.pdf
QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest");
QPDFNameTreeObjectHelper ntoh(qtest);
QPDFNameTreeObjectHelper ntoh(qtest, pdf);
for (auto iter: ntoh)
{
std::cout << iter.first << " -> "