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

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
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_font/fpdf_font.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"
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 bool IsString() const { return m_Type == PDFOBJ_STRING; } 86 bool IsString() const { return m_Type == PDFOBJ_STRING; }
85 87
86 CPDF_Boolean* AsBoolean(); 88 CPDF_Boolean* AsBoolean();
87 const CPDF_Boolean* AsBoolean() const; 89 const CPDF_Boolean* AsBoolean() const;
88 90
89 CPDF_Dictionary* AsDictionary(); 91 CPDF_Dictionary* AsDictionary();
90 const CPDF_Dictionary* AsDictionary() const; 92 const CPDF_Dictionary* AsDictionary() const;
91 93
94 CPDF_Name* AsName();
95 const CPDF_Name* AsName() const;
96
92 CPDF_Number* AsNumber(); 97 CPDF_Number* AsNumber();
93 const CPDF_Number* AsNumber() const; 98 const CPDF_Number* AsNumber() const;
94 99
95 CPDF_String* AsString(); 100 CPDF_String* AsString();
96 const CPDF_String* AsString() const; 101 const CPDF_String* AsString() const;
97 102
98 protected: 103 protected:
99 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} 104 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {}
100 ~CPDF_Object() {} 105 ~CPDF_Object() {}
101 void Destroy(); 106 void Destroy();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 CFX_ByteString& GetString() { return m_Name; } 257 CFX_ByteString& GetString() { return m_Name; }
253 258
254 FX_BOOL Identical(CPDF_Name* pOther) const { 259 FX_BOOL Identical(CPDF_Name* pOther) const {
255 return m_Name == pOther->m_Name; 260 return m_Name == pOther->m_Name;
256 } 261 }
257 262
258 protected: 263 protected:
259 CFX_ByteString m_Name; 264 CFX_ByteString m_Name;
260 friend class CPDF_Object; 265 friend class CPDF_Object;
261 }; 266 };
267 inline CPDF_Name* ToName(CPDF_Object* obj) {
268 return obj ? obj->AsName() : nullptr;
269 }
270 inline const CPDF_Name* ToName(const CPDF_Object* obj) {
271 return obj ? obj->AsName() : nullptr;
272 }
273
262 class CPDF_Array : public CPDF_Object { 274 class CPDF_Array : public CPDF_Object {
263 public: 275 public:
264 static CPDF_Array* Create() { return new CPDF_Array(); } 276 static CPDF_Array* Create() { return new CPDF_Array(); }
265 277
266 CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) {} 278 CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) {}
267 279
268 FX_DWORD GetCount() const { return m_Objects.GetSize(); } 280 FX_DWORD GetCount() const { return m_Objects.GetSize(); }
269 281
270 CPDF_Object* GetElement(FX_DWORD index) const; 282 CPDF_Object* GetElement(FX_DWORD index) const;
271 283
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 609
598 protected: 610 protected:
599 CFX_MapPtrToPtr m_IndirectObjs; 611 CFX_MapPtrToPtr m_IndirectObjs;
600 612
601 CPDF_Parser* m_pParser; 613 CPDF_Parser* m_pParser;
602 614
603 FX_DWORD m_LastObjNum; 615 FX_DWORD m_LastObjNum;
604 }; 616 };
605 617
606 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ 618 #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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698