Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(867)

Side by Side Diff: core/include/fpdfapi/fpdf_objects.h

Issue 1417623005: Add type cast definitions for CPDF_Boolean. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_
8 #define CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ 8 #define CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_
9 9
10 #include "../fxcrt/fx_coordinates.h" 10 #include "../fxcrt/fx_coordinates.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 CPDF_Array* GetArray() const; 71 CPDF_Array* GetArray() const;
72 72
73 void SetString(const CFX_ByteString& str); 73 void SetString(const CFX_ByteString& str);
74 74
75 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); 75 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1);
76 76
77 int GetDirectType() const; 77 int GetDirectType() const;
78 78
79 FX_BOOL IsModified() const { return FALSE; } 79 FX_BOOL IsModified() const { return FALSE; }
80 80
81 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; }
81 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } 82 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; }
82 83
84 CPDF_Boolean* AsBoolean();
85 const CPDF_Boolean* AsBoolean() const;
86
83 CPDF_Dictionary* AsDictionary(); 87 CPDF_Dictionary* AsDictionary();
84 const CPDF_Dictionary* AsDictionary() const; 88 const CPDF_Dictionary* AsDictionary() const;
85 89
86 protected: 90 protected:
87 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} 91 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {}
88 ~CPDF_Object() {} 92 ~CPDF_Object() {}
89 void Destroy(); 93 void Destroy();
90 94
91 static const int OBJECT_REF_MAX_DEPTH = 128; 95 static const int OBJECT_REF_MAX_DEPTH = 128;
92 static int s_nCurRefDepth; 96 static int s_nCurRefDepth;
(...skipping 17 matching lines...) Expand all
110 CPDF_Boolean(FX_BOOL value) : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(value) {} 114 CPDF_Boolean(FX_BOOL value) : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(value) {}
111 115
112 FX_BOOL Identical(CPDF_Boolean* pOther) const { 116 FX_BOOL Identical(CPDF_Boolean* pOther) const {
113 return m_bValue == pOther->m_bValue; 117 return m_bValue == pOther->m_bValue;
114 } 118 }
115 119
116 protected: 120 protected:
117 FX_BOOL m_bValue; 121 FX_BOOL m_bValue;
118 friend class CPDF_Object; 122 friend class CPDF_Object;
119 }; 123 };
124 inline CPDF_Boolean* ToBoolean(CPDF_Object* obj) {
125 return obj ? obj->AsBoolean() : nullptr;
126 }
127 inline const CPDF_Boolean* ToBoolean(const CPDF_Object* obj) {
128 return obj ? obj->AsBoolean() : nullptr;
129 }
130
120 class CPDF_Number : public CPDF_Object { 131 class CPDF_Number : public CPDF_Object {
121 public: 132 public:
122 static CPDF_Number* Create(int value) { return new CPDF_Number(value); } 133 static CPDF_Number* Create(int value) { return new CPDF_Number(value); }
123 134
124 static CPDF_Number* Create(FX_FLOAT value) { return new CPDF_Number(value); } 135 static CPDF_Number* Create(FX_FLOAT value) { return new CPDF_Number(value); }
125 136
126 static CPDF_Number* Create(const CFX_ByteStringC& str) { 137 static CPDF_Number* Create(const CFX_ByteStringC& str) {
127 return new CPDF_Number(str); 138 return new CPDF_Number(str);
128 } 139 }
129 140
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 581
571 protected: 582 protected:
572 CFX_MapPtrToPtr m_IndirectObjs; 583 CFX_MapPtrToPtr m_IndirectObjs;
573 584
574 CPDF_Parser* m_pParser; 585 CPDF_Parser* m_pParser;
575 586
576 FX_DWORD m_LastObjNum; 587 FX_DWORD m_LastObjNum;
577 }; 588 };
578 589
579 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ 590 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698