diff options
Diffstat (limited to 'core/include/fpdfapi/fpdf_objects.h')
-rw-r--r-- | core/include/fpdfapi/fpdf_objects.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index 0df8be727c..438c89cc50 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -80,6 +80,7 @@ class CPDF_Object { bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; } bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } + bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; } CPDF_Boolean* AsBoolean(); const CPDF_Boolean* AsBoolean() const; @@ -87,6 +88,9 @@ class CPDF_Object { CPDF_Dictionary* AsDictionary(); const CPDF_Dictionary* AsDictionary() const; + CPDF_Number* AsNumber(); + const CPDF_Number* AsNumber() const; + protected: CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} ~CPDF_Object() {} @@ -178,6 +182,13 @@ class CPDF_Number : public CPDF_Object { }; friend class CPDF_Object; }; +inline CPDF_Number* ToNumber(CPDF_Object* obj) { + return obj ? obj->AsNumber() : nullptr; +} +inline const CPDF_Number* ToNumber(const CPDF_Object* obj) { + return obj ? obj->AsNumber() : nullptr; +} + class CPDF_String : public CPDF_Object { public: static CPDF_String* Create(const CFX_ByteString& str, FX_BOOL bHex = FALSE) { |