PoDoFo
0.9.6
|
#include <PdfTokenizer.h>
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 | |
static PODOFO_NOTHROW bool | IsWhitespace (const unsigned char ch) |
static PODOFO_NOTHROW bool | IsDelimiter (const unsigned char ch) |
static PODOFO_NOTHROW bool | IsRegular (const unsigned char ch) |
static PODOFO_NOTHROW bool | IsPrintable (const unsigned char ch) |
static PODOFO_NOTHROW int | GetHexValue (const unsigned char ch) |
Static Public Attributes | |
static 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 | ReadHexString (std::vector< char > &rVecBuffer) |
void | ReadName (PdfVariant &rVariant) |
void | QuequeToken (const char *pszToken, EPdfTokenType eType) |
A simple tokenizer for PDF files and PDF content streams
|
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.
|
inlinestatic |
Get the hex value from a static map of a given hex character (0-9, A-F, a-f).
ch | hex character |
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.
|
virtual |
Reads the next token from the current file position ignoring all comments.
[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. |
Reimplemented in PoDoFo::PdfContentsTokenizer.
|
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.
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.
rVariant | write the read variant to this value |
pEncrypt | an encryption object which is used to decrypt strings during parsing |
|
inlinestatic |
Returns true if the given character is a delimiter according to the pdf reference
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.
pszToken | a token that is compared to the read token |
|
inlinestatic |
True if the passed character is within the generally accepted "printable" ASCII range.
|
inlinestatic |
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 delimiter character.
|
inlinestatic |
Returns true if the given character is a whitespace according to the pdf reference
|
protected |
Add a token to the queue of tokens. GetNextToken() will return all enqueued tokens first before reading new tokens from the input device.
pszToken | string of the token |
eType | type of the token |
|
protected |
Read an array from the input device and store it into a variant.
rVariant | store the array into this variable |
pEncrypt | an encryption object which is used to decrypt strings during parsing |
|
protected |
Read a dictionary from the input device and store it into a variant.
rVariant | store the dictionary into this variable |
pEncrypt | an encryption object which is used to decrypt strings during parsing |
|
protected |
Read a hex string from the input device and store it into a variant.
rVariant | store the hex string into this variable |
pEncrypt | an encryption object which is used to decrypt strings during parsing |
|
protected |
Read a hex string from the input device and store it into a vector.
rVecBuffer | store the hex string into this variable |
|
protected |
Read a name from the input device and store it into a variant.
Throws UnexpectedEOF if there is nothing to read.
rVariant | store the name into this variable |
|
protected |
Read a string from the input device and store it into a variant.
rVariant | store the string into this variable |
pEncrypt | an encryption object which is used to decrypt strings during parsing |
|
static |
Constant which is returned for invalid hex values.