summaryrefslogtreecommitdiff
path: root/core/fpdfapi/edit/cpdf_xrefstream.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/edit/cpdf_xrefstream.h')
-rw-r--r--core/fpdfapi/edit/cpdf_xrefstream.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/core/fpdfapi/edit/cpdf_xrefstream.h b/core/fpdfapi/edit/cpdf_xrefstream.h
new file mode 100644
index 0000000000..cb11261f9f
--- /dev/null
+++ b/core/fpdfapi/edit/cpdf_xrefstream.h
@@ -0,0 +1,50 @@
+// Copyright 2017 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 CORE_FPDFAPI_EDIT_CPDF_XREFSTREAM_H_
+#define CORE_FPDFAPI_EDIT_CPDF_XREFSTREAM_H_
+
+#include <vector>
+
+class CPDF_Creator;
+class CPDF_Object;
+
+class CPDF_XRefStream {
+ public:
+ struct Index {
+ uint32_t objnum;
+ uint32_t count;
+ };
+
+ CPDF_XRefStream();
+ ~CPDF_XRefStream();
+
+ bool Start();
+ int32_t CompressIndirectObject(uint32_t dwObjNum,
+ const CPDF_Object* pObj,
+ CPDF_Creator* pCreator);
+ int32_t CompressIndirectObject(uint32_t dwObjNum,
+ const uint8_t* pBuffer,
+ uint32_t dwSize,
+ CPDF_Creator* pCreator);
+ bool End(CPDF_Creator* pCreator, bool bEOF);
+ void AddObjectNumberToIndexArray(uint32_t objnum);
+ bool EndXRefStream(CPDF_Creator* pCreator);
+
+ std::vector<Index> m_IndexArray;
+ FX_FILESIZE m_PrevOffset;
+ uint32_t m_dwTempObjNum;
+
+ protected:
+ int32_t EndObjectStream(CPDF_Creator* pCreator, bool bEOF);
+ bool GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF);
+
+ size_t m_iSeg;
+ CPDF_ObjectStream m_ObjStream;
+ CFX_ByteTextBuf m_Buffer;
+};
+
+#endif // CORE_FPDFAPI_EDIT_CPDF_XREFSTREAM_H_