diff options
author | Jay Berkenbilt <ejb@ql.org> | 2018-02-03 00:21:34 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2018-02-19 03:05:46 +0100 |
commit | 99101044429c3c91bd11bdd1b26e5b6c2ceb140b (patch) | |
tree | 5ab366eab31ddf76e80f99bd1d34c421291f1c4e /libqpdf/qpdf/Pl_QPDFTokenizer.hh | |
parent | b8723e97f4b94fe03e631aab0309382ead3137ed (diff) | |
download | qpdf-99101044429c3c91bd11bdd1b26e5b6c2ceb140b.tar.zst |
Implement TokenFilter and refactor Pl_QPDFTokenizer
Implement a TokenFilter class and refactor Pl_QPDFTokenizer to use a
TokenFilter class called ContentNormalizer. Pl_QPDFTokenizer is now a
general filter that passes data through a TokenFilter.
Diffstat (limited to 'libqpdf/qpdf/Pl_QPDFTokenizer.hh')
-rw-r--r-- | libqpdf/qpdf/Pl_QPDFTokenizer.hh | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/libqpdf/qpdf/Pl_QPDFTokenizer.hh b/libqpdf/qpdf/Pl_QPDFTokenizer.hh index 54507f68..9f4ac133 100644 --- a/libqpdf/qpdf/Pl_QPDFTokenizer.hh +++ b/libqpdf/qpdf/Pl_QPDFTokenizer.hh @@ -4,6 +4,8 @@ #include <qpdf/Pipeline.hh> #include <qpdf/QPDFTokenizer.hh> +#include <qpdf/PointerHolder.hh> +#include <qpdf/QPDFObjectHandle.hh> // // Treat incoming text as a stream consisting of valid PDF tokens, but @@ -16,7 +18,8 @@ class Pl_QPDFTokenizer: public Pipeline { public: - Pl_QPDFTokenizer(char const* identifier, Pipeline* next); + Pl_QPDFTokenizer(char const* identifier, + QPDFObjectHandle::TokenFilter* filter); virtual ~Pl_QPDFTokenizer(); virtual void write(unsigned char* buf, size_t len); virtual void finish(); @@ -24,14 +27,25 @@ class Pl_QPDFTokenizer: public Pipeline private: void processChar(char ch); void checkUnread(); - void writeNext(char const*, size_t len); - void writeToken(QPDFTokenizer::Token&); - - QPDFTokenizer tokenizer; - bool just_wrote_nl; - bool last_char_was_cr; - bool unread_char; - char char_to_unread; + + class Members + { + friend class Pl_QPDFTokenizer; + + public: + ~Members(); + + private: + Members(); + Members(Members const&); + + QPDFObjectHandle::TokenFilter* filter; + QPDFTokenizer tokenizer; + bool last_char_was_cr; + bool unread_char; + char char_to_unread; + }; + PointerHolder<Members> m; }; #endif // __PL_QPDFTOKENIZER_HH__ |