From 08c807acb527e34108afca02408cd8683b51399f Mon Sep 17 00:00:00 2001 From: Masamichi Hosoda Date: Sat, 20 Aug 2016 20:40:18 +0900 Subject: [PATCH v2 2/3] Add functions for named destination name in name-tree Get the number of named destinations in name-tree int Catalog::numDestNameTree(); Get the i'th named destination name in name-tree GooString *Catalog::getDestNameTreeName(int i); Get the i'th named destination link destination in name-tree LinkDest *Catalog::getDestNameTreeDest(int i); --- poppler/Catalog.cc | 12 ++++++++++++ poppler/Catalog.h | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc index 7754e47..32ab3d9 100644 --- a/poppler/Catalog.cc +++ b/poppler/Catalog.cc @@ -504,6 +504,18 @@ LinkDest *Catalog::createLinkDest(Object *obj) return dest; } +LinkDest *Catalog::getDestNameTreeDest(int i) +{ + LinkDest *dest; + Object obj; + + getDestNameTree()->getValue(i).fetch(xref, &obj); + dest = createLinkDest(&obj); + obj.free(); + + return dest; +} + FileSpec *Catalog::embeddedFile(int i) { Object efDict; diff --git a/poppler/Catalog.h b/poppler/Catalog.h index c7cce92..59109df 100644 --- a/poppler/Catalog.h +++ b/poppler/Catalog.h @@ -151,6 +151,16 @@ public: Object *getDests(); + // Get the number of named destinations in name-tree + int numDestNameTree() { return getDestNameTree()->numEntries(); } + + // Get the i'th named destination name in name-tree + GooString *getDestNameTreeName(int i) + { return getDestNameTree()->getName(i); } + + // Get the i'th named destination link destination in name-tree + LinkDest *getDestNameTreeDest(int i); + // Get the number of embedded files int numEmbeddedFiles() { return getEmbeddedFileNameTree()->numEntries(); } -- 2.8.3