From 5e2dee7ac9a6ecb8f1d9e5d829d82109168b5b42 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 10 Apr 2015 16:02:55 +0200 Subject: Implement hasNonWhitespaceChar, lastCharIsWhitespace and firstCharIsWhitespace methods for TokenizedData class --- src/core/parser/utils/TokenizedData.hpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/core/parser/utils/TokenizedData.hpp') diff --git a/src/core/parser/utils/TokenizedData.hpp b/src/core/parser/utils/TokenizedData.hpp index bc937f2..95af95e 100644 --- a/src/core/parser/utils/TokenizedData.hpp +++ b/src/core/parser/utils/TokenizedData.hpp @@ -143,6 +143,14 @@ public: size_t append(char c, SourceOffset offsStart, SourceOffset offsEnd, bool protect = false); + /** + * Marks the whitespace character at the given buffer position as protected. + * + * @param bufPos is the position of the character for which the "protected" + * flag should be set. + */ + void protect(size_t bufPos); + /** * Stores a token ending at the last character of the current buffer. * @@ -208,6 +216,31 @@ public: * the internal buffer. */ TokenizedDataReader reader() const; + + /** + * Returns true if at least one non-whitespace character is stored in the + * TokenizedData structure. + * + * @return true if the at least one character in the TokenizedData structure + * is a non-whitespace character. + */ + bool hasNonWhitespaceChar() const; + + /** + * Returns true if the last character of the TokenizedData structure is a + * whitespace character. + * + * @return true if the last character is a whitespace character. + */ + bool lastCharIsWhitespace() const; + + /** + * Returns true if the first character of the TokenizedData structure is a + * whitespace character. + * + * @return true if the first character is a whitespace character. + */ + bool firstCharIsWhitespace() const; }; /** -- cgit v1.2.3