mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-1997 add functions for "ICU rule white space" - Cf+White_Space
X-SVN-Rev: 9259
This commit is contained in:
parent
df1c104e58
commit
3a4cd45887
4 changed files with 35 additions and 0 deletions
|
@ -258,6 +258,14 @@ u_isUWhiteSpace(UChar32 c) {
|
|||
return u_hasBinaryProperty(c, UCHAR_WHITE_SPACE);
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uprv_isRuleWhiteSpace(UChar32 c) {
|
||||
/* "white space" in the sense of ICU rule parsers: Cf+White_Space */
|
||||
return
|
||||
u_charType(c)==U_FORMAT_CHAR ||
|
||||
u_hasBinaryProperty(c, UCHAR_WHITE_SPACE);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
u_getIntPropertyValue(UChar32 c, UProperty which) {
|
||||
UErrorCode errorCode;
|
||||
|
|
|
@ -230,4 +230,11 @@ uprv_comparePropertyNames(const char *name1, const char *name2);
|
|||
#define _Pi FLAG(U_INITIAL_PUNCTUATION)
|
||||
#define _Pf FLAG(U_FINAL_PUNCTUATION)
|
||||
|
||||
/**
|
||||
* Is this character a "white space" in the sense of ICU rule parsers?
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uprv_isRuleWhiteSpace(UChar32 c);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -427,6 +427,20 @@ UnicodeSet* UnicodePropertySet::createBinaryPropertySet(const UnicodeString& nam
|
|||
return set;
|
||||
}
|
||||
|
||||
UnicodeSet
|
||||
UnicodePropertySet::getRuleWhiteSpaceSet() {
|
||||
UnicodeSet set;
|
||||
int32_t code;
|
||||
|
||||
/* "white space" in the sense of ICU rule parsers: Cf+White_Space */
|
||||
code = UCHAR_WHITE_SPACE;
|
||||
initSetFromFilter(set, _binaryPropertyFilter, &code);
|
||||
|
||||
set.addAll(getCategorySet(U_FORMAT_CHAR));
|
||||
|
||||
return set; /* return by value */
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// Utility methods
|
||||
//----------------------------------------------------------------
|
||||
|
|
|
@ -97,6 +97,12 @@ class UnicodePropertySet /* not : public UObject because all methods are static
|
|||
|
||||
typedef UnicodeSet* (*SetFactory)(const UnicodeString& valueName);
|
||||
|
||||
/**
|
||||
* "white space" in the sense of ICU rule parsers
|
||||
* @internal
|
||||
*/
|
||||
static UnicodeSet getRuleWhiteSpaceSet();
|
||||
|
||||
private:
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue