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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 static TextBreakIterator* setUpIteratorWithRules(bool& createdIterator, TextBrea
kIterator*& iterator, | 713 static TextBreakIterator* setUpIteratorWithRules(bool& createdIterator, TextBrea
kIterator*& iterator, |
714 const char* breakRules, const UChar* string, int length) | 714 const char* breakRules, const UChar* string, int length) |
715 { | 715 { |
716 if (!string) | 716 if (!string) |
717 return 0; | 717 return 0; |
718 | 718 |
719 if (!createdIterator) { | 719 if (!createdIterator) { |
720 UParseError parseStatus; | 720 UParseError parseStatus; |
721 UErrorCode openStatus = U_ZERO_ERROR; | 721 UErrorCode openStatus = U_ZERO_ERROR; |
722 Vector<UChar> rules; | 722 Vector<UChar> rules; |
723 String(ASCIILiteral(breakRules)).appendTo(rules); | 723 String(breakRules).appendTo(rules); |
724 iterator = reinterpret_cast<TextBreakIterator*>(ubrk_openRules(rules.dat
a(), rules.size(), 0, 0, &parseStatus, &openStatus)); | 724 iterator = reinterpret_cast<TextBreakIterator*>(ubrk_openRules(rules.dat
a(), rules.size(), 0, 0, &parseStatus, &openStatus)); |
725 createdIterator = true; | 725 createdIterator = true; |
726 ASSERT_WITH_MESSAGE(U_SUCCESS(openStatus), "ICU could not open a break i
terator: %s (%d)", u_errorName(openStatus), openStatus); | 726 ASSERT_WITH_MESSAGE(U_SUCCESS(openStatus), "ICU could not open a break i
terator: %s (%d)", u_errorName(openStatus), openStatus); |
727 } | 727 } |
728 if (!iterator) | 728 if (!iterator) |
729 return 0; | 729 return 0; |
730 | 730 |
731 UErrorCode setTextStatus = U_ZERO_ERROR; | 731 UErrorCode setTextStatus = U_ZERO_ERROR; |
732 ubrk_setText(reinterpret_cast<UBreakIterator*>(iterator), string, length, &s
etTextStatus); | 732 ubrk_setText(reinterpret_cast<UBreakIterator*>(iterator), string, length, &s
etTextStatus); |
733 if (U_FAILURE(setTextStatus)) | 733 if (U_FAILURE(setTextStatus)) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 "$Kan1 $KanV $Kan0;" // Kannada Virama (backward) | 819 "$Kan1 $KanV $Kan0;" // Kannada Virama (backward) |
820 "$Mal1 $MalV $Mal0;" // Malayalam Virama (backward) | 820 "$Mal1 $MalV $Mal0;" // Malayalam Virama (backward) |
821 "!!safe_reverse;" | 821 "!!safe_reverse;" |
822 "!!safe_forward;"; | 822 "!!safe_forward;"; |
823 static bool createdCursorMovementIterator = false; | 823 static bool createdCursorMovementIterator = false; |
824 static TextBreakIterator* staticCursorMovementIterator; | 824 static TextBreakIterator* staticCursorMovementIterator; |
825 return setUpIteratorWithRules(createdCursorMovementIterator, staticCursorMov
ementIterator, kRules, string, length); | 825 return setUpIteratorWithRules(createdCursorMovementIterator, staticCursorMov
ementIterator, kRules, string, length); |
826 } | 826 } |
827 | 827 |
828 } | 828 } |
OLD | NEW |