diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-21 15:46:10 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-21 15:46:10 -0400 |
commit | 710c909117da4297e5a9508bedb306fc5c49eb36 (patch) | |
tree | 53c9bf4471ebe72977773ec8151b4ae44c3975bb /core/include/fpdfapi/fpdf_objects.h | |
parent | 316eb864137a0b8eeb0d0d4d698ba83f4946a89c (diff) | |
download | pdfium-710c909117da4297e5a9508bedb306fc5c49eb36.tar.xz |
Merge to XFA: Add type cast definitions for CPDF_Name.
This Cl adds ToName, CPDF_Object::AsName and CPDF_Object::IsName and
updates the src to use them as needed.
BUG=pdfium:201
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1417823005 .
(cherry picked from commit 1c77edb7b34e03787605b7965784cea38ef9f1d7)
Review URL: https://codereview.chromium.org/1417033004 .
Diffstat (limited to 'core/include/fpdfapi/fpdf_objects.h')
-rw-r--r-- | core/include/fpdfapi/fpdf_objects.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index a790d349ad..bd7f5bf0c4 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -16,6 +16,7 @@ class CPDF_CryptoHandler; class CPDF_Dictionary; class CPDF_Document; class CPDF_IndirectObjects; +class CPDF_Name; class CPDF_Null; class CPDF_Number; class CPDF_Parser; @@ -82,6 +83,7 @@ class CPDF_Object { 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; } @@ -91,6 +93,9 @@ class CPDF_Object { CPDF_Dictionary* AsDictionary(); const CPDF_Dictionary* AsDictionary() const; + CPDF_Name* AsName(); + const CPDF_Name* AsName() const; + CPDF_Number* AsNumber(); const CPDF_Number* AsNumber() const; @@ -261,6 +266,13 @@ class CPDF_Name : public CPDF_Object { CFX_ByteString m_Name; friend class CPDF_Object; }; +inline CPDF_Name* ToName(CPDF_Object* obj) { + return obj ? obj->AsName() : nullptr; +} +inline const CPDF_Name* ToName(const CPDF_Object* obj) { + return obj ? obj->AsName() : nullptr; +} + class CPDF_Array : public CPDF_Object { public: static CPDF_Array* Create() { return new CPDF_Array(); } |