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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h

Issue 2392603004: Move core/fpdfapi/fpdf_parser to core/fpdfapi/parser (Closed)
Patch Set: Rebase to master Created 4 years, 2 months 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
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_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
9
10 #include <memory>
11
12 #include "core/fxcrt/cfx_string_pool_template.h"
13 #include "core/fxcrt/cfx_weak_ptr.h"
14 #include "core/fxcrt/fx_basic.h"
15
16 class CPDF_CryptoHandler;
17 class CPDF_Dictionary;
18 class CPDF_IndirectObjectHolder;
19 class CPDF_Object;
20 class CPDF_Stream;
21 class IFX_FileRead;
22
23 class CPDF_SyntaxParser {
24 public:
25 CPDF_SyntaxParser();
26 explicit CPDF_SyntaxParser(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
27 ~CPDF_SyntaxParser();
28
29 void InitParser(IFX_FileRead* pFileAccess, uint32_t HeaderOffset);
30
31 FX_FILESIZE SavePos() const { return m_Pos; }
32 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; }
33
34 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList,
35 uint32_t objnum,
36 uint32_t gennum,
37 FX_BOOL bDecrypt);
38 CPDF_Object* GetObjectForStrict(CPDF_IndirectObjectHolder* pObjList,
39 uint32_t objnum,
40 uint32_t gennum);
41 CFX_ByteString GetKeyword();
42
43 void ToNextLine();
44 void ToNextWord();
45
46 FX_BOOL SearchWord(const CFX_ByteStringC& word,
47 FX_BOOL bWholeWord,
48 FX_BOOL bForward,
49 FX_FILESIZE limit);
50 int SearchMultiWord(const CFX_ByteStringC& words,
51 FX_BOOL bWholeWord,
52 FX_FILESIZE limit);
53 FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit);
54
55 void SetEncrypt(std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler);
56
57 FX_BOOL ReadBlock(uint8_t* pBuf, uint32_t size);
58 FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch);
59 CFX_ByteString GetNextWord(bool* bIsNumber);
60
61 private:
62 friend class CPDF_Parser;
63 friend class CPDF_DataAvail;
64 friend class cpdf_syntax_parser_ReadHexString_Test;
65
66 static const int kParserMaxRecursionDepth = 64;
67 static int s_CurrentRecursionDepth;
68
69 uint32_t GetDirectNum();
70 FX_BOOL GetNextChar(uint8_t& ch);
71 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch);
72 void GetNextWordInternal(bool* bIsNumber);
73 bool IsWholeWord(FX_FILESIZE startpos,
74 FX_FILESIZE limit,
75 const CFX_ByteStringC& tag,
76 FX_BOOL checkKeyword);
77
78 CFX_ByteString ReadString();
79 CFX_ByteString ReadHexString();
80 unsigned int ReadEOLMarkers(FX_FILESIZE pos);
81 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict,
82 uint32_t objnum,
83 uint32_t gennum);
84
85 CFX_ByteString MaybeIntern(const CFX_ByteString& str);
86
87 FX_FILESIZE m_Pos;
88 int m_MetadataObjnum;
89 IFX_FileRead* m_pFileAccess;
90 FX_FILESIZE m_HeaderOffset;
91 FX_FILESIZE m_FileLen;
92 uint8_t* m_pFileBuf;
93 uint32_t m_BufSize;
94 FX_FILESIZE m_BufOffset;
95 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler;
96 uint8_t m_WordBuffer[257];
97 uint32_t m_WordSize;
98 CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
99 };
100
101 #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_string.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698