| 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 _FPDF_OBJECTS_ | 7 #ifndef _FPDF_OBJECTS_ |
| 8 #define _FPDF_OBJECTS_ | 8 #define _FPDF_OBJECTS_ |
| 9 #ifndef _FXCRT_EXTENSION_ | 9 #ifndef _FXCRT_EXTENSION_ |
| 10 #include "../fxcrt/fx_ext.h" | 10 #include "../fxcrt/fx_ext.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 private: | 106 private: |
| 107 CPDF_Object(const CPDF_Object& src) {} | 107 CPDF_Object(const CPDF_Object& src) {} |
| 108 CPDF_Object* CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visited) const; | 108 CPDF_Object* CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visited) const; |
| 109 }; | 109 }; |
| 110 class CPDF_Boolean : public CPDF_Object | 110 class CPDF_Boolean : public CPDF_Object |
| 111 { | 111 { |
| 112 public: | 112 public: |
| 113 | 113 |
| 114 static CPDF_Boolean* Create(FX_BOOL value) | 114 static CPDF_Boolean* Create(FX_BOOL value) |
| 115 { | 115 { |
| 116 return FX_NEW CPDF_Boolean(value); | 116 return new CPDF_Boolean(value); |
| 117 } | 117 } |
| 118 | 118 |
| 119 CPDF_Boolean() : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(false) { } | 119 CPDF_Boolean() : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(false) { } |
| 120 CPDF_Boolean(FX_BOOL value) : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(value) {
} | 120 CPDF_Boolean(FX_BOOL value) : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(value) {
} |
| 121 | 121 |
| 122 FX_BOOL Identical(CPDF_Boolean* pOther)
const | 122 FX_BOOL Identical(CPDF_Boolean* pOther)
const |
| 123 { | 123 { |
| 124 return m_bValue == pOther->m_bValue; | 124 return m_bValue == pOther->m_bValue; |
| 125 } | 125 } |
| 126 protected: | 126 protected: |
| 127 | 127 |
| 128 FX_BOOL m_bValue; | 128 FX_BOOL m_bValue; |
| 129 friend class CPDF_Object; | 129 friend class CPDF_Object; |
| 130 }; | 130 }; |
| 131 class CPDF_Number : public CPDF_Object | 131 class CPDF_Number : public CPDF_Object |
| 132 { | 132 { |
| 133 public: | 133 public: |
| 134 | 134 |
| 135 static CPDF_Number* Create(int value) | 135 static CPDF_Number* Create(int value) |
| 136 { | 136 { |
| 137 return FX_NEW CPDF_Number(value); | 137 return new CPDF_Number(value); |
| 138 } | 138 } |
| 139 | 139 |
| 140 static CPDF_Number* Create(FX_FLOAT value) | 140 static CPDF_Number* Create(FX_FLOAT value) |
| 141 { | 141 { |
| 142 return FX_NEW CPDF_Number(value); | 142 return new CPDF_Number(value); |
| 143 } | 143 } |
| 144 | 144 |
| 145 static CPDF_Number* Create(FX_BSTR str) | 145 static CPDF_Number* Create(FX_BSTR str) |
| 146 { | 146 { |
| 147 return FX_NEW CPDF_Number(str); | 147 return new CPDF_Number(str); |
| 148 } | 148 } |
| 149 | 149 |
| 150 static CPDF_Number* Create(FX_BOOL bInteger, void* pData) | 150 static CPDF_Number* Create(FX_BOOL bInteger, void* pData) |
| 151 { | 151 { |
| 152 return FX_NEW CPDF_Number(bInteger, pData); | 152 return new CPDF_Number(bInteger, pData); |
| 153 } | 153 } |
| 154 | 154 |
| 155 CPDF_Number() : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(false), m_Integer(0)
{ } | 155 CPDF_Number() : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(false), m_Integer(0)
{ } |
| 156 | 156 |
| 157 CPDF_Number(FX_BOOL bInteger, void* pData); | 157 CPDF_Number(FX_BOOL bInteger, void* pData); |
| 158 | 158 |
| 159 CPDF_Number(int value); | 159 CPDF_Number(int value); |
| 160 | 160 |
| 161 CPDF_Number(FX_FLOAT value); | 161 CPDF_Number(FX_FLOAT value); |
| 162 | 162 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 FX_FLOAT m_Float; | 205 FX_FLOAT m_Float; |
| 206 }; | 206 }; |
| 207 friend class CPDF_Object; | 207 friend class CPDF_Object; |
| 208 }; | 208 }; |
| 209 class CPDF_String : public CPDF_Object | 209 class CPDF_String : public CPDF_Object |
| 210 { | 210 { |
| 211 public: | 211 public: |
| 212 | 212 |
| 213 static CPDF_String* Create(const CFX_ByteString& str, FX_BOOL bHex =
FALSE) | 213 static CPDF_String* Create(const CFX_ByteString& str, FX_BOOL bHex =
FALSE) |
| 214 { | 214 { |
| 215 return FX_NEW CPDF_String(str, bHex); | 215 return new CPDF_String(str, bHex); |
| 216 } | 216 } |
| 217 | 217 |
| 218 static CPDF_String* Create(const CFX_WideString& str) | 218 static CPDF_String* Create(const CFX_WideString& str) |
| 219 { | 219 { |
| 220 return FX_NEW CPDF_String(str); | 220 return new CPDF_String(str); |
| 221 } | 221 } |
| 222 | 222 |
| 223 CPDF_String() : CPDF_Object(PDFOBJ_STRING), m_bHex(FALSE) { } | 223 CPDF_String() : CPDF_Object(PDFOBJ_STRING), m_bHex(FALSE) { } |
| 224 | 224 |
| 225 CPDF_String(const CFX_ByteString& str, FX_BOOL bHex = FALSE) | 225 CPDF_String(const CFX_ByteString& str, FX_BOOL bHex = FALSE) |
| 226 : CPDF_Object(PDFOBJ_STRING), m_String(str), m_bHex(bHex) { | 226 : CPDF_Object(PDFOBJ_STRING), m_String(str), m_bHex(bHex) { |
| 227 } | 227 } |
| 228 | 228 |
| 229 CPDF_String(const CFX_WideString& str); | 229 CPDF_String(const CFX_WideString& str); |
| 230 | 230 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 248 | 248 |
| 249 FX_BOOL m_bHex; | 249 FX_BOOL m_bHex; |
| 250 friend class CPDF_Object; | 250 friend class CPDF_Object; |
| 251 }; | 251 }; |
| 252 class CPDF_Name : public CPDF_Object | 252 class CPDF_Name : public CPDF_Object |
| 253 { | 253 { |
| 254 public: | 254 public: |
| 255 | 255 |
| 256 static CPDF_Name* Create(const CFX_ByteString& str) | 256 static CPDF_Name* Create(const CFX_ByteString& str) |
| 257 { | 257 { |
| 258 return FX_NEW CPDF_Name(str); | 258 return new CPDF_Name(str); |
| 259 } | 259 } |
| 260 | 260 |
| 261 static CPDF_Name* Create(FX_BSTR str) | 261 static CPDF_Name* Create(FX_BSTR str) |
| 262 { | 262 { |
| 263 return FX_NEW CPDF_Name(str); | 263 return new CPDF_Name(str); |
| 264 } | 264 } |
| 265 | 265 |
| 266 static CPDF_Name* Create(FX_LPCSTR str) | 266 static CPDF_Name* Create(FX_LPCSTR str) |
| 267 { | 267 { |
| 268 return FX_NEW CPDF_Name(str); | 268 return new CPDF_Name(str); |
| 269 } | 269 } |
| 270 | 270 |
| 271 CPDF_Name(const CFX_ByteString& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str)
{ } | 271 CPDF_Name(const CFX_ByteString& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str)
{ } |
| 272 CPDF_Name(FX_BSTR str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } | 272 CPDF_Name(FX_BSTR str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } |
| 273 CPDF_Name(FX_LPCSTR str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } | 273 CPDF_Name(FX_LPCSTR str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } |
| 274 | 274 |
| 275 CFX_ByteString& GetString() | 275 CFX_ByteString& GetString() |
| 276 { | 276 { |
| 277 return m_Name; | 277 return m_Name; |
| 278 } | 278 } |
| 279 | 279 |
| 280 FX_BOOL Identical(CPDF_Name* pOther) con
st | 280 FX_BOOL Identical(CPDF_Name* pOther) con
st |
| 281 { | 281 { |
| 282 return m_Name == pOther->m_Name; | 282 return m_Name == pOther->m_Name; |
| 283 } | 283 } |
| 284 protected: | 284 protected: |
| 285 | 285 |
| 286 CFX_ByteString m_Name; | 286 CFX_ByteString m_Name; |
| 287 friend class CPDF_Object; | 287 friend class CPDF_Object; |
| 288 }; | 288 }; |
| 289 class CPDF_Array : public CPDF_Object | 289 class CPDF_Array : public CPDF_Object |
| 290 { | 290 { |
| 291 public: | 291 public: |
| 292 | 292 |
| 293 static CPDF_Array* Create() | 293 static CPDF_Array* Create() |
| 294 { | 294 { |
| 295 return FX_NEW CPDF_Array(); | 295 return new CPDF_Array(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) { } | 298 CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) { } |
| 299 | 299 |
| 300 FX_DWORD GetCount() const | 300 FX_DWORD GetCount() const |
| 301 { | 301 { |
| 302 return m_Objects.GetSize(); | 302 return m_Objects.GetSize(); |
| 303 } | 303 } |
| 304 | 304 |
| 305 CPDF_Object* GetElement(FX_DWORD index) const; | 305 CPDF_Object* GetElement(FX_DWORD index) const; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 382 |
| 383 CFX_PtrArray m_Objects; | 383 CFX_PtrArray m_Objects; |
| 384 friend class CPDF_Object; | 384 friend class CPDF_Object; |
| 385 }; | 385 }; |
| 386 class CPDF_Dictionary : public CPDF_Object | 386 class CPDF_Dictionary : public CPDF_Object |
| 387 { | 387 { |
| 388 public: | 388 public: |
| 389 | 389 |
| 390 static CPDF_Dictionary* Create() | 390 static CPDF_Dictionary* Create() |
| 391 { | 391 { |
| 392 return FX_NEW CPDF_Dictionary(); | 392 return new CPDF_Dictionary(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) { } | 395 CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) { } |
| 396 | 396 |
| 397 CPDF_Object* GetElement(FX_BSTR key) const; | 397 CPDF_Object* GetElement(FX_BSTR key) const; |
| 398 | 398 |
| 399 CPDF_Object* GetElementValue(FX_BSTR key) const; | 399 CPDF_Object* GetElementValue(FX_BSTR key) const; |
| 400 | 400 |
| 401 | 401 |
| 402 | 402 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 CFX_CMapByteStringToPtr m_Map; | 499 CFX_CMapByteStringToPtr m_Map; |
| 500 | 500 |
| 501 friend class CPDF_Object; | 501 friend class CPDF_Object; |
| 502 }; | 502 }; |
| 503 class CPDF_Stream : public CPDF_Object | 503 class CPDF_Stream : public CPDF_Object |
| 504 { | 504 { |
| 505 public: | 505 public: |
| 506 | 506 |
| 507 static CPDF_Stream* Create(FX_LPBYTE pData, FX_DWORD size, CPDF_Dict
ionary* pDict) | 507 static CPDF_Stream* Create(FX_LPBYTE pData, FX_DWORD size, CPDF_Dict
ionary* pDict) |
| 508 { | 508 { |
| 509 return FX_NEW CPDF_Stream(pData, size, pDict); | 509 return new CPDF_Stream(pData, size, pDict); |
| 510 } | 510 } |
| 511 | 511 |
| 512 CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict); | 512 CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict); |
| 513 | 513 |
| 514 CPDF_Dictionary* GetDict() const | 514 CPDF_Dictionary* GetDict() const |
| 515 { | 515 { |
| 516 return m_pDict; | 516 return m_pDict; |
| 517 } | 517 } |
| 518 | 518 |
| 519 void SetData(FX_LPCBYTE pData, FX_DWO
RD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf); | 519 void SetData(FX_LPCBYTE pData, FX_DWO
RD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 | 657 |
| 658 FX_BYTE m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; | 658 FX_BYTE m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; |
| 659 friend class CPDF_Stream; | 659 friend class CPDF_Stream; |
| 660 }; | 660 }; |
| 661 class CPDF_Null : public CPDF_Object | 661 class CPDF_Null : public CPDF_Object |
| 662 { | 662 { |
| 663 public: | 663 public: |
| 664 | 664 |
| 665 static CPDF_Null* Create() | 665 static CPDF_Null* Create() |
| 666 { | 666 { |
| 667 return FX_NEW CPDF_Null(); | 667 return new CPDF_Null(); |
| 668 } | 668 } |
| 669 | 669 |
| 670 CPDF_Null() : CPDF_Object(PDFOBJ_NULL) { } | 670 CPDF_Null() : CPDF_Object(PDFOBJ_NULL) { } |
| 671 }; | 671 }; |
| 672 class CPDF_Reference : public CPDF_Object | 672 class CPDF_Reference : public CPDF_Object |
| 673 { | 673 { |
| 674 public: | 674 public: |
| 675 | 675 |
| 676 static CPDF_Reference* Create(CPDF_IndirectObjects* pDoc, int objnum) | 676 static CPDF_Reference* Create(CPDF_IndirectObjects* pDoc, int objnum) |
| 677 { | 677 { |
| 678 return FX_NEW CPDF_Reference(pDoc, objnum); | 678 return new CPDF_Reference(pDoc, objnum); |
| 679 } | 679 } |
| 680 | 680 |
| 681 CPDF_Reference(CPDF_IndirectObjects* pDoc, int objnum) | 681 CPDF_Reference(CPDF_IndirectObjects* pDoc, int objnum) |
| 682 : CPDF_Object(PDFOBJ_REFERENCE), m_pObjList(pDoc), m_RefObjNum(objnum) { | 682 : CPDF_Object(PDFOBJ_REFERENCE), m_pObjList(pDoc), m_RefObjNum(objnum) { |
| 683 } | 683 } |
| 684 | 684 |
| 685 CPDF_IndirectObjects* GetObjList() const | 685 CPDF_IndirectObjects* GetObjList() const |
| 686 { | 686 { |
| 687 return m_pObjList; | 687 return m_pObjList; |
| 688 } | 688 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 } | 736 } |
| 737 protected: | 737 protected: |
| 738 | 738 |
| 739 CFX_MapPtrToPtr m_IndirectObjs; | 739 CFX_MapPtrToPtr m_IndirectObjs; |
| 740 | 740 |
| 741 IPDF_DocParser* m_pParser; | 741 IPDF_DocParser* m_pParser; |
| 742 | 742 |
| 743 FX_DWORD m_LastObjNum; | 743 FX_DWORD m_LastObjNum; |
| 744 }; | 744 }; |
| 745 #endif | 745 #endif |
| OLD | NEW |