Commit e60f53cc7228407d3488b06ab1958138167bc5d2
1 parent
00b59979
Remove Tokenizer method overloads using std::shared_ptr<InputSource>
Showing
2 changed files
with
31 additions
and
56 deletions
libqpdf/QPDFTokenizer.cc
| @@ -799,13 +799,7 @@ Tokenizer::presentEOF() | @@ -799,13 +799,7 @@ Tokenizer::presentEOF() | ||
| 799 | void | 799 | void |
| 800 | QPDFTokenizer::expectInlineImage(std::shared_ptr<InputSource> input) | 800 | QPDFTokenizer::expectInlineImage(std::shared_ptr<InputSource> input) |
| 801 | { | 801 | { |
| 802 | - m->expectInlineImage(input); | ||
| 803 | -} | ||
| 804 | - | ||
| 805 | -void | ||
| 806 | -Tokenizer::expectInlineImage(std::shared_ptr<InputSource> input) | ||
| 807 | -{ | ||
| 808 | - expectInlineImage(*input); | 802 | + m->expectInlineImage(*input); |
| 809 | } | 803 | } |
| 810 | 804 | ||
| 811 | void | 805 | void |
| @@ -953,6 +947,13 @@ QPDFTokenizer::readToken( | @@ -953,6 +947,13 @@ QPDFTokenizer::readToken( | ||
| 953 | } | 947 | } |
| 954 | 948 | ||
| 955 | QPDFTokenizer::Token | 949 | QPDFTokenizer::Token |
| 950 | +QPDFTokenizer::readToken( | ||
| 951 | + std::shared_ptr<InputSource> input, std::string const& context, bool allow_bad, size_t max_len) | ||
| 952 | +{ | ||
| 953 | + return m->readToken(*input, context, allow_bad, max_len); | ||
| 954 | +} | ||
| 955 | + | ||
| 956 | +QPDFTokenizer::Token | ||
| 956 | Tokenizer::readToken(InputSource& input, std::string const& context, bool allow_bad, size_t max_len) | 957 | Tokenizer::readToken(InputSource& input, std::string const& context, bool allow_bad, size_t max_len) |
| 957 | { | 958 | { |
| 958 | nextToken(input, context, max_len); | 959 | nextToken(input, context, max_len); |
| @@ -977,20 +978,6 @@ Tokenizer::readToken(InputSource& input, std::string const& context, bool allow_ | @@ -977,20 +978,6 @@ Tokenizer::readToken(InputSource& input, std::string const& context, bool allow_ | ||
| 977 | return token; | 978 | return token; |
| 978 | } | 979 | } |
| 979 | 980 | ||
| 980 | -QPDFTokenizer::Token | ||
| 981 | -QPDFTokenizer::readToken( | ||
| 982 | - std::shared_ptr<InputSource> input, std::string const& context, bool allow_bad, size_t max_len) | ||
| 983 | -{ | ||
| 984 | - return m->readToken(*input, context, allow_bad, max_len); | ||
| 985 | -} | ||
| 986 | - | ||
| 987 | -QPDFTokenizer::Token | ||
| 988 | -Tokenizer::readToken( | ||
| 989 | - std::shared_ptr<InputSource> input, std::string const& context, bool allow_bad, size_t max_len) | ||
| 990 | -{ | ||
| 991 | - return readToken(*input, context, allow_bad, max_len); | ||
| 992 | -} | ||
| 993 | - | ||
| 994 | bool | 981 | bool |
| 995 | Tokenizer::nextToken(InputSource& input, std::string const& context, size_t max_len) | 982 | Tokenizer::nextToken(InputSource& input, std::string const& context, size_t max_len) |
| 996 | { | 983 | { |
libqpdf/qpdf/QPDFTokenizer_private.hh
| @@ -38,20 +38,12 @@ namespace qpdf | @@ -38,20 +38,12 @@ namespace qpdf | ||
| 38 | bool allow_bad = false, | 38 | bool allow_bad = false, |
| 39 | size_t max_len = 0); | 39 | size_t max_len = 0); |
| 40 | 40 | ||
| 41 | - QPDFTokenizer::Token readToken( | ||
| 42 | - std::shared_ptr<InputSource> input, | ||
| 43 | - std::string const& context, | ||
| 44 | - bool allow_bad = false, | ||
| 45 | - size_t max_len = 0); | ||
| 46 | - | ||
| 47 | // Calling this method puts the tokenizer in a state for reading inline images. You should | 41 | // Calling this method puts the tokenizer in a state for reading inline images. You should |
| 48 | // call this method after reading the character following the ID operator. In that state, it | 42 | // call this method after reading the character following the ID operator. In that state, it |
| 49 | // will return all data up to BUT NOT INCLUDING the next EI token. After you call this | 43 | // will return all data up to BUT NOT INCLUDING the next EI token. After you call this |
| 50 | // method, the next call to readToken (or the token created next time getToken returns true) | 44 | // method, the next call to readToken (or the token created next time getToken returns true) |
| 51 | // will either be tt_inline_image or tt_bad. This is the only way readToken returns a | 45 | // will either be tt_inline_image or tt_bad. This is the only way readToken returns a |
| 52 | // tt_inline_image token. | 46 | // tt_inline_image token. |
| 53 | - void expectInlineImage(std::shared_ptr<InputSource> input); | ||
| 54 | - | ||
| 55 | void expectInlineImage(InputSource& input); | 47 | void expectInlineImage(InputSource& input); |
| 56 | 48 | ||
| 57 | // Read a token from an input source. Context describes the context in which the token is | 49 | // Read a token from an input source. Context describes the context in which the token is |
| @@ -66,10 +58,29 @@ namespace qpdf | @@ -66,10 +58,29 @@ namespace qpdf | ||
| 66 | // QPDFTokenizer method is called. They allow the results of calling nextToken to be | 58 | // QPDFTokenizer method is called. They allow the results of calling nextToken to be |
| 67 | // accessed without creating a Token, thus avoiding copying information that may not be | 59 | // accessed without creating a Token, thus avoiding copying information that may not be |
| 68 | // needed. | 60 | // needed. |
| 69 | - inline QPDFTokenizer::token_type_e getType() const; | ||
| 70 | - inline std::string const& getValue() const; | ||
| 71 | - inline std::string const& getRawValue() const; | ||
| 72 | - inline std::string const& getErrorMessage() const; | 61 | + |
| 62 | + inline QPDFTokenizer::token_type_e | ||
| 63 | + getType() const | ||
| 64 | + { | ||
| 65 | + return this->type; | ||
| 66 | + } | ||
| 67 | + inline std::string const& | ||
| 68 | + getValue() const | ||
| 69 | + { | ||
| 70 | + return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string) | ||
| 71 | + ? this->val | ||
| 72 | + : this->raw_val; | ||
| 73 | + } | ||
| 74 | + inline std::string const& | ||
| 75 | + getRawValue() const | ||
| 76 | + { | ||
| 77 | + return this->raw_val; | ||
| 78 | + } | ||
| 79 | + inline std::string const& | ||
| 80 | + getErrorMessage() const | ||
| 81 | + { | ||
| 82 | + return this->error_message; | ||
| 83 | + } | ||
| 73 | 84 | ||
| 74 | private: | 85 | private: |
| 75 | bool isSpace(char); | 86 | bool isSpace(char); |
| @@ -150,29 +161,6 @@ namespace qpdf | @@ -150,29 +161,6 @@ namespace qpdf | ||
| 150 | int digit_count; | 161 | int digit_count; |
| 151 | }; | 162 | }; |
| 152 | 163 | ||
| 153 | - inline QPDFTokenizer::token_type_e | ||
| 154 | - Tokenizer::getType() const | ||
| 155 | - { | ||
| 156 | - return this->type; | ||
| 157 | - } | ||
| 158 | - inline std::string const& | ||
| 159 | - Tokenizer::getValue() const | ||
| 160 | - { | ||
| 161 | - return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string) | ||
| 162 | - ? this->val | ||
| 163 | - : this->raw_val; | ||
| 164 | - } | ||
| 165 | - inline std::string const& | ||
| 166 | - Tokenizer::getRawValue() const | ||
| 167 | - { | ||
| 168 | - return this->raw_val; | ||
| 169 | - } | ||
| 170 | - inline std::string const& | ||
| 171 | - Tokenizer::getErrorMessage() const | ||
| 172 | - { | ||
| 173 | - return this->error_message; | ||
| 174 | - } | ||
| 175 | - | ||
| 176 | } // namespace qpdf | 164 | } // namespace qpdf |
| 177 | 165 | ||
| 178 | #endif // QPDFTOKENIZER_PRIVATE_HH | 166 | #endif // QPDFTOKENIZER_PRIVATE_HH |