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)
 
void SetPassword (const ByteString &password)
 
ByteString GetPassword () const
 
ByteString GetEncodedPassword () const
 
const CPDF_DictionaryGetTrailer () const
 
CPDF_DictionaryGetMutableTrailerForTesting ()
 
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_DictionaryGetRoot () 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
 
bool IsObjectFreeOrNull (uint32_t objnum) const
 
const RetainPtr< CPDF_SecurityHandler > & GetSecurityHandler () const
 
bool IsObjectFree (uint32_t objnum) const
 
int GetFileVersion () const
 
bool IsXRefStream () const
 
RetainPtr< CPDF_ObjectParseIndirectObjectAt (FX_FILESIZE pos, uint32_t objnum)
 
FX_FILESIZE GetDocumentSize () const
 
uint32_t GetFirstPageNo () const
 
const CPDF_LinearizedHeaderGetLinearizedHeader () const
 
const CPDF_CrossRefTableGetCrossRefTable () const
 
bool xref_table_rebuilt () const
 
std::vector< unsigned int > GetTrailerEnds ()
 
bool WriteToArchive (IFX_ArchiveStream *archive, FX_FILESIZE src_size)
 
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 LoadCrossRefV4 (FX_FILESIZE pos, bool bSkip)
 
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 155 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 164 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 978 of file cpdf_parser.cpp.

◆ GetCrossRefTable()

const CPDF_CrossRefTable * CPDF_Parser::GetCrossRefTable ( ) const
inline

Definition at line 117 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 1083 of file cpdf_parser.cpp.

◆ GetEncodedPassword()

ByteString CPDF_Parser::GetEncodedPassword ( ) const

Definition at line 962 of file cpdf_parser.cpp.

◆ GetEncryptDict()

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

Definition at line 943 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 105 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 1087 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 933 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 984 of file cpdf_parser.cpp.

References CPDF_Object::kInvalidObjNum.

◆ GetLastObjNum()

uint32_t CPDF_Parser::GetLastObjNum ( ) const

Definition at line 168 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 85 of file cpdf_parser.h.

◆ GetLinearizedHeader()

const CPDF_LinearizedHeader * CPDF_Parser::GetLinearizedHeader ( ) const
inline

Definition at line 113 of file cpdf_parser.h.

◆ GetMutableTrailerForTesting()

CPDF_Dictionary * CPDF_Parser::GetMutableTrailerForTesting ( )

Definition at line 970 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 178 of file cpdf_parser.cpp.

References CPDF_CrossRefTable::kNormal.

Referenced by ParseIndirectObject().

+ Here is the caller graph for this function:

◆ GetPassword()

ByteString CPDF_Parser::GetPassword ( ) const
inline

Definition at line 71 of file cpdf_parser.h.

◆ GetPermissions()

uint32_t CPDF_Parser::GetPermissions ( bool get_owner_perms) const

Definition at line 1103 of file cpdf_parser.cpp.

◆ GetRoot()

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

Definition at line 937 of file cpdf_parser.cpp.

Referenced by StartParseInternal().

+ Here is the caller graph for this function:

◆ GetRootObjNum()

uint32_t CPDF_Parser::GetRootObjNum ( ) const

Definition at line 992 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 100 of file cpdf_parser.h.

◆ GetTrailer()

const CPDF_Dictionary * CPDF_Parser::GetTrailer ( ) const

Definition at line 966 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 1252 of file cpdf_parser.cpp.

References CPDF_SyntaxParser::WordResult::is_number.

◆ GetTrailerObjectNumber()

uint32_t CPDF_Parser::GetTrailerObjectNumber ( ) const

Definition at line 974 of file cpdf_parser.cpp.

◆ IsObjectFree()

bool CPDF_Parser::IsObjectFree ( uint32_t objnum) const

Definition at line 201 of file cpdf_parser.cpp.

References CPDF_CrossRefTable::kFree.

◆ IsObjectFreeOrNull()

bool CPDF_Parser::IsObjectFreeOrNull ( uint32_t objnum) const

◆ IsValidObjectNumber()

bool CPDF_Parser::IsValidObjectNumber ( uint32_t objnum) const

Definition at line 174 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 106 of file cpdf_parser.h.

◆ LoadCrossRefV4()

bool CPDF_Parser::LoadCrossRefV4 ( FX_FILESIZE pos,
bool bSkip )
protected

Definition at line 636 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 1000 of file cpdf_parser.cpp.

References GetObjectPositionOrZero(), IsValidObjectNumber(), CPDF_CrossRefTable::kCompressed, CPDF_CrossRefTable::kNormal, and ParseIndirectObjectAt().

+ Here is the call graph for this function:

◆ ParseIndirectObjectAt()

RetainPtr< CPDF_Object > CPDF_Parser::ParseIndirectObjectAt ( FX_FILESIZE pos,
uint32_t objnum )

Definition at line 1062 of file cpdf_parser.cpp.

Referenced by ParseIndirectObject().

+ Here is the caller graph for this function:

◆ ParseLinearizedHeader()

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

Definition at line 1109 of file cpdf_parser.cpp.

◆ ParseStartXRef()

FX_FILESIZE CPDF_Parser::ParseStartXRef ( )
protected

Definition at line 304 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 695 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 1091 of file cpdf_parser.cpp.

◆ SetPassword()

void CPDF_Parser::SetPassword ( const ByteString & password)
inline

Definition at line 70 of file cpdf_parser.h.

Referenced by StartLinearizedParse(), and StartParse().

+ Here is the caller graph for this function:

◆ SetSyntaxParserForTesting()

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

Definition at line 1247 of file cpdf_parser.cpp.

◆ StartLinearizedParse()

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

Definition at line 1113 of file cpdf_parser.cpp.

References FORMAT_ERROR, CPDF_Dictionary::GetDirectIntegerFor(), GetLastObjNum(), GetRootObjNum(), GetTrailer(), CPDF_Object::kInvalidObjNum, LoadCrossRefV4(), RebuildCrossRef(), SetPassword(), 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 234 of file cpdf_parser.cpp.

References FORMAT_ERROR, SetPassword(), and StartParseInternal().

+ Here is the call graph for this function:

◆ StartParseInternal()

CPDF_Parser::Error CPDF_Parser::StartParseInternal ( )
protected

Definition at line 244 of file cpdf_parser.cpp.

References FORMAT_ERROR, GetRoot(), 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 1296 of file cpdf_parser.cpp.

◆ xref_table_rebuilt()

bool CPDF_Parser::xref_table_rebuilt ( ) const
inline

Definition at line 121 of file cpdf_parser.h.

Friends And Related Symbol Documentation

◆ CPDF_DataAvail

friend class CPDF_DataAvail
friend

Definition at line 139 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: