Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PoDoFo::PdfTokenizer Class Reference

#include <PdfTokenizer.h>

Inheritance diagram for PoDoFo::PdfTokenizer:

PoDoFo::PdfContentsTokenizer PoDoFo::PdfParser PoDoFo::PdfParserObject PoDoFo::PdfXRefStreamParserObject List of all members.

Public Member Functions

virtual bool GetNextToken (const char *&pszToken, EPdfTokenType *peType=NULL)
bool IsNextToken (const char *pszToken)
pdf_long GetNextNumber ()
void GetNextVariant (PdfVariant &rVariant, PdfEncrypt *pEncrypt)

Static Public Member Functions

PODOFO_NOTHROW bool IsWhitespace (const unsigned char ch)
PODOFO_NOTHROW bool IsDelimiter (const unsigned char ch)
PODOFO_NOTHROW bool IsRegular (const unsigned char ch)
PODOFO_NOTHROW bool IsPrintable (const unsigned char ch)
PODOFO_NOTHROW int GetHexValue (const unsigned char ch)

Static Public Attributes

const unsigned int HEX_NOT_FOUND = std::numeric_limits<unsigned int>::max()

Protected Member Functions

void GetNextVariant (const char *pszToken, EPdfTokenType eType, PdfVariant &rVariant, PdfEncrypt *pEncrypt)
EPdfDataType DetermineDataType (const char *pszToken, EPdfTokenType eType, PdfVariant &rVariant)
void ReadDictionary (PdfVariant &rVariant, PdfEncrypt *pEncrypt)
void ReadArray (PdfVariant &rVariant, PdfEncrypt *pEncrypt)
void ReadString (PdfVariant &rVariant, PdfEncrypt *pEncrypt)
void ReadHexString (PdfVariant &rVariant, PdfEncrypt *pEncrypt)
void ReadName (PdfVariant &rVariant)
void QuequeToken (const char *pszToken, EPdfTokenType eType)

Detailed Description

A simple tokenizer for PDF files and PDF content streams


Member Function Documentation

EPdfDataType PoDoFo::PdfTokenizer::DetermineDataType const char *  pszToken,
EPdfTokenType  eType,
PdfVariant rVariant
[protected]
 

Determine the possible datatype of a token. Numbers, reals, bools or NULL values are parsed directly by this function and saved to a variant.

Returns:
the expected datatype

int PoDoFo::PdfTokenizer::GetHexValue const unsigned char  ch  )  [inline, static]
 

Get the hex value from a static map of a given hex character (0-9, A-F, a-f).

Parameters:
ch hex character
Returns:
hex value or HEX_NOT_FOUND if invalid
See also:
HEX_NOT_FOUND

pdf_long PoDoFo::PdfTokenizer::GetNextNumber  ) 
 

Read the next number from the current file position ignoring all comments.

Raises NoNumber exception if the next token is no number, and UnexpectedEOF if no token could be read. No token is consumed if NoNumber is thrown.

Returns:
a number read from the input device.

bool PoDoFo::PdfTokenizer::GetNextToken const char *&  pszToken,
EPdfTokenType *  peType = NULL
[virtual]
 

Reads the next token from the current file position ignoring all comments.

Parameters:
[out] pszToken On true return, set to a pointer to the read token (a NULL-terminated C string). The pointer is to memory owned by PdfTokenizer and must NOT be freed. The contents are invalidated on the next call to GetNextToken(..) and by the destruction of the PdfTokenizer. Undefined on false return.
[out] peType On true return, if not NULL the type of the read token will be stored into this parameter. Undefined on false return.
Returns:
True if a token was read, false if there are no more tokens to read.
See also:
GetBuffer

Reimplemented in PoDoFo::PdfContentsTokenizer.

void PoDoFo::PdfTokenizer::GetNextVariant const char *  pszToken,
EPdfTokenType  eType,
PdfVariant rVariant,
PdfEncrypt pEncrypt
[protected]
 

Read the next variant from the current file position ignoring all comments.

Raises an exception if there is no variant left in the file.

Parameters:
pszToken a token that has already been read
eType type of the passed token
rVariant write the read variant to this value
pEncrypt an encryption object which is used to decrypt strings during parsing

void PoDoFo::PdfTokenizer::GetNextVariant PdfVariant rVariant,
PdfEncrypt pEncrypt
 

Read the next variant from the current file position ignoring all comments.

Raises an UnexpectedEOF exception if there is no variant left in the file.

Parameters:
rVariant write the read variant to this value
pEncrypt an encryption object which is used to decrypt strings during parsing

bool PoDoFo::PdfTokenizer::IsDelimiter const unsigned char  ch  )  [inline, static]
 

Returns true if the given character is a delimiter according to the pdf reference

Returns:
true if it is a delimiter character otherwise false

bool PoDoFo::PdfTokenizer::IsNextToken const char *  pszToken  ) 
 

Reads the next token from the current file position ignoring all comments and compare the passed token to the read token.

If there is no next token available, throws UnexpectedEOF.

Parameters:
pszToken a token that is compared to the read token
Returns:
true if the read token equals the passed token.

bool PoDoFo::PdfTokenizer::IsPrintable const unsigned char  ch  )  [inline, static]
 

True if the passed character is within the generally accepted "printable" ASCII range.

bool PoDoFo::PdfTokenizer::IsRegular const unsigned char  ch  )  [inline, static]
 

True if the passed character is a regular character according to the PDF reference (Section 3.1.1, Character Set); ie it is neither a white-space nor a delimeter character.

bool PoDoFo::PdfTokenizer::IsWhitespace const unsigned char  ch  )  [inline, static]
 

Returns true if the given character is a whitespace according to the pdf reference

Returns:
true if it is a whitespace character otherwise false

void PoDoFo::PdfTokenizer::QuequeToken const char *  pszToken,
EPdfTokenType  eType
[protected]
 

Add a token to the queque of tokens. GetNextToken() will return all quequed tokens first before reading new tokens from the input device.

Parameters:
pszToken string of the token
eType type of the token
See also:
GetNextToken

void PoDoFo::PdfTokenizer::ReadArray PdfVariant rVariant,
PdfEncrypt pEncrypt
[protected]
 

Read an array from the input device and store it into a variant.

Parameters:
rVariant store the array into this variable
pEncrypt an encryption object which is used to decrypt strings during parsing

void PoDoFo::PdfTokenizer::ReadDictionary PdfVariant rVariant,
PdfEncrypt pEncrypt
[protected]
 

Read a dictionary from the input device and store it into a variant.

Parameters:
rVariant store the dictionary into this variable
pEncrypt an encryption object which is used to decrypt strings during parsing

void PoDoFo::PdfTokenizer::ReadHexString PdfVariant rVariant,
PdfEncrypt pEncrypt
[protected]
 

Read a hex string from the input device and store it into a variant.

Parameters:
rVariant store the hex string into this variable
pEncrypt an encryption object which is used to decrypt strings during parsing

void PoDoFo::PdfTokenizer::ReadName PdfVariant rVariant  )  [protected]
 

Read a name from the input device and store it into a variant.

Throws UnexpectedEOF if there is nothing to read.

Parameters:
rVariant store the name into this variable

void PoDoFo::PdfTokenizer::ReadString PdfVariant rVariant,
PdfEncrypt pEncrypt
[protected]
 

Read a string from the input device and store it into a variant.

Parameters:
rVariant store the string into this variable
pEncrypt an encryption object which is used to decrypt strings during parsing


Member Data Documentation

const unsigned int PoDoFo::PdfTokenizer::HEX_NOT_FOUND = std::numeric_limits<unsigned int>::max() [static]
 

Constant which is returned for invalid hex values.


Generated on Sun Feb 12 13:22:47 2012 for PoDoFo by  doxygen 1.3.9.1