From 5a370d77d0db7550e91888f0ff50ee305f0f9f3d Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 6 Mar 2015 10:34:48 -0800 Subject: Make conversion between CPDF_Dest and its object explicit. Precursor to taking a second shot at cleaning up the FPDF_* APIs. A FPDF_Dest is a CPDF_Array, and a CPDF_Dest is a structure holding a FPDF_Dest. This goes against the convention that FPDF_ types get cast to CPDF_* types, so we want to make it clear where objects are getting constructed, etc. R=thestig@chromium.org Review URL: https://codereview.chromium.org/984703004 --- core/include/fpdfdoc/fpdf_doc.h | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'core/include/fpdfdoc') diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index dbcc7f433e..dac215e711 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -124,28 +124,19 @@ public: class CPDF_Dest : public CFX_Object { public: + CPDF_Dest() : m_pObj(nullptr) { } + explicit CPDF_Dest(CPDF_Object* pObj) : m_pObj(pObj) { } - CPDF_Dest(CPDF_Object* pObj = NULL) - { - m_pObj = pObj; - } - - operator CPDF_Object* () const - { - return m_pObj; - } + operator bool () const { return m_pObj != NULL; } + CPDF_Object* GetObject() const { return m_pObj; } CFX_ByteString GetRemoteName(); - int GetPageIndex(CPDF_Document* pDoc); - FX_DWORD GetPageObjNum(); - int GetZoomMode(); - FX_FLOAT GetParam(int index); - +protected: CPDF_Object* m_pObj; }; class CPDF_OCContext : public CFX_Object, public IPDF_OCContext -- cgit v1.2.3