aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFObjectHandle.cc14
-rw-r--r--libqpdf/QPDF_Array.cc6
-rw-r--r--libqpdf/QPDF_Dictionary.cc7
-rw-r--r--libqpdf/qpdf/QPDF_Array.hh1
-rw-r--r--libqpdf/qpdf/QPDF_Dictionary.hh1
5 files changed, 29 insertions, 0 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index b877f3dd..8567eef9 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -246,6 +246,13 @@ QPDFObjectHandle::getArrayItem(int n)
return dynamic_cast<QPDF_Array*>(obj.getPointer())->getItem(n);
}
+std::vector<QPDFObjectHandle>
+QPDFObjectHandle::getArrayAsVector()
+{
+ assertType("Array", isArray());
+ return dynamic_cast<QPDF_Array*>(obj.getPointer())->getAsVector();
+}
+
// Array mutators
void
@@ -278,6 +285,13 @@ QPDFObjectHandle::getKeys()
return dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->getKeys();
}
+std::map<std::string, QPDFObjectHandle>
+QPDFObjectHandle::getDictAsMap()
+{
+ assertType("Dictionary", isDictionary());
+ return dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->getAsMap();
+}
+
// Array and Name accessors
bool
QPDFObjectHandle::isOrHasName(std::string const& value)
diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc
index ae70bd67..ab61f307 100644
--- a/libqpdf/QPDF_Array.cc
+++ b/libqpdf/QPDF_Array.cc
@@ -51,6 +51,12 @@ QPDF_Array::getItem(int n) const
return this->items[n];
}
+std::vector<QPDFObjectHandle> const&
+QPDF_Array::getAsVector() const
+{
+ return this->items;
+}
+
void
QPDF_Array::setItem(int n, QPDFObjectHandle const& oh)
{
diff --git a/libqpdf/QPDF_Dictionary.cc b/libqpdf/QPDF_Dictionary.cc
index 838a37e6..3be138a4 100644
--- a/libqpdf/QPDF_Dictionary.cc
+++ b/libqpdf/QPDF_Dictionary.cc
@@ -78,6 +78,13 @@ QPDF_Dictionary::getKeys()
return result;
}
+std::map<std::string, QPDFObjectHandle> const&
+QPDF_Dictionary::getAsMap() const
+{
+
+ return this->items;
+}
+
void
QPDF_Dictionary::replaceKey(std::string const& key,
QPDFObjectHandle const& value)
diff --git a/libqpdf/qpdf/QPDF_Array.hh b/libqpdf/qpdf/QPDF_Array.hh
index 490df723..a57834c8 100644
--- a/libqpdf/qpdf/QPDF_Array.hh
+++ b/libqpdf/qpdf/QPDF_Array.hh
@@ -14,6 +14,7 @@ class QPDF_Array: public QPDFObject
virtual std::string unparse();
int getNItems() const;
QPDFObjectHandle getItem(int n) const;
+ std::vector<QPDFObjectHandle> const& getAsVector() const;
void setItem(int, QPDFObjectHandle const&);
protected:
diff --git a/libqpdf/qpdf/QPDF_Dictionary.hh b/libqpdf/qpdf/QPDF_Dictionary.hh
index e84b549e..af9f7f09 100644
--- a/libqpdf/qpdf/QPDF_Dictionary.hh
+++ b/libqpdf/qpdf/QPDF_Dictionary.hh
@@ -21,6 +21,7 @@ class QPDF_Dictionary: public QPDFObject
bool hasKey(std::string const&);
QPDFObjectHandle getKey(std::string const&);
std::set<std::string> getKeys();
+ std::map<std::string, QPDFObjectHandle> const& getAsMap() const;
// Replace value of key, adding it if it does not exist
void replaceKey(std::string const& key, QPDFObjectHandle const&);