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; return;
} }
QPDFNameTreeObjectHelper ef_tree(embedded_files); QPDFNameTreeObjectHelper ef_tree(embedded_files, *this);
for (auto i: ef_tree) for (auto i: ef_tree)
{ {
QPDFObjectHandle item = i.second; QPDFObjectHandle item = i.second;

View File

@ -6,9 +6,9 @@
static bool any_failures = false; 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; QPDFObjectHandle o1;
long long offset = 0; long long offset = 0;
bool f1 = nh.findObjectAtOrBelow(item, o1, offset); bool f1 = nh.findObjectAtOrBelow(item, o1, offset);
@ -81,8 +81,8 @@ void test_bsearch()
return node; return node;
}; };
auto r = [](QPDFObjectHandle& oh, int item, int exp) { auto r = [&q](QPDFObjectHandle& oh, int item, int exp) {
if (report(oh, item, exp)) if (report(q, oh, item, exp))
{ {
any_failures = true; any_failures = true;
} }
@ -218,7 +218,7 @@ void test_depth()
.getArrayItem(1)); .getArrayItem(1));
} }
QPDFNameTreeObjectHelper nh(n0); QPDFNameTreeObjectHelper nh(n0, q);
std::cout << "--- forward ---" << std::endl; std::cout << "--- forward ---" << std::endl;
for (auto i: nh) 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 // Test number tree. This test is crafted to work with
// number-tree.pdf // number-tree.pdf
QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest"); QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest");
QPDFNumberTreeObjectHelper ntoh(qtest); QPDFNumberTreeObjectHelper ntoh(qtest, pdf);
for (auto iter: ntoh) for (auto iter: ntoh)
{ {
std::cout << iter.first << " " 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 // Test name tree. This test is crafted to work with
// name-tree.pdf // name-tree.pdf
QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest"); QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest");
QPDFNameTreeObjectHelper ntoh(qtest); QPDFNameTreeObjectHelper ntoh(qtest, pdf);
for (auto iter: ntoh) for (auto iter: ntoh)
{ {
std::cout << iter.first << " -> " std::cout << iter.first << " -> "