OLD | NEW |
---|---|
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 23 matching lines...) Expand all Loading... | |
34 #define PDFOBJ_ARRAY 5 | 34 #define PDFOBJ_ARRAY 5 |
35 #define PDFOBJ_DICTIONARY 6 | 35 #define PDFOBJ_DICTIONARY 6 |
36 #define PDFOBJ_STREAM 7 | 36 #define PDFOBJ_STREAM 7 |
37 #define PDFOBJ_NULL 8 | 37 #define PDFOBJ_NULL 8 |
38 #define PDFOBJ_REFERENCE 9 | 38 #define PDFOBJ_REFERENCE 9 |
39 | 39 |
40 typedef IFX_FileStream* (*FPDF_LPFCloneStreamCallback)(CPDF_Stream *pStream, voi d* pUserData); | 40 typedef IFX_FileStream* (*FPDF_LPFCloneStreamCallback)(CPDF_Stream *pStream, voi d* pUserData); |
41 class CPDF_Object | 41 class CPDF_Object |
42 { | 42 { |
43 public: | 43 public: |
44 | |
45 int GetType() const | 44 int GetType() const |
46 { | 45 { |
47 return m_Type; | 46 return m_Type; |
48 } | 47 } |
49 | 48 |
50 FX_DWORD GetObjNum() const | 49 FX_DWORD GetObjNum() const |
51 { | 50 { |
52 return m_ObjNum; | 51 return m_ObjNum; |
53 } | 52 } |
54 | 53 |
55 FX_DWORD GetGenNum() const | 54 FX_DWORD GetGenNum() const |
56 { | 55 { |
57 return m_GenNum; | 56 return m_GenNum; |
58 } | 57 } |
59 | 58 |
60 FX_BOOL IsIdentical(CPDF_Object* pObj) const; | 59 FX_BOOL IsIdentical(CPDF_Object* pObj) const; |
61 | 60 |
62 CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const; | 61 CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const; |
63 | 62 |
64 CPDF_Object* CloneRef(CPDF_IndirectObjects* pObjs) co nst; | 63 CPDF_Object* CloneRef(CPDF_IndirectObjects* pObjs) co nst; |
65 | 64 |
66 CPDF_Object* GetDirect() const; | 65 CPDF_Object* GetDirect() const; |
67 | 66 |
68 void Release(); | 67 void Release(); |
69 | 68 |
70 CFX_ByteString GetString() const; | 69 virtual CFX_ByteString GetString() const; |
71 | 70 |
72 CFX_ByteStringC GetConstString() const; | 71 CFX_ByteStringC GetConstString() const; |
73 | 72 |
74 CFX_WideString GetUnicodeText(CFX_CharMap* pCharMap = N ULL) const; | 73 CFX_WideString GetUnicodeText(CFX_CharMap* pCharMap = N ULL) const; |
75 FX_FLOAT GetNumber() const; | 74 FX_FLOAT GetNumber() const; |
Tom Sepez
2015/07/16 20:24:46
There are a whole bunch of these that need to be v
| |
76 | 75 |
77 FX_FLOAT GetNumber16() const; | 76 FX_FLOAT GetNumber16() const; |
78 | 77 |
79 int GetInteger() const; | 78 int GetInteger() const; |
80 | 79 |
81 CPDF_Dictionary* GetDict() const; | 80 CPDF_Dictionary* GetDict() const; |
82 | 81 |
83 CPDF_Array* GetArray() const; | 82 CPDF_Array* GetArray() const; |
84 | 83 |
85 void SetString(const CFX_ByteString& str); | 84 void SetString(const CFX_ByteString& str); |
86 | 85 |
87 void SetUnicodeText(const FX_WCHAR* pUnicodes , int len = -1); | 86 void SetUnicodeText(const FX_WCHAR* pUnicodes , int len = -1); |
88 | 87 |
89 int GetDirectType() const; | 88 int GetDirectType() const; |
90 | 89 |
91 FX_BOOL IsModified() const | 90 FX_BOOL IsModified() const |
92 { | 91 { |
93 return FALSE; | 92 return FALSE; |
94 } | 93 } |
95 protected: | 94 protected: |
96 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) { } | 95 CPDF_Object(FX_DWORD type) : m_Type(type), m_ObjNum(0), m_GenNum(0) { } |
97 ~CPDF_Object() { } | 96 virtual ~CPDF_Object() {} |
Tom Sepez
2015/07/16 20:24:46
Right, now that we are paying the price for a vtab
| |
98 void Destroy(); | 97 void Destroy(); |
Tom Sepez
2015/07/16 20:24:46
Remove Destroy() now that we have virtual destruct
| |
99 | 98 |
100 static const int OBJECT_REF_MAX_DEPTH = 128; | 99 static const int OBJECT_REF_MAX_DEPTH = 128; |
101 static int s_nCurRefDepth; | 100 static int s_nCurRefDepth; |
102 FX_DWORD m_Type; | 101 FX_DWORD m_Type; |
103 FX_DWORD m_ObjNum; | 102 FX_DWORD m_ObjNum; |
104 FX_DWORD m_GenNum; | 103 FX_DWORD m_GenNum; |
105 | 104 |
106 friend class CPDF_IndirectObjects; | 105 friend class CPDF_IndirectObjects; |
107 friend class CPDF_Parser; | 106 friend class CPDF_Parser; |
108 friend class CPDF_SyntaxParser; | 107 friend class CPDF_SyntaxParser; |
109 private: | 108 private: |
110 CPDF_Object(const CPDF_Object& src) {} | 109 CPDF_Object(const CPDF_Object& src) {} |
111 CPDF_Object* CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visited) const; | 110 CPDF_Object* CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visited) const; |
112 }; | 111 }; |
112 | |
113 class CPDF_Boolean : public CPDF_Object | 113 class CPDF_Boolean : public CPDF_Object |
114 { | 114 { |
115 public: | 115 public: |
116 | 116 |
117 static CPDF_Boolean* Create(FX_BOOL value) | 117 static CPDF_Boolean* Create(FX_BOOL value) |
118 { | 118 { |
119 return new CPDF_Boolean(value); | 119 return new CPDF_Boolean(value); |
120 } | 120 } |
121 | 121 |
122 CPDF_Boolean() : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(false) { } | 122 CPDF_Boolean() : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(false) { } |
123 CPDF_Boolean(FX_BOOL value) : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(value) { } | 123 CPDF_Boolean(FX_BOOL value) : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(value) { } |
124 ~CPDF_Boolean() override {} | |
124 | 125 |
125 FX_BOOL Identical(CPDF_Boolean* pOther) const | 126 FX_BOOL Identical(CPDF_Boolean* pOther) const |
126 { | 127 { |
127 return m_bValue == pOther->m_bValue; | 128 return m_bValue == pOther->m_bValue; |
128 } | 129 } |
129 protected: | 130 protected: |
131 CFX_ByteString GetString() const override; | |
130 | 132 |
131 FX_BOOL m_bValue; | 133 FX_BOOL m_bValue; |
132 friend class CPDF_Object; | 134 friend class CPDF_Object; |
133 }; | 135 }; |
136 | |
134 class CPDF_Number : public CPDF_Object | 137 class CPDF_Number : public CPDF_Object |
135 { | 138 { |
136 public: | 139 public: |
137 | 140 |
138 static CPDF_Number* Create(int value) | 141 static CPDF_Number* Create(int value) |
139 { | 142 { |
140 return new CPDF_Number(value); | 143 return new CPDF_Number(value); |
141 } | 144 } |
142 | 145 |
143 static CPDF_Number* Create(FX_FLOAT value) | 146 static CPDF_Number* Create(FX_FLOAT value) |
(...skipping 14 matching lines...) Expand all Loading... | |
158 CPDF_Number() : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(false), m_Integer(0) { } | 161 CPDF_Number() : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(false), m_Integer(0) { } |
159 | 162 |
160 CPDF_Number(FX_BOOL bInteger, void* pData); | 163 CPDF_Number(FX_BOOL bInteger, void* pData); |
161 | 164 |
162 CPDF_Number(int value); | 165 CPDF_Number(int value); |
163 | 166 |
164 CPDF_Number(FX_FLOAT value); | 167 CPDF_Number(FX_FLOAT value); |
165 | 168 |
166 CPDF_Number(const CFX_ByteStringC& str); | 169 CPDF_Number(const CFX_ByteStringC& str); |
167 | 170 |
171 ~CPDF_Number() override {} | |
172 | |
168 FX_BOOL Identical(CPDF_Number* pOther) c onst; | 173 FX_BOOL Identical(CPDF_Number* pOther) c onst; |
169 | 174 |
170 CFX_ByteString GetString() const; | |
171 | |
172 void SetString(const CFX_ByteStringC& str); | 175 void SetString(const CFX_ByteStringC& str); |
173 | 176 |
174 FX_BOOL IsInteger() const | 177 FX_BOOL IsInteger() const |
175 { | 178 { |
176 return m_bInteger; | 179 return m_bInteger; |
177 } | 180 } |
178 | 181 |
179 int GetInteger() const | 182 int GetInteger() const |
180 { | 183 { |
181 return m_bInteger ? m_Integer : (int)m_Float; | 184 return m_bInteger ? m_Integer : (int)m_Float; |
182 } | 185 } |
183 | 186 |
184 FX_FLOAT GetNumber() const | 187 FX_FLOAT GetNumber() const |
185 { | 188 { |
186 return m_bInteger ? (FX_FLOAT)m_Integer : m_Float; | 189 return m_bInteger ? (FX_FLOAT)m_Integer : m_Float; |
187 } | 190 } |
188 | 191 |
189 void SetNumber(FX_FLOAT value); | 192 void SetNumber(FX_FLOAT value); |
190 | 193 |
191 FX_FLOAT GetNumber16() const | 194 FX_FLOAT GetNumber16() const |
192 { | 195 { |
193 return GetNumber(); | 196 return GetNumber(); |
194 } | 197 } |
195 | 198 |
196 FX_FLOAT GetFloat() const | 199 FX_FLOAT GetFloat() const |
197 { | 200 { |
198 return m_bInteger ? (FX_FLOAT)m_Integer : m_Float; | 201 return m_bInteger ? (FX_FLOAT)m_Integer : m_Float; |
199 } | 202 } |
200 protected: | 203 protected: |
204 CFX_ByteString GetString() const override; | |
Tom Sepez
2015/07/16 20:24:46
not sure why this needs to be protected, either.
| |
201 | 205 |
202 FX_BOOL m_bInteger; | 206 FX_BOOL m_bInteger; |
203 | 207 |
204 union { | 208 union { |
205 | 209 |
206 int m_Integer; | 210 int m_Integer; |
207 | 211 |
208 FX_FLOAT m_Float; | 212 FX_FLOAT m_Float; |
209 }; | 213 }; |
210 friend class CPDF_Object; | 214 friend class CPDF_Object; |
211 }; | 215 }; |
216 | |
212 class CPDF_String : public CPDF_Object | 217 class CPDF_String : public CPDF_Object |
213 { | 218 { |
214 public: | 219 public: |
215 | 220 |
216 static CPDF_String* Create(const CFX_ByteString& str, FX_BOOL bHex = FALSE) | 221 static CPDF_String* Create(const CFX_ByteString& str, FX_BOOL bHex = FALSE) |
217 { | 222 { |
218 return new CPDF_String(str, bHex); | 223 return new CPDF_String(str, bHex); |
219 } | 224 } |
220 | 225 |
221 static CPDF_String* Create(const CFX_WideString& str) | 226 static CPDF_String* Create(const CFX_WideString& str) |
222 { | 227 { |
223 return new CPDF_String(str); | 228 return new CPDF_String(str); |
224 } | 229 } |
225 | 230 |
226 CPDF_String() : CPDF_Object(PDFOBJ_STRING), m_bHex(FALSE) { } | 231 CPDF_String() : CPDF_Object(PDFOBJ_STRING), m_bHex(FALSE) { } |
227 | 232 |
228 CPDF_String(const CFX_ByteString& str, FX_BOOL bHex = FALSE) | 233 CPDF_String(const CFX_ByteString& str, FX_BOOL bHex = FALSE) |
229 : CPDF_Object(PDFOBJ_STRING), m_String(str), m_bHex(bHex) { | 234 : CPDF_Object(PDFOBJ_STRING), m_String(str), m_bHex(bHex) { |
230 } | 235 } |
231 | 236 |
232 CPDF_String(const CFX_WideString& str); | 237 CPDF_String(const CFX_WideString& str); |
233 | 238 |
234 CFX_ByteString&» » » GetString() | 239 ~CPDF_String() override {} |
235 { | |
236 return m_String; | |
237 } | |
238 | 240 |
239 FX_BOOL Identical(CPDF_String* pOther) c onst | 241 FX_BOOL Identical(CPDF_String* pOther) c onst |
240 { | 242 { |
241 return m_String == pOther->m_String; | 243 return m_String == pOther->m_String; |
242 } | 244 } |
243 | 245 |
244 FX_BOOL IsHex() const | 246 FX_BOOL IsHex() const |
245 { | 247 { |
246 return m_bHex; | 248 return m_bHex; |
247 } | 249 } |
248 protected: | 250 protected: |
251 CFX_ByteString GetString() const override; | |
Tom Sepez
2015/07/16 20:24:46
ditto
| |
249 | 252 |
250 CFX_ByteString m_String; | 253 CFX_ByteString m_String; |
251 | 254 |
252 FX_BOOL m_bHex; | 255 FX_BOOL m_bHex; |
253 friend class CPDF_Object; | 256 friend class CPDF_Object; |
254 }; | 257 }; |
258 | |
255 class CPDF_Name : public CPDF_Object | 259 class CPDF_Name : public CPDF_Object |
256 { | 260 { |
257 public: | 261 public: |
258 | 262 |
259 static CPDF_Name* Create(const CFX_ByteString& str) | 263 static CPDF_Name* Create(const CFX_ByteString& str) |
260 { | 264 { |
261 return new CPDF_Name(str); | 265 return new CPDF_Name(str); |
262 } | 266 } |
263 | 267 |
264 static CPDF_Name* Create(const CFX_ByteStringC& str) | 268 static CPDF_Name* Create(const CFX_ByteStringC& str) |
265 { | 269 { |
266 return new CPDF_Name(str); | 270 return new CPDF_Name(str); |
267 } | 271 } |
268 | 272 |
269 static CPDF_Name* Create(const FX_CHAR* str) | 273 static CPDF_Name* Create(const FX_CHAR* str) |
270 { | 274 { |
271 return new CPDF_Name(str); | 275 return new CPDF_Name(str); |
272 } | 276 } |
273 | 277 |
274 CPDF_Name(const CFX_ByteString& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } | 278 CPDF_Name(const CFX_ByteString& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } |
275 CPDF_Name(const CFX_ByteStringC& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str ) { } | 279 CPDF_Name(const CFX_ByteStringC& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str ) { } |
276 CPDF_Name(const FX_CHAR* str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } | 280 CPDF_Name(const FX_CHAR* str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } |
281 ~CPDF_Name() override {} | |
277 | 282 |
278 CFX_ByteString& GetString() | 283 CFX_ByteString& GetString() |
279 { | 284 { |
280 return m_Name; | 285 return m_Name; |
281 } | 286 } |
282 | 287 |
283 FX_BOOL Identical(CPDF_Name* pOther) con st | 288 FX_BOOL Identical(CPDF_Name* pOther) con st |
284 { | 289 { |
285 return m_Name == pOther->m_Name; | 290 return m_Name == pOther->m_Name; |
286 } | 291 } |
287 protected: | 292 protected: |
293 CFX_ByteString GetString() const override; | |
Tom Sepez
2015/07/16 20:24:46
ditto
| |
288 | 294 |
289 CFX_ByteString m_Name; | 295 CFX_ByteString m_Name; |
290 friend class CPDF_Object; | 296 friend class CPDF_Object; |
291 }; | 297 }; |
298 | |
292 class CPDF_Array : public CPDF_Object | 299 class CPDF_Array : public CPDF_Object |
293 { | 300 { |
294 public: | 301 public: |
295 | 302 |
296 static CPDF_Array* Create() | 303 static CPDF_Array* Create() |
297 { | 304 { |
298 return new CPDF_Array(); | 305 return new CPDF_Array(); |
299 } | 306 } |
300 | 307 |
301 CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) { } | 308 CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) { } |
302 | 309 |
303 FX_DWORD GetCount() const | 310 FX_DWORD GetCount() const |
304 { | 311 { |
305 return m_Objects.GetSize(); | 312 return m_Objects.GetSize(); |
306 } | 313 } |
307 | 314 |
308 CPDF_Object* GetElement(FX_DWORD index) const; | 315 CPDF_Object* GetElement(FX_DWORD index) const; |
309 | 316 |
310 CPDF_Object* GetElementValue(FX_DWORD index) const; | 317 CPDF_Object* GetElementValue(FX_DWORD index) const; |
311 | 318 |
312 | 319 |
313 | 320 |
314 CFX_AffineMatrix GetMatrix(); | 321 CFX_AffineMatrix GetMatrix(); |
315 | 322 |
316 CFX_FloatRect GetRect(); | 323 CFX_FloatRect GetRect(); |
317 | 324 |
318 | 325 |
319 | 326 |
320 | 327 |
321 CFX_ByteString» » » GetString(FX_DWORD index) const; | 328 CFX_ByteString GetStringAt(FX_DWORD index) const; |
Tom Sepez
2015/07/16 20:24:46
I presume this is the overriding overloaded method
| |
322 | 329 |
323 CFX_ByteStringC GetConstString(FX_DWORD index) const; | 330 CFX_ByteStringC GetConstString(FX_DWORD index) const; |
324 | 331 |
325 int GetInteger(FX_DWORD index) const ; | 332 int GetInteger(FX_DWORD index) const ; |
326 | 333 |
327 FX_FLOAT GetNumber(FX_DWORD index) const; | 334 FX_FLOAT GetNumber(FX_DWORD index) const; |
328 | 335 |
329 CPDF_Dictionary* GetDict(FX_DWORD index) const; | 336 CPDF_Dictionary* GetDict(FX_DWORD index) const; |
330 | 337 |
331 CPDF_Stream* GetStream(FX_DWORD index) const; | 338 CPDF_Stream* GetStream(FX_DWORD index) const; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 return GetNumber(index); | 380 return GetNumber(index); |
374 } | 381 } |
375 | 382 |
376 void AddNumber16(FX_FLOAT value) | 383 void AddNumber16(FX_FLOAT value) |
377 { | 384 { |
378 AddNumber(value); | 385 AddNumber(value); |
379 } | 386 } |
380 | 387 |
381 FX_BOOL Identical(CPDF_Array* pOther) co nst; | 388 FX_BOOL Identical(CPDF_Array* pOther) co nst; |
382 protected: | 389 protected: |
383 | 390 ~CPDF_Array() override; |
384 ~CPDF_Array(); | |
385 | 391 |
386 CFX_PtrArray m_Objects; | 392 CFX_PtrArray m_Objects; |
387 friend class CPDF_Object; | 393 friend class CPDF_Object; |
388 }; | 394 }; |
395 | |
389 class CPDF_Dictionary : public CPDF_Object | 396 class CPDF_Dictionary : public CPDF_Object |
390 { | 397 { |
391 public: | 398 public: |
392 | 399 |
393 static CPDF_Dictionary* Create() | 400 static CPDF_Dictionary* Create() |
394 { | 401 { |
395 return new CPDF_Dictionary(); | 402 return new CPDF_Dictionary(); |
396 } | 403 } |
397 | 404 |
398 CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) { } | 405 CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) { } |
399 | 406 |
400 CPDF_Object* GetElement(const CFX_ByteStringC& key) c onst; | 407 CPDF_Object* GetElement(const CFX_ByteStringC& key) c onst; |
401 | 408 |
402 CPDF_Object* GetElementValue(const CFX_ByteStringC& k ey) const; | 409 CPDF_Object* GetElementValue(const CFX_ByteStringC& k ey) const; |
403 | 410 |
404 | 411 CFX_ByteString GetStringAt(const CFX_ByteStringC& key) const; |
405 | |
406 | |
407 | |
408 CFX_ByteString» » » GetString(const CFX_ByteStringC& key) co nst; | |
409 | 412 |
410 CFX_ByteStringC GetConstString(const CFX_ByteStringC& ke y) const; | 413 CFX_ByteStringC GetConstString(const CFX_ByteStringC& ke y) const; |
411 | 414 |
412 CFX_ByteString» » » GetString(const CFX_ByteStringC& key, co nst CFX_ByteStringC& default_str) const; | 415 CFX_ByteString GetStringAt(const CFX_ByteStringC& key, |
416 const CFX_ByteStringC& default_str) const; | |
413 | 417 |
414 CFX_ByteStringC GetConstString(const CFX_ByteStringC& ke y, const CFX_ByteStringC& default_str) const; | 418 CFX_ByteStringC GetConstString(const CFX_ByteStringC& ke y, const CFX_ByteStringC& default_str) const; |
415 | 419 |
416 CFX_WideString GetUnicodeText(const CFX_ByteStringC& ke y, CFX_CharMap* pCharMap = NULL) const; | 420 CFX_WideString GetUnicodeText(const CFX_ByteStringC& ke y, CFX_CharMap* pCharMap = NULL) const; |
417 | 421 |
418 int GetInteger(const CFX_ByteStringC & key) const; | 422 int GetInteger(const CFX_ByteStringC & key) const; |
419 | 423 |
420 int GetInteger(const CFX_ByteStringC & key, int default_int) const; | 424 int GetInteger(const CFX_ByteStringC & key, int default_int) const; |
421 | 425 |
422 FX_BOOL GetBoolean(const CFX_ByteStringC & key, FX_BOOL bDefault = FALSE) const; | 426 FX_BOOL GetBoolean(const CFX_ByteStringC & key, FX_BOOL bDefault = FALSE) const; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 | 493 |
490 FX_BOOL Identical(CPDF_Dictionary* pDict ) const; | 494 FX_BOOL Identical(CPDF_Dictionary* pDict ) const; |
491 | 495 |
492 int GetCount() const | 496 int GetCount() const |
493 { | 497 { |
494 return m_Map.GetCount(); | 498 return m_Map.GetCount(); |
495 } | 499 } |
496 | 500 |
497 void AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj); | 501 void AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj); |
498 protected: | 502 protected: |
499 | 503 ~CPDF_Dictionary() override; |
500 ~CPDF_Dictionary(); | |
501 | 504 |
502 CFX_CMapByteStringToPtr m_Map; | 505 CFX_CMapByteStringToPtr m_Map; |
503 | 506 |
504 friend class CPDF_Object; | 507 friend class CPDF_Object; |
505 }; | 508 }; |
509 | |
506 class CPDF_Stream : public CPDF_Object | 510 class CPDF_Stream : public CPDF_Object |
507 { | 511 { |
508 public: | 512 public: |
509 | 513 |
510 static CPDF_Stream* Create(uint8_t* pData, FX_DWORD size, CPDF_Dicti onary* pDict) | 514 static CPDF_Stream* Create(uint8_t* pData, FX_DWORD size, CPDF_Dicti onary* pDict) |
511 { | 515 { |
512 return new CPDF_Stream(pData, size, pDict); | 516 return new CPDF_Stream(pData, size, pDict); |
513 } | 517 } |
514 | 518 |
515 CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); | 519 CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); |
(...skipping 23 matching lines...) Expand all Loading... | |
539 FX_BOOL ReadRawData(FX_FILESIZE start_po s, uint8_t* pBuf, FX_DWORD buf_size) const; | 543 FX_BOOL ReadRawData(FX_FILESIZE start_po s, uint8_t* pBuf, FX_DWORD buf_size) const; |
540 | 544 |
541 | 545 |
542 FX_BOOL IsMemoryBased() const | 546 FX_BOOL IsMemoryBased() const |
543 { | 547 { |
544 return m_GenNum == (FX_DWORD) - 1; | 548 return m_GenNum == (FX_DWORD) - 1; |
545 } | 549 } |
546 | 550 |
547 CPDF_Stream* Clone(FX_BOOL bDirect, FPDF_LPFCloneStre amCallback lpfCallback, void* pUserData) const; | 551 CPDF_Stream* Clone(FX_BOOL bDirect, FPDF_LPFCloneStre amCallback lpfCallback, void* pUserData) const; |
548 protected: | 552 protected: |
549 | 553 ~CPDF_Stream() override; |
550 ~CPDF_Stream(); | |
551 | 554 |
552 CPDF_Dictionary* m_pDict; | 555 CPDF_Dictionary* m_pDict; |
553 | 556 |
554 FX_DWORD m_dwSize; | 557 FX_DWORD m_dwSize; |
555 | 558 |
556 FX_DWORD m_GenNum; | 559 FX_DWORD m_GenNum; |
557 | 560 |
558 union { | 561 union { |
559 | 562 |
560 uint8_t* m_pDataBuf; | 563 uint8_t* m_pDataBuf; |
561 | 564 |
562 IFX_FileRead* m_pFile; | 565 IFX_FileRead* m_pFile; |
563 }; | 566 }; |
564 | 567 |
565 FX_FILESIZE m_FileOffset; | 568 FX_FILESIZE m_FileOffset; |
566 | 569 |
567 CPDF_CryptoHandler* m_pCryptoHandler; | 570 CPDF_CryptoHandler* m_pCryptoHandler; |
568 | 571 |
569 void InitStream(CPDF_Dictionary* pDic t); | 572 void InitStream(CPDF_Dictionary* pDic t); |
570 friend class CPDF_Object; | 573 friend class CPDF_Object; |
571 friend class CPDF_StreamAcc; | 574 friend class CPDF_StreamAcc; |
572 friend class CPDF_AttachmentAcc; | 575 friend class CPDF_AttachmentAcc; |
573 }; | 576 }; |
577 | |
574 class CPDF_StreamAcc | 578 class CPDF_StreamAcc |
575 { | 579 { |
576 public: | 580 public: |
577 | 581 |
578 CPDF_StreamAcc(); | 582 CPDF_StreamAcc(); |
579 | 583 |
580 ~CPDF_StreamAcc(); | 584 ~CPDF_StreamAcc(); |
581 | 585 |
582 void LoadAllData(const CPDF_Stream* p Stream, FX_BOOL bRawAccess = FALSE, | 586 void LoadAllData(const CPDF_Stream* p Stream, FX_BOOL bRawAccess = FALSE, |
583 FX_DWORD estimated_size = 0, FX_BOOL bIm ageAcc = FALSE); | 587 FX_DWORD estimated_size = 0, FX_BOOL bIm ageAcc = FALSE); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
616 FX_BOOL m_bNewBuf; | 620 FX_BOOL m_bNewBuf; |
617 | 621 |
618 CFX_ByteString m_ImageDecoder; | 622 CFX_ByteString m_ImageDecoder; |
619 | 623 |
620 CPDF_Dictionary* m_pImageParam; | 624 CPDF_Dictionary* m_pImageParam; |
621 | 625 |
622 const CPDF_Stream* m_pStream; | 626 const CPDF_Stream* m_pStream; |
623 | 627 |
624 uint8_t* m_pSrcData; | 628 uint8_t* m_pSrcData; |
625 }; | 629 }; |
630 | |
626 CFX_DataFilter* FPDF_CreateFilter(const CFX_ByteStringC& name, const CPDF_Dictio nary* pParam, int width = 0, int height = 0); | 631 CFX_DataFilter* FPDF_CreateFilter(const CFX_ByteStringC& name, const CPDF_Dictio nary* pParam, int width = 0, int height = 0); |
627 #define FPDF_FILTER_BUFFER_SIZE 20480 | 632 #define FPDF_FILTER_BUFFER_SIZE 20480 |
628 class CPDF_StreamFilter | 633 class CPDF_StreamFilter |
629 { | 634 { |
630 public: | 635 public: |
631 | 636 |
632 ~CPDF_StreamFilter(); | 637 ~CPDF_StreamFilter(); |
633 | 638 |
634 FX_DWORD ReadBlock(uint8_t* buffer, FX_DWORD size); | 639 FX_DWORD ReadBlock(uint8_t* buffer, FX_DWORD size); |
635 | 640 |
(...skipping 18 matching lines...) Expand all Loading... | |
654 | 659 |
655 CFX_BinaryBuf* m_pBuffer; | 660 CFX_BinaryBuf* m_pBuffer; |
656 | 661 |
657 FX_DWORD m_BufOffset; | 662 FX_DWORD m_BufOffset; |
658 | 663 |
659 FX_DWORD m_SrcOffset; | 664 FX_DWORD m_SrcOffset; |
660 | 665 |
661 uint8_t m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; | 666 uint8_t m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; |
662 friend class CPDF_Stream; | 667 friend class CPDF_Stream; |
663 }; | 668 }; |
669 | |
664 class CPDF_Null : public CPDF_Object | 670 class CPDF_Null : public CPDF_Object |
665 { | 671 { |
666 public: | 672 public: |
667 | 673 |
668 static CPDF_Null* Create() | 674 static CPDF_Null* Create() |
669 { | 675 { |
670 return new CPDF_Null(); | 676 return new CPDF_Null(); |
671 } | 677 } |
672 | 678 |
673 CPDF_Null() : CPDF_Object(PDFOBJ_NULL) { } | 679 CPDF_Null() : CPDF_Object(PDFOBJ_NULL) { } |
680 ~CPDF_Null() override {} | |
674 }; | 681 }; |
682 | |
675 class CPDF_Reference : public CPDF_Object | 683 class CPDF_Reference : public CPDF_Object |
676 { | 684 { |
677 public: | 685 public: |
678 | 686 |
679 static CPDF_Reference* Create(CPDF_IndirectObjects* pDoc, int objnum) | 687 static CPDF_Reference* Create(CPDF_IndirectObjects* pDoc, int objnum) |
680 { | 688 { |
681 return new CPDF_Reference(pDoc, objnum); | 689 return new CPDF_Reference(pDoc, objnum); |
682 } | 690 } |
683 | 691 |
684 CPDF_Reference(CPDF_IndirectObjects* pDoc, int objnum) | 692 CPDF_Reference(CPDF_IndirectObjects* pDoc, int objnum) |
685 : CPDF_Object(PDFOBJ_REFERENCE), m_pObjList(pDoc), m_RefObjNum(objnum) { | 693 : CPDF_Object(PDFOBJ_REFERENCE), m_pObjList(pDoc), m_RefObjNum(objnum) { |
686 } | 694 } |
695 ~CPDF_Reference() override {} | |
687 | 696 |
688 CPDF_IndirectObjects* GetObjList() const | 697 CPDF_IndirectObjects* GetObjList() const |
689 { | 698 { |
690 return m_pObjList; | 699 return m_pObjList; |
691 } | 700 } |
692 | 701 |
693 FX_DWORD GetRefObjNum() const | 702 FX_DWORD GetRefObjNum() const |
694 { | 703 { |
695 return m_RefObjNum; | 704 return m_RefObjNum; |
696 } | 705 } |
697 | 706 |
698 void SetRef(CPDF_IndirectObjects* pDo c, FX_DWORD objnum); | 707 void SetRef(CPDF_IndirectObjects* pDo c, FX_DWORD objnum); |
699 | 708 |
700 FX_BOOL Identical(CPDF_Reference* pOther ) const | 709 FX_BOOL Identical(CPDF_Reference* pOther ) const |
701 { | 710 { |
702 return m_RefObjNum == pOther->m_RefObjNum; | 711 return m_RefObjNum == pOther->m_RefObjNum; |
703 } | 712 } |
704 protected: | 713 protected: |
714 CFX_ByteString GetString() const override; | |
705 | 715 |
706 CPDF_IndirectObjects* m_pObjList; | 716 CPDF_IndirectObjects* m_pObjList; |
707 | 717 |
708 FX_DWORD m_RefObjNum; | 718 FX_DWORD m_RefObjNum; |
709 friend class CPDF_Object; | 719 friend class CPDF_Object; |
710 }; | 720 }; |
721 | |
711 class CPDF_IndirectObjects | 722 class CPDF_IndirectObjects |
712 { | 723 { |
713 public: | 724 public: |
714 | 725 |
715 CPDF_IndirectObjects(CPDF_Parser* pParser); | 726 CPDF_IndirectObjects(CPDF_Parser* pParser); |
716 | 727 |
717 ~CPDF_IndirectObjects(); | 728 ~CPDF_IndirectObjects(); |
718 | 729 |
719 CPDF_Object* GetIndirectObject(FX_DWORD objnum, struc t PARSE_CONTEXT* pContext = NULL); | 730 CPDF_Object* GetIndirectObject(FX_DWORD objnum, struc t PARSE_CONTEXT* pContext = NULL); |
720 | 731 |
(...skipping 19 matching lines...) Expand all Loading... | |
740 protected: | 751 protected: |
741 | 752 |
742 CFX_MapPtrToPtr m_IndirectObjs; | 753 CFX_MapPtrToPtr m_IndirectObjs; |
743 | 754 |
744 CPDF_Parser* m_pParser; | 755 CPDF_Parser* m_pParser; |
745 | 756 |
746 FX_DWORD m_LastObjNum; | 757 FX_DWORD m_LastObjNum; |
747 }; | 758 }; |
748 | 759 |
749 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 760 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
OLD | NEW |