コード例 #1
0
ファイル: NativeCollation.cpp プロジェクト: OMFGB/libcore
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));
}
コード例 #2
0
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));
}