//static jstring NativeDecimalFormat_getTextAttribute(JNIEnv* env, jclass, jint addr, jint javaAttr) { JNIEXPORT jstring JNICALL Java_com_ibm_icu4jni_text_NativeDecimalFormat_getTextAttribute(JNIEnv* env, jclass, jint addr, jint javaAttr) { UErrorCode status = U_ZERO_ERROR; UNumberFormat* fmt = toUNumberFormat(addr); UNumberFormatTextAttribute attr = static_cast<UNumberFormatTextAttribute> (javaAttr); // Find out how long the result will be... UniquePtr<UChar[]> chars; uint32_t charCount = 0; uint32_t desiredCount = unum_getTextAttribute(fmt, attr, chars.get(), charCount, &status); if (status == U_BUFFER_OVERFLOW_ERROR) { // ...then get it. status = U_ZERO_ERROR; charCount = desiredCount + 1; chars.reset(new UChar[charCount]); charCount = unum_getTextAttribute(fmt, attr, chars.get(), charCount, &status); } return icu4jni_error(env, status) ? NULL : env->NewString( (const jchar*) chars.get(), charCount); }
static jint NativeDecimalFormat_getAttribute(JNIEnv*, jclass, jlong addr, jint javaAttr) { UNumberFormatAttribute attr = static_cast<UNumberFormatAttribute>(javaAttr); return unum_getAttribute(toUNumberFormat(addr), attr); }
static void NativeDecimalFormat_setAttribute(JNIEnv*, jclass, jlong addr, jint javaAttr, jint value) { UNumberFormatAttribute attr = static_cast<UNumberFormatAttribute>(javaAttr); unum_setAttribute(toUNumberFormat(addr), attr, value); }