| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> | 2 * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> |
| 3 * Copyright (C) 2007, 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2011, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 ~LazyLineBreakIterator() | 74 ~LazyLineBreakIterator() |
| 75 { | 75 { |
| 76 if (m_iterator) | 76 if (m_iterator) |
| 77 releaseLineBreakIterator(m_iterator); | 77 releaseLineBreakIterator(m_iterator); |
| 78 } | 78 } |
| 79 | 79 |
| 80 String string() const { return m_string; } | 80 String string() const { return m_string; } |
| 81 | 81 |
| 82 UChar lastCharacter() const | 82 UChar lastCharacter() const |
| 83 { | 83 { |
| 84 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_
unexpected_prior_context_length); | 84 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "TextBreakIterator
has unexpected prior context length"); |
| 85 return m_priorContext[1]; | 85 return m_priorContext[1]; |
| 86 } | 86 } |
| 87 | 87 |
| 88 UChar secondToLastCharacter() const | 88 UChar secondToLastCharacter() const |
| 89 { | 89 { |
| 90 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_
unexpected_prior_context_length); | 90 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "TextBreakIterator
has unexpected prior context length"); |
| 91 return m_priorContext[0]; | 91 return m_priorContext[0]; |
| 92 } | 92 } |
| 93 | 93 |
| 94 void setPriorContext(UChar last, UChar secondToLast) | 94 void setPriorContext(UChar last, UChar secondToLast) |
| 95 { | 95 { |
| 96 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_
unexpected_prior_context_length); | 96 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "TextBreakIterator
has unexpected prior context length"); |
| 97 m_priorContext[0] = secondToLast; | 97 m_priorContext[0] = secondToLast; |
| 98 m_priorContext[1] = last; | 98 m_priorContext[1] = last; |
| 99 } | 99 } |
| 100 | 100 |
| 101 void updatePriorContext(UChar last) | 101 void updatePriorContext(UChar last) |
| 102 { | 102 { |
| 103 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_
unexpected_prior_context_length); | 103 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "TextBreakIterator
has unexpected prior context length"); |
| 104 m_priorContext[0] = m_priorContext[1]; | 104 m_priorContext[0] = m_priorContext[1]; |
| 105 m_priorContext[1] = last; | 105 m_priorContext[1] = last; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void resetPriorContext() | 108 void resetPriorContext() |
| 109 { | 109 { |
| 110 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_
unexpected_prior_context_length); | 110 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "TextBreakIterator
has unexpected prior context length"); |
| 111 m_priorContext[0] = 0; | 111 m_priorContext[0] = 0; |
| 112 m_priorContext[1] = 0; | 112 m_priorContext[1] = 0; |
| 113 } | 113 } |
| 114 | 114 |
| 115 unsigned priorContextLength() const | 115 unsigned priorContextLength() const |
| 116 { | 116 { |
| 117 unsigned priorContextLength = 0; | 117 unsigned priorContextLength = 0; |
| 118 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_
unexpected_prior_context_length); | 118 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "TextBreakIterator
has unexpected prior context length"); |
| 119 if (m_priorContext[1]) { | 119 if (m_priorContext[1]) { |
| 120 ++priorContextLength; | 120 ++priorContextLength; |
| 121 if (m_priorContext[0]) | 121 if (m_priorContext[0]) |
| 122 ++priorContextLength; | 122 ++priorContextLength; |
| 123 } | 123 } |
| 124 return priorContextLength; | 124 return priorContextLength; |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Obtain text break iterator, possibly previously cached, where this iterat
or is (or has been) | 127 // Obtain text break iterator, possibly previously cached, where this iterat
or is (or has been) |
| 128 // initialized to use the previously stored string as the primary breaking c
ontext and using | 128 // initialized to use the previously stored string as the primary breaking c
ontext and using |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 // Counts the number of grapheme clusters. A surrogate pair or a sequence | 227 // Counts the number of grapheme clusters. A surrogate pair or a sequence |
| 228 // of a non-combining character and following combining characters is | 228 // of a non-combining character and following combining characters is |
| 229 // counted as 1 grapheme cluster. | 229 // counted as 1 grapheme cluster. |
| 230 PLATFORM_EXPORT unsigned numGraphemeClusters(const String&); | 230 PLATFORM_EXPORT unsigned numGraphemeClusters(const String&); |
| 231 | 231 |
| 232 } | 232 } |
| 233 | 233 |
| 234 #endif | 234 #endif |
| OLD | NEW |