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 <map> | |
10 #include <set> | 11 #include <set> |
11 | 12 |
12 #include "core/include/fxcrt/fx_coordinates.h" | 13 #include "core/include/fxcrt/fx_coordinates.h" |
13 #include "core/include/fxcrt/fx_system.h" | 14 #include "core/include/fxcrt/fx_system.h" |
14 | 15 |
15 class CPDF_Array; | 16 class CPDF_Array; |
16 class CPDF_Boolean; | 17 class CPDF_Boolean; |
17 class CPDF_CryptoHandler; | 18 class CPDF_CryptoHandler; |
18 class CPDF_Dictionary; | 19 class CPDF_Dictionary; |
19 class CPDF_Document; | 20 class CPDF_Document; |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 }; | 332 }; |
332 inline CPDF_Array* ToArray(CPDF_Object* obj) { | 333 inline CPDF_Array* ToArray(CPDF_Object* obj) { |
333 return obj ? obj->AsArray() : nullptr; | 334 return obj ? obj->AsArray() : nullptr; |
334 } | 335 } |
335 inline const CPDF_Array* ToArray(const CPDF_Object* obj) { | 336 inline const CPDF_Array* ToArray(const CPDF_Object* obj) { |
336 return obj ? obj->AsArray() : nullptr; | 337 return obj ? obj->AsArray() : nullptr; |
337 } | 338 } |
338 | 339 |
339 class CPDF_Dictionary : public CPDF_Object { | 340 class CPDF_Dictionary : public CPDF_Object { |
340 public: | 341 public: |
342 typedef std::map<CFX_ByteString, CPDF_Object*>::iterator iterator; | |
Tom Sepez
2016/01/05 19:41:55
nit: using
Oliver Chang
2016/01/07 16:04:25
Done.
| |
343 typedef std::map<CFX_ByteString, CPDF_Object*>::const_iterator const_iterator; | |
344 | |
341 CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) {} | 345 CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) {} |
342 | 346 |
343 CPDF_Object* GetElement(const CFX_ByteStringC& key) const; | 347 CPDF_Object* GetElement(const CFX_ByteStringC& key) const; |
344 | 348 |
345 CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; | 349 CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; |
346 | 350 |
347 CFX_ByteString GetString(const CFX_ByteStringC& key) const; | 351 CFX_ByteString GetString(const CFX_ByteStringC& key) const; |
348 | 352 |
349 CFX_ByteStringC GetConstString(const CFX_ByteStringC& key) const; | 353 CFX_ByteStringC GetConstString(const CFX_ByteStringC& key) const; |
350 | 354 |
(...skipping 22 matching lines...) Expand all Loading... | |
373 CPDF_Array* GetArray(const CFX_ByteStringC& key) const; | 377 CPDF_Array* GetArray(const CFX_ByteStringC& key) const; |
374 | 378 |
375 CFX_FloatRect GetRect(const CFX_ByteStringC& key) const; | 379 CFX_FloatRect GetRect(const CFX_ByteStringC& key) const; |
376 | 380 |
377 CFX_Matrix GetMatrix(const CFX_ByteStringC& key) const; | 381 CFX_Matrix GetMatrix(const CFX_ByteStringC& key) const; |
378 | 382 |
379 FX_FLOAT GetFloat(const CFX_ByteStringC& key) const { return GetNumber(key); } | 383 FX_FLOAT GetFloat(const CFX_ByteStringC& key) const { return GetNumber(key); } |
380 | 384 |
381 FX_BOOL KeyExist(const CFX_ByteStringC& key) const; | 385 FX_BOOL KeyExist(const CFX_ByteStringC& key) const; |
382 | 386 |
383 FX_POSITION GetStartPos() const; | |
384 | |
385 CPDF_Object* GetNextElement(FX_POSITION& pos, CFX_ByteString& key) const; | |
386 | |
387 void SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj); | 387 void SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj); |
388 | 388 |
389 void SetAtName(const CFX_ByteStringC& key, const CFX_ByteString& name); | 389 void SetAtName(const CFX_ByteStringC& key, const CFX_ByteString& name); |
390 | 390 |
391 void SetAtString(const CFX_ByteStringC& key, const CFX_ByteString& string); | 391 void SetAtString(const CFX_ByteStringC& key, const CFX_ByteString& string); |
392 | 392 |
393 void SetAtInteger(const CFX_ByteStringC& key, int i); | 393 void SetAtInteger(const CFX_ByteStringC& key, int i); |
394 | 394 |
395 void SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f); | 395 void SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f); |
396 | 396 |
(...skipping 16 matching lines...) Expand all Loading... | |
413 void SetAtMatrix(const CFX_ByteStringC& key, const CFX_Matrix& matrix); | 413 void SetAtMatrix(const CFX_ByteStringC& key, const CFX_Matrix& matrix); |
414 | 414 |
415 void SetAtBoolean(const CFX_ByteStringC& key, FX_BOOL bValue); | 415 void SetAtBoolean(const CFX_ByteStringC& key, FX_BOOL bValue); |
416 | 416 |
417 void RemoveAt(const CFX_ByteStringC& key); | 417 void RemoveAt(const CFX_ByteStringC& key); |
418 | 418 |
419 void ReplaceKey(const CFX_ByteStringC& oldkey, const CFX_ByteStringC& newkey); | 419 void ReplaceKey(const CFX_ByteStringC& oldkey, const CFX_ByteStringC& newkey); |
420 | 420 |
421 FX_BOOL Identical(CPDF_Dictionary* pDict) const; | 421 FX_BOOL Identical(CPDF_Dictionary* pDict) const; |
422 | 422 |
423 int GetCount() const { return m_Map.GetCount(); } | 423 size_t GetCount() const { return m_Map.size(); } |
424 | 424 |
425 void AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj); | 425 iterator begin() { return m_Map.begin(); } |
426 | |
427 iterator end() { return m_Map.end(); } | |
428 | |
429 const_iterator begin() const { return m_Map.begin(); } | |
430 | |
431 const_iterator end() const { return m_Map.end(); } | |
426 | 432 |
427 protected: | 433 protected: |
428 ~CPDF_Dictionary(); | 434 ~CPDF_Dictionary(); |
429 | 435 |
430 CFX_CMapByteStringToPtr m_Map; | 436 std::map<CFX_ByteString, CPDF_Object*> m_Map; |
431 | 437 |
432 friend class CPDF_Object; | 438 friend class CPDF_Object; |
433 }; | 439 }; |
434 inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) { | 440 inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) { |
435 return obj ? obj->AsDictionary() : nullptr; | 441 return obj ? obj->AsDictionary() : nullptr; |
436 } | 442 } |
437 inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) { | 443 inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) { |
438 return obj ? obj->AsDictionary() : nullptr; | 444 return obj ? obj->AsDictionary() : nullptr; |
439 } | 445 } |
440 | 446 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
598 | 604 |
599 protected: | 605 protected: |
600 CFX_MapPtrToPtr m_IndirectObjs; | 606 CFX_MapPtrToPtr m_IndirectObjs; |
601 | 607 |
602 CPDF_Parser* m_pParser; | 608 CPDF_Parser* m_pParser; |
603 | 609 |
604 FX_DWORD m_LastObjNum; | 610 FX_DWORD m_LastObjNum; |
605 }; | 611 }; |
606 | 612 |
607 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 613 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
OLD | NEW |