7#ifndef CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_
8#define CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_
15#include "core/fpdfapi/parser/cpdf_stream.h"
16#include "core/fxcrt/data_vector.h"
17#include "core/fxcrt/fx_types.h"
18#include "core/fxcrt/retain_ptr.h"
19#include "core/fxcrt/string_pool_template.h"
20#include "core/fxcrt/unowned_ptr.h"
21#include "core/fxcrt/weak_ptr.h"
22#include "third_party/base/containers/span.h"
50 m_ReadBufferSize = read_buffer_size;
66 bool ReadBlock(pdfium::span<uint8_t> buffer);
87 m_TrailerEnds = trailer_ends;
91 enum class WordType :
bool { kWord, kNumber };
93 friend class CPDF_DataAvail;
94 friend class cpdf_syntax_parser_ReadHexString_Test;
96 static constexpr int kParserMaxRecursionDepth = 64;
97 static int s_CurrentRecursionDepth;
100 bool GetCharAtBackward(
FX_FILESIZE pos, uint8_t* ch);
101 WordType GetNextWordInternal();
125 WeakPtr<ByteStringPool> m_pPool;
126 DataVector<uint8_t> m_pFileBuf;
128 uint32_t m_WordSize = 0;
129 uint8_t m_WordBuffer[257] = {};
133 UnownedPtr<std::vector<
unsigned int>> m_TrailerEnds;
static std::unique_ptr< CFDF_Document > CreateNewDoc()
const CPDF_Dictionary * GetRoot() const
static std::unique_ptr< CFDF_Document > ParseMemory(pdfium::span< const uint8_t > span)
RetainPtr< CPDF_Dictionary > GetMutableRoot() const
~CFDF_Document() override
ByteString WriteToString() const
bool ReplaceIndirectObjectIfHigherGeneration(uint32_t objnum, RetainPtr< CPDF_Object > pObj)
static constexpr int kFileBufSize
RetainPtr< CPDF_Object > GetIndirectObject(CPDF_IndirectObjectHolder *pObjList, ParseType parse_type)
static std::unique_ptr< CPDF_SyntaxParser > CreateForTesting(RetainPtr< IFX_SeekableReadStream > pFileAccess, FX_FILESIZE HeaderOffset)
bool BackwardsSearchToWord(ByteStringView word, FX_FILESIZE limit)
RetainPtr< CPDF_ReadValidator > GetValidator() const
ByteString PeekNextWord()
void RecordingToNextWord()
CPDF_SyntaxParser(RetainPtr< IFX_SeekableReadStream > pFileAccess)
void SetReadBufferSize(uint32_t read_buffer_size)
FX_FILESIZE FindTag(ByteStringView tag)
FX_FILESIZE GetPos() const
ByteString ReadHexString()
FX_FILESIZE GetDocumentSize() const
CPDF_SyntaxParser(RetainPtr< CPDF_ReadValidator > pValidator, FX_FILESIZE HeaderOffset)
bool GetNextChar(uint8_t &ch)
bool ReadBlock(pdfium::span< uint8_t > buffer)
void SetPos(FX_FILESIZE pos)
RetainPtr< CPDF_Object > GetObjectBody(CPDF_IndirectObjectHolder *pObjList)
void SetTrailerEnds(std::vector< unsigned int > *trailer_ends)
bool GetCharAt(FX_FILESIZE pos, uint8_t &ch)