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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp » ('j') | fpdfsdk/src/fsdk_actionhandler.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/include/fpdfapi/fpdf_objects.h
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index bd7f5bf0c49d37a2ab9ef4cf6fdfced931e35d56..dbd44952aed8f84d490d571e9174dc5c42951c48 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -81,12 +81,16 @@ class CPDF_Object {
FX_BOOL IsModified() const { return FALSE; }
+ bool IsArray() const { return m_Type == PDFOBJ_ARRAY; }
bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; }
bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; }
bool IsName() const { return m_Type == PDFOBJ_NAME; }
bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; }
bool IsString() const { return m_Type == PDFOBJ_STRING; }
+ CPDF_Array* AsArray();
+ const CPDF_Array* AsArray() const;
+
CPDF_Boolean* AsBoolean();
const CPDF_Boolean* AsBoolean() const;
@@ -343,6 +347,13 @@ class CPDF_Array : public CPDF_Object {
CFX_PtrArray m_Objects;
friend class CPDF_Object;
};
+inline CPDF_Array* ToArray(CPDF_Object* obj) {
+ return obj ? obj->AsArray() : nullptr;
+}
+inline const CPDF_Array* ToArray(const CPDF_Object* obj) {
+ return obj ? obj->AsArray() : nullptr;
+}
+
class CPDF_Dictionary : public CPDF_Object {
public:
static CPDF_Dictionary* Create() { return new CPDF_Dictionary(); }
« 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