summaryrefslogtreecommitdiff
path: root/core/include/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/include/fpdfapi')
-rw-r--r--core/include/fpdfapi/fpdf_objects.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index 41b457799b..a790d349ad 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -83,6 +83,7 @@ class CPDF_Object {
bool IsBoolean() const { return m_Type == PDFOBJ_BOOLEAN; }
bool IsDictionary() const { return m_Type == PDFOBJ_DICTIONARY; }
bool IsNumber() const { return m_Type == PDFOBJ_NUMBER; }
+ bool IsString() const { return m_Type == PDFOBJ_STRING; }
CPDF_Boolean* AsBoolean();
const CPDF_Boolean* AsBoolean() const;
@@ -93,6 +94,9 @@ class CPDF_Object {
CPDF_Number* AsNumber();
const CPDF_Number* AsNumber() const;
+ CPDF_String* AsString();
+ const CPDF_String* AsString() const;
+
protected:
CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) {}
~CPDF_Object() {}
@@ -222,6 +226,13 @@ class CPDF_String : public CPDF_Object {
FX_BOOL m_bHex;
friend class CPDF_Object;
};
+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;
+}
+
class CPDF_Name : public CPDF_Object {
public:
static CPDF_Name* Create(const CFX_ByteString& str) {