ICU-1997 add functions for "ICU rule white space" - Cf+White_Space

X-SVN-Rev: 9259
This commit is contained in:
Markus Scherer 2002-07-19 21:16:42 +00:00
parent df1c104e58
commit 3a4cd45887
4 changed files with 35 additions and 0 deletions

View file

@ -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;

View file

@ -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

View file

@ -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
//----------------------------------------------------------------

View file

@ -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:
//----------------------------------------------------------------