• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FPDFAPI_PAGE_CPDF_CONTENTPARSER_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_CONTENTPARSER_H_
9 
10 #include <memory>
11 #include <vector>
12 
13 #include "core/fpdfapi/page/cpdf_pageobjectholder.h"
14 #include "core/fpdfapi/page/cpdf_streamcontentparser.h"
15 
16 class CPDF_AllStates;
17 class CPDF_Form;
18 class CPDF_Page;
19 class CPDF_StreamAcc;
20 class CPDF_Type3Char;
21 
22 class CPDF_ContentParser {
23  public:
24   enum ParseStatus { Ready, ToBeContinued, Done };
25 
26   CPDF_ContentParser();
27   ~CPDF_ContentParser();
28 
GetStatus()29   ParseStatus GetStatus() const { return m_Status; }
30   void Start(CPDF_Page* pPage);
31   void Start(CPDF_Form* pForm,
32              CPDF_AllStates* pGraphicStates,
33              const CFX_Matrix* pParentMatrix,
34              CPDF_Type3Char* pType3Char,
35              int level);
36   void Continue(IFX_Pause* pPause);
37 
38  private:
39   enum InternalStage {
40     STAGE_GETCONTENT = 1,
41     STAGE_PARSE,
42     STAGE_CHECKCLIP,
43   };
44 
45   ParseStatus m_Status;
46   InternalStage m_InternalStage;
47   CPDF_PageObjectHolder* m_pObjectHolder;
48   bool m_bForm;
49   CPDF_Type3Char* m_pType3Char;
50   uint32_t m_nStreams;
51   std::unique_ptr<CPDF_StreamAcc> m_pSingleStream;
52   std::vector<std::unique_ptr<CPDF_StreamAcc>> m_StreamArray;
53   uint8_t* m_pData;
54   uint32_t m_Size;
55   uint32_t m_CurrentOffset;
56   std::unique_ptr<CPDF_StreamContentParser> m_pParser;
57 };
58 
59 #endif  // CORE_FPDFAPI_PAGE_CPDF_CONTENTPARSER_H_
60