summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_checksum.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-14 14:14:16 -0400
committerDan Sinclair <dsinclair@chromium.org>2016-03-14 14:14:16 -0400
commit1770c021cf998ff1b33855b1397f6ea8ff9f7cd7 (patch)
tree285e39abd4b5872d8cd632b9e331b0667fdc3eae /xfa/fxfa/app/xfa_checksum.h
parentf766ad219f66543654520f6a1955836f519e26d1 (diff)
downloadpdfium-1770c021cf998ff1b33855b1397f6ea8ff9f7cd7.tar.xz
Move xfa/src up to xfa/.
This CL moves the xfa/src files up to the xfa/ directory and fixes the includes, include guards, and build files. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1803723002 .
Diffstat (limited to 'xfa/fxfa/app/xfa_checksum.h')
-rw-r--r--xfa/fxfa/app/xfa_checksum.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/xfa/fxfa/app/xfa_checksum.h b/xfa/fxfa/app/xfa_checksum.h
new file mode 100644
index 0000000000..5331800b82
--- /dev/null
+++ b/xfa/fxfa/app/xfa_checksum.h
@@ -0,0 +1,73 @@
+// 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_APP_XFA_CHECKSUM_H_
+#define XFA_FXFA_APP_XFA_CHECKSUM_H_
+
+#include "xfa/fgas/xml/fgas_sax.h"
+#include "xfa/include/fxfa/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,
+ FX_DWORD 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,
+ FX_DWORD dwStartPos);
+ virtual void OnTagClose(void* pTag, FX_DWORD dwEndPos);
+ virtual void OnTagEnd(void* pTag,
+ const CFX_ByteStringC& bsTagName,
+ FX_DWORD dwEndPos);
+
+ virtual void OnTargetData(void* pTag,
+ FX_SAXNODE eType,
+ const CFX_ByteStringC& bsData,
+ FX_DWORD dwStartPos);
+
+ protected:
+ void UpdateChecksum(FX_BOOL bCheckSpace);
+ CXFA_ChecksumContext* m_pContext;
+ CXFA_SAXContext m_SAXContext;
+};
+
+class CXFA_ChecksumContext : public IXFA_ChecksumContext {
+ public:
+ CXFA_ChecksumContext();
+ virtual ~CXFA_ChecksumContext();
+ virtual void Release() { delete this; }
+ virtual FX_BOOL StartChecksum();
+ virtual FX_BOOL UpdateChecksum(IFX_FileRead* pSrcFile,
+ FX_FILESIZE offset = 0,
+ size_t size = 0);
+ virtual void FinishChecksum();
+ virtual 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_APP_XFA_CHECKSUM_H_