diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-06 14:33:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-06 14:33:08 -0700 |
commit | 7222ea6936cbcff886037e4d8d4018e13a7f720f (patch) | |
tree | 2901f6ff4cbd1205a261843f5bc18a31cdc69b69 /xfa/fxfa/include/xfa_checksum.h | |
parent | 0b5adb6ead171069aa6f8c49c529f1c6d381e155 (diff) | |
download | pdfium-7222ea6936cbcff886037e4d8d4018e13a7f720f.tar.xz |
Move remaining xfa/include/fxfa files
This CL moves the remaining files in xfa/include/fxfa to xfa/fxfa/include.
Review URL: https://codereview.chromium.org/1864973005
Diffstat (limited to 'xfa/fxfa/include/xfa_checksum.h')
-rw-r--r-- | xfa/fxfa/include/xfa_checksum.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/xfa/fxfa/include/xfa_checksum.h b/xfa/fxfa/include/xfa_checksum.h new file mode 100644 index 0000000000..6c24b2a5af --- /dev/null +++ b/xfa/fxfa/include/xfa_checksum.h @@ -0,0 +1,74 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FXFA_INCLUDE_XFA_CHECKSUM_H_ +#define XFA_FXFA_INCLUDE_XFA_CHECKSUM_H_ + +#include "xfa/fgas/xml/fgas_sax.h" +#include "xfa/fxfa/include/fxfa.h" + +class CXFA_SAXReaderHandler; +class CXFA_ChecksumContext; + +class CXFA_SAXContext { + public: + CXFA_SAXContext() : m_eNode(FX_SAXNODE_Unknown) {} + CFX_ByteTextBuf m_TextBuf; + CFX_ByteString m_bsTagName; + FX_SAXNODE m_eNode; +}; +class CXFA_SAXReaderHandler : public IFX_SAXReaderHandler { + public: + CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext); + virtual ~CXFA_SAXReaderHandler(); + virtual void* OnTagEnter(const CFX_ByteStringC& bsTagName, + FX_SAXNODE eType, + uint32_t dwStartPos); + virtual void OnTagAttribute(void* pTag, + const CFX_ByteStringC& bsAttri, + const CFX_ByteStringC& bsValue); + virtual void OnTagBreak(void* pTag); + virtual void OnTagData(void* pTag, + FX_SAXNODE eType, + const CFX_ByteStringC& bsData, + uint32_t dwStartPos); + virtual void OnTagClose(void* pTag, uint32_t dwEndPos); + virtual void OnTagEnd(void* pTag, + const CFX_ByteStringC& bsTagName, + uint32_t dwEndPos); + + virtual void OnTargetData(void* pTag, + FX_SAXNODE eType, + const CFX_ByteStringC& bsData, + uint32_t dwStartPos); + + protected: + void UpdateChecksum(FX_BOOL bCheckSpace); + CXFA_ChecksumContext* m_pContext; + CXFA_SAXContext m_SAXContext; +}; + +class CXFA_ChecksumContext { + public: + CXFA_ChecksumContext(); + ~CXFA_ChecksumContext(); + + void Release() { delete this; } + FX_BOOL StartChecksum(); + FX_BOOL UpdateChecksum(IFX_FileRead* pSrcFile, + FX_FILESIZE offset = 0, + size_t size = 0); + void FinishChecksum(); + void GetChecksum(CFX_ByteString& bsChecksum); + void Update(const CFX_ByteStringC& bsText); + + protected: + IFX_SAXReader* m_pSAXReader; + uint8_t* m_pByteContext; + CFX_ByteString m_bsChecksum; +}; + +#endif // XFA_FXFA_INCLUDE_XFA_CHECKSUM_H_ |