OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_FPDFAPI_FPDF_PARSER_CPDF_OBJECT_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_OBJECT_H_ |
8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_OBJECT_H_ | 8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_OBJECT_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 20 matching lines...) Expand all Loading... |
31 NUMBER, | 31 NUMBER, |
32 STRING, | 32 STRING, |
33 NAME, | 33 NAME, |
34 ARRAY, | 34 ARRAY, |
35 DICTIONARY, | 35 DICTIONARY, |
36 STREAM, | 36 STREAM, |
37 NULLOBJ, | 37 NULLOBJ, |
38 REFERENCE | 38 REFERENCE |
39 }; | 39 }; |
40 | 40 |
| 41 virtual ~CPDF_Object(); |
| 42 |
41 virtual Type GetType() const = 0; | 43 virtual Type GetType() const = 0; |
42 uint32_t GetObjNum() const { return m_ObjNum; } | 44 uint32_t GetObjNum() const { return m_ObjNum; } |
43 uint32_t GetGenNum() const { return m_GenNum; } | 45 uint32_t GetGenNum() const { return m_GenNum; } |
44 | 46 |
45 // Create a deep copy of the object. | 47 // Create a deep copy of the object. |
46 virtual CPDF_Object* Clone() const = 0; | 48 virtual CPDF_Object* Clone() const = 0; |
47 // Create a deep copy of the object except any reference object be | 49 // Create a deep copy of the object except any reference object be |
48 // copied to the object it points to directly. | 50 // copied to the object it points to directly. |
49 virtual CPDF_Object* CloneDirectObject() const; | 51 virtual CPDF_Object* CloneDirectObject() const; |
50 virtual CPDF_Object* GetDirect() const; | 52 virtual CPDF_Object* GetDirect() const; |
51 | 53 |
52 void Release(); | |
53 | |
54 virtual CFX_ByteString GetString() const; | 54 virtual CFX_ByteString GetString() const; |
55 virtual CFX_WideString GetUnicodeText() const; | 55 virtual CFX_WideString GetUnicodeText() const; |
56 virtual FX_FLOAT GetNumber() const; | 56 virtual FX_FLOAT GetNumber() const; |
57 virtual int GetInteger() const; | 57 virtual int GetInteger() const; |
58 virtual CPDF_Dictionary* GetDict() const; | 58 virtual CPDF_Dictionary* GetDict() const; |
59 | 59 |
60 virtual void SetString(const CFX_ByteString& str); | 60 virtual void SetString(const CFX_ByteString& str); |
61 | 61 |
62 virtual bool IsArray() const; | 62 virtual bool IsArray() const; |
63 virtual bool IsBoolean() const; | 63 virtual bool IsBoolean() const; |
(...skipping 22 matching lines...) Expand all Loading... |
86 virtual const CPDF_String* AsString() const; | 86 virtual const CPDF_String* AsString() const; |
87 | 87 |
88 protected: | 88 protected: |
89 friend class CPDF_Array; | 89 friend class CPDF_Array; |
90 friend class CPDF_Dictionary; | 90 friend class CPDF_Dictionary; |
91 friend class CPDF_Document; | 91 friend class CPDF_Document; |
92 friend class CPDF_IndirectObjectHolder; | 92 friend class CPDF_IndirectObjectHolder; |
93 friend class CPDF_Parser; | 93 friend class CPDF_Parser; |
94 friend class CPDF_Reference; | 94 friend class CPDF_Reference; |
95 friend class CPDF_Stream; | 95 friend class CPDF_Stream; |
96 friend struct std::default_delete<CPDF_Object>; | |
97 | 96 |
98 CPDF_Object() : m_ObjNum(0), m_GenNum(0) {} | 97 CPDF_Object() : m_ObjNum(0), m_GenNum(0) {} |
99 virtual ~CPDF_Object(); | |
100 | 98 |
101 CPDF_Object* CloneObjectNonCyclic(bool bDirect) const; | 99 CPDF_Object* CloneObjectNonCyclic(bool bDirect) const; |
102 | 100 |
103 // Create a deep copy of the object with the option to either | 101 // Create a deep copy of the object with the option to either |
104 // copy a reference object or directly copy the object it refers to | 102 // copy a reference object or directly copy the object it refers to |
105 // when |bDirect| is true. | 103 // when |bDirect| is true. |
106 // Also check cyclic reference against |pVisited|, no copy if it is found. | 104 // Also check cyclic reference against |pVisited|, no copy if it is found. |
107 // Complex objects should implement their own CloneNonCyclic() | 105 // Complex objects should implement their own CloneNonCyclic() |
108 // function to properly check for possible loop. | 106 // function to properly check for possible loop. |
109 virtual CPDF_Object* CloneNonCyclic( | 107 virtual CPDF_Object* CloneNonCyclic( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 172 |
175 inline CPDF_Stream* ToStream(CPDF_Object* obj) { | 173 inline CPDF_Stream* ToStream(CPDF_Object* obj) { |
176 return obj ? obj->AsStream() : nullptr; | 174 return obj ? obj->AsStream() : nullptr; |
177 } | 175 } |
178 | 176 |
179 inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { | 177 inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { |
180 return obj ? obj->AsStream() : nullptr; | 178 return obj ? obj->AsStream() : nullptr; |
181 } | 179 } |
182 | 180 |
183 #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_OBJECT_H_ | 181 #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_OBJECT_H_ |
OLD | NEW |