summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-22 15:02:06 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-22 15:02:06 -0400
commit2b11dc1220746d2f6f97a940fc9e4235c8ed4975 (patch)
treee25b2ba13112f4ead789260ee57fe5b40c13b83e /core/include
parentbc6c6723c37772b02de9e6e43fa0fd9439874905 (diff)
downloadpdfium-2b11dc1220746d2f6f97a940fc9e4235c8ed4975.tar.xz
Merge to XFA: Add type cast definitions for CPDF_Array.
This Cl adds ToArray, CPDF_Object::AsArray and CPDF_Object::IsArray and updates the src to use them as needed. BUG=pdfium:201 R=thestig@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1417893003 . (cherry picked from commit c2bfc000e502c42c9a3017038fd9104c7997d126) Review URL: https://codereview.chromium.org/1419643005 .
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fpdfapi/fpdf_objects.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index bd7f5bf0c4..dbd44952ae 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -81,12 +81,16 @@ class CPDF_Object {
FX_BOOL IsModified() const { return FALSE; }
+ bool IsArray() const { return m_Type == PDFOBJ_ARRAY; }
bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; }
bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; }
bool IsName() const { return m_Type == PDFOBJ_NAME; }
bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; }
bool IsString() const { return m_Type == PDFOBJ_STRING; }
+ CPDF_Array* AsArray();
+ const CPDF_Array* AsArray() const;
+
CPDF_Boolean* AsBoolean();
const CPDF_Boolean* AsBoolean() const;
@@ -343,6 +347,13 @@ class CPDF_Array : public CPDF_Object {
CFX_PtrArray m_Objects;
friend class CPDF_Object;
};
+inline CPDF_Array* ToArray(CPDF_Object* obj) {
+ return obj ? obj->AsArray() : nullptr;
+}
+inline const CPDF_Array* ToArray(const CPDF_Object* obj) {
+ return obj ? obj->AsArray() : nullptr;
+}
+
class CPDF_Dictionary : public CPDF_Object {
public:
static CPDF_Dictionary* Create() { return new CPDF_Dictionary(); }