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_FPDFAPI_PAGE_PAGEINT_H_ | 7 #ifndef CORE_FPDFAPI_PAGE_PAGEINT_H_ |
8 #define CORE_FPDFAPI_PAGE_PAGEINT_H_ | 8 #define CORE_FPDFAPI_PAGE_PAGEINT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <unordered_map> | 13 #include <unordered_map> |
| 14 #include <utility> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
16 #include "core/fpdfapi/page/cpdf_contentmark.h" | 17 #include "core/fpdfapi/page/cpdf_contentmark.h" |
17 #include "core/fpdfapi/page/cpdf_countedobject.h" | 18 #include "core/fpdfapi/page/cpdf_countedobject.h" |
18 #include "core/fpdfapi/page/cpdf_pageobjectholder.h" | 19 #include "core/fpdfapi/page/cpdf_pageobjectholder.h" |
19 #include "core/fpdfapi/page/cpdf_streamcontentparser.h" | 20 #include "core/fpdfapi/page/cpdf_streamcontentparser.h" |
20 #include "core/fpdfapi/parser/cpdf_stream.h" | 21 #include "core/fpdfapi/parser/cpdf_stream.h" |
21 #include "core/fxcrt/cfx_string_pool_template.h" | 22 #include "core/fxcrt/cfx_string_pool_template.h" |
22 #include "core/fxcrt/cfx_weak_ptr.h" | 23 #include "core/fxcrt/cfx_weak_ptr.h" |
23 #include "core/fxge/cfx_pathdata.h" | 24 #include "core/fxge/cfx_pathdata.h" |
(...skipping 21 matching lines...) Expand all Loading... |
45 class CPDF_StreamParser { | 46 class CPDF_StreamParser { |
46 public: | 47 public: |
47 enum SyntaxType { EndOfData, Number, Keyword, Name, Others }; | 48 enum SyntaxType { EndOfData, Number, Keyword, Name, Others }; |
48 | 49 |
49 CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize); | 50 CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize); |
50 CPDF_StreamParser(const uint8_t* pData, | 51 CPDF_StreamParser(const uint8_t* pData, |
51 uint32_t dwSize, | 52 uint32_t dwSize, |
52 const CFX_WeakPtr<CFX_ByteStringPool>& pPool); | 53 const CFX_WeakPtr<CFX_ByteStringPool>& pPool); |
53 ~CPDF_StreamParser(); | 54 ~CPDF_StreamParser(); |
54 | 55 |
55 CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, | |
56 CPDF_Dictionary* pDict, | |
57 CPDF_Object* pCSObj); | |
58 SyntaxType ParseNextElement(); | 56 SyntaxType ParseNextElement(); |
59 uint8_t* GetWordBuf() { return m_WordBuffer; } | 57 uint8_t* GetWordBuf() { return m_WordBuffer; } |
60 uint32_t GetWordSize() const { return m_WordSize; } | 58 uint32_t GetWordSize() const { return m_WordSize; } |
61 CPDF_Object* GetObject(); | |
62 uint32_t GetPos() const { return m_Pos; } | 59 uint32_t GetPos() const { return m_Pos; } |
63 void SetPos(uint32_t pos) { m_Pos = pos; } | 60 void SetPos(uint32_t pos) { m_Pos = pos; } |
64 CPDF_Object* ReadNextObject(bool bAllowNestedArray, uint32_t dwInArrayLevel); | 61 std::unique_ptr<CPDF_Object> GetObject() { return std::move(m_pLastObj); } |
| 62 std::unique_ptr<CPDF_Object> ReadNextObject(bool bAllowNestedArray, |
| 63 uint32_t dwInArrayLevel); |
| 64 std::unique_ptr<CPDF_Stream> ReadInlineStream(CPDF_Document* pDoc, |
| 65 CPDF_Dictionary* pDict, |
| 66 CPDF_Object* pCSObj); |
65 | 67 |
66 private: | 68 private: |
67 friend class cpdf_streamparser_ReadHexString_Test; | 69 friend class cpdf_streamparser_ReadHexString_Test; |
68 | 70 |
69 void GetNextWord(bool& bIsNumber); | 71 void GetNextWord(bool& bIsNumber); |
70 CFX_ByteString ReadString(); | 72 CFX_ByteString ReadString(); |
71 CFX_ByteString ReadHexString(); | 73 CFX_ByteString ReadHexString(); |
72 bool PositionIsInBounds() const; | 74 bool PositionIsInBounds() const; |
73 | 75 |
74 const uint8_t* m_pBuf; | 76 const uint8_t* m_pBuf; |
75 uint32_t m_Size; // Length in bytes of m_pBuf. | 77 uint32_t m_Size; // Length in bytes of m_pBuf. |
76 uint32_t m_Pos; // Current byte position within m_pBuf. | 78 uint32_t m_Pos; // Current byte position within m_pBuf. |
77 uint8_t m_WordBuffer[256]; | 79 uint8_t m_WordBuffer[256]; |
78 uint32_t m_WordSize; | 80 uint32_t m_WordSize; |
79 CPDF_Object* m_pLastObj; | 81 std::unique_ptr<CPDF_Object> m_pLastObj; |
80 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; | 82 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; |
81 }; | 83 }; |
82 | 84 |
83 #define _FPDF_MAX_TYPE3_FORM_LEVEL_ 4 | 85 #define _FPDF_MAX_TYPE3_FORM_LEVEL_ 4 |
84 | 86 |
85 class CPDF_ContentParser { | 87 class CPDF_ContentParser { |
86 public: | 88 public: |
87 enum ParseStatus { Ready, ToBeContinued, Done }; | 89 enum ParseStatus { Ready, ToBeContinued, Done }; |
88 | 90 |
89 CPDF_ContentParser(); | 91 CPDF_ContentParser(); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 CPDF_CountedPattern* m_pCountedPattern; | 299 CPDF_CountedPattern* m_pCountedPattern; |
298 int m_nComps; | 300 int m_nComps; |
299 FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS]; | 301 FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS]; |
300 }; | 302 }; |
301 | 303 |
302 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); | 304 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); |
303 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( | 305 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( |
304 const CFX_ByteStringC& abbr); | 306 const CFX_ByteStringC& abbr); |
305 | 307 |
306 #endif // CORE_FPDFAPI_PAGE_PAGEINT_H_ | 308 #endif // CORE_FPDFAPI_PAGE_PAGEINT_H_ |
OLD | NEW |