OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
3 * Copyright (C) 2005 Alexey Proskuryakov. | 3 * Copyright (C) 2005 Alexey Proskuryakov. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 #ifndef NDEBUG | 1634 #ifndef NDEBUG |
1635 static bool searcherInUse; | 1635 static bool searcherInUse; |
1636 #endif | 1636 #endif |
1637 | 1637 |
1638 static UStringSearch* createSearcher() | 1638 static UStringSearch* createSearcher() |
1639 { | 1639 { |
1640 // Provide a non-empty pattern and non-empty text so usearch_open will not f
ail, | 1640 // Provide a non-empty pattern and non-empty text so usearch_open will not f
ail, |
1641 // but it doesn't matter exactly what it is, since we don't perform any sear
ches | 1641 // but it doesn't matter exactly what it is, since we don't perform any sear
ches |
1642 // without setting both the pattern and the text. | 1642 // without setting both the pattern and the text. |
1643 UErrorCode status = U_ZERO_ERROR; | 1643 UErrorCode status = U_ZERO_ERROR; |
1644 String searchCollatorName = currentSearchLocaleID() + String(ASCIILiteral("@
collation=search")); | 1644 String searchCollatorName = currentSearchLocaleID() + String("@collation=sea
rch"); |
1645 UStringSearch* searcher = usearch_open(&newlineCharacter, 1, &newlineCharact
er, 1, searchCollatorName.utf8().data(), 0, &status); | 1645 UStringSearch* searcher = usearch_open(&newlineCharacter, 1, &newlineCharact
er, 1, searchCollatorName.utf8().data(), 0, &status); |
1646 ASSERT(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING || statu
s == U_USING_DEFAULT_WARNING); | 1646 ASSERT(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING || statu
s == U_USING_DEFAULT_WARNING); |
1647 return searcher; | 1647 return searcher; |
1648 } | 1648 } |
1649 | 1649 |
1650 static UStringSearch* searcher() | 1650 static UStringSearch* searcher() |
1651 { | 1651 { |
1652 static UStringSearch* searcher = createSearcher(); | 1652 static UStringSearch* searcher = createSearcher(); |
1653 return searcher; | 1653 return searcher; |
1654 } | 1654 } |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2444 if (!matchLength) | 2444 if (!matchLength) |
2445 return collapsedToBoundary(range, !(options & Backwards)); | 2445 return collapsedToBoundary(range, !(options & Backwards)); |
2446 } | 2446 } |
2447 | 2447 |
2448 // Then, find the document position of the start and the end of the text. | 2448 // Then, find the document position of the start and the end of the text. |
2449 CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls
); | 2449 CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls
); |
2450 return characterSubrange(computeRangeIterator, matchStart, matchLength); | 2450 return characterSubrange(computeRangeIterator, matchStart, matchLength); |
2451 } | 2451 } |
2452 | 2452 |
2453 } | 2453 } |
OLD | NEW |