Пример #1
0
//static void NativeCollation_setNormalization(JNIEnv* env, jclass, jint address, jint mode) {
JNIEXPORT void JNICALL
Java_com_ibm_icu4jni_text_NativeCollation_setNormalization(JNIEnv* env, jclass,
		jint address, jint mode) {
	UErrorCode status = U_ZERO_ERROR;
	ucol_setAttribute(toCollator(address), UCOL_NORMALIZATION_MODE,
			UColAttributeValue(mode), &status);
	icu4jni_error(env, status);
}
Пример #2
0
static jint NativeCollation_openCollatorFromRules(JNIEnv* env, jclass, jstring rules0, jint mode, jint strength) {
    ScopedJavaUnicodeString rules(env, rules0);
    UErrorCode status = U_ZERO_ERROR;
    UCollator* c = ucol_openRules(rules.unicodeString().getBuffer(), rules.unicodeString().length(),
            UColAttributeValue(mode), UCollationStrength(strength), NULL, &status);
    icu4jni_error(env, status);
    return static_cast<jint>(reinterpret_cast<uintptr_t>(c));
}
static jlong NativeCollation_openCollatorFromRules(JNIEnv* env, jclass, jstring javaRules, jint mode, jint strength) {
    ScopedStringChars rules(env, javaRules);
    if (rules.get() == NULL) {
        return -1;
    }
    UErrorCode status = U_ZERO_ERROR;
    UCollator* c = ucol_openRules(rules.get(), rules.size(),
            UColAttributeValue(mode), UCollationStrength(strength), NULL, &status);
    maybeThrowIcuException(env, "ucol_openRules", status);
    return static_cast<jlong>(reinterpret_cast<uintptr_t>(c));
}