Chromium Code Reviews| Index: core/include/fpdfapi/fpdf_objects.h |
| diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h |
| index 570dc410c208c0a14559a6602286498b54f5eadc..81bb3ff3ecc65ab0a12761ea2af8ee0e66503a63 100644 |
| --- a/core/include/fpdfapi/fpdf_objects.h |
| +++ b/core/include/fpdfapi/fpdf_objects.h |
| @@ -41,7 +41,6 @@ typedef IFX_FileStream* (*FPDF_LPFCloneStreamCallback)(CPDF_Stream *pStream, voi |
| class CPDF_Object |
| { |
| public: |
| - |
| int GetType() const |
| { |
| return m_Type; |
| @@ -67,7 +66,7 @@ public: |
| void Release(); |
| - CFX_ByteString GetString() const; |
| + virtual CFX_ByteString GetString() const; |
| CFX_ByteStringC GetConstString() const; |
| @@ -94,7 +93,7 @@ public: |
| } |
| protected: |
| CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) { } |
| - ~CPDF_Object() { } |
| + virtual ~CPDF_Object() {} |
|
Tom Sepez
2015/07/16 20:24:46
Right, now that we are paying the price for a vtab
|
| void Destroy(); |
|
Tom Sepez
2015/07/16 20:24:46
Remove Destroy() now that we have virtual destruct
|
| static const int OBJECT_REF_MAX_DEPTH = 128; |
| @@ -110,6 +109,7 @@ private: |
| CPDF_Object(const CPDF_Object& src) {} |
| CPDF_Object* CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visited) const; |
| }; |
| + |
| class CPDF_Boolean : public CPDF_Object |
| { |
| public: |
| @@ -121,16 +121,19 @@ public: |
| CPDF_Boolean() : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(false) { } |
| CPDF_Boolean(FX_BOOL value) : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(value) { } |
| + ~CPDF_Boolean() override {} |
| FX_BOOL Identical(CPDF_Boolean* pOther) const |
| { |
| return m_bValue == pOther->m_bValue; |
| } |
| protected: |
| + CFX_ByteString GetString() const override; |
| FX_BOOL m_bValue; |
| friend class CPDF_Object; |
| }; |
| + |
| class CPDF_Number : public CPDF_Object |
| { |
| public: |
| @@ -165,9 +168,9 @@ public: |
| CPDF_Number(const CFX_ByteStringC& str); |
| - FX_BOOL Identical(CPDF_Number* pOther) const; |
| + ~CPDF_Number() override {} |
| - CFX_ByteString GetString() const; |
| + FX_BOOL Identical(CPDF_Number* pOther) const; |
| void SetString(const CFX_ByteStringC& str); |
| @@ -198,6 +201,7 @@ public: |
| return m_bInteger ? (FX_FLOAT)m_Integer : m_Float; |
| } |
| protected: |
| + CFX_ByteString GetString() const override; |
|
Tom Sepez
2015/07/16 20:24:46
not sure why this needs to be protected, either.
|
| FX_BOOL m_bInteger; |
| @@ -209,6 +213,7 @@ protected: |
| }; |
| friend class CPDF_Object; |
| }; |
| + |
| class CPDF_String : public CPDF_Object |
| { |
| public: |
| @@ -231,10 +236,7 @@ public: |
| CPDF_String(const CFX_WideString& str); |
| - CFX_ByteString& GetString() |
| - { |
| - return m_String; |
| - } |
| + ~CPDF_String() override {} |
| FX_BOOL Identical(CPDF_String* pOther) const |
| { |
| @@ -246,12 +248,14 @@ public: |
| return m_bHex; |
| } |
| protected: |
| + CFX_ByteString GetString() const override; |
|
Tom Sepez
2015/07/16 20:24:46
ditto
|
| CFX_ByteString m_String; |
| FX_BOOL m_bHex; |
| friend class CPDF_Object; |
| }; |
| + |
| class CPDF_Name : public CPDF_Object |
| { |
| public: |
| @@ -274,6 +278,7 @@ public: |
| CPDF_Name(const CFX_ByteString& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } |
| CPDF_Name(const CFX_ByteStringC& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } |
| CPDF_Name(const FX_CHAR* str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } |
| + ~CPDF_Name() override {} |
| CFX_ByteString& GetString() |
| { |
| @@ -285,10 +290,12 @@ public: |
| return m_Name == pOther->m_Name; |
| } |
| protected: |
| + CFX_ByteString GetString() const override; |
|
Tom Sepez
2015/07/16 20:24:46
ditto
|
| CFX_ByteString m_Name; |
| friend class CPDF_Object; |
| }; |
| + |
| class CPDF_Array : public CPDF_Object |
| { |
| public: |
| @@ -318,7 +325,7 @@ public: |
| - CFX_ByteString GetString(FX_DWORD index) const; |
| + CFX_ByteString GetStringAt(FX_DWORD index) const; |
|
Tom Sepez
2015/07/16 20:24:46
I presume this is the overriding overloaded method
|
| CFX_ByteStringC GetConstString(FX_DWORD index) const; |
| @@ -380,12 +387,12 @@ public: |
| FX_BOOL Identical(CPDF_Array* pOther) const; |
| protected: |
| - |
| - ~CPDF_Array(); |
| + ~CPDF_Array() override; |
| CFX_PtrArray m_Objects; |
| friend class CPDF_Object; |
| }; |
| + |
| class CPDF_Dictionary : public CPDF_Object |
| { |
| public: |
| @@ -401,15 +408,12 @@ public: |
| CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; |
| - |
| - |
| - |
| - |
| - CFX_ByteString GetString(const CFX_ByteStringC& key) const; |
| + CFX_ByteString GetStringAt(const CFX_ByteStringC& key) const; |
| CFX_ByteStringC GetConstString(const CFX_ByteStringC& key) const; |
| - CFX_ByteString GetString(const CFX_ByteStringC& key, const CFX_ByteStringC& default_str) const; |
| + CFX_ByteString GetStringAt(const CFX_ByteStringC& key, |
| + const CFX_ByteStringC& default_str) const; |
| CFX_ByteStringC GetConstString(const CFX_ByteStringC& key, const CFX_ByteStringC& default_str) const; |
| @@ -496,13 +500,13 @@ public: |
| void AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj); |
| protected: |
| - |
| - ~CPDF_Dictionary(); |
| + ~CPDF_Dictionary() override; |
| CFX_CMapByteStringToPtr m_Map; |
| friend class CPDF_Object; |
| }; |
| + |
| class CPDF_Stream : public CPDF_Object |
| { |
| public: |
| @@ -546,8 +550,7 @@ public: |
| CPDF_Stream* Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, void* pUserData) const; |
| protected: |
| - |
| - ~CPDF_Stream(); |
| + ~CPDF_Stream() override; |
| CPDF_Dictionary* m_pDict; |
| @@ -571,6 +574,7 @@ protected: |
| friend class CPDF_StreamAcc; |
| friend class CPDF_AttachmentAcc; |
| }; |
| + |
| class CPDF_StreamAcc |
| { |
| public: |
| @@ -623,6 +627,7 @@ protected: |
| uint8_t* m_pSrcData; |
| }; |
| + |
| CFX_DataFilter* FPDF_CreateFilter(const CFX_ByteStringC& name, const CPDF_Dictionary* pParam, int width = 0, int height = 0); |
| #define FPDF_FILTER_BUFFER_SIZE 20480 |
| class CPDF_StreamFilter |
| @@ -661,6 +666,7 @@ protected: |
| uint8_t m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; |
| friend class CPDF_Stream; |
| }; |
| + |
| class CPDF_Null : public CPDF_Object |
| { |
| public: |
| @@ -671,7 +677,9 @@ public: |
| } |
| CPDF_Null() : CPDF_Object(PDFOBJ_NULL) { } |
| + ~CPDF_Null() override {} |
| }; |
| + |
| class CPDF_Reference : public CPDF_Object |
| { |
| public: |
| @@ -684,6 +692,7 @@ public: |
| CPDF_Reference(CPDF_IndirectObjects* pDoc, int objnum) |
| : CPDF_Object(PDFOBJ_REFERENCE), m_pObjList(pDoc), m_RefObjNum(objnum) { |
| } |
| + ~CPDF_Reference() override {} |
| CPDF_IndirectObjects* GetObjList() const |
| { |
| @@ -702,12 +711,14 @@ public: |
| return m_RefObjNum == pOther->m_RefObjNum; |
| } |
| protected: |
| + CFX_ByteString GetString() const override; |
| CPDF_IndirectObjects* m_pObjList; |
| FX_DWORD m_RefObjNum; |
| friend class CPDF_Object; |
| }; |
| + |
| class CPDF_IndirectObjects |
| { |
| public: |