您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ures_getStringByIndex函数代码示例

51自学网 2021-06-03 09:17:13
  C++
这篇教程C++ ures_getStringByIndex函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ures_getStringByIndex函数的典型用法代码示例。如果您正苦于以下问题:C++ ures_getStringByIndex函数的具体用法?C++ ures_getStringByIndex怎么用?C++ ures_getStringByIndex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ures_getStringByIndex函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ures_openDirect

const UChar*TimeZone::dereferOlsonLink(const UnicodeString& id) {    const UChar *result = NULL;    UErrorCode ec = U_ZERO_ERROR;    UResourceBundle *rb = ures_openDirect(NULL, kZONEINFO, &ec);    // resolve zone index by name    UResourceBundle *names = ures_getByKey(rb, kNAMES, NULL, &ec);    int32_t idx = findInStringArray(names, id, ec);    result = ures_getStringByIndex(names, idx, NULL, &ec);    // open the zone bundle by index    ures_getByKey(rb, kZONES, rb, &ec);    ures_getByIndex(rb, idx, rb, &ec);    if (U_SUCCESS(ec)) {        if (ures_getType(rb) == URES_INT) {            // this is a link - dereference the link            int32_t deref = ures_getInt(rb, &ec);            const UChar* tmp = ures_getStringByIndex(names, deref, NULL, &ec);            if (U_SUCCESS(ec)) {                result = tmp;            }        }    }    ures_close(names);    ures_close(rb);    return result;}
开发者ID:hihihippp,项目名称:build-couchdb-1,代码行数:31,


示例2: getAmPmMarkers

static jobjectArray getAmPmMarkers(JNIEnv* env, UResourceBundle* gregorian) {    UErrorCode status = U_ZERO_ERROR;    ScopedResourceBundle gregorianElems(ures_getByKey(gregorian, "AmPmMarkers", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    ures_resetIterator(gregorianElems.get());    int lengthAm, lengthPm;    const jchar* am = ures_getStringByIndex(gregorianElems.get(), 0, &lengthAm, &status);    const jchar* pm = ures_getStringByIndex(gregorianElems.get(), 1, &lengthPm, &status);    if (U_FAILURE(status)) {        return NULL;    }        jobjectArray amPmMarkers = env->NewObjectArray(2, string_class, NULL);    jstring amU = env->NewString(am, lengthAm);    env->SetObjectArrayElement(amPmMarkers, 0, amU);    env->DeleteLocalRef(amU);    jstring pmU = env->NewString(pm, lengthPm);    env->SetObjectArrayElement(amPmMarkers, 1, pmU);    env->DeleteLocalRef(pmU);    return amPmMarkers;}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:27,


示例3: TZEnumeration

    TZEnumeration(const char* country) : map(NULL), len(0), pos(0) {        if (!getOlsonMeta()) {            return;        }        UErrorCode ec = U_ZERO_ERROR;        UResourceBundle *res = ures_openDirect(0, kZONEINFO, &ec);        ures_getByKey(res, kREGIONS, res, &ec);        if (U_SUCCESS(ec) && ures_getType(res) == URES_ARRAY) {            UChar uCountry[] = {0, 0, 0, 0};            if (country) {                u_charsToUChars(country, uCountry, 2);            } else {                u_strcpy(uCountry, WORLD);            }            // count matches            int32_t count = 0;            int32_t i;            const UChar *region;            for (i = 0; i < ures_getSize(res); i++) {                region = ures_getStringByIndex(res, i, NULL, &ec);                if (U_FAILURE(ec)) {                    break;                }                if (u_strcmp(uCountry, region) == 0) {                    count++;                }            }            if (count > 0) {                map = (int32_t*)uprv_malloc(sizeof(int32_t) * count);                if (map != NULL) {                    int32_t idx = 0;                    for (i = 0; i < ures_getSize(res); i++) {                        region = ures_getStringByIndex(res, i, NULL, &ec);                        if (U_FAILURE(ec)) {                            break;                        }                        if (u_strcmp(uCountry, region) == 0) {                            map[idx++] = i;                        }                    }                    if (U_SUCCESS(ec)) {                        len = count;                    } else {                        uprv_free(map);                        map = NULL;                    }                } else {                    U_DEBUG_TZ_MSG(("Failed to load tz for region %s: %s/n", country, u_errorName(ec)));                }            }        }        ures_close(res);    }
开发者ID:hihihippp,项目名称:build-couchdb-1,代码行数:56,


示例4: getDecimalPatternChars

static jstring getDecimalPatternChars(JNIEnv *env, UResourceBundle *rootElems) {        UErrorCode status = U_ZERO_ERROR;    int zeroL, digitL, decSepL, groupL, listL, percentL, permillL, expL, currSepL, minusL;    int patternLength;    jchar *patternChars;    const jchar* zero = ures_getStringByIndex(rootElems, 4, &zeroL, &status);    const jchar* digit = ures_getStringByIndex(rootElems, 5, &digitL, &status);    const jchar* decSep = ures_getStringByIndex(rootElems, 0, &decSepL, &status);    const jchar* group = ures_getStringByIndex(rootElems, 1, &groupL, &status);    const jchar* list = ures_getStringByIndex(rootElems, 2, &listL, &status);    const jchar* percent = ures_getStringByIndex(rootElems, 3, &percentL, &status);    const jchar* permill = ures_getStringByIndex(rootElems, 8, &permillL, &status);    const jchar* exp = ures_getStringByIndex(rootElems, 7, &expL, &status);    const jchar* currSep = ures_getStringByIndex(rootElems, 0, &currSepL, &status);    const jchar* minus = ures_getStringByIndex(rootElems, 6, &minusL, &status);    if(U_FAILURE(status)) {        return NULL;    }    patternChars = (jchar *) malloc(11 * sizeof(jchar));    patternChars[0] = 0;    u_strncat(patternChars, zero, 1);    u_strncat(patternChars, digit, 1);    u_strncat(patternChars, decSep, 1);    u_strncat(patternChars, group, 1);    u_strncat(patternChars, list, 1);    u_strncat(patternChars, percent, 1);    u_strncat(patternChars, permill, 1);    u_strncat(patternChars, exp, 1);    u_strncat(patternChars, currSep, 1);    u_strncat(patternChars, minus, 1);    jstring decimalPatternChars = env->NewString(patternChars, 10);    free(patternChars);    return decimalPatternChars;}
开发者ID:llnull,项目名称:platform_dalvik,代码行数:55,


示例5: getNames

static jobjectArray getNames(JNIEnv* env, UResourceBundle* namesBundle, bool months, NameType type, NameWidth width) {    const char* typeKey = (type == REGULAR) ? "format" : "stand-alone";    const char* widthKey = (width == LONG) ? "wide" : "abbreviated";    UErrorCode status = U_ZERO_ERROR;    ScopedResourceBundle formatBundle(ures_getByKey(namesBundle, typeKey, NULL, &status));    ScopedResourceBundle valuesBundle(ures_getByKey(formatBundle.get(), widthKey, NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    // The months array has a trailing empty string. The days array has a leading empty string.    int count = ures_getSize(valuesBundle.get());    jobjectArray result = env->NewObjectArray(count + 1, JniConstants::stringClass, NULL);    env->SetObjectArrayElement(result, months ? count : 0, env->NewStringUTF(""));    int arrayOffset = months ? 0 : 1;    for (int i = 0; i < count; ++i) {        int nameLength;        const jchar* name = ures_getStringByIndex(valuesBundle.get(), i, &nameLength, &status);        if (U_FAILURE(status)) {            return NULL;        }        ScopedLocalRef<jstring> nameString(env, env->NewString(name, nameLength));        env->SetObjectArrayElement(result, arrayOffset++, nameString.get());    }    return result;}
开发者ID:OMFGB,项目名称:libcore,代码行数:26,


示例6: ICU_getCurrencySymbol

static jstring ICU_getCurrencySymbol(JNIEnv* env, jclass, jstring locale, jstring currencyCode) {    // We can't use ucurr_getName because it doesn't distinguish between using data root from    // the root locale and parroting back the input because it's never heard of the currency code.    ScopedUtfChars localeName(env, locale);    UErrorCode status = U_ZERO_ERROR;    ScopedResourceBundle currLoc(ures_open(U_ICUDATA_CURR, localeName.c_str(), &status));    if (U_FAILURE(status)) {        return NULL;    }    ScopedResourceBundle currencies(ures_getByKey(currLoc.get(), "Currencies", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    ScopedUtfChars currency(env, currencyCode);    ScopedResourceBundle currencyElems(ures_getByKey(currencies.get(), currency.c_str(), NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    int32_t charCount;    const jchar* chars = ures_getStringByIndex(currencyElems.get(), 0, &charCount, &status);    if (U_FAILURE(status)) {        return NULL;    }    return (charCount == 0) ? NULL : env->NewString(chars, charCount);}
开发者ID:TeamNyx,项目名称:libcore,代码行数:28,


示例7: ures_getStringByIndex

// ---------------------------------------------------------------------------//  Implementation of the virtual message loader API// ---------------------------------------------------------------------------bool ICUMsgLoader::loadMsg( const   XMLMsgLoader::XMLMsgId  msgToLoad                          ,         XMLCh* const            toFill                          , const   XMLSize_t               maxChars){    UErrorCode   err = U_ZERO_ERROR;    int32_t      strLen = 0;    // Assuming array format    const UChar *name = ures_getStringByIndex(fDomainBundle, (int32_t)msgToLoad-1, &strLen, &err);    if (!U_SUCCESS(err) || (name == NULL))    {        return false;    }    int retStrLen = strLen > (int32_t)maxChars ? maxChars : strLen;    if (sizeof(UChar)==sizeof(XMLCh))    {        XMLString::moveChars(toFill, (XMLCh*)name, retStrLen);        toFill[retStrLen] = (XMLCh) 0;    }    else    {        XMLCh* retStr = toFill;        const UChar *srcPtr = name;        while (retStrLen--)           *retStr++ = *srcPtr++;        *retStr = 0;    }    return true;}
开发者ID:AuditoryBiophysicsLab,项目名称:EarLab,代码行数:38,


示例8: getCurrencySymbolNative

static jstring getCurrencySymbolNative(JNIEnv* env, jclass clazz,         jstring locale, jstring currencyCode) {    // LOGI("ENTER getCurrencySymbolNative");    const char* locName = env->GetStringUTFChars(locale, NULL);    UErrorCode status = U_ZERO_ERROR;    ScopedResourceBundle root(ures_open(NULL, locName, &status));    env->ReleaseStringUTFChars(locale, locName);    if (U_FAILURE(status)) {        return NULL;    }    ScopedResourceBundle currencies(ures_getByKey(root.get(), "Currencies", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    const char* currName = env->GetStringUTFChars(currencyCode, NULL);    ScopedResourceBundle currencyElems(ures_getByKey(currencies.get(), currName, NULL, &status));    env->ReleaseStringUTFChars(currencyCode, currName);    if (U_FAILURE(status)) {        return NULL;    }    int currSymbL;    const jchar* currSymbU = ures_getStringByIndex(currencyElems.get(), 0, &currSymbL, &status);    if (U_FAILURE(status)) {        return NULL;    }    return (currSymbL == 0) ? NULL : env->NewString(currSymbU, currSymbL);}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:32,


示例9: ICU_getCurrencySymbolNative

static jstring ICU_getCurrencySymbolNative(JNIEnv* env, jclass, jstring locale, jstring currencyCode) {    ScopedUtfChars localeName(env, locale);    UErrorCode status = U_ZERO_ERROR;    ScopedResourceBundle currLoc(ures_open(U_ICUDATA_CURR, localeName.c_str(), &status));    if (U_FAILURE(status)) {        return NULL;    }    ScopedResourceBundle currencies(ures_getByKey(currLoc.get(), "Currencies", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    ScopedUtfChars currency(env, currencyCode);    ScopedResourceBundle currencyElems(ures_getByKey(currencies.get(), currency.c_str(), NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    int currSymbL;    const jchar* currSymbU = ures_getStringByIndex(currencyElems.get(), 0, &currSymbL, &status);    if (U_FAILURE(status)) {        return NULL;    }    return (currSymbL == 0) ? NULL : env->NewString(currSymbU, currSymbL);}
开发者ID:OMFGB,项目名称:libcore,代码行数:27,


示例10: getEras

static jobjectArray getEras(JNIEnv* env, UResourceBundle* gregorian) {    UErrorCode status = U_ZERO_ERROR;    ScopedResourceBundle gregorianElems(ures_getByKey(gregorian, "eras", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    ScopedResourceBundle eraElems(ures_getByKey(gregorianElems.get(), "abbreviated", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    int eraCount = ures_getSize(eraElems.get());    jobjectArray eras = env->NewObjectArray(eraCount, string_class, NULL);    ures_resetIterator(eraElems.get());    for (int i = 0; i < eraCount; ++i) {        int eraLength;        const jchar* era = ures_getStringByIndex(eraElems.get(), i, &eraLength, &status);        if (U_FAILURE(status)) {            return NULL;        }        jstring eraU = env->NewString(era, eraLength);        env->SetObjectArrayElement(eras, i, eraU);        env->DeleteLocalRef(eraU);    }    return eras;}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:28,


示例11: getWeekdayNames

static jobjectArray getWeekdayNames(JNIEnv* env, UResourceBundle* gregorian, bool longNames) {    UErrorCode status = U_ZERO_ERROR;    ScopedResourceBundle gregorianElems(ures_getByKey(gregorian, "dayNames", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    ScopedResourceBundle dayNameElems(ures_getByKey(gregorianElems.get(), "format", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    ScopedResourceBundle dayNameElemsFormat(ures_getByKey(dayNameElems.get(), longNames ? "wide" : "abbreviated", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    ures_resetIterator(dayNameElemsFormat.get());    int dayCount = ures_getSize(dayNameElemsFormat.get());    jobjectArray weekdays = env->NewObjectArray(dayCount + 1, string_class, NULL);    // first entry in the weekdays array is an empty string    env->SetObjectArrayElement(weekdays, 0, env->NewStringUTF(""));    for(int i = 0; i < dayCount; i++) {        int dayNameLength;        const jchar* day = ures_getStringByIndex(dayNameElemsFormat.get(), i, &dayNameLength, &status);        if(U_FAILURE(status)) {            return NULL;        }        jstring dayU = env->NewString(day, dayNameLength);        env->SetObjectArrayElement(weekdays, i + 1, dayU);        env->DeleteLocalRef(dayU);    }    return weekdays;}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:34,


示例12: setStringField

static void setStringField(JNIEnv* env, jobject obj, const char* fieldName, UResourceBundle* bundle, int index) {    UErrorCode status = U_ZERO_ERROR;    int charCount;    const UChar* chars = ures_getStringByIndex(bundle, index, &charCount, &status);    if (U_SUCCESS(status)) {        setStringField(env, obj, fieldName, env->NewString(chars, charCount));    }}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:8,


示例13: setStringField

static void setStringField(JNIEnv* env, jobject obj, const char* fieldName, UResourceBundle* bundle, int index) {  UErrorCode status = U_ZERO_ERROR;  int charCount;  const UChar* chars = ures_getStringByIndex(bundle, index, &charCount, &status);  if (U_SUCCESS(status)) {    setStringField(env, obj, fieldName, env->NewString(chars, charCount));  } else {    ALOGE("Error setting String field %s from ICU resource (index %d): %s", fieldName, index, u_errorName(status));  }}
开发者ID:LeMaker,项目名称:android-actions,代码行数:10,


示例14: setCharField

static void setCharField(JNIEnv* env, jobject obj, const char* fieldName, UResourceBundle* bundle, int index) {    UErrorCode status = U_ZERO_ERROR;    int charCount;    const UChar* chars = ures_getStringByIndex(bundle, index, &charCount, &status);    if (U_SUCCESS(status)) {        jfieldID fid = env->GetFieldID(JniConstants::localeDataClass, fieldName, "C");        env->SetCharField(obj, fid, chars[0]);    } else {        LOGE("Error setting char field %s from ICU resource: %s", fieldName, u_errorName(status));    }}
开发者ID:OMFGB,项目名称:libcore,代码行数:11,


示例15: getShortMonthNames

static jobjectArray getShortMonthNames(JNIEnv *env, UResourceBundle *gregorian) {        UErrorCode status = U_ZERO_ERROR;    const jchar* shortMonth;    jstring shortMonthU;    UResourceBundle *gregorianElems = ures_getByKey(gregorian, "monthNames", NULL, &status);    if(U_FAILURE(status)) {        return NULL;    }    UResourceBundle *monthNameElems = ures_getByKey(gregorianElems, "format", NULL, &status);    if(U_FAILURE(status)) {        ures_close(gregorianElems);        return NULL;    }    UResourceBundle *monthNameElemsFormat = ures_getByKey(monthNameElems, "abbreviated", NULL, &status);    if(U_FAILURE(status)) {        ures_close(monthNameElems);        ures_close(gregorianElems);        return NULL;    }    int shortMonthNameLength;    ures_resetIterator(monthNameElemsFormat);    int shortMonthCount = ures_getSize(monthNameElemsFormat);    // the array length is +1 because the harmony locales had an empty string at the end of their month name array    jobjectArray shortMonths = env->NewObjectArray(shortMonthCount + 1, string_class, NULL);    for(int i = 0; i < shortMonthCount; i++) {        shortMonth = ures_getStringByIndex(monthNameElemsFormat, i, &shortMonthNameLength, &status);        if(U_FAILURE(status)) {            ures_close(monthNameElemsFormat);            ures_close(monthNameElems);            ures_close(gregorianElems);            return NULL;        }        shortMonthU = env->NewString(shortMonth, shortMonthNameLength);        env->SetObjectArrayElement(shortMonths, i, shortMonthU);        env->DeleteLocalRef(shortMonthU);    }    shortMonthU = env->NewStringUTF("");    env->SetObjectArrayElement(shortMonths, shortMonthCount, shortMonthU);    env->DeleteLocalRef(shortMonthU);    ures_close(monthNameElemsFormat);    ures_close(monthNameElems);    ures_close(gregorianElems);    return shortMonths;}
开发者ID:llnull,项目名称:platform_dalvik,代码行数:52,


示例16: loadOlsonIDs

static UBool loadOlsonIDs() {    if (OLSON_IDS != 0) {        return TRUE;    }    UErrorCode ec = U_ZERO_ERROR;    UnicodeString* ids = 0;    int32_t count = 0;    UResourceBundle *top = ures_openDirect(0, kZONEINFO, &ec);    UResourceBundle *nres = ures_getByKey(top, kNAMES, NULL, &ec); // dereference Names section    if (U_SUCCESS(ec)) {        getOlsonMeta(top);        int32_t start = 0;        count = ures_getSize(nres);        ids = new UnicodeString[(count > 0) ? count : 1];        // Null pointer check        if (ids != NULL) {            for (int32_t i=0; i<count; ++i) {                int32_t idLen = 0;                const UChar* id = ures_getStringByIndex(nres, i, &idLen, &ec);                ids[i].fastCopyFrom(UnicodeString(TRUE, id, idLen));                if (U_FAILURE(ec)) {                    break;                }            }        } else {            ec = U_MEMORY_ALLOCATION_ERROR;        }    }    ures_close(nres);    ures_close(top);    if (U_FAILURE(ec)) {        delete[] ids;        return FALSE;    }    // Keep mutexed operations as short as possible by doing all    // computations first, then doing pointer copies within the mutex.    umtx_lock(&LOCK);    if (OLSON_IDS == 0) {        OLSON_IDS = ids;        ids = 0;        ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);    }    umtx_unlock(&LOCK);    // If another thread initialized the statics first, then delete    // our unused data.    delete[] ids;    return TRUE;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:52,


示例17: getMonthNames

static jobjectArray getMonthNames(JNIEnv *env, UResourceBundle *gregorian) {        UErrorCode status = U_ZERO_ERROR;    const jchar* month;    jstring monthU;    UResourceBundle *gregorianElems = ures_getByKey(gregorian, "monthNames", NULL, &status);    if(U_FAILURE(status)) {        return NULL;    }    UResourceBundle *monthNameElems = ures_getByKey(gregorianElems, "format", NULL, &status);    if(U_FAILURE(status)) {        ures_close(gregorianElems);        return NULL;    }    UResourceBundle *monthNameElemsFormat = ures_getByKey(monthNameElems, "wide", NULL, &status);    if(U_FAILURE(status)) {        ures_close(monthNameElems);        ures_close(gregorianElems);        return NULL;    }    int monthNameLength;    ures_resetIterator(monthNameElemsFormat);    int monthCount = ures_getSize(monthNameElemsFormat);    jobjectArray months = env->NewObjectArray(monthCount + 1, string_class, NULL);    for(int i = 0; i < monthCount; i++) {        month = ures_getStringByIndex(monthNameElemsFormat, i, &monthNameLength, &status);        if(U_FAILURE(status)) {            ures_close(monthNameElemsFormat);            ures_close(monthNameElems);            ures_close(gregorianElems);            return NULL;        }        monthU = env->NewString(month, monthNameLength);        env->SetObjectArrayElement(months, i, monthU);        env->DeleteLocalRef(monthU);    }    monthU = env->NewStringUTF("");    env->SetObjectArrayElement(months, monthCount, monthU);    env->DeleteLocalRef(monthU);    ures_close(monthNameElemsFormat);    ures_close(monthNameElems);    ures_close(gregorianElems);    return months;}
开发者ID:llnull,项目名称:platform_dalvik,代码行数:51,


示例18: getWeekdayNames

static jobjectArray getWeekdayNames(JNIEnv *env, UResourceBundle *gregorian) {        UErrorCode status = U_ZERO_ERROR;    const jchar* day;    jstring dayU;    UResourceBundle *gregorianElems = ures_getByKey(gregorian, "dayNames", NULL, &status);    if(U_FAILURE(status)) {        return NULL;    }    UResourceBundle *dayNameElems = ures_getByKey(gregorianElems, "format", NULL, &status);    if(U_FAILURE(status)) {        ures_close(gregorianElems);        return NULL;    }    UResourceBundle *dayNameElemsFormat = ures_getByKey(dayNameElems, "wide", NULL, &status);    if(U_FAILURE(status)) {        ures_close(dayNameElems);        ures_close(gregorianElems);        return NULL;    }    int dayNameLength;    ures_resetIterator(dayNameElemsFormat);    int dayCount = ures_getSize(dayNameElemsFormat);    jobjectArray weekdays = env->NewObjectArray(dayCount + 1, string_class, NULL);    // first entry in the weekdays array is an empty string    env->SetObjectArrayElement(weekdays, 0, env->NewStringUTF(""));    for(int i = 0; i < dayCount; i++) {        day = ures_getStringByIndex(dayNameElemsFormat, i, &dayNameLength, &status);        if(U_FAILURE(status)) {            ures_close(dayNameElemsFormat);            ures_close(dayNameElems);            ures_close(gregorianElems);            return NULL;        }        dayU = env->NewString(day, dayNameLength);        env->SetObjectArrayElement(weekdays, i + 1, dayU);        env->DeleteLocalRef(dayU);    }        ures_close(dayNameElemsFormat);    ures_close(dayNameElems);    ures_close(gregorianElems);    return weekdays;}
开发者ID:llnull,项目名称:platform_dalvik,代码行数:50,


示例19: getAmPmMarkers

static jobjectArray getAmPmMarkers(JNIEnv* env, UResourceBundle* gregorian) {    UErrorCode status = U_ZERO_ERROR;    ScopedResourceBundle gregorianElems(ures_getByKey(gregorian, "AmPmMarkers", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }    int lengthAm, lengthPm;    const jchar* am = ures_getStringByIndex(gregorianElems.get(), 0, &lengthAm, &status);    const jchar* pm = ures_getStringByIndex(gregorianElems.get(), 1, &lengthPm, &status);    if (U_FAILURE(status)) {        return NULL;    }    jobjectArray amPmMarkers = env->NewObjectArray(2, JniConstants::stringClass, NULL);    ScopedLocalRef<jstring> amU(env, env->NewString(am, lengthAm));    env->SetObjectArrayElement(amPmMarkers, 0, amU.get());    ScopedLocalRef<jstring> pmU(env, env->NewString(pm, lengthPm));    env->SetObjectArrayElement(amPmMarkers, 1, pmU.get());    return amPmMarkers;}
开发者ID:OMFGB,项目名称:libcore,代码行数:23,


示例20: getShortWeekdayNames

static jobjectArray getShortWeekdayNames(JNIEnv *env, UResourceBundle *gregorian) {        UErrorCode status = U_ZERO_ERROR;    const jchar* shortDay;    jstring shortDayU;    UResourceBundle *gregorianElems = ures_getByKey(gregorian, "dayNames", NULL, &status);    if(U_FAILURE(status)) {        return NULL;    }    UResourceBundle *dayNameElems = ures_getByKey(gregorianElems, "format", NULL, &status);    if(U_FAILURE(status)) {        ures_close(gregorianElems);        return NULL;    }    UResourceBundle *dayNameElemsFormat = ures_getByKey(dayNameElems, "abbreviated", NULL, &status);    if(U_FAILURE(status)) {        ures_close(dayNameElems);        ures_close(gregorianElems);        return NULL;    }    int shortDayNameLength;    ures_resetIterator(dayNameElemsFormat);    int shortDayCount = ures_getSize(dayNameElemsFormat);    jobjectArray shortWeekdays = env->NewObjectArray(shortDayCount + 1, string_class, NULL);    env->SetObjectArrayElement(shortWeekdays, 0, env->NewStringUTF(""));    for(int i = 0; i < shortDayCount; i++) {        shortDay = ures_getStringByIndex(dayNameElemsFormat, i, &shortDayNameLength, &status);        if(U_FAILURE(status)) {            ures_close(dayNameElemsFormat);            ures_close(dayNameElems);            ures_close(gregorianElems);            return NULL;        }        shortDayU = env->NewString(shortDay, shortDayNameLength);        env->SetObjectArrayElement(shortWeekdays, i + 1, shortDayU);        env->DeleteLocalRef(shortDayU);    }    ures_close(dayNameElemsFormat);    ures_close(dayNameElems);    ures_close(gregorianElems);    return shortWeekdays;}
开发者ID:llnull,项目名称:platform_dalvik,代码行数:48,


示例21: getID

 UBool getID(int32_t i) {     UErrorCode ec = U_ZERO_ERROR;     int32_t idLen = 0;     const UChar* id = NULL;     UResourceBundle *top = ures_openDirect(0, kZONEINFO, &ec);     top = ures_getByKey(top, kNAMES, top, &ec); // dereference Zones section     id = ures_getStringByIndex(top, i, &idLen, &ec);     if(U_FAILURE(ec)) {         unistr.truncate(0);     }     else {         unistr.fastCopyFrom(UnicodeString(TRUE, id, idLen));     }     ures_close(top);     return U_SUCCESS(ec); }
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:16,


示例22: getCurrencySymbolNative

static jstring getCurrencySymbolNative(JNIEnv* env, jclass clazz,         jstring locale, jstring currencyCode) {    // LOGI("ENTER getCurrencySymbolNative");    UErrorCode status = U_ZERO_ERROR;    const char *locName = env->GetStringUTFChars(locale, NULL);    UResourceBundle *root = ures_open(NULL, locName, &status);    env->ReleaseStringUTFChars(locale, locName);    if(U_FAILURE(status)) {        return NULL;    }    UResourceBundle *rootElems = ures_getByKey(root, "Currencies", NULL, &status);    if(U_FAILURE(status)) {        ures_close(root);        return NULL;    }    const char *currName = env->GetStringUTFChars(currencyCode, NULL);    UResourceBundle *currencyElems = ures_getByKey(rootElems, currName, NULL, &status);    env->ReleaseStringUTFChars(currencyCode, currName);    if(U_FAILURE(status)) {        ures_close(rootElems);        ures_close(root);        return NULL;    }    int currSymbL;    const jchar *currSymbU = ures_getStringByIndex(currencyElems, 0, &currSymbL, &status);    if(U_FAILURE(status)) {        ures_close(currencyElems);        ures_close(rootElems);        ures_close(root);        return NULL;    }    ures_close(currencyElems);    ures_close(rootElems);    ures_close(root);    if(currSymbL == 0) {        return NULL;    }    return env->NewString(currSymbU, currSymbL);}
开发者ID:llnull,项目名称:platform_dalvik,代码行数:46,


示例23: EnumUResourceBundle

static void EnumUResourceBundle(const UResourceBundle* bundle,                                EnumCalendarInfoCallback callback,                                const void* context){    int32_t eraNameCount = ures_getSize(bundle);    for (int i = 0; i < eraNameCount; i++)    {        UErrorCode status = U_ZERO_ERROR;        int32_t ignore; // We don't care about the length of the string as it is null terminated.        const UChar* eraName = ures_getStringByIndex(bundle, i, &ignore, &status);        if (U_SUCCESS(status))        {            callback(eraName, context);        }    }}
开发者ID:Clockwork-Muse,项目名称:coreclr,代码行数:18,


示例24: getEras

static jobjectArray getEras(JNIEnv* env, UResourceBundle *gregorian) {        jobjectArray eras;    jstring eraU;    const jchar* era;    UErrorCode status = U_ZERO_ERROR;    UResourceBundle *gregorianElems;    UResourceBundle *eraElems;    gregorianElems = ures_getByKey(gregorian, "eras", NULL, &status);    if(U_FAILURE(status)) {        return NULL;    }    eraElems = ures_getByKey(gregorianElems, "abbreviated", NULL, &status);    if(U_FAILURE(status)) {        ures_close(gregorianElems);        return NULL;    }    int eraLength;    int eraCount = ures_getSize(eraElems);    eras = env->NewObjectArray(eraCount, string_class, NULL);    ures_resetIterator(eraElems);    for(int i = 0; i < eraCount; i++) {        era = ures_getStringByIndex(eraElems, i, &eraLength, &status);        if(U_FAILURE(status)) {            ures_close(gregorianElems);            ures_close(eraElems);            return NULL;        }        eraU = env->NewString(era, eraLength);        env->SetObjectArrayElement(eras, i, eraU);        env->DeleteLocalRef(eraU);    }    ures_close(eraElems);    ures_close(gregorianElems);    return eras;}
开发者ID:llnull,项目名称:platform_dalvik,代码行数:44,


示例25: ures_getByIndex

void RBDataMap::init(UResourceBundle *headers, UResourceBundle *data, UErrorCode &status){  int32_t i = 0;  fData->removeAll();  UResourceBundle *t = NULL;  const UChar *key = NULL;  int32_t keyLen = 0;  if(ures_getSize(headers) == ures_getSize(data)) {    for(i = 0; i < ures_getSize(data); i++) {      t = ures_getByIndex(data, i, t, &status);      key = ures_getStringByIndex(headers, i, &keyLen, &status);      fData->put(UnicodeString(key, keyLen), new ResourceBundle(t, status), status);    }  } else {    // error    status = U_INVALID_FORMAT_ERROR;  }  ures_close(t);}
开发者ID:LittoCats,项目名称:OT_4010D,代码行数:19,


示例26: ures_open

const UChar *getErrorName(UErrorCode errorNumber) {    UErrorCode status = U_ZERO_ERROR;    int32_t len = 0;    UResourceBundle *error = ures_open(currdir, locale, &status);    UResourceBundle *errorcodes = ures_getByKey(error, "errorcodes", NULL, &status);    const UChar *result = ures_getStringByIndex(errorcodes, errorNumber, &len, &status);    ures_close(errorcodes);    ures_close(error);    if(U_SUCCESS(status)) {        return result;    } else {        return baderror;    }}
开发者ID:mason105,项目名称:red5cpp,代码行数:20,


示例27: ures_open

void RelativeDateFormat::loadDates(UErrorCode &status) {    UResourceBundle *rb = ures_open(NULL, fLocale.getBaseName(), &status);    LocalUResourceBundlePointer dateTimePatterns(        ures_getByKeyWithFallback(rb,                                  "calendar/gregorian/DateTimePatterns",                                  (UResourceBundle*)NULL, &status));    if(U_SUCCESS(status)) {        int32_t patternsSize = ures_getSize(dateTimePatterns.getAlias());        if (patternsSize > kDateTime) {            int32_t resStrLen = 0;            int32_t glueIndex = kDateTime;            if (patternsSize >= (kDateTimeOffset + kShort + 1)) {                int32_t offsetIncrement = (fDateStyle & ~kRelative); // Remove relative bit.                if (offsetIncrement >= (int32_t)kFull &&                    offsetIncrement <= (int32_t)kShortRelative) {                    glueIndex = kDateTimeOffset + offsetIncrement;                }            }            const UChar *resStr = ures_getStringByIndex(dateTimePatterns.getAlias(), glueIndex, &resStrLen, &status);            if (U_SUCCESS(status) && resStrLen >= patItem1Len && u_strncmp(resStr,patItem1,patItem1Len)==0) {                fCombinedHasDateAtStart = TRUE;            }            fCombinedFormat = new SimpleFormatter(UnicodeString(TRUE, resStr, resStrLen), 2, 2, status);        }    }    // Data loading for relative names, e.g., "yesterday", "today", "tomorrow".    fDatesLen = UDAT_DIRECTION_COUNT; // Maximum defined by data.    fDates = (URelativeString*) uprv_malloc(sizeof(fDates[0])*fDatesLen);    RelDateFmtDataSink sink(fDates, fDatesLen);    ures_getAllItemsWithFallback(rb, "fields/day/relative", sink, status);    ures_close(rb);    if(U_FAILURE(status)) {        fDatesLen=0;        return;    }}
开发者ID:DavidCai1993,项目名称:node,代码行数:41,


示例28: U_DEBUG_TZ_MSG

const UnicodeString U_EXPORT2TimeZone::getEquivalentID(const UnicodeString& id, int32_t index) {    U_DEBUG_TZ_MSG(("gEI(%d)/n", index));    UnicodeString result;    UErrorCode ec = U_ZERO_ERROR;    UResourceBundle res;    ures_initStackObject(&res);    UResourceBundle *top = openOlsonResource(id, res, ec);    int32_t zone = -1;    if (U_SUCCESS(ec)) {        int32_t size = ures_getSize(&res);        if (size == 4 || size == 6) {            UResourceBundle r;            ures_initStackObject(&r);            ures_getByIndex(&res, size-1, &r, &ec);            const int32_t* v = ures_getIntVector(&r, &size, &ec);            if (index >= 0 && index < size && getOlsonMeta()) {                zone = v[index];            }            ures_close(&r);        }    }    ures_close(&res);    if (zone >= 0) {        UResourceBundle *ares = ures_getByKey(top, kNAMES, NULL, &ec); // dereference Zones section        if (U_SUCCESS(ec)) {            int32_t idLen = 0;            const UChar* id = ures_getStringByIndex(ares, zone, &idLen, &ec);            result.fastCopyFrom(UnicodeString(TRUE, id, idLen));            U_DEBUG_TZ_MSG(("gei(%d) -> %d, len%d, %s/n", index, zone, result.length(), u_errorName(ec)));        }        ures_close(ares);    }    ures_close(top);#if defined(U_DEBUG_TZ)    if(result.length() ==0) {      U_DEBUG_TZ_MSG(("equiv [__, #%d] -> 0 (%s)/n", index, u_errorName(ec)));    }#endif    return result;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:41,


示例29: findInStringArray

static int32_t findInStringArray(UResourceBundle* array, const UnicodeString& id, UErrorCode &status){    UnicodeString copy;    const UChar *u;    int32_t len;        int32_t start = 0;    int32_t limit = ures_getSize(array);    int32_t mid;    int32_t lastMid = INT32_MAX;    if(U_FAILURE(status) || (limit < 1)) {         return -1;    }    U_DEBUG_TZ_MSG(("fisa: Looking for %s, between %d and %d/n", U_DEBUG_TZ_STR(UnicodeString(id).getTerminatedBuffer()), start, limit));        for (;;) {        mid = (int32_t)((start + limit) / 2);        if (lastMid == mid) {   /* Have we moved? */            break;  /* We haven't moved, and it wasn't found. */        }        lastMid = mid;        u = ures_getStringByIndex(array, mid, &len, &status);        if (U_FAILURE(status)) {            break;        }        U_DEBUG_TZ_MSG(("tz: compare to %s, %d .. [%d] .. %d/n", U_DEBUG_TZ_STR(u), start, mid, limit));        copy.setTo(TRUE, u, len);        int r = id.compare(copy);        if(r==0) {            U_DEBUG_TZ_MSG(("fisa: found at %d/n", mid));            return mid;        } else if(r<0) {            limit = mid;        } else {            start = mid;        }    }    U_DEBUG_TZ_MSG(("fisa: not found/n"));    return -1;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:40,



注:本文中的ures_getStringByIndex函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ures_getStringByKey函数代码示例
C++ ures_getSize函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。