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

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

Issue 1417033004: Merge to XFA: Add type cast definitions for CPDF_Name. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
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') | fpdfsdk/src/fpdfppo.cpp » ('J')
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void SetString(const CFX_ByteString& str); 76 void SetString(const CFX_ByteString& str);
76 77
77 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); 78 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1);
78 79
79 int GetDirectType() const; 80 int GetDirectType() const;
80 81
81 FX_BOOL IsModified() const { return FALSE; } 82 FX_BOOL IsModified() const { return FALSE; }
82 83
83 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; } 84 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; }
84 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } 85 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; }
86 bool IsName() const { return m_Type == PDFOBJ_NAME; }
85 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; } 87 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; }
86 bool IsString() const { return m_Type == PDFOBJ_STRING; } 88 bool IsString() const { return m_Type == PDFOBJ_STRING; }
87 89
88 CPDF_Boolean* AsBoolean(); 90 CPDF_Boolean* AsBoolean();
89 const CPDF_Boolean* AsBoolean() const; 91 const CPDF_Boolean* AsBoolean() const;
90 92
91 CPDF_Dictionary* AsDictionary(); 93 CPDF_Dictionary* AsDictionary();
92 const CPDF_Dictionary* AsDictionary() const; 94 const CPDF_Dictionary* AsDictionary() const;
93 95
96 CPDF_Name* AsName();
97 const CPDF_Name* AsName() const;
98
94 CPDF_Number* AsNumber(); 99 CPDF_Number* AsNumber();
95 const CPDF_Number* AsNumber() const; 100 const CPDF_Number* AsNumber() const;
96 101
97 CPDF_String* AsString(); 102 CPDF_String* AsString();
98 const CPDF_String* AsString() const; 103 const CPDF_String* AsString() const;
99 104
100 protected: 105 protected:
101 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {} 106 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {}
102 ~CPDF_Object() {} 107 ~CPDF_Object() {}
103 void Destroy(); 108 void Destroy();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 CFX_ByteString& GetString() { return m_Name; } 259 CFX_ByteString& GetString() { return m_Name; }
255 260
256 FX_BOOL Identical(CPDF_Name* pOther) const { 261 FX_BOOL Identical(CPDF_Name* pOther) const {
257 return m_Name == pOther->m_Name; 262 return m_Name == pOther->m_Name;
258 } 263 }
259 264
260 protected: 265 protected:
261 CFX_ByteString m_Name; 266 CFX_ByteString m_Name;
262 friend class CPDF_Object; 267 friend class CPDF_Object;
263 }; 268 };
269 inline CPDF_Name* ToName(CPDF_Object* obj) {
270 return obj ? obj->AsName() : nullptr;
271 }
272 inline const CPDF_Name* ToName(const CPDF_Object* obj) {
273 return obj ? obj->AsName() : nullptr;
274 }
275
264 class CPDF_Array : public CPDF_Object { 276 class CPDF_Array : public CPDF_Object {
265 public: 277 public:
266 static CPDF_Array* Create() { return new CPDF_Array(); } 278 static CPDF_Array* Create() { return new CPDF_Array(); }
267 279
268 CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) {} 280 CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) {}
269 281
270 FX_DWORD GetCount() const { return m_Objects.GetSize(); } 282 FX_DWORD GetCount() const { return m_Objects.GetSize(); }
271 283
272 CPDF_Object* GetElement(FX_DWORD index) const; 284 CPDF_Object* GetElement(FX_DWORD index) const;
273 285
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 653
642 protected: 654 protected:
643 CFX_MapPtrToPtr m_IndirectObjs; 655 CFX_MapPtrToPtr m_IndirectObjs;
644 656
645 CPDF_Parser* m_pParser; 657 CPDF_Parser* m_pParser;
646 658
647 FX_DWORD m_LastObjNum; 659 FX_DWORD m_LastObjNum;
648 }; 660 };
649 661
650 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ 662 #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') | fpdfsdk/src/fpdfppo.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698