OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MediaQueryInputStream_h | |
6 #define MediaQueryInputStream_h | |
7 | |
8 #include "wtf/text/WTFString.h" | |
9 | |
10 namespace WebCore { | |
11 | |
12 // The CSS Syntax spec is written as a (fixed size) look-ahead | |
eseidel
2014/03/08 22:08:07
Please remove this.
| |
13 // tokenizer instead of a state-machine like HTML | |
14 // so we have our own input stream class. :( | |
15 class MediaQueryInputStream { | |
16 WTF_MAKE_NONCOPYABLE(MediaQueryInputStream); | |
17 WTF_MAKE_FAST_ALLOCATED; | |
18 public: | |
19 MediaQueryInputStream(String input); | |
20 | |
21 UChar currentInputChar(); | |
22 UChar peek(unsigned); | |
23 | |
24 void advance(unsigned = 1); | |
25 void pushBack(UChar); | |
26 | |
27 unsigned long long getUInt(unsigned, unsigned); | |
28 double getDouble(unsigned, unsigned); | |
29 | |
30 template<bool characterPredicate(UChar)> | |
31 unsigned skipWhilePredicate(unsigned offset) | |
32 { | |
33 while ((m_offset + offset) < m_string.length() && characterPredicate(m_s tring[m_offset + offset])) | |
34 ++offset; | |
35 return offset; | |
36 } | |
37 | |
38 private: | |
39 size_t m_offset; | |
40 String m_string; | |
41 }; | |
42 | |
43 } // namespace WebCore | |
44 | |
45 #endif // MediaQueryInputStream_h | |
46 | |
OLD | NEW |