| 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 class MediaQueryInputStream { | |
| 13 WTF_MAKE_NONCOPYABLE(MediaQueryInputStream); | |
| 14 WTF_MAKE_FAST_ALLOCATED; | |
| 15 public: | |
| 16 MediaQueryInputStream(String input); | |
| 17 | |
| 18 UChar peek(unsigned); | |
| 19 inline UChar currentInputChar() | |
| 20 { | |
| 21 return peek(0); | |
| 22 } | |
| 23 | |
| 24 void advance(unsigned = 1); | |
| 25 void pushBack(UChar); | |
| 26 | |
| 27 inline size_t maxLength() | |
| 28 { | |
| 29 return m_string.length() + 1; | |
| 30 } | |
| 31 | |
| 32 inline size_t leftChars() | |
| 33 { | |
| 34 return m_string.length() - m_offset; | |
| 35 | |
| 36 } | |
| 37 | |
| 38 unsigned long long getUInt(unsigned start, unsigned end); | |
| 39 double getDouble(unsigned start, unsigned end); | |
| 40 | |
| 41 template<bool characterPredicate(UChar)> | |
| 42 unsigned skipWhilePredicate(unsigned offset) | |
| 43 { | |
| 44 while ((m_offset + offset) < m_string.length() && characterPredicate(m_s
tring[m_offset + offset])) | |
| 45 ++offset; | |
| 46 return offset; | |
| 47 } | |
| 48 | |
| 49 private: | |
| 50 size_t m_offset; | |
| 51 String m_string; | |
| 52 }; | |
| 53 | |
| 54 } // namespace WebCore | |
| 55 | |
| 56 #endif // MediaQueryInputStream_h | |
| 57 | |
| OLD | NEW |