[poppler] glib/poppler-structure-element.cc poppler/StructElement.cc poppler/StructElement.h poppler/StructTreeRoot.cc poppler/StructTreeRoot.h

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Wed Mar 5 08:49:59 PST 2014


 glib/poppler-structure-element.cc |   16 ++++++++--------
 poppler/StructElement.cc          |    6 +++---
 poppler/StructElement.h           |    8 ++++----
 poppler/StructTreeRoot.cc         |    4 ++--
 poppler/StructTreeRoot.h          |    8 ++++----
 5 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 7ddd03f9a00dcf505921821c55bebe6817aa3605
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Wed Mar 5 17:48:39 2014 +0100

    Rename getNumElements, getElement and appendElement as getNumChildren, getChild and appendChild
    
    It's more consistent with other internal API and less confusing.

diff --git a/glib/poppler-structure-element.cc b/glib/poppler-structure-element.cc
index e15bf4b..a59b988 100644
--- a/glib/poppler-structure-element.cc
+++ b/glib/poppler-structure-element.cc
@@ -798,7 +798,7 @@ poppler_structure_element_iter_new (PopplerDocument *poppler_document)
   if (root == NULL)
     return NULL;
 
-  if (root->getNumElements () == 0)
+  if (root->getNumChildren () == 0)
     return NULL;
 
   iter = g_slice_new0 (PopplerStructureElementIter);
@@ -829,8 +829,8 @@ poppler_structure_element_iter_next (PopplerStructureElementIter *iter)
   g_return_val_if_fail (iter != NULL, FALSE);
 
   elements = iter->is_root
-    ? iter->root->getNumElements ()
-    : iter->elem->getNumElements ();
+    ? iter->root->getNumChildren ()
+    : iter->elem->getNumChildren ();
 
   return ++iter->index < elements;
 }
@@ -853,8 +853,8 @@ poppler_structure_element_iter_get_element (PopplerStructureElementIter *iter)
   g_return_val_if_fail (iter != NULL, NULL);
 
   elem = iter->is_root
-    ? iter->root->getElement (iter->index)
-    : iter->elem->getElement (iter->index);
+    ? iter->root->getChild (iter->index)
+    : iter->elem->getChild (iter->index);
 
   return _poppler_structure_element_new (iter->document, elem);
 }
@@ -879,10 +879,10 @@ poppler_structure_element_iter_get_child (PopplerStructureElementIter *parent)
   g_return_val_if_fail (parent != NULL, NULL);
 
   elem = parent->is_root
-    ? parent->root->getElement (parent->index)
-    : parent->elem->getElement (parent->index);
+    ? parent->root->getChild (parent->index)
+    : parent->elem->getChild (parent->index);
 
-  if (elem->getNumElements () > 0)
+  if (elem->getNumChildren () > 0)
     {
       PopplerStructureElementIter *child = g_slice_new0 (PopplerStructureElementIter);
       child->document = (PopplerDocument *) g_object_ref (parent->document);
diff --git a/poppler/StructElement.cc b/poppler/StructElement.cc
index ba859e9..ed8ee25 100644
--- a/poppler/StructElement.cc
+++ b/poppler/StructElement.cc
@@ -1012,8 +1012,8 @@ GooString* StructElement::appendSubTreeText(GooString *string, GBool recursive)
   if (!string)
     string = new GooString();
 
-  for (unsigned i = 0; i < getNumElements(); i++)
-    getElement(i)->appendSubTreeText(string, recursive);
+  for (unsigned i = 0; i < getNumChildren(); i++)
+    getChild(i)->appendSubTreeText(string, recursive);
 
   return string;
 }
@@ -1276,7 +1276,7 @@ StructElement *StructElement::parseChild(Object *ref,
 
   if (child) {
     if (child->isOk()) {
-      appendElement(child);
+      appendChild(child);
       if (ref->isRef())
         treeRoot->parentTreeAdd(ref->getRef(), child);
     } else {
diff --git a/poppler/StructElement.h b/poppler/StructElement.h
index 7de0082..96ad2ed 100644
--- a/poppler/StructElement.h
+++ b/poppler/StructElement.h
@@ -191,11 +191,11 @@ public:
   const GooString *getExpandedAbbr() const { return isContent() ? NULL : s->expandedAbbr; }
   GooString *getExpandedAbbr() { return isContent() ? NULL : s->expandedAbbr; }
 
-  unsigned getNumElements() const { return isContent() ? 0 : s->elements.size(); }
-  const StructElement *getElement(int i) const { return isContent() ? NULL : s->elements.at(i); }
-  StructElement *getElement(int i) { return isContent() ? NULL : s->elements.at(i); }
+  unsigned getNumChildren() const { return isContent() ? 0 : s->elements.size(); }
+  const StructElement *getChild(int i) const { return isContent() ? NULL : s->elements.at(i); }
+  StructElement *getChild(int i) { return isContent() ? NULL : s->elements.at(i); }
 
-  void appendElement(StructElement *element) {
+  void appendChild(StructElement *element) {
     if (!isContent() && element && element->isOk()) {
       s->elements.push_back(element);
     }
diff --git a/poppler/StructTreeRoot.cc b/poppler/StructTreeRoot.cc
index 4fff297..56ce945 100644
--- a/poppler/StructTreeRoot.cc
+++ b/poppler/StructTreeRoot.cc
@@ -128,7 +128,7 @@ void StructTreeRoot::parse(Dict *root)
                           child->getType() == StructElement::Div)) {
             error(errSyntaxWarning, -1, "StructTreeRoot element of tagged PDF is wrong type ({0:s})", child->getTypeName());
           }
-          appendElement(child);
+          appendChild(child);
           if (ref.isRef()) {
             parentTreeAdd(ref.getRef(), child);
           }
@@ -148,7 +148,7 @@ void StructTreeRoot::parse(Dict *root)
     }
     StructElement *child = new StructElement(kids.getDict(), this, NULL, seenElements);
     if (child->isOk()) {
-      appendElement(child);
+      appendChild(child);
       Object ref;
       if (root->lookupNF("K", &ref)->isRef())
         parentTreeAdd(ref.getRef(), child);
diff --git a/poppler/StructTreeRoot.h b/poppler/StructTreeRoot.h
index 9928e2f..f42cdd5 100644
--- a/poppler/StructTreeRoot.h
+++ b/poppler/StructTreeRoot.h
@@ -33,11 +33,11 @@ public:
   PDFDoc *getDoc() { return doc; }
   Dict *getRoleMap() { return roleMap.isDict() ? roleMap.getDict() : NULL; }
   Dict *getClassMap() { return classMap.isDict() ? classMap.getDict() : NULL; }
-  unsigned getNumElements() const { return elements.size(); }
-  const StructElement *getElement(int i) const { return elements.at(i); }
-  StructElement *getElement(int i) { return elements.at(i); }
+  unsigned getNumChildren() const { return elements.size(); }
+  const StructElement *getChild(int i) const { return elements.at(i); }
+  StructElement *getChild(int i) { return elements.at(i); }
 
-  void appendElement(StructElement *element) {
+  void appendChild(StructElement *element) {
     if (element && element->isOk()) {
       elements.push_back(element);
     }


More information about the poppler mailing list