Commit 1a05b099fc7508aebc41c28dca662f7afa3da201
1 parent
5f347f35
Refactor ContentNormalizer to use inline method definitions
Moved `anyBadTokens` and `lastTokenWasBad` methods to inline definitions within the header file for improved readability and maintainability. Also marked the class and relevant methods as `final` to prevent further inheritance and overrides.
Showing
2 changed files
with
13 additions
and
17 deletions
libqpdf/ContentNormalizer.cc
| @@ -71,15 +71,3 @@ ContentNormalizer::handleToken(QPDFTokenizer::Token const& token) | @@ -71,15 +71,3 @@ ContentNormalizer::handleToken(QPDFTokenizer::Token const& token) | ||
| 71 | write("\n"); | 71 | write("\n"); |
| 72 | } | 72 | } |
| 73 | } | 73 | } |
| 74 | - | ||
| 75 | -bool | ||
| 76 | -ContentNormalizer::anyBadTokens() const | ||
| 77 | -{ | ||
| 78 | - return this->any_bad_tokens; | ||
| 79 | -} | ||
| 80 | - | ||
| 81 | -bool | ||
| 82 | -ContentNormalizer::lastTokenWasBad() const | ||
| 83 | -{ | ||
| 84 | - return this->last_token_was_bad; | ||
| 85 | -} |
libqpdf/qpdf/ContentNormalizer.hh
| @@ -3,15 +3,23 @@ | @@ -3,15 +3,23 @@ | ||
| 3 | 3 | ||
| 4 | #include <qpdf/QPDFObjectHandle.hh> | 4 | #include <qpdf/QPDFObjectHandle.hh> |
| 5 | 5 | ||
| 6 | -class ContentNormalizer: public QPDFObjectHandle::TokenFilter | 6 | +class ContentNormalizer final: public QPDFObjectHandle::TokenFilter |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | ContentNormalizer(); | 9 | ContentNormalizer(); |
| 10 | - ~ContentNormalizer() override = default; | ||
| 11 | - void handleToken(QPDFTokenizer::Token const&) override; | 10 | + ~ContentNormalizer() final = default; |
| 11 | + void handleToken(QPDFTokenizer::Token const&) final; | ||
| 12 | 12 | ||
| 13 | - bool anyBadTokens() const; | ||
| 14 | - bool lastTokenWasBad() const; | 13 | + bool |
| 14 | + anyBadTokens() const | ||
| 15 | + { | ||
| 16 | + return any_bad_tokens; | ||
| 17 | + } | ||
| 18 | + bool | ||
| 19 | + lastTokenWasBad() const | ||
| 20 | + { | ||
| 21 | + return last_token_was_bad; | ||
| 22 | + } | ||
| 15 | 23 | ||
| 16 | private: | 24 | private: |
| 17 | bool any_bad_tokens; | 25 | bool any_bad_tokens; |