diff options
author | Masamichi Hosoda <trueroad@trueroad.jp> | 2016-08-20 23:16:33 +0900 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2016-09-17 11:22:30 +0200 |
commit | 151715976509075e9b95e0ab86d1fcacb2c1580a (patch) | |
tree | fed7ea7c0513cf027fa236a1367019e031d41916 | |
parent | 99267c0b3f3aed520247dc0a5eb70df04b00df46 (diff) |
Add functions for named destination name in name-dict
Get the number of named destinations in name-dict
int numDests();
Get the i'th named destination name in name-dict
char *getDestsName(int i);
Get the i'th named destination link destination in name-dict
LinkDest *getDestsDest(int i);
-rw-r--r-- | poppler/Catalog.cc | 38 | ||||
-rw-r--r-- | poppler/Catalog.h | 9 |
2 files changed, 47 insertions, 0 deletions
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc index 312d1798..0e37c843 100644 --- a/poppler/Catalog.cc +++ b/poppler/Catalog.cc @@ -504,6 +504,44 @@ LinkDest *Catalog::createLinkDest(Object *obj) return dest; } +int Catalog::numDests() +{ + Object *obj; + + obj= getDests(); + if (!obj->isDict()) { + return 0; + } + return obj->dictGetLength(); +} + +char *Catalog::getDestsName(int i) +{ + Object *obj; + + obj= getDests(); + if (!obj->isDict()) { + return NULL; + } + return obj->dictGetKey(i); +} + +LinkDest *Catalog::getDestsDest(int i) +{ + LinkDest *dest; + Object *obj, obj1; + + obj= getDests(); + if (!obj->isDict()) { + return NULL; + } + obj->dictGetVal(i, &obj1); + dest = createLinkDest(&obj1); + obj1.free(); + + return dest; +} + LinkDest *Catalog::getDestNameTreeDest(int i) { LinkDest *dest; diff --git a/poppler/Catalog.h b/poppler/Catalog.h index 32364871..81b0e125 100644 --- a/poppler/Catalog.h +++ b/poppler/Catalog.h @@ -151,6 +151,15 @@ public: Object *getDests(); + // Get the number of named destinations in name-dict + int numDests(); + + // Get the i'th named destination name in name-dict + char *getDestsName(int i); + + // Get the i'th named destination link destination in name-dict + LinkDest *getDestsDest(int i); + // Get the number of named destinations in name-tree int numDestNameTree() { return getDestNameTree()->numEntries(); } |