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

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

Issue 1419643005: Merge to XFA: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month 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"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 CPDF_Array* GetArray() const; 74 CPDF_Array* GetArray() const;
75 75
76 void SetString(const CFX_ByteString& str); 76 void SetString(const CFX_ByteString& str);
77 77
78 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); 78 void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1);
79 79
80 int GetDirectType() const; 80 int GetDirectType() const;
81 81
82 FX_BOOL IsModified() const { return FALSE; } 82 FX_BOOL IsModified() const { return FALSE; }
83 83
84 bool IsArray() const { return m_Type == PDFOBJ_ARRAY; }
84 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; } 85 bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; }
85 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; } 86 bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; }
86 bool IsName() const { return m_Type == PDFOBJ_NAME; } 87 bool IsName() const { return m_Type == PDFOBJ_NAME; }
87 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; } 88 bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; }
88 bool IsString() const { return m_Type == PDFOBJ_STRING; } 89 bool IsString() const { return m_Type == PDFOBJ_STRING; }
89 90
91 CPDF_Array* AsArray();
92 const CPDF_Array* AsArray() const;
93
90 CPDF_Boolean* AsBoolean(); 94 CPDF_Boolean* AsBoolean();
91 const CPDF_Boolean* AsBoolean() const; 95 const CPDF_Boolean* AsBoolean() const;
92 96
93 CPDF_Dictionary* AsDictionary(); 97 CPDF_Dictionary* AsDictionary();
94 const CPDF_Dictionary* AsDictionary() const; 98 const CPDF_Dictionary* AsDictionary() const;
95 99
96 CPDF_Name* AsName(); 100 CPDF_Name* AsName();
97 const CPDF_Name* AsName() const; 101 const CPDF_Name* AsName() const;
98 102
99 CPDF_Number* AsNumber(); 103 CPDF_Number* AsNumber();
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 void AddNumber16(FX_FLOAT value) { AddNumber(value); } 340 void AddNumber16(FX_FLOAT value) { AddNumber(value); }
337 341
338 FX_BOOL Identical(CPDF_Array* pOther) const; 342 FX_BOOL Identical(CPDF_Array* pOther) const;
339 343
340 protected: 344 protected:
341 ~CPDF_Array(); 345 ~CPDF_Array();
342 346
343 CFX_PtrArray m_Objects; 347 CFX_PtrArray m_Objects;
344 friend class CPDF_Object; 348 friend class CPDF_Object;
345 }; 349 };
350 inline CPDF_Array* ToArray(CPDF_Object* obj) {
351 return obj ? obj->AsArray() : nullptr;
352 }
353 inline const CPDF_Array* ToArray(const CPDF_Object* obj) {
354 return obj ? obj->AsArray() : nullptr;
355 }
356
346 class CPDF_Dictionary : public CPDF_Object { 357 class CPDF_Dictionary : public CPDF_Object {
347 public: 358 public:
348 static CPDF_Dictionary* Create() { return new CPDF_Dictionary(); } 359 static CPDF_Dictionary* Create() { return new CPDF_Dictionary(); }
349 360
350 CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) {} 361 CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) {}
351 362
352 CPDF_Object* GetElement(const CFX_ByteStringC& key) const; 363 CPDF_Object* GetElement(const CFX_ByteStringC& key) const;
353 364
354 CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; 365 CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const;
355 366
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 664
654 protected: 665 protected:
655 CFX_MapPtrToPtr m_IndirectObjs; 666 CFX_MapPtrToPtr m_IndirectObjs;
656 667
657 CPDF_Parser* m_pParser; 668 CPDF_Parser* m_pParser;
658 669
659 FX_DWORD m_LastObjNum; 670 FX_DWORD m_LastObjNum;
660 }; 671 };
661 672
662 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ 673 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp » ('j') | fpdfsdk/src/fsdk_actionhandler.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698