summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_array.h8
-rw-r--r--core/fpdfapi/parser/cpdf_boolean.h8
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.h8
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp1
-rw-r--r--core/fpdfapi/parser/cpdf_name.h8
-rw-r--r--core/fpdfapi/parser/cpdf_number.h8
-rw-r--r--core/fpdfapi/parser/cpdf_object.h63
-rw-r--r--core/fpdfapi/parser/cpdf_reference.h8
-rw-r--r--core/fpdfapi/parser/cpdf_stream.h8
-rw-r--r--core/fpdfapi/parser/cpdf_string.h8
10 files changed, 65 insertions, 63 deletions
diff --git a/core/fpdfapi/parser/cpdf_array.h b/core/fpdfapi/parser/cpdf_array.h
index da9677e927..46e9d47667 100644
--- a/core/fpdfapi/parser/cpdf_array.h
+++ b/core/fpdfapi/parser/cpdf_array.h
@@ -70,4 +70,12 @@ class CPDF_Array : public CPDF_Object {
std::vector<CPDF_Object*> m_Objects;
};
+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;
+}
+
#endif // CORE_FPDFAPI_PARSER_CPDF_ARRAY_H_
diff --git a/core/fpdfapi/parser/cpdf_boolean.h b/core/fpdfapi/parser/cpdf_boolean.h
index 89ed17d743..91b99f6dd2 100644
--- a/core/fpdfapi/parser/cpdf_boolean.h
+++ b/core/fpdfapi/parser/cpdf_boolean.h
@@ -32,4 +32,12 @@ class CPDF_Boolean : public CPDF_Object {
bool m_bValue;
};
+inline CPDF_Boolean* ToBoolean(CPDF_Object* obj) {
+ return obj ? obj->AsBoolean() : nullptr;
+}
+
+inline const CPDF_Boolean* ToBoolean(const CPDF_Object* obj) {
+ return obj ? obj->AsBoolean() : nullptr;
+}
+
#endif // CORE_FPDFAPI_PARSER_CPDF_BOOLEAN_H_
diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h
index b56e40a6ef..9cf575ddd4 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.h
+++ b/core/fpdfapi/parser/cpdf_dictionary.h
@@ -98,4 +98,12 @@ class CPDF_Dictionary : public CPDF_Object {
std::map<CFX_ByteString, CPDF_Object*> m_Map;
};
+inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) {
+ return obj ? obj->AsDictionary() : nullptr;
+}
+
+inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) {
+ return obj ? obj->AsDictionary() : nullptr;
+}
+
#endif // CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 0e688c685b..a5bf39d438 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -16,6 +16,7 @@
#include "core/fpdfapi/page/pageint.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
+#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfapi/parser/cpdf_parser.h"
#include "core/fpdfapi/parser/cpdf_reference.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
diff --git a/core/fpdfapi/parser/cpdf_name.h b/core/fpdfapi/parser/cpdf_name.h
index e6b460de39..cfc2fe641a 100644
--- a/core/fpdfapi/parser/cpdf_name.h
+++ b/core/fpdfapi/parser/cpdf_name.h
@@ -29,4 +29,12 @@ class CPDF_Name : public CPDF_Object {
CFX_ByteString m_Name;
};
+inline CPDF_Name* ToName(CPDF_Object* obj) {
+ return obj ? obj->AsName() : nullptr;
+}
+
+inline const CPDF_Name* ToName(const CPDF_Object* obj) {
+ return obj ? obj->AsName() : nullptr;
+}
+
#endif // CORE_FPDFAPI_PARSER_CPDF_NAME_H_
diff --git a/core/fpdfapi/parser/cpdf_number.h b/core/fpdfapi/parser/cpdf_number.h
index 8c708e93f1..a5efc1423e 100644
--- a/core/fpdfapi/parser/cpdf_number.h
+++ b/core/fpdfapi/parser/cpdf_number.h
@@ -41,4 +41,12 @@ class CPDF_Number : public CPDF_Object {
};
};
+inline CPDF_Number* ToNumber(CPDF_Object* obj) {
+ return obj ? obj->AsNumber() : nullptr;
+}
+
+inline const CPDF_Number* ToNumber(const CPDF_Object* obj) {
+ return obj ? obj->AsNumber() : nullptr;
+}
+
#endif // CORE_FPDFAPI_PARSER_CPDF_NUMBER_H_
diff --git a/core/fpdfapi/parser/cpdf_object.h b/core/fpdfapi/parser/cpdf_object.h
index 75400f3a53..e2c30b96ca 100644
--- a/core/fpdfapi/parser/cpdf_object.h
+++ b/core/fpdfapi/parser/cpdf_object.h
@@ -117,67 +117,4 @@ class CPDF_Object {
CPDF_Object(const CPDF_Object& src) {}
};
-inline CPDF_Boolean* ToBoolean(CPDF_Object* obj) {
- return obj ? obj->AsBoolean() : nullptr;
-}
-
-inline const CPDF_Boolean* ToBoolean(const CPDF_Object* obj) {
- return obj ? obj->AsBoolean() : nullptr;
-}
-
-inline CPDF_Number* ToNumber(CPDF_Object* obj) {
- return obj ? obj->AsNumber() : nullptr;
-}
-
-inline const CPDF_Number* ToNumber(const CPDF_Object* obj) {
- return obj ? obj->AsNumber() : nullptr;
-}
-
-inline CPDF_String* ToString(CPDF_Object* obj) {
- return obj ? obj->AsString() : nullptr;
-}
-
-inline const CPDF_String* ToString(const CPDF_Object* obj) {
- return obj ? obj->AsString() : nullptr;
-}
-
-inline CPDF_Name* ToName(CPDF_Object* obj) {
- return obj ? obj->AsName() : nullptr;
-}
-
-inline const CPDF_Name* ToName(const CPDF_Object* obj) {
- return obj ? obj->AsName() : nullptr;
-}
-
-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;
-}
-
-inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) {
- return obj ? obj->AsDictionary() : nullptr;
-}
-
-inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) {
- return obj ? obj->AsDictionary() : nullptr;
-}
-inline CPDF_Reference* ToReference(CPDF_Object* obj) {
- return obj ? obj->AsReference() : nullptr;
-}
-
-inline const CPDF_Reference* ToReference(const CPDF_Object* obj) {
- return obj ? obj->AsReference() : nullptr;
-}
-
-inline CPDF_Stream* ToStream(CPDF_Object* obj) {
- return obj ? obj->AsStream() : nullptr;
-}
-
-inline const CPDF_Stream* ToStream(const CPDF_Object* obj) {
- return obj ? obj->AsStream() : nullptr;
-}
-
#endif // CORE_FPDFAPI_PARSER_CPDF_OBJECT_H_
diff --git a/core/fpdfapi/parser/cpdf_reference.h b/core/fpdfapi/parser/cpdf_reference.h
index 8c57d85e0e..5221832f80 100644
--- a/core/fpdfapi/parser/cpdf_reference.h
+++ b/core/fpdfapi/parser/cpdf_reference.h
@@ -47,4 +47,12 @@ class CPDF_Reference : public CPDF_Object {
uint32_t m_RefObjNum;
};
+inline CPDF_Reference* ToReference(CPDF_Object* obj) {
+ return obj ? obj->AsReference() : nullptr;
+}
+
+inline const CPDF_Reference* ToReference(const CPDF_Object* obj) {
+ return obj ? obj->AsReference() : nullptr;
+}
+
#endif // CORE_FPDFAPI_PARSER_CPDF_REFERENCE_H_
diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h
index 6a4f1011c0..ed266778b3 100644
--- a/core/fpdfapi/parser/cpdf_stream.h
+++ b/core/fpdfapi/parser/cpdf_stream.h
@@ -58,4 +58,12 @@ class CPDF_Stream : public CPDF_Object {
IFX_FileRead* m_pFile = nullptr;
};
+inline CPDF_Stream* ToStream(CPDF_Object* obj) {
+ return obj ? obj->AsStream() : nullptr;
+}
+
+inline const CPDF_Stream* ToStream(const CPDF_Object* obj) {
+ return obj ? obj->AsStream() : nullptr;
+}
+
#endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_H_
diff --git a/core/fpdfapi/parser/cpdf_string.h b/core/fpdfapi/parser/cpdf_string.h
index d99e00c403..01ea8224d4 100644
--- a/core/fpdfapi/parser/cpdf_string.h
+++ b/core/fpdfapi/parser/cpdf_string.h
@@ -36,4 +36,12 @@ class CPDF_String : public CPDF_Object {
FX_BOOL m_bHex;
};
+inline CPDF_String* ToString(CPDF_Object* obj) {
+ return obj ? obj->AsString() : nullptr;
+}
+
+inline const CPDF_String* ToString(const CPDF_Object* obj) {
+ return obj ? obj->AsString() : nullptr;
+}
+
#endif // CORE_FPDFAPI_PARSER_CPDF_STRING_H_