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

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

Issue 1417823005: Add type cast definitions for CPDF_Name. (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
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"
11 #include "../fxcrt/fx_system.h" 11 #include "../fxcrt/fx_system.h"
12 12
13 class CPDF_Array; 13 class CPDF_Array;
14 class CPDF_Boolean; 14 class CPDF_Boolean;
15 class CPDF_CryptoHandler; 15 class CPDF_CryptoHandler;
16 class CPDF_Dictionary; 16 class CPDF_Dictionary;
17 class CPDF_Document; 17 class CPDF_Document;
18 class CPDF_IndirectObjects; 18 class CPDF_IndirectObjects;
19 class CPDF_Name;
19 class CPDF_Null; 20 class CPDF_Null;
20 class CPDF_Number; 21 class CPDF_Number;
21 class CPDF_Parser; 22 class CPDF_Parser;
22 class CPDF_Reference; 23 class CPDF_Reference;
23 class CPDF_Stream; 24 class CPDF_Stream;
24 class CPDF_StreamAcc; 25 class CPDF_StreamAcc;
25 class CPDF_StreamFilter; 26 class CPDF_StreamFilter;
26 class CPDF_String; 27 class CPDF_String;
27 class IFX_FileRead; 28 class IFX_FileRead;
28 29
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 void SetString(const CFX_ByteString& str); 74 void SetString(const CFX_ByteString& str);
74 75
75 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); 76 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1);
76 77
77 int GetDirectType() const; 78 int GetDirectType() const;
78 79
79 FX_BOOL IsModified() const { return FALSE; } 80 FX_BOOL IsModified() const { return FALSE; }
80 81
81 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; } 82 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; }
82 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } 83 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; }
84 bool IsName() const { return m_Type == PDFOBJ_NAME; }
83 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; } 85 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; }
84 86
85 CPDF_Boolean* AsBoolean(); 87 CPDF_Boolean* AsBoolean();
86 const CPDF_Boolean* AsBoolean() const; 88 const CPDF_Boolean* AsBoolean() const;
87 89
88 CPDF_Dictionary* AsDictionary(); 90 CPDF_Dictionary* AsDictionary();
89 const CPDF_Dictionary* AsDictionary() const; 91 const CPDF_Dictionary* AsDictionary() const;
90 92
93 CPDF_Name* AsName();
94 const CPDF_Name* AsName() const;
95
91 CPDF_Number* AsNumber(); 96 CPDF_Number* AsNumber();
92 const CPDF_Number* AsNumber() const; 97 const CPDF_Number* AsNumber() const;
93 98
94 protected: 99 protected:
95 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} 100 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {}
96 ~CPDF_Object() {} 101 ~CPDF_Object() {}
97 void Destroy(); 102 void Destroy();
98 103
99 static const int OBJECT_REF_MAX_DEPTH = 128; 104 static const int OBJECT_REF_MAX_DEPTH = 128;
100 static int s_nCurRefDepth; 105 static int s_nCurRefDepth;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 CFX_ByteString& GetString() { return m_Name; } 246 CFX_ByteString& GetString() { return m_Name; }
242 247
243 FX_BOOL Identical(CPDF_Name* pOther) const { 248 FX_BOOL Identical(CPDF_Name* pOther) const {
244 return m_Name == pOther->m_Name; 249 return m_Name == pOther->m_Name;
245 } 250 }
246 251
247 protected: 252 protected:
248 CFX_ByteString m_Name; 253 CFX_ByteString m_Name;
249 friend class CPDF_Object; 254 friend class CPDF_Object;
250 }; 255 };
256 inline CPDF_Name* ToName(CPDF_Object* obj) {
257 return obj ? obj->AsName() : nullptr;
258 }
259 inline const CPDF_Name* ToName(const CPDF_Object* obj) {
260 return obj ? obj->AsName() : nullptr;
261 }
262
251 class CPDF_Array : public CPDF_Object { 263 class CPDF_Array : public CPDF_Object {
252 public: 264 public:
253 static CPDF_Array* Create() { return new CPDF_Array(); } 265 static CPDF_Array* Create() { return new CPDF_Array(); }
254 266
255 CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) {} 267 CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) {}
256 268
257 FX_DWORD GetCount() const { return m_Objects.GetSize(); } 269 FX_DWORD GetCount() const { return m_Objects.GetSize(); }
258 270
259 CPDF_Object* GetElement(FX_DWORD index) const; 271 CPDF_Object* GetElement(FX_DWORD index) const;
260 272
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 598
587 protected: 599 protected:
588 CFX_MapPtrToPtr m_IndirectObjs; 600 CFX_MapPtrToPtr m_IndirectObjs;
589 601
590 CPDF_Parser* m_pParser; 602 CPDF_Parser* m_pParser;
591 603
592 FX_DWORD m_LastObjNum; 604 FX_DWORD m_LastObjNum;
593 }; 605 };
594 606
595 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ 607 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698