PoDoFo 0.9.20
|
#include <PdfTokenizer.h>
Public Member Functions | |
bool | TryReadNextToken (InputStreamDevice &device, std::string_view &token) |
bool | TryPeekNextToken (InputStreamDevice &device, std::string_view &token) |
int64_t | ReadNextNumber (InputStreamDevice &device) |
void | ReadNextVariant (InputStreamDevice &device, PdfVariant &variant, const PdfStatefulEncrypt &encrypt={ }) |
Static Public Member Functions | |
static bool | IsWhitespace (char ch) |
static bool | IsDelimiter (char ch) |
static bool | IsTokenDelimiter (char ch, PdfTokenType &tokenType) |
static bool | IsRegular (char ch) |
static bool | IsPrintable (char ch) |
Protected Member Functions | |
void | ReadNextVariant (InputStreamDevice &device, const std::string_view &token, PdfTokenType tokenType, PdfVariant &variant, const PdfStatefulEncrypt &encrypt) |
void | EnqueueToken (const std::string_view &token, PdfTokenType type) |
void | ReadDictionary (InputStreamDevice &device, PdfVariant &variant, const PdfStatefulEncrypt &encrypt) |
void | ReadArray (InputStreamDevice &device, PdfVariant &variant, const PdfStatefulEncrypt &encrypt) |
void | ReadString (InputStreamDevice &device, PdfVariant &variant, const PdfStatefulEncrypt &encrypt) |
void | ReadHexString (InputStreamDevice &device, PdfVariant &variant, const PdfStatefulEncrypt &encrypt) |
void | ReadName (InputStreamDevice &device, PdfVariant &variant) |
PdfLiteralDataType | DetermineDataType (InputStreamDevice &device, const std::string_view &token, PdfTokenType tokenType, PdfVariant &variant) |
A simple tokenizer for PDF files and PDF content streams
|
protected |
Determine the possible datatype of a token. Numbers, reals, bools or nullptr values are parsed directly by this function and saved to a variant.
|
protected |
Add a token to the queue of tokens. tryReadNextToken() will return all enqueued tokens first before reading new tokens from the input device.
token | string of the token |
type | type of the token |
|
static |
Returns true if the given character is a delimiter according to the pdf reference
|
static |
True if the passed character is within the generally accepted "printable" ASCII range.
|
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 delimiter character.
|
static |
Returns true if the given character is a token delimiter
|
static |
Returns true if the given character is a whitespace according to the pdf reference
|
protected |
Read an array from the input device and store it into a variant.
variant | store the array into this variable |
encrypt | 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.
variant | store the dictionary into this variable |
encrypt | 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.
variant | store the hex string into this variable |
encrypt | an encryption object which is used to decrypt strings during parsing |
|
protected |
Read a name from the input device and store it into a variant.
Throws UnexpectedEOF if there is nothing to read.
variant | store the name into this variable |
int64_t PdfTokenizer::ReadNextNumber | ( | InputStreamDevice & | device | ) |
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.
|
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.
token | a token that has already been read |
type | type of the passed token |
variant | write the read variant to this value |
encrypt | an encryption object which is used to decrypt strings during parsing |
void PdfTokenizer::ReadNextVariant | ( | InputStreamDevice & | device, |
PdfVariant & | variant, | ||
const PdfStatefulEncrypt & | encrypt = { } ) |
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.
variant | write the read variant to this value |
encrypt | an encryption object which is used to decrypt strings during parsing |
|
protected |
Read a string from the input device and store it into a variant.
variant | store the string into this variable |
encrypt | an encryption object which is used to decrypt strings during parsing |
bool PoDoFo::PdfTokenizer::TryPeekNextToken | ( | InputStreamDevice & | device, |
std::string_view & | token ) |
Try peek the next token from the current file position ignoring all comments, without actually consuming it
bool PoDoFo::PdfTokenizer::TryReadNextToken | ( | InputStreamDevice & | device, |
std::string_view & | token ) |
Reads the next token from the current file position ignoring all comments.
[out] | token | On true return, set to a pointer to the read token (a nullptr-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 tryReadNextToken(..) and by the destruction of the PdfTokenizer. Undefined on false return. |
[out] | tokenType | On true return, if not nullptr the type of the read token will be stored into this parameter. Undefined on false return. |