summaryrefslogtreecommitdiff
path: root/core/include/fpdfapi/fpdf_objects.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-26 16:54:39 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-26 16:54:39 -0400
commitbf81c14cdb2b336a62f97119315f6bc43502e840 (patch)
treec9bc0f23a2cc60307b77a69851733ed85c87196f /core/include/fpdfapi/fpdf_objects.h
parent15ce59a0f34278b6b222675c77b25e3e0c50139f (diff)
downloadpdfium-bf81c14cdb2b336a62f97119315f6bc43502e840.tar.xz
Merge to XFA: Revert "Revert "Add type cast definitions for CPDF_Reference.""
This reverts commit 7e155865c90cc1115cc7193b7646a341d8f9093e. Add type cast definitions for CPDF_Reference. This Cl adds ToReference, CPDF_Object::AsReference and CPDF_Object::IsReference and updates the src to use them as needed. BUG=pdfium:201 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1418923005 . (cherry picked from commit 6ee3484bcb413f4cce303e237fe15e2bdaf51ade) Review URL: https://codereview.chromium.org/1410073007 .
Diffstat (limited to 'core/include/fpdfapi/fpdf_objects.h')
-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 b97cc68677..7287814f9a 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -84,6 +84,7 @@ class CPDF_Object {
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 IsReference() const { return m_Type == PDFOBJ_REFERENCE; }
bool IsStream() const { return m_Type == PDFOBJ_STREAM; }
bool IsString() const { return m_Type == PDFOBJ_STRING; }
@@ -102,6 +103,9 @@ class CPDF_Object {
CPDF_Number* AsNumber();
const CPDF_Number* AsNumber() const;
+ CPDF_Reference* AsReference();
+ const CPDF_Reference* AsReference() const;
+
CPDF_Stream* AsStream();
const CPDF_Stream* AsStream() const;
@@ -604,6 +608,13 @@ class CPDF_Reference : public CPDF_Object {
FX_DWORD m_RefObjNum;
friend class CPDF_Object;
};
+inline CPDF_Reference* ToReference(CPDF_Object* obj) {
+ return obj ? obj->AsReference() : nullptr;
+}
+inline const CPDF_Reference* ToReference(const CPDF_Object* obj) {
+ return obj ? obj->AsReference() : nullptr;
+}
+
class CPDF_IndirectObjects {
public:
CPDF_IndirectObjects(CPDF_Parser* pParser);