mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-03 07:12:28 +00:00
Use QPDFObjGen::set in QPDFOutlineDocumentHelper
This commit is contained in:
parent
0e81ffa7b6
commit
55abecc42d
@ -22,13 +22,13 @@
|
||||
#ifndef QPDFOUTLINEDOCUMENTHELPER_HH
|
||||
#define QPDFOUTLINEDOCUMENTHELPER_HH
|
||||
|
||||
#include <qpdf/QPDF.hh>
|
||||
#include <qpdf/QPDFDocumentHelper.hh>
|
||||
#include <qpdf/QPDFNameTreeObjectHelper.hh>
|
||||
#include <qpdf/QPDFObjGen.hh>
|
||||
#include <qpdf/QPDFOutlineObjectHelper.hh>
|
||||
|
||||
#include <qpdf/QPDF.hh>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include <qpdf/DLL.h>
|
||||
@ -69,16 +69,16 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper
|
||||
{
|
||||
friend class QPDFOutlineObjectHelper;
|
||||
|
||||
// ABI: remove QPDF_DLL and pass og by value.
|
||||
QPDF_DLL
|
||||
static bool
|
||||
checkSeen(QPDFOutlineDocumentHelper& dh, QPDFObjGen const& og)
|
||||
{
|
||||
return dh.checkSeen(og);
|
||||
return !dh.m->seen.add(og);
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
bool checkSeen(QPDFObjGen const& og);
|
||||
void initializeByPage();
|
||||
|
||||
class Members
|
||||
@ -94,7 +94,7 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper
|
||||
Members(Members const&) = delete;
|
||||
|
||||
std::vector<QPDFOutlineObjectHelper> outlines;
|
||||
std::set<QPDFObjGen> seen;
|
||||
QPDFObjGen::set seen;
|
||||
QPDFObjectHandle dest_dict;
|
||||
std::shared_ptr<QPDFNameTreeObjectHelper> names_dest;
|
||||
std::map<QPDFObjGen, std::vector<QPDFOutlineObjectHelper>> by_page;
|
||||
|
@ -15,13 +15,8 @@ QPDFOutlineDocumentHelper::QPDFOutlineDocumentHelper(QPDF& qpdf) :
|
||||
return;
|
||||
}
|
||||
QPDFObjectHandle cur = outlines.getKey("/First");
|
||||
std::set<QPDFObjGen> seen;
|
||||
while (!cur.isNull()) {
|
||||
auto og = cur.getObjGen();
|
||||
if (seen.count(og)) {
|
||||
break;
|
||||
}
|
||||
seen.insert(og);
|
||||
QPDFObjGen::set seen;
|
||||
while (!cur.isNull() && seen.add(cur)) {
|
||||
this->m->outlines.push_back(
|
||||
QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
|
||||
cur = cur.getKey("/Next");
|
||||
@ -104,13 +99,3 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
QPDFOutlineDocumentHelper::checkSeen(QPDFObjGen const& og)
|
||||
{
|
||||
if (this->m->seen.count(og) > 0) {
|
||||
return true;
|
||||
}
|
||||
this->m->seen.insert(og);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user