diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc index bcab379..7ca4664 100644 --- a/libqpdf/QPDFTokenizer.cc +++ b/libqpdf/QPDFTokenizer.cc @@ -799,13 +799,7 @@ Tokenizer::presentEOF() void QPDFTokenizer::expectInlineImage(std::shared_ptr input) { - m->expectInlineImage(input); -} - -void -Tokenizer::expectInlineImage(std::shared_ptr input) -{ - expectInlineImage(*input); + m->expectInlineImage(*input); } void @@ -953,6 +947,13 @@ QPDFTokenizer::readToken( } QPDFTokenizer::Token +QPDFTokenizer::readToken( + std::shared_ptr input, std::string const& context, bool allow_bad, size_t max_len) +{ + return m->readToken(*input, context, allow_bad, max_len); +} + +QPDFTokenizer::Token Tokenizer::readToken(InputSource& input, std::string const& context, bool allow_bad, size_t max_len) { nextToken(input, context, max_len); @@ -977,20 +978,6 @@ Tokenizer::readToken(InputSource& input, std::string const& context, bool allow_ return token; } -QPDFTokenizer::Token -QPDFTokenizer::readToken( - std::shared_ptr input, std::string const& context, bool allow_bad, size_t max_len) -{ - return m->readToken(*input, context, allow_bad, max_len); -} - -QPDFTokenizer::Token -Tokenizer::readToken( - std::shared_ptr input, std::string const& context, bool allow_bad, size_t max_len) -{ - return readToken(*input, context, allow_bad, max_len); -} - bool Tokenizer::nextToken(InputSource& input, std::string const& context, size_t max_len) { diff --git a/libqpdf/qpdf/QPDFTokenizer_private.hh b/libqpdf/qpdf/QPDFTokenizer_private.hh index f109cbb..b9be86a 100644 --- a/libqpdf/qpdf/QPDFTokenizer_private.hh +++ b/libqpdf/qpdf/QPDFTokenizer_private.hh @@ -38,20 +38,12 @@ namespace qpdf bool allow_bad = false, size_t max_len = 0); - QPDFTokenizer::Token readToken( - std::shared_ptr input, - std::string const& context, - bool allow_bad = false, - size_t max_len = 0); - // Calling this method puts the tokenizer in a state for reading inline images. You should // call this method after reading the character following the ID operator. In that state, it // will return all data up to BUT NOT INCLUDING the next EI token. After you call this // method, the next call to readToken (or the token created next time getToken returns true) // will either be tt_inline_image or tt_bad. This is the only way readToken returns a // tt_inline_image token. - void expectInlineImage(std::shared_ptr input); - void expectInlineImage(InputSource& input); // Read a token from an input source. Context describes the context in which the token is @@ -66,10 +58,29 @@ namespace qpdf // QPDFTokenizer method is called. They allow the results of calling nextToken to be // accessed without creating a Token, thus avoiding copying information that may not be // needed. - inline QPDFTokenizer::token_type_e getType() const; - inline std::string const& getValue() const; - inline std::string const& getRawValue() const; - inline std::string const& getErrorMessage() const; + + inline QPDFTokenizer::token_type_e + getType() const + { + return this->type; + } + inline std::string const& + getValue() const + { + return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string) + ? this->val + : this->raw_val; + } + inline std::string const& + getRawValue() const + { + return this->raw_val; + } + inline std::string const& + getErrorMessage() const + { + return this->error_message; + } private: bool isSpace(char); @@ -150,29 +161,6 @@ namespace qpdf int digit_count; }; - inline QPDFTokenizer::token_type_e - Tokenizer::getType() const - { - return this->type; - } - inline std::string const& - Tokenizer::getValue() const - { - return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string) - ? this->val - : this->raw_val; - } - inline std::string const& - Tokenizer::getRawValue() const - { - return this->raw_val; - } - inline std::string const& - Tokenizer::getErrorMessage() const - { - return this->error_message; - } - } // namespace qpdf #endif // QPDFTOKENIZER_PRIVATE_HH