• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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_FXCRT_XML_CFX_SAXREADERHANDLER_H_
8 #define CORE_FXCRT_XML_CFX_SAXREADERHANDLER_H_
9 
10 #include "core/fxcrt/fx_string.h"
11 #include "core/fxcrt/xml/cfx_saxcontext.h"
12 #include "core/fxcrt/xml/cfx_saxreader.h"
13 
14 class CFX_ChecksumContext;
15 
16 class CFX_SAXReaderHandler : public CFX_SAXReader::HandlerIface {
17  public:
18   explicit CFX_SAXReaderHandler(CFX_ChecksumContext* pContext);
19   ~CFX_SAXReaderHandler() override;
20 
21   CFX_SAXContext* OnTagEnter(const ByteStringView& bsTagName,
22                              CFX_SAXItem::Type eType,
23                              uint32_t dwStartPos) override;
24   void OnTagAttribute(CFX_SAXContext* pTag,
25                       const ByteStringView& bsAttri,
26                       const ByteStringView& bsValue) override;
27   void OnTagBreak(CFX_SAXContext* pTag) override;
28   void OnTagData(CFX_SAXContext* pTag,
29                  CFX_SAXItem::Type eType,
30                  const ByteStringView& bsData,
31                  uint32_t dwStartPos) override;
32   void OnTagClose(CFX_SAXContext* pTag, uint32_t dwEndPos) override;
33   void OnTagEnd(CFX_SAXContext* pTag,
34                 const ByteStringView& bsTagName,
35                 uint32_t dwEndPos) override;
36   void OnTargetData(CFX_SAXContext* pTag,
37                     CFX_SAXItem::Type eType,
38                     const ByteStringView& bsData,
39                     uint32_t dwStartPos) override;
40 
41  private:
42   void UpdateChecksum(bool bCheckSpace);
43 
44   CFX_ChecksumContext* m_pContext;
45   CFX_SAXContext m_SAXContext;
46 };
47 
48 #endif  // CORE_FXCRT_XML_CFX_SAXREADERHANDLER_H_
49