Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: core/fpdfapi/page/cpdf_streamparser.h

Issue 2521123003: Continue splitting pageint.h into per-class files (Closed)
Patch Set: const Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/page/cpdf_streamcontentparser.cpp ('k') | core/fpdfapi/page/cpdf_streamparser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_STREAMPARSER_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
9
10 #include <memory>
11 #include <utility>
12
13 #include "core/fpdfapi/parser/cpdf_dictionary.h"
14 #include "core/fpdfapi/parser/cpdf_document.h"
15 #include "core/fpdfapi/parser/cpdf_object.h"
16 #include "core/fpdfapi/parser/cpdf_stream.h"
17 #include "core/fxcrt/cfx_string_pool_template.h"
18 #include "core/fxcrt/cfx_weak_ptr.h"
19
20 class CPDF_StreamParser {
21 public:
22 enum SyntaxType { EndOfData, Number, Keyword, Name, Others };
23
24 CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize);
25 CPDF_StreamParser(const uint8_t* pData,
26 uint32_t dwSize,
27 const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
28 ~CPDF_StreamParser();
29
30 SyntaxType ParseNextElement();
31 const uint8_t* GetWordBuf() const { return m_WordBuffer; }
32 uint32_t GetWordSize() const { return m_WordSize; }
33 uint32_t GetPos() const { return m_Pos; }
34 void SetPos(uint32_t pos) { m_Pos = pos; }
35 std::unique_ptr<CPDF_Object> GetObject() { return std::move(m_pLastObj); }
36 std::unique_ptr<CPDF_Object> ReadNextObject(bool bAllowNestedArray,
37 uint32_t dwInArrayLevel);
38 std::unique_ptr<CPDF_Stream> ReadInlineStream(
39 CPDF_Document* pDoc,
40 std::unique_ptr<CPDF_Dictionary> pDict,
41 CPDF_Object* pCSObj);
42
43 private:
44 friend class cpdf_streamparser_ReadHexString_Test;
45
46 void GetNextWord(bool& bIsNumber);
47 CFX_ByteString ReadString();
48 CFX_ByteString ReadHexString();
49 bool PositionIsInBounds() const;
50
51 const uint8_t* m_pBuf;
52 uint32_t m_Size; // Length in bytes of m_pBuf.
53 uint32_t m_Pos; // Current byte position within m_pBuf.
54 uint8_t m_WordBuffer[256];
55 uint32_t m_WordSize;
56 std::unique_ptr<CPDF_Object> m_pLastObj;
57 CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
58 };
59
60 #endif // CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/page/cpdf_streamcontentparser.cpp ('k') | core/fpdfapi/page/cpdf_streamparser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698