Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
CPDF_Parser Class Reference

#include <cpdf_parser.h>

Inheritance diagram for CPDF_Parser:
Collaboration diagram for CPDF_Parser:

Classes

class  ParsedObjectsHolder

Public Types

enum  Error {
  SUCCESS = 0 , FILE_ERROR , FORMAT_ERROR , PASSWORD_ERROR ,
  HANDLER_ERROR
}

Public Member Functions

 CPDF_Parser (ParsedObjectsHolder *holder)
 CPDF_Parser ()
 ~CPDF_Parser ()
Error StartParse (RetainPtr< IFX_SeekableReadStream > pFile, const ByteString &password)
Error StartLinearizedParse (RetainPtr< CPDF_ReadValidator > validator, const ByteString &password)
ByteString GetPassword () const
ByteString GetEncodedPassword () const
const CPDF_DictionaryGetTrailer () const
uint32_t GetTrailerObjectNumber () const
RetainPtr< CPDF_DictionaryGetCombinedTrailer () const
FX_FILESIZE GetLastXRefOffset () const
uint32_t GetPermissions (bool get_owner_perms) const
uint32_t GetRootObjNum () const
uint32_t GetInfoObjNum () const
RetainPtr< const CPDF_ArrayGetIDArray () const
RetainPtr< const CPDF_DictionaryGetEncryptDict () const
RetainPtr< CPDF_ObjectParseIndirectObject (uint32_t objnum)
uint32_t GetLastObjNum () const
bool IsValidObjectNumber (uint32_t objnum) const
FX_FILESIZE GetObjectPositionOrZero (uint32_t objnum) const
const RetainPtr< CPDF_SecurityHandler > & GetSecurityHandler () const
bool IsObjectFree (uint32_t objnum) const
int GetFileVersion () const
bool IsXRefStream () const
FX_FILESIZE GetDocumentSize () const
uint32_t GetFirstPageNo () const
const CPDF_LinearizedHeaderGetLinearizedHeader () const
bool xref_table_rebuilt () const
std::vector< unsigned int > GetTrailerEnds ()
bool WriteToArchive (IFX_ArchiveStream *archive, FX_FILESIZE src_size)
const CPDF_CrossRefTableGetCrossRefTableForTesting () const
CPDF_DictionaryGetMutableTrailerForTesting ()
RetainPtr< CPDF_ObjectParseIndirectObjectAtForTesting (FX_FILESIZE pos)
void SetLinearizedHeaderForTesting (std::unique_ptr< CPDF_LinearizedHeader > pLinearized)

Static Public Attributes

static constexpr uint32_t kMaxObjectNumber = 4 * 1024 * 1024
static constexpr size_t kInvalidPos = std::numeric_limits<size_t>::max()

Protected Member Functions

bool LoadCrossRefTable (FX_FILESIZE pos, bool skip)
bool RebuildCrossRef ()
Error StartParseInternal ()
FX_FILESIZE ParseStartXRef ()
std::unique_ptr< CPDF_LinearizedHeaderParseLinearizedHeader ()
void SetSyntaxParserForTesting (std::unique_ptr< CPDF_SyntaxParser > parser)

Friends

class CPDF_DataAvail

Detailed Description

Definition at line 37 of file cpdf_parser.h.

Member Enumeration Documentation

◆ Error

Enumerator
SUCCESS 
FILE_ERROR 
FORMAT_ERROR 
PASSWORD_ERROR 
HANDLER_ERROR 

Definition at line 44 of file cpdf_parser.h.

Constructor & Destructor Documentation

◆ CPDF_Parser() [1/2]

CPDF_Parser::CPDF_Parser ( ParsedObjectsHolder * holder)
explicit

Definition at line 158 of file cpdf_parser.cpp.

References CPDF_Parser().

Referenced by CPDF_Parser(), and CPDF_Parser().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CPDF_Parser() [2/2]

CPDF_Parser::CPDF_Parser ( )

Definition at line 167 of file cpdf_parser.cpp.

References CPDF_Parser().

Here is the call graph for this function:

◆ ~CPDF_Parser()

CPDF_Parser::~CPDF_Parser ( )
default

Member Function Documentation

◆ GetCombinedTrailer()

RetainPtr< CPDF_Dictionary > CPDF_Parser::GetCombinedTrailer ( ) const

Definition at line 977 of file cpdf_parser.cpp.

◆ GetCrossRefTableForTesting()

const CPDF_CrossRefTable * CPDF_Parser::GetCrossRefTableForTesting ( ) const
inline

Definition at line 115 of file cpdf_parser.h.

Referenced by TEST(), TEST(), and TEST().

Here is the caller graph for this function:

◆ GetDocumentSize()

FX_FILESIZE CPDF_Parser::GetDocumentSize ( ) const

Definition at line 1091 of file cpdf_parser.cpp.

◆ GetEncodedPassword()

ByteString CPDF_Parser::GetEncodedPassword ( ) const

Definition at line 961 of file cpdf_parser.cpp.

◆ GetEncryptDict()

RetainPtr< const CPDF_Dictionary > CPDF_Parser::GetEncryptDict ( ) const

Definition at line 942 of file cpdf_parser.cpp.

References GetTrailer().

Here is the call graph for this function:

◆ GetFileVersion()

int CPDF_Parser::GetFileVersion ( ) const
inline

Definition at line 101 of file cpdf_parser.h.

Referenced by FPDF_GetFileVersion().

Here is the caller graph for this function:

◆ GetFirstPageNo()

uint32_t CPDF_Parser::GetFirstPageNo ( ) const

Definition at line 1095 of file cpdf_parser.cpp.

Referenced by FPDFAvail_GetFirstPageNum().

Here is the caller graph for this function:

◆ GetIDArray()

RetainPtr< const CPDF_Array > CPDF_Parser::GetIDArray ( ) const

Definition at line 932 of file cpdf_parser.cpp.

References CPDF_Dictionary::GetArrayFor(), and GetTrailer().

Here is the call graph for this function:

◆ GetInfoObjNum()

uint32_t CPDF_Parser::GetInfoObjNum ( ) const

Definition at line 983 of file cpdf_parser.cpp.

References CPDF_Object::kInvalidObjNum.

◆ GetLastObjNum()

uint32_t CPDF_Parser::GetLastObjNum ( ) const

Definition at line 171 of file cpdf_parser.cpp.

Referenced by IsValidObjectNumber(), and StartLinearizedParse().

Here is the caller graph for this function:

◆ GetLastXRefOffset()

FX_FILESIZE CPDF_Parser::GetLastXRefOffset ( ) const
inline

Definition at line 83 of file cpdf_parser.h.

◆ GetLinearizedHeader()

const CPDF_LinearizedHeader * CPDF_Parser::GetLinearizedHeader ( ) const
inline

Definition at line 106 of file cpdf_parser.h.

◆ GetMutableTrailerForTesting()

CPDF_Dictionary * CPDF_Parser::GetMutableTrailerForTesting ( )

Definition at line 969 of file cpdf_parser.cpp.

Referenced by CPDFSecurityHandlerEmbedderTest::RemoveTrailerIdFromDocument().

Here is the caller graph for this function:

◆ GetObjectPositionOrZero()

FX_FILESIZE CPDF_Parser::GetObjectPositionOrZero ( uint32_t objnum) const

Definition at line 181 of file cpdf_parser.cpp.

References CPDF_CrossRefTable::kNormal.

◆ GetPassword()

ByteString CPDF_Parser::GetPassword ( ) const
inline

Definition at line 70 of file cpdf_parser.h.

◆ GetPermissions()

uint32_t CPDF_Parser::GetPermissions ( bool get_owner_perms) const

Definition at line 1111 of file cpdf_parser.cpp.

◆ GetRootObjNum()

uint32_t CPDF_Parser::GetRootObjNum ( ) const

Definition at line 991 of file cpdf_parser.cpp.

References CPDF_Object::kInvalidObjNum.

Referenced by StartLinearizedParse(), and StartParseInternal().

Here is the caller graph for this function:

◆ GetSecurityHandler()

const RetainPtr< CPDF_SecurityHandler > & CPDF_Parser::GetSecurityHandler ( ) const
inline

Definition at line 96 of file cpdf_parser.h.

◆ GetTrailer()

const CPDF_Dictionary * CPDF_Parser::GetTrailer ( ) const

Definition at line 965 of file cpdf_parser.cpp.

Referenced by GetEncryptDict(), GetIDArray(), and StartLinearizedParse().

Here is the caller graph for this function:

◆ GetTrailerEnds()

std::vector< unsigned int > CPDF_Parser::GetTrailerEnds ( )

Definition at line 1258 of file cpdf_parser.cpp.

References CPDF_SyntaxParser::WordResult::is_number.

◆ GetTrailerObjectNumber()

uint32_t CPDF_Parser::GetTrailerObjectNumber ( ) const

Definition at line 973 of file cpdf_parser.cpp.

◆ IsObjectFree()

bool CPDF_Parser::IsObjectFree ( uint32_t objnum) const

Definition at line 186 of file cpdf_parser.cpp.

References CPDF_CrossRefTable::kFree.

◆ IsValidObjectNumber()

bool CPDF_Parser::IsValidObjectNumber ( uint32_t objnum) const

Definition at line 177 of file cpdf_parser.cpp.

References GetLastObjNum().

Referenced by ParseIndirectObject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsXRefStream()

bool CPDF_Parser::IsXRefStream ( ) const
inline

Definition at line 102 of file cpdf_parser.h.

◆ LoadCrossRefTable()

bool CPDF_Parser::LoadCrossRefTable ( FX_FILESIZE pos,
bool skip )
protected

Definition at line 617 of file cpdf_parser.cpp.

Referenced by StartLinearizedParse(), and TEST().

Here is the caller graph for this function:

◆ ParseIndirectObject()

RetainPtr< CPDF_Object > CPDF_Parser::ParseIndirectObject ( uint32_t objnum)

Definition at line 999 of file cpdf_parser.cpp.

References IsValidObjectNumber(), CPDF_CrossRefTable::kCompressed, CPDF_CrossRefTable::kFree, and CPDF_CrossRefTable::kNormal.

Here is the call graph for this function:

◆ ParseIndirectObjectAtForTesting()

RetainPtr< CPDF_Object > CPDF_Parser::ParseIndirectObjectAtForTesting ( FX_FILESIZE pos)
inline

Definition at line 121 of file cpdf_parser.h.

◆ ParseLinearizedHeader()

std::unique_ptr< CPDF_LinearizedHeader > CPDF_Parser::ParseLinearizedHeader ( )
protected

Definition at line 1117 of file cpdf_parser.cpp.

◆ ParseStartXRef()

FX_FILESIZE CPDF_Parser::ParseStartXRef ( )
protected

Definition at line 290 of file cpdf_parser.cpp.

References CPDF_SyntaxParser::WordResult::is_number.

Referenced by StartParseInternal(), TEST(), and TEST().

Here is the caller graph for this function:

◆ RebuildCrossRef()

bool CPDF_Parser::RebuildCrossRef ( )
protected

Definition at line 703 of file cpdf_parser.cpp.

References CPDF_SyntaxParser::WordResult::is_number, kMaxObjectNumber, and fxcrt::ByteString::operator==().

Referenced by StartLinearizedParse(), StartParseInternal(), TEST(), and TEST().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetLinearizedHeaderForTesting()

void CPDF_Parser::SetLinearizedHeaderForTesting ( std::unique_ptr< CPDF_LinearizedHeader > pLinearized)

Definition at line 1099 of file cpdf_parser.cpp.

◆ SetSyntaxParserForTesting()

void CPDF_Parser::SetSyntaxParserForTesting ( std::unique_ptr< CPDF_SyntaxParser > parser)
protected

Definition at line 1253 of file cpdf_parser.cpp.

◆ StartLinearizedParse()

CPDF_Parser::Error CPDF_Parser::StartLinearizedParse ( RetainPtr< CPDF_ReadValidator > validator,
const ByteString & password )

Definition at line 1121 of file cpdf_parser.cpp.

References FORMAT_ERROR, CPDF_Dictionary::GetDirectIntegerFor(), GetLastObjNum(), GetRootObjNum(), GetTrailer(), CPDF_Object::kInvalidObjNum, LoadCrossRefTable(), RebuildCrossRef(), StartParseInternal(), and SUCCESS.

Here is the call graph for this function:

◆ StartParse()

CPDF_Parser::Error CPDF_Parser::StartParse ( RetainPtr< IFX_SeekableReadStream > pFile,
const ByteString & password )

Definition at line 221 of file cpdf_parser.cpp.

References FORMAT_ERROR, and StartParseInternal().

Here is the call graph for this function:

◆ StartParseInternal()

CPDF_Parser::Error CPDF_Parser::StartParseInternal ( )
protected

Definition at line 231 of file cpdf_parser.cpp.

References FORMAT_ERROR, GetRootObjNum(), CPDF_Object::kInvalidObjNum, ParseStartXRef(), RebuildCrossRef(), and SUCCESS.

Referenced by StartLinearizedParse(), StartParse(), and TEST().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteToArchive()

bool CPDF_Parser::WriteToArchive ( IFX_ArchiveStream * archive,
FX_FILESIZE src_size )

Definition at line 1302 of file cpdf_parser.cpp.

◆ xref_table_rebuilt()

bool CPDF_Parser::xref_table_rebuilt ( ) const
inline

Definition at line 110 of file cpdf_parser.h.

◆ CPDF_DataAvail

friend class CPDF_DataAvail
friend

Definition at line 138 of file cpdf_parser.h.

Member Data Documentation

◆ kInvalidPos

size_t CPDF_Parser::kInvalidPos = std::numeric_limits<size_t>::max()
staticconstexpr

Definition at line 59 of file cpdf_parser.h.

◆ kMaxObjectNumber


The documentation for this class was generated from the following files: