aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2018-01-30 02:00:06 +0100
committerJay Berkenbilt <ejb@ql.org>2018-02-19 03:05:46 +0100
commit2699ecf13e8559b136ded1986bf18e1a0a51011f (patch)
tree60d158b2f9cdf551548c6887e24e6af3423fb315 /include
parentd97474868d7fa6a94bab49d89af5dd82fd5e3a41 (diff)
downloadqpdf-2699ecf13e8559b136ded1986bf18e1a0a51011f.tar.zst
Push QPDFTokenizer members into a nested structure
This is for protection against future ABI breaking changes.
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDFTokenizer.hh66
1 files changed, 44 insertions, 22 deletions
diff --git a/include/qpdf/QPDFTokenizer.hh b/include/qpdf/QPDFTokenizer.hh
index cd727613..7d7f6132 100644
--- a/include/qpdf/QPDFTokenizer.hh
+++ b/include/qpdf/QPDFTokenizer.hh
@@ -165,31 +165,53 @@ class QPDFTokenizer
size_t max_len = 0);
private:
- void reset();
+ // Do not implement copy or assignment
+ QPDFTokenizer(QPDFTokenizer const&);
+ QPDFTokenizer& operator=(QPDFTokenizer const&);
+
void resolveLiteral();
bool isSpace(char);
- // Lexer state
- enum { st_top, st_in_space, st_in_comment, st_in_string, st_lt, st_gt,
- st_literal, st_in_hexstring, st_token_ready } state;
-
- bool pound_special_in_name;
- bool allow_eof;
- bool include_ignorable;
-
- // Current token accumulation
- token_type_e type;
- std::string val;
- std::string raw_val;
- std::string error_message;
- bool unread_char;
- char char_to_unread;
-
- // State for strings
- int string_depth;
- bool string_ignoring_newline;
- char bs_num_register[4];
- bool last_char_was_bs;
+ enum state_e {
+ st_top, st_in_space, st_in_comment, st_in_string, st_lt, st_gt,
+ st_literal, st_in_hexstring, st_token_ready
+ };
+
+ class Members
+ {
+ friend class QPDFTokenizer;
+
+ public:
+ QPDF_DLL
+ ~Members();
+
+ private:
+ Members();
+ Members(Members const&);
+ void reset();
+
+ // Lexer state
+ state_e state;
+
+ bool pound_special_in_name;
+ bool allow_eof;
+ bool include_ignorable;
+
+ // Current token accumulation
+ token_type_e type;
+ std::string val;
+ std::string raw_val;
+ std::string error_message;
+ bool unread_char;
+ char char_to_unread;
+
+ // State for strings
+ int string_depth;
+ bool string_ignoring_newline;
+ char bs_num_register[4];
+ bool last_char_was_bs;
+ };
+ PointerHolder<Members> m;
};
#endif // __QPDFTOKENIZER_HH__