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 27 matching lines...) Expand all Loading... |
38 enum VoicedSoundMarkType { | 38 enum VoicedSoundMarkType { |
39 NoVoicedSoundMark, | 39 NoVoicedSoundMark, |
40 VoicedSoundMark, | 40 VoicedSoundMark, |
41 SemiVoicedSoundMark | 41 SemiVoicedSoundMark |
42 }; | 42 }; |
43 | 43 |
44 template <typename CharType> | 44 template <typename CharType> |
45 static inline CharType foldQuoteMarkOrSoftHyphen(CharType c) | 45 static inline CharType foldQuoteMarkOrSoftHyphen(CharType c) |
46 { | 46 { |
47 switch (static_cast<UChar>(c)) { | 47 switch (static_cast<UChar>(c)) { |
48 case hebrewPunctuationGershayim: | 48 case hebrewPunctuationGershayimCharacter: |
49 case leftDoubleQuotationMark: | 49 case leftDoubleQuotationMarkCharacter: |
50 case rightDoubleQuotationMark: | 50 case rightDoubleQuotationMarkCharacter: |
51 return '"'; | 51 return '"'; |
52 case hebrewPunctuationGeresh: | 52 case hebrewPunctuationGereshCharacter: |
53 case leftSingleQuotationMark: | 53 case leftSingleQuotationMarkCharacter: |
54 case rightSingleQuotationMark: | 54 case rightSingleQuotationMarkCharacter: |
55 return '\''; | 55 return '\''; |
56 case softHyphen: | 56 case softHyphenCharacter: |
57 // Replace soft hyphen with an ignorable character so that their presenc
e or absence will | 57 // Replace soft hyphen with an ignorable character so that their presenc
e or absence will |
58 // not affect string comparison. | 58 // not affect string comparison. |
59 return 0; | 59 return 0; |
60 default: | 60 default: |
61 return c; | 61 return c; |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 void foldQuoteMarksAndSoftHyphens(UChar* data, size_t length) | 65 void foldQuoteMarksAndSoftHyphens(UChar* data, size_t length) |
66 { | 66 { |
67 for (size_t i = 0; i < length; ++i) | 67 for (size_t i = 0; i < length; ++i) |
68 data[i] = foldQuoteMarkOrSoftHyphen(data[i]); | 68 data[i] = foldQuoteMarkOrSoftHyphen(data[i]); |
69 } | 69 } |
70 | 70 |
71 void foldQuoteMarksAndSoftHyphens(String& s) | 71 void foldQuoteMarksAndSoftHyphens(String& s) |
72 { | 72 { |
73 s.replace(hebrewPunctuationGeresh, '\''); | 73 s.replace(hebrewPunctuationGereshCharacter, '\''); |
74 s.replace(hebrewPunctuationGershayim, '"'); | 74 s.replace(hebrewPunctuationGershayimCharacter, '"'); |
75 s.replace(leftDoubleQuotationMark, '"'); | 75 s.replace(leftDoubleQuotationMarkCharacter, '"'); |
76 s.replace(leftSingleQuotationMark, '\''); | 76 s.replace(leftSingleQuotationMarkCharacter, '\''); |
77 s.replace(rightDoubleQuotationMark, '"'); | 77 s.replace(rightDoubleQuotationMarkCharacter, '"'); |
78 s.replace(rightSingleQuotationMark, '\''); | 78 s.replace(rightSingleQuotationMarkCharacter, '\''); |
79 // Replace soft hyphen with an ignorable character so that their presence or
absence will | 79 // Replace soft hyphen with an ignorable character so that their presence or
absence will |
80 // not affect string comparison. | 80 // not affect string comparison. |
81 s.replace(softHyphen, 0); | 81 s.replace(softHyphenCharacter, 0); |
82 } | 82 } |
83 | 83 |
84 static bool isNonLatin1Separator(UChar32 character) | 84 static bool isNonLatin1Separator(UChar32 character) |
85 { | 85 { |
86 ASSERT_ARG(character, character >= 256); | 86 ASSERT_ARG(character, character >= 256); |
87 | 87 |
88 return U_GET_GC_MASK(character) & (U_GC_S_MASK | U_GC_P_MASK | U_GC_Z_MASK |
U_GC_CF_MASK); | 88 return U_GET_GC_MASK(character) & (U_GC_S_MASK | U_GC_P_MASK | U_GC_Z_MASK |
U_GC_CF_MASK); |
89 } | 89 } |
90 | 90 |
91 bool isSeparator(UChar32 character) | 91 bool isSeparator(UChar32 character) |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 if (offset == kNotFound) | 406 if (offset == kNotFound) |
407 return false; | 407 return false; |
408 | 408 |
409 // Update values of |a| and |b| after comparing. | 409 // Update values of |a| and |b| after comparing. |
410 a += offset; | 410 a += offset; |
411 b += offset; | 411 b += offset; |
412 } | 412 } |
413 } | 413 } |
414 | 414 |
415 } | 415 } |
OLD | NEW |