---
src/base/PdfDictionary.cpp | 13 +++++++++++++
src/base/PdfDictionary.h | 12 +++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/base/PdfDictionary.cpp b/src/base/PdfDictionary.cpp
index b0be927..65ed73a 100644
--- a/src/base/PdfDictionary.cpp
+++ b/src/base/PdfDictionary.cpp
@@ -166,6 +166,19 @@ const PdfObject* PdfDictionary::GetKey( const PdfName &
key ) const
}
return NULL;
+}
+
+const bool PdfDictionary::TryGetKey(const PdfName & key, PdfObject *& object)
const
+{
+ TCIKeyMap found = m_mapKeys.find(key);
+ if (found == m_mapKeys.end())
+ {
+ object = nullptr;
+ return false;
+ }
+
+ object = found->second;
+ return true;
}
PdfObject* PdfDictionary::GetKey( const PdfName & key )
diff --git a/src/base/PdfDictionary.h b/src/base/PdfDictionary.h
index 0a4493a..67043af 100644
--- a/src/base/PdfDictionary.h
+++ b/src/base/PdfDictionary.h
@@ -165,7 +165,17 @@ class PODOFO_API PdfDictionary : public PdfDataType {
*
* \returns pointer to the found value or 0 if the key was not found.
*/
- const PdfObject* GetKey( const PdfName & key ) const;
+ const PdfObject* GetKey( const PdfName & key ) const;
+
+ /** Try Get the keys value out of the dictionary.
+ *
+ * \param key look for the key names pszKey in the dictionary
+ * \object found object, null if not not found
+ *
+ * \returns true if key found
+ * \see GetKey
+ */
+ const bool TryGetKey(const PdfName & key, PdfObject *& object) const;
/** Get the keys value out of the dictionary. This is an overloaded member
* function.
--
2.16.1.windows.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users