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

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

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

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

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

示例1: openOlsonResource

static UResourceBundle* openOlsonResource(const UnicodeString& id,                                          UResourceBundle& res,                                          UErrorCode& ec){#if U_DEBUG_TZ    char buf[128];    id.extract(0, sizeof(buf)-1, buf, sizeof(buf), "");#endif    UResourceBundle *top = ures_openDirect(0, kZONEINFO, &ec);    U_DEBUG_TZ_MSG(("pre: res sz=%d/n", ures_getSize(&res)));    /* &res = */ getZoneByName(top, id, &res, ec);    // Dereference if this is an alias.  Docs say result should be 1    // but it is 0 in 2.8 (?).    U_DEBUG_TZ_MSG(("Loading zone '%s' (%s, size %d) - %s/n", buf, ures_getKey((UResourceBundle*)&res), ures_getSize(&res), u_errorName(ec)));    if (ures_getSize(&res) <= 1 && getOlsonMeta(top)) {        int32_t deref = ures_getInt(&res, &ec) + 0;        U_DEBUG_TZ_MSG(("getInt: %s - type is %d/n", u_errorName(ec), ures_getType(&res)));        UResourceBundle *ares = ures_getByKey(top, kZONES, NULL, &ec); // dereference Zones section        ures_getByIndex(ares, deref, &res, &ec);        ures_close(ares);        U_DEBUG_TZ_MSG(("alias to #%d (%s) - %s/n", deref, "??", u_errorName(ec)));    } else {        U_DEBUG_TZ_MSG(("not an alias - size %d/n", ures_getSize(&res)));    }    U_DEBUG_TZ_MSG(("%s - final status is %s/n", buf, u_errorName(ec)));    return top;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:27,


示例2: TestData

RBTestData::RBTestData(UResourceBundle *data, UResourceBundle *headers, UErrorCode& status): TestData(ures_getKey(data)),fData(data),fHeaders(headers),fSettings(NULL),fCases(NULL){  UErrorCode intStatus = U_ZERO_ERROR;  UResourceBundle *currHeaders = ures_getByKey(data, "Headers", NULL, &intStatus);  if(intStatus == U_ZERO_ERROR) {    ures_close(fHeaders);    fHeaders = currHeaders;  } else {    intStatus = U_ZERO_ERROR;  }  fSettings = ures_getByKey(data, "Settings", NULL, &intStatus);  fSettingsSize = ures_getSize(fSettings);  UResourceBundle *info = ures_getByKey(data, "Info", NULL, &intStatus);  if(U_SUCCESS(intStatus)) {    fInfo = new RBDataMap(info, status);  } else {    intStatus = U_ZERO_ERROR;  }  fCases = ures_getByKey(data, "Cases", NULL, &status);  fCasesSize = ures_getSize(fCases);  ures_close(info);}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:28,


示例3: getZoneByName

static UResourceBundle* getZoneByName(const UResourceBundle* top, const UnicodeString& id, UResourceBundle *oldbundle, UErrorCode& status) {    // load the Rules object    UResourceBundle *tmp = ures_getByKey(top, kNAMES, NULL, &status);        // search for the string    int32_t idx = findInStringArray(tmp, id, status);        if((idx == -1) && U_SUCCESS(status)) {        // not found         status = U_MISSING_RESOURCE_ERROR;        //ures_close(oldbundle);        //oldbundle = NULL;    } else {        U_DEBUG_TZ_MSG(("gzbn: oldbundle= size %d, type %d, %s/n", ures_getSize(tmp), ures_getType(tmp), u_errorName(status)));        tmp = ures_getByKey(top, kZONES, tmp, &status); // get Zones object from top        U_DEBUG_TZ_MSG(("gzbn: loaded ZONES, size %d, type %d, path %s %s/n", ures_getSize(tmp), ures_getType(tmp), ures_getPath(tmp), u_errorName(status)));        oldbundle = ures_getByIndex(tmp, idx, oldbundle, &status); // get nth Zone object        U_DEBUG_TZ_MSG(("gzbn: loaded z#%d, size %d, type %d, path %s, %s/n", idx, ures_getSize(oldbundle), ures_getType(oldbundle), ures_getPath(oldbundle),  u_errorName(status)));    }    ures_close(tmp);    if(U_FAILURE(status)) {         //ures_close(oldbundle);        return NULL;    } else {        return oldbundle;    }}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:27,


示例4: 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,


示例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: Z_INTL_RESOURCEBUNDLE_P

/* {{{ resourcebundle_get_iterator */zend_object_iterator *resourcebundle_get_iterator( zend_class_entry *ce, zval *object, int byref ){	ResourceBundle_object   *rb = Z_INTL_RESOURCEBUNDLE_P(object );	ResourceBundle_iterator *iterator = emalloc( sizeof( ResourceBundle_iterator ) );	if (byref) {	     php_error( E_ERROR, "ResourceBundle does not support writable iterators" );	}	zend_iterator_init(&iterator->intern);	ZVAL_COPY(&iterator->intern.data, object);	iterator->intern.funcs = &resourcebundle_iterator_funcs;	iterator->subject = rb;	/* The iterated rb can only be either URES_TABLE or URES_ARRAY	 * All other types are returned as php primitives!	 */	iterator->is_table = (ures_getType( rb->me ) == URES_TABLE);	iterator->length = ures_getSize( rb->me );	ZVAL_UNDEF(&iterator->current);	iterator->currentkey = NULL;	iterator->i = 0;	return (zend_object_iterator *) iterator;}
开发者ID:AmesianX,项目名称:php-src,代码行数:28,


示例7: 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,


示例8: 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,


示例9: initAvailableLocaleList

static void U_CALLCONV initAvailableLocaleList(UErrorCode &status) {    U_ASSERT(availableLocaleListCount == 0);    U_ASSERT(availableLocaleList == NULL);    // for now, there is a hardcoded list, so just walk through that list and set it up.    UResourceBundle *index = NULL;    UResourceBundle installed;    int32_t i = 0;        ures_initStackObject(&installed);    index = ures_openDirect(U_ICUDATA_COLL, "res_index", &status);    ures_getByKey(index, "InstalledLocales", &installed, &status);        if(U_SUCCESS(status)) {        availableLocaleListCount = ures_getSize(&installed);        availableLocaleList = new Locale[availableLocaleListCount];                if (availableLocaleList != NULL) {            ures_resetIterator(&installed);            while(ures_hasNext(&installed)) {                const char *tempKey = NULL;                ures_getNextString(&installed, NULL, &tempKey, &status);                availableLocaleList[i++] = Locale(tempKey);            }        }        U_ASSERT(availableLocaleListCount == i);        ures_close(&installed);    }    ures_close(index);    ucln_i18n_registerCleanup(UCLN_I18N_COLLATOR, collator_cleanup);}
开发者ID:cyrusimap,项目名称:icu4c,代码行数:31,


示例10: ures_initStackObject

int32_t U_EXPORT2TimeZone::countEquivalentIDs(const UnicodeString& id) {    int32_t result = 0;    UErrorCode ec = U_ZERO_ERROR;    UResourceBundle res;    ures_initStackObject(&res);    U_DEBUG_TZ_MSG(("countEquivalentIDs../n"));    UResourceBundle *top = openOlsonResource(id, res, ec);    if (U_SUCCESS(ec)) {        int32_t size = ures_getSize(&res);        U_DEBUG_TZ_MSG(("cEI: success (size %d, key %s)../n", size, ures_getKey(&res)));        if (size == 4 || size == 6) {            UResourceBundle r;            ures_initStackObject(&r);            ures_getByIndex(&res, size-1, &r, &ec);            //result = ures_getSize(&r); // doesn't work            ures_getIntVector(&r, &result, &ec);            U_DEBUG_TZ_MSG(("ceI: result %d, err %s/n", result, u_errorName(ec)));            ures_close(&r);        }    } else {      U_DEBUG_TZ_MSG(("cEI: fail, %s/n", u_errorName(ec)));    }    ures_close(&res);    ures_close(top);    return result;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:27,


示例11: init

void RBDataMap::init(UResourceBundle *data, UErrorCode &status) {  int32_t i = 0;  fData->removeAll();  UResourceBundle *t = NULL;  for(i = 0; i < ures_getSize(data); i++) {    t = ures_getByIndex(data, i, t, &status);    fData->put(UnicodeString(ures_getKey(t), -1, US_INV), new ResourceBundle(t, status), status);  }  ures_close(t);}
开发者ID:LittoCats,项目名称:OT_4010D,代码行数:10,


示例12: 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,


示例13: 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,


示例14: 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,


示例15: 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,


示例16: resourcebundle_array_count

/* {{{ resourcebundle_array_count */int resourcebundle_array_count(zend_object *object, zend_long *count){	ResourceBundle_object *rb = php_intl_resourcebundle_fetch_object(object);	if (rb->me == NULL) {		intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR,				"Found unconstructed ResourceBundle", 0);		return 0;	}	*count = ures_getSize( rb->me );	return SUCCESS;}
开发者ID:bishopb,项目名称:php-src,代码行数:15,


示例17: isAvailableLocaleListInitialized

static UBool isAvailableLocaleListInitialized(UErrorCode &status) {    // for now, there is a hardcoded list, so just walk through that list and set it up.    UBool needInit;    UMTX_CHECK(NULL, availableLocaleList == NULL, needInit);    if (needInit) {        UResourceBundle *index = NULL;        UResourceBundle installed;        Locale * temp;        int32_t i = 0;        int32_t localeCount;                ures_initStackObject(&installed);        index = ures_openDirect(U_ICUDATA_COLL, "res_index", &status);        ures_getByKey(index, "InstalledLocales", &installed, &status);                if(U_SUCCESS(status)) {            localeCount = ures_getSize(&installed);            temp = new Locale[localeCount];                        if (temp != NULL) {                ures_resetIterator(&installed);                while(ures_hasNext(&installed)) {                    const char *tempKey = NULL;                    ures_getNextString(&installed, NULL, &tempKey, &status);                    temp[i++] = Locale(tempKey);                }                                umtx_lock(NULL);                if (availableLocaleList == NULL)                {                    availableLocaleListCount = localeCount;                    availableLocaleList = temp;                    temp = NULL;                    ucln_i18n_registerCleanup(UCLN_I18N_COLLATOR, collator_cleanup);                }                 umtx_unlock(NULL);                needInit = FALSE;                if (temp) {                    delete []temp;                }            }            ures_close(&installed);        }        ures_close(index);    }    return !needInit;}
开发者ID:CucasLoon,项目名称:in-the-box,代码行数:50,


示例18: getOlsonMeta

static UBool getOlsonMeta(const UResourceBundle* top) {    if (OLSON_ZONE_COUNT == 0) {        UErrorCode ec = U_ZERO_ERROR;        UResourceBundle res;        ures_initStackObject(&res);        ures_getByKey(top, kZONES, &res, &ec);        if(U_SUCCESS(ec)) {            OLSON_ZONE_COUNT = ures_getSize(&res);            U_DEBUG_TZ_MSG(("OZC%d/n",OLSON_ZONE_COUNT));        }        ures_close(&res);    }    return (OLSON_ZONE_COUNT > 0);}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:14,


示例19: resourcebundle_array_count

/* {{{ resourcebundle_array_count */int resourcebundle_array_count(zval *object, zend_long *count){	ResourceBundle_object *rb;	RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK;	if (rb->me == NULL) {		intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR,				"Found unconstructed ResourceBundle", 0);		return 0;	}	*count = ures_getSize( rb->me );	return SUCCESS;}
开发者ID:IMSoP,项目名称:php-src,代码行数:16,


示例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: 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,


示例22: 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,


示例23: 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,


示例24: 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,


示例25: 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,


示例26: initCDFLocaleStyleData

// initCDFLocaleStyleData loads formatting data for a particular style.// decimalFormatBundle is the "decimalFormat" resource bundle in CLDR.// Loaded data stored in result.static void initCDFLocaleStyleData(const UResourceBundle* decimalFormatBundle, CDFLocaleStyleData* result, UErrorCode& status) {  if (U_FAILURE(status)) {    return;  }  // Iterate through all the powers of 10.  int32_t size = ures_getSize(decimalFormatBundle);  UResourceBundle* power10 = NULL;  for (int32_t i = 0; i < size; ++i) {    power10 = ures_getByIndex(decimalFormatBundle, i, power10, &status);    if (U_FAILURE(status)) {      ures_close(power10);      return;    }    populatePower10(power10, result, status);    if (U_FAILURE(status)) {      ures_close(power10);      return;    }  }  ures_close(power10);  fillInMissing(result);}
开发者ID:icu-project,项目名称:icu4c,代码行数:25,


示例27: TestDataModule

RBTestDataModule::RBTestDataModule(const char* name, TestLog& log, UErrorCode& status) : TestDataModule(name, log, status),  fModuleBundle(NULL),  fTestData(NULL),  fInfoRB(NULL),  tdpath(NULL){  fNumberOfTests = 0;  fDataTestValid = TRUE;  fModuleBundle = getTestBundle(name, status);  if(fDataTestValid) {    fTestData = ures_getByKey(fModuleBundle, "TestData", NULL, &status);    fNumberOfTests = ures_getSize(fTestData);    fInfoRB = ures_getByKey(fModuleBundle, "Info", NULL, &status);    if(status != U_ZERO_ERROR) {      log.errln(UNICODE_STRING_SIMPLE("Unable to initalize test data - missing mandatory description resources!"));      fDataTestValid = FALSE;    } else {      fInfo = new RBDataMap(fInfoRB, status);    }  }}
开发者ID:Andproject,项目名称:platform_external_icu4c,代码行数:22,


示例28: getMonthNames

static jobjectArray getMonthNames(JNIEnv* env, UResourceBundle* gregorian, bool longNames) {    UErrorCode status = U_ZERO_ERROR;    ScopedResourceBundle gregorianElems(ures_getByKey(gregorian, "monthNames", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }        ScopedResourceBundle monthNameElems(ures_getByKey(gregorianElems.get(), "format", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }        ScopedResourceBundle monthNameElemsFormat(ures_getByKey(monthNameElems.get(), longNames ? "wide" : "abbreviated", NULL, &status));    if (U_FAILURE(status)) {        return NULL;    }        ures_resetIterator(monthNameElemsFormat.get());    int monthCount = ures_getSize(monthNameElemsFormat.get());    // the array length is +1 because the harmony locales had an empty string at the end of their month name array    jobjectArray months = env->NewObjectArray(monthCount + 1, string_class, NULL);    for (int i = 0; i < monthCount; ++i) {        int monthNameLength;        const jchar* month = ures_getStringByIndex(monthNameElemsFormat.get(), i, &monthNameLength, &status);        if (U_FAILURE(status)) {            return NULL;        }        jstring monthU = env->NewString(month, monthNameLength);        env->SetObjectArrayElement(months, i, monthU);        env->DeleteLocalRef(monthU);    }        jstring monthU = env->NewStringUTF("");    env->SetObjectArrayElement(months, monthCount, monthU);    env->DeleteLocalRef(monthU);        return months;}
开发者ID:Ar3kkusu,项目名称:android_libcore,代码行数:38,


示例29: ures_openDirect

UnicodeString&TimeZone::dereferOlsonLink(const UnicodeString& linkTo, UnicodeString& linkFrom) {    UErrorCode ec = U_ZERO_ERROR;    linkFrom.remove();    UResourceBundle *top = ures_openDirect(0, kZONEINFO, &ec);    UResourceBundle *res = getZoneByName(top, linkTo, NULL, ec);    if (U_SUCCESS(ec)) {        if (ures_getSize(res) == 1) {            int32_t deref = ures_getInt(res, &ec);            UResourceBundle *nres = ures_getByKey(top, kNAMES, NULL, &ec); // dereference Names section            int32_t len;            const UChar* tmp = ures_getStringByIndex(nres, deref, &len, &ec);            if (U_SUCCESS(ec)) {                linkFrom.setTo(tmp, len);            }            ures_close(nres);        } else {            linkFrom.setTo(linkTo);        }    }    ures_close(res);    ures_close(top);    return linkFrom;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:24,



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


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