| 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_ext.h" | 10 #include "../fxcrt/fx_ext.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #define PDFOBJ_BOOLEAN 1 | 29 #define PDFOBJ_BOOLEAN 1 |
| 30 #define PDFOBJ_NUMBER 2 | 30 #define PDFOBJ_NUMBER 2 |
| 31 #define PDFOBJ_STRING 3 | 31 #define PDFOBJ_STRING 3 |
| 32 #define PDFOBJ_NAME 4 | 32 #define PDFOBJ_NAME 4 |
| 33 #define PDFOBJ_ARRAY 5 | 33 #define PDFOBJ_ARRAY 5 |
| 34 #define PDFOBJ_DICTIONARY 6 | 34 #define PDFOBJ_DICTIONARY 6 |
| 35 #define PDFOBJ_STREAM 7 | 35 #define PDFOBJ_STREAM 7 |
| 36 #define PDFOBJ_NULL 8 | 36 #define PDFOBJ_NULL 8 |
| 37 #define PDFOBJ_REFERENCE 9 | 37 #define PDFOBJ_REFERENCE 9 |
| 38 | 38 |
| 39 typedef IFX_FileStream* (*FPDF_LPFCloneStreamCallback)(CPDF_Stream *pStream, FX_
LPVOID pUserData); | 39 typedef IFX_FileStream* (*FPDF_LPFCloneStreamCallback)(CPDF_Stream *pStream, voi
d* pUserData); |
| 40 class CPDF_Object | 40 class CPDF_Object |
| 41 { | 41 { |
| 42 public: | 42 public: |
| 43 | 43 |
| 44 int GetType() const | 44 int GetType() const |
| 45 { | 45 { |
| 46 return m_Type; | 46 return m_Type; |
| 47 } | 47 } |
| 48 | 48 |
| 49 FX_DWORD GetObjNum() const | 49 FX_DWORD GetObjNum() const |
| (...skipping 26 matching lines...) Expand all Loading... |
| 76 FX_FLOAT GetNumber16() const; | 76 FX_FLOAT GetNumber16() const; |
| 77 | 77 |
| 78 int GetInteger() const; | 78 int GetInteger() const; |
| 79 | 79 |
| 80 CPDF_Dictionary* GetDict() const; | 80 CPDF_Dictionary* GetDict() const; |
| 81 | 81 |
| 82 CPDF_Array* GetArray() const; | 82 CPDF_Array* GetArray() const; |
| 83 | 83 |
| 84 void SetString(const CFX_ByteString& str); | 84 void SetString(const CFX_ByteString& str); |
| 85 | 85 |
| 86 void SetUnicodeText(FX_LPCWSTR pUnicodes, int
len = -1); | 86 void SetUnicodeText(const FX_WCHAR* pUnicodes
, int len = -1); |
| 87 | 87 |
| 88 int GetDirectType() const; | 88 int GetDirectType() const; |
| 89 | 89 |
| 90 FX_BOOL IsModified() const | 90 FX_BOOL IsModified() const |
| 91 { | 91 { |
| 92 return FALSE; | 92 return FALSE; |
| 93 } | 93 } |
| 94 protected: | 94 protected: |
| 95 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) { } |
| 96 ~CPDF_Object() { } | 96 ~CPDF_Object() { } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 static CPDF_Name* Create(const CFX_ByteString& str) | 258 static CPDF_Name* Create(const CFX_ByteString& str) |
| 259 { | 259 { |
| 260 return new CPDF_Name(str); | 260 return new CPDF_Name(str); |
| 261 } | 261 } |
| 262 | 262 |
| 263 static CPDF_Name* Create(FX_BSTR str) | 263 static CPDF_Name* Create(FX_BSTR str) |
| 264 { | 264 { |
| 265 return new CPDF_Name(str); | 265 return new CPDF_Name(str); |
| 266 } | 266 } |
| 267 | 267 |
| 268 static CPDF_Name*» » Create(FX_LPCSTR str) | 268 static CPDF_Name*» » Create(const FX_CHAR* str) |
| 269 { | 269 { |
| 270 return new CPDF_Name(str); | 270 return new CPDF_Name(str); |
| 271 } | 271 } |
| 272 | 272 |
| 273 CPDF_Name(const CFX_ByteString& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str)
{ } | 273 CPDF_Name(const CFX_ByteString& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str)
{ } |
| 274 CPDF_Name(FX_BSTR str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } | 274 CPDF_Name(FX_BSTR str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } |
| 275 CPDF_Name(FX_LPCSTR str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } | 275 CPDF_Name(const FX_CHAR* str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } |
| 276 | 276 |
| 277 CFX_ByteString& GetString() | 277 CFX_ByteString& GetString() |
| 278 { | 278 { |
| 279 return m_Name; | 279 return m_Name; |
| 280 } | 280 } |
| 281 | 281 |
| 282 FX_BOOL Identical(CPDF_Name* pOther) con
st | 282 FX_BOOL Identical(CPDF_Name* pOther) con
st |
| 283 { | 283 { |
| 284 return m_Name == pOther->m_Name; | 284 return m_Name == pOther->m_Name; |
| 285 } | 285 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 ~CPDF_Dictionary(); | 499 ~CPDF_Dictionary(); |
| 500 | 500 |
| 501 CFX_CMapByteStringToPtr m_Map; | 501 CFX_CMapByteStringToPtr m_Map; |
| 502 | 502 |
| 503 friend class CPDF_Object; | 503 friend class CPDF_Object; |
| 504 }; | 504 }; |
| 505 class CPDF_Stream : public CPDF_Object | 505 class CPDF_Stream : public CPDF_Object |
| 506 { | 506 { |
| 507 public: | 507 public: |
| 508 | 508 |
| 509 static CPDF_Stream*»» Create(FX_LPBYTE pData, FX_DWORD size, CPDF_Dict
ionary* pDict) | 509 static CPDF_Stream*»» Create(uint8_t* pData, FX_DWORD size, CPDF_Dicti
onary* pDict) |
| 510 { | 510 { |
| 511 return new CPDF_Stream(pData, size, pDict); | 511 return new CPDF_Stream(pData, size, pDict); |
| 512 } | 512 } |
| 513 | 513 |
| 514 CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict); | 514 CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); |
| 515 | 515 |
| 516 CPDF_Dictionary* GetDict() const | 516 CPDF_Dictionary* GetDict() const |
| 517 { | 517 { |
| 518 return m_pDict; | 518 return m_pDict; |
| 519 } | 519 } |
| 520 | 520 |
| 521 void» » » » » SetData(FX_LPCBYTE pData, FX_DWO
RD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf); | 521 void» » » » » SetData(const uint8_t* pData, FX
_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf); |
| 522 | 522 |
| 523 void InitStream(uint8_t* pData, FX_DW
ORD size, CPDF_Dictionary* pDict); | 523 void InitStream(uint8_t* pData, FX_DW
ORD size, CPDF_Dictionary* pDict); |
| 524 | 524 |
| 525 void InitStream(IFX_FileRead *pFile,
CPDF_Dictionary* pDict); | 525 void InitStream(IFX_FileRead *pFile,
CPDF_Dictionary* pDict); |
| 526 | 526 |
| 527 FX_BOOL Identical(CPDF_Stream* pOther) c
onst; | 527 FX_BOOL Identical(CPDF_Stream* pOther) c
onst; |
| 528 | 528 |
| 529 CPDF_StreamFilter* GetStreamFilter(FX_BOOL bRaw = FALSE) const; | 529 CPDF_StreamFilter* GetStreamFilter(FX_BOOL bRaw = FALSE) const; |
| 530 | 530 |
| 531 | 531 |
| 532 | 532 |
| 533 FX_DWORD GetRawSize() const | 533 FX_DWORD GetRawSize() const |
| 534 { | 534 { |
| 535 return m_dwSize; | 535 return m_dwSize; |
| 536 } | 536 } |
| 537 | 537 |
| 538 FX_BOOL» » » » » ReadRawData(FX_FILESIZE start_po
s, FX_LPBYTE pBuf, FX_DWORD buf_size) const; | 538 FX_BOOL» » » » » ReadRawData(FX_FILESIZE start_po
s, uint8_t* pBuf, FX_DWORD buf_size) const; |
| 539 | 539 |
| 540 | 540 |
| 541 FX_BOOL IsMemoryBased() const | 541 FX_BOOL IsMemoryBased() const |
| 542 { | 542 { |
| 543 return m_GenNum == (FX_DWORD) - 1; | 543 return m_GenNum == (FX_DWORD) - 1; |
| 544 } | 544 } |
| 545 | 545 |
| 546 CPDF_Stream*» » » Clone(FX_BOOL bDirect, FPDF_LPFCloneStre
amCallback lpfCallback, FX_LPVOID pUserData) const; | 546 CPDF_Stream*» » » Clone(FX_BOOL bDirect, FPDF_LPFCloneStre
amCallback lpfCallback, void* pUserData) const; |
| 547 protected: | 547 protected: |
| 548 | 548 |
| 549 ~CPDF_Stream(); | 549 ~CPDF_Stream(); |
| 550 | 550 |
| 551 CPDF_Dictionary* m_pDict; | 551 CPDF_Dictionary* m_pDict; |
| 552 | 552 |
| 553 FX_DWORD m_dwSize; | 553 FX_DWORD m_dwSize; |
| 554 | 554 |
| 555 FX_DWORD m_GenNum; | 555 FX_DWORD m_GenNum; |
| 556 | 556 |
| 557 union { | 557 union { |
| 558 | 558 |
| 559 FX_LPBYTE» » » m_pDataBuf; | 559 uint8_t*» » » m_pDataBuf; |
| 560 | 560 |
| 561 IFX_FileRead* m_pFile; | 561 IFX_FileRead* m_pFile; |
| 562 }; | 562 }; |
| 563 | 563 |
| 564 FX_FILESIZE m_FileOffset; | 564 FX_FILESIZE m_FileOffset; |
| 565 | 565 |
| 566 CPDF_CryptoHandler* m_pCryptoHandler; | 566 CPDF_CryptoHandler* m_pCryptoHandler; |
| 567 | 567 |
| 568 void InitStream(CPDF_Dictionary* pDic
t); | 568 void InitStream(CPDF_Dictionary* pDic
t); |
| 569 friend class CPDF_Object; | 569 friend class CPDF_Object; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 584 const CPDF_Stream* GetStream() const | 584 const CPDF_Stream* GetStream() const |
| 585 { | 585 { |
| 586 return m_pStream; | 586 return m_pStream; |
| 587 } | 587 } |
| 588 | 588 |
| 589 CPDF_Dictionary* GetDict() const | 589 CPDF_Dictionary* GetDict() const |
| 590 { | 590 { |
| 591 return m_pStream? m_pStream->GetDict() : NULL; | 591 return m_pStream? m_pStream->GetDict() : NULL; |
| 592 } | 592 } |
| 593 | 593 |
| 594 FX_LPCBYTE» » » » GetData() const; | 594 const uint8_t*» » » » GetData() const; |
| 595 | 595 |
| 596 FX_DWORD GetSize() const; | 596 FX_DWORD GetSize() const; |
| 597 | 597 |
| 598 FX_LPBYTE» » » » DetachData(); | 598 uint8_t*» » » » DetachData(); |
| 599 | 599 |
| 600 const CFX_ByteString& GetImageDecoder() | 600 const CFX_ByteString& GetImageDecoder() |
| 601 { | 601 { |
| 602 return m_ImageDecoder; | 602 return m_ImageDecoder; |
| 603 } | 603 } |
| 604 | 604 |
| 605 const CPDF_Dictionary* GetImageParam() | 605 const CPDF_Dictionary* GetImageParam() |
| 606 { | 606 { |
| 607 return m_pImageParam; | 607 return m_pImageParam; |
| 608 } | 608 } |
| 609 protected: | 609 protected: |
| 610 | 610 |
| 611 FX_LPBYTE» » » » m_pData; | 611 uint8_t*» » » » m_pData; |
| 612 | 612 |
| 613 FX_DWORD m_dwSize; | 613 FX_DWORD m_dwSize; |
| 614 | 614 |
| 615 FX_BOOL m_bNewBuf; | 615 FX_BOOL m_bNewBuf; |
| 616 | 616 |
| 617 CFX_ByteString m_ImageDecoder; | 617 CFX_ByteString m_ImageDecoder; |
| 618 | 618 |
| 619 CPDF_Dictionary* m_pImageParam; | 619 CPDF_Dictionary* m_pImageParam; |
| 620 | 620 |
| 621 const CPDF_Stream* m_pStream; | 621 const CPDF_Stream* m_pStream; |
| 622 | 622 |
| 623 FX_LPBYTE» » » » m_pSrcData; | 623 uint8_t*» » » » m_pSrcData; |
| 624 }; | 624 }; |
| 625 CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, i
nt width = 0, int height = 0); | 625 CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, i
nt width = 0, int height = 0); |
| 626 #define FPDF_FILTER_BUFFER_SIZE 20480 | 626 #define FPDF_FILTER_BUFFER_SIZE 20480 |
| 627 class CPDF_StreamFilter | 627 class CPDF_StreamFilter |
| 628 { | 628 { |
| 629 public: | 629 public: |
| 630 | 630 |
| 631 ~CPDF_StreamFilter(); | 631 ~CPDF_StreamFilter(); |
| 632 | 632 |
| 633 FX_DWORD» » » ReadBlock(FX_LPBYTE buffer, FX_DWORD size); | 633 FX_DWORD» » » ReadBlock(uint8_t* buffer, FX_DWORD size); |
| 634 | 634 |
| 635 FX_DWORD GetSrcPos() | 635 FX_DWORD GetSrcPos() |
| 636 { | 636 { |
| 637 return m_SrcOffset; | 637 return m_SrcOffset; |
| 638 } | 638 } |
| 639 | 639 |
| 640 const CPDF_Stream* GetStream() | 640 const CPDF_Stream* GetStream() |
| 641 { | 641 { |
| 642 return m_pStream; | 642 return m_pStream; |
| 643 } | 643 } |
| 644 protected: | 644 protected: |
| 645 | 645 |
| 646 CPDF_StreamFilter() {} | 646 CPDF_StreamFilter() {} |
| 647 | 647 |
| 648 FX_DWORD» » » ReadLeftOver(FX_LPBYTE buffer, FX_DWORD buf_size
); | 648 FX_DWORD» » » ReadLeftOver(uint8_t* buffer, FX_DWORD buf_size)
; |
| 649 | 649 |
| 650 const CPDF_Stream* m_pStream; | 650 const CPDF_Stream* m_pStream; |
| 651 | 651 |
| 652 CFX_DataFilter* m_pFilter; | 652 CFX_DataFilter* m_pFilter; |
| 653 | 653 |
| 654 CFX_BinaryBuf* m_pBuffer; | 654 CFX_BinaryBuf* m_pBuffer; |
| 655 | 655 |
| 656 FX_DWORD m_BufOffset; | 656 FX_DWORD m_BufOffset; |
| 657 | 657 |
| 658 FX_DWORD m_SrcOffset; | 658 FX_DWORD m_SrcOffset; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 protected: | 739 protected: |
| 740 | 740 |
| 741 CFX_MapPtrToPtr m_IndirectObjs; | 741 CFX_MapPtrToPtr m_IndirectObjs; |
| 742 | 742 |
| 743 CPDF_Parser* m_pParser; | 743 CPDF_Parser* m_pParser; |
| 744 | 744 |
| 745 FX_DWORD m_LastObjNum; | 745 FX_DWORD m_LastObjNum; |
| 746 }; | 746 }; |
| 747 | 747 |
| 748 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ | 748 #endif // CORE_INCLUDE_FPDFAPI_FPDF_OBJECTS_H_ |
| OLD | NEW |