| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class PLATFORM_EXPORT UTF16TextIterator { | 30 class PLATFORM_EXPORT UTF16TextIterator { |
| 31 public: | 31 public: |
| 32 // The passed in UChar pointer starts at 'offset'. The iterator operates on
the range [offset, endOffset]. | 32 // The passed in UChar pointer starts at 'offset'. The iterator operates on
the range [offset, endOffset]. |
| 33 // 'length' denotes the maximum length of the UChar array, which might excee
d 'endOffset'. | 33 // 'length' denotes the maximum length of the UChar array, which might excee
d 'endOffset'. |
| 34 UTF16TextIterator(const UChar*, int length); | 34 UTF16TextIterator(const UChar*, int length); |
| 35 | 35 |
| 36 // FIXME: The offset/endOffset fields are only used by the SimpleShaper, | 36 // FIXME: The offset/endOffset fields are only used by the SimpleShaper, |
| 37 // remove once HarfBuzz is used for all text. | 37 // remove once HarfBuzz is used for all text. |
| 38 UTF16TextIterator(const UChar*, int offset, int endOffset, int length); | 38 UTF16TextIterator(const UChar*, int offset, int endOffset, int length); |
| 39 | 39 |
| 40 bool atEnd() const { return m_offset >= m_endOffset; } |
| 41 |
| 40 inline bool consume(UChar32& character) | 42 inline bool consume(UChar32& character) |
| 41 { | 43 { |
| 42 if (m_offset >= m_endOffset) | 44 if (m_offset >= m_endOffset) |
| 43 return false; | 45 return false; |
| 44 | 46 |
| 45 character = *m_characters; | 47 character = *m_characters; |
| 46 m_currentGlyphLength = 1; | 48 m_currentGlyphLength = 1; |
| 47 | 49 |
| 48 if (!U16_IS_SURROGATE(character) || consumeSurrogatePair(character)) { | 50 if (!U16_IS_SURROGATE(character) || consumeSurrogatePair(character)) { |
| 49 if (U_GET_GC_MASK(character) & U_GC_M_MASK) | 51 if (U_GET_GC_MASK(character) & U_GC_M_MASK) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 74 const UChar* m_characters; | 76 const UChar* m_characters; |
| 75 const UChar* m_charactersEnd; | 77 const UChar* m_charactersEnd; |
| 76 int m_offset; | 78 int m_offset; |
| 77 int m_endOffset; | 79 int m_endOffset; |
| 78 unsigned m_currentGlyphLength; | 80 unsigned m_currentGlyphLength; |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 } | 83 } |
| 82 | 84 |
| 83 #endif | 85 #endif |
| OLD | NEW |