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

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

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

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

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

示例1: ucol_setAttribute

void UCAConformanceTest::setCollShifted(UCollator *coll) {  ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);  ucol_setAttribute(coll, UCOL_CASE_FIRST, UCOL_OFF, &status);  ucol_setAttribute(coll, UCOL_CASE_LEVEL, UCOL_OFF, &status);  ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_QUATERNARY, &status);  ucol_setAttribute(coll, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, &status);}
开发者ID:andrewleech,项目名称:firebird,代码行数:8,


示例2: DECLARE_CATCH_SCOPE

void IntlCollator::createCollator(ExecState& state){    VM& vm = state.vm();    auto scope = DECLARE_CATCH_SCOPE(vm);    ASSERT(!m_collator);    if (!m_initializedCollator) {        initializeCollator(state, jsUndefined(), jsUndefined());        ASSERT_UNUSED(scope, !scope.exception());    }    UErrorCode status = U_ZERO_ERROR;    auto collator = std::unique_ptr<UCollator, UCollatorDeleter>(ucol_open(m_locale.utf8().data(), &status));    if (U_FAILURE(status))        return;    UColAttributeValue strength = UCOL_PRIMARY;    UColAttributeValue caseLevel = UCOL_OFF;    switch (m_sensitivity) {    case Sensitivity::Base:        break;    case Sensitivity::Accent:        strength = UCOL_SECONDARY;        break;    case Sensitivity::Case:        caseLevel = UCOL_ON;        break;    case Sensitivity::Variant:        strength = UCOL_TERTIARY;        break;    default:        ASSERT_NOT_REACHED();    }    ucol_setAttribute(collator.get(), UCOL_STRENGTH, strength, &status);    ucol_setAttribute(collator.get(), UCOL_CASE_LEVEL, caseLevel, &status);    ucol_setAttribute(collator.get(), UCOL_NUMERIC_COLLATION, m_numeric ? UCOL_ON : UCOL_OFF, &status);    // FIXME: Setting UCOL_ALTERNATE_HANDLING to UCOL_SHIFTED causes punctuation and whitespace to be    // ignored. There is currently no way to ignore only punctuation.    ucol_setAttribute(collator.get(), UCOL_ALTERNATE_HANDLING, m_ignorePunctuation ? UCOL_SHIFTED : UCOL_DEFAULT, &status);    // "The method is required to return 0 when comparing Strings that are considered canonically    // equivalent by the Unicode standard."    ucol_setAttribute(collator.get(), UCOL_NORMALIZATION_MODE, UCOL_ON, &status);    if (U_FAILURE(status))        return;    m_collator = WTFMove(collator);}
开发者ID:ollie314,项目名称:webkit,代码行数:50,


示例3: ucol_open

static const UCollator *MakeRootCollator() {  UErrorCode ErrorCode = U_ZERO_ERROR;  UCollator *root = ucol_open("", &ErrorCode);  if (U_FAILURE(ErrorCode)) {    swift::crash("ucol_open: Failure setting up default collation.");  }  ucol_setAttribute(root, UCOL_NORMALIZATION_MODE, UCOL_ON, &ErrorCode);  ucol_setAttribute(root, UCOL_STRENGTH, UCOL_TERTIARY, &ErrorCode);  ucol_setAttribute(root, UCOL_NUMERIC_COLLATION, UCOL_OFF, &ErrorCode);  ucol_setAttribute(root, UCOL_CASE_LEVEL, UCOL_OFF, &ErrorCode);  if (U_FAILURE(ErrorCode)) {    swift::crash("ucol_setAttribute: Failure setting up default collation.");  }  return root;}
开发者ID:akrisiun,项目名称:swiftwindows,代码行数:15,


示例4: couch_drv_start

static ErlDrvData couch_drv_start(ErlDrvPort port, char *buff){    UErrorCode status = U_ZERO_ERROR;    couch_drv_data* pData = (couch_drv_data*)driver_alloc(sizeof(couch_drv_data));    if (pData == NULL)        return ERL_DRV_ERROR_GENERAL;    pData->port = port;    pData->coll = ucol_open("", &status);    if (U_FAILURE(status)) {        couch_drv_stop((ErlDrvData)pData);        return ERL_DRV_ERROR_GENERAL;    }    pData->collNoCase = ucol_open("", &status);    if (U_FAILURE(status)) {        couch_drv_stop((ErlDrvData)pData);        return ERL_DRV_ERROR_GENERAL;    }    ucol_setAttribute(pData->collNoCase, UCOL_STRENGTH, UCOL_PRIMARY, &status);    if (U_FAILURE(status)) {        couch_drv_stop((ErlDrvData)pData);        return ERL_DRV_ERROR_GENERAL;    }    return (ErlDrvData)pData;}
开发者ID:davisp,项目名称:nifspeed,代码行数:30,


示例5: MojAssert

MojErr MojDbTextCollator::init(const MojChar* locale, MojDbCollationStrength level){	MojAssert(locale);	MojAssert(!m_ucol);	UCollationStrength strength = UCOL_PRIMARY;	switch (level) {	case MojDbCollationPrimary:		strength = UCOL_PRIMARY;		break;	case MojDbCollationSecondary:		strength = UCOL_SECONDARY;		break;	case MojDbCollationTertiary:		strength = UCOL_TERTIARY;		break;	case MojDbCollationIdentical:		strength = UCOL_IDENTICAL;		break;	default:		MojAssertNotReached();	}	UErrorCode status = U_ZERO_ERROR;	m_ucol = ucol_open(locale, &status);	MojUnicodeErrCheck(status);	MojAssert(m_ucol);	ucol_setAttribute(m_ucol, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);	MojUnicodeErrCheck(status);	ucol_setStrength(m_ucol, strength);	return MojErrNone;}
开发者ID:anttiharju-owo,项目名称:db8,代码行数:33,


示例6: checkOwned

void RuleBasedCollator::setStrength(ECollationStrength newStrength){    checkOwned();    UErrorCode intStatus = U_ZERO_ERROR;    UCollationStrength strength = getUCollationStrength(newStrength);    ucol_setAttribute(ucollator, UCOL_STRENGTH, strength, &intStatus);}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:7,


示例7: sortkey_from_unicode

static int32_tsortkey_from_unicode (UChar *input, uint8_t **output){    UErrorCode status = U_ZERO_ERROR;    UCollator * collator = ucol_open ("", &status);    int32_t size;    if (icu_failure (status))        return 0;    ucol_setAttribute (collator, UCOL_NUMERIC_COLLATION, UCOL_ON, &status);    if (icu_failure (status))        return 0;    *output = (uint8_t *) palloc (sizeof (uint8_t) * PREALLOC_SIZE);    size = ucol_getSortKey (collator, input, -1, *output, PREALLOC_SIZE);    if (size > PREALLOC_SIZE)    {        pfree (*output);        *output = (uint8_t *) palloc (sizeof (uint8_t) * size);        ucol_getSortKey (collator, input, -1, *output, size);    }    ucol_close (collator);    if (size < 1)    {        ereport(ERROR, (errmsg("ICU sortkey is zero")));    }    return size;}
开发者ID:hblanks,项目名称:postgresql-musicbrainz-collate,代码行数:34,


示例8: TestFCDCrash

static voidTestFCDCrash(void) {    static const char *test[] = {    "Gr//u00F6//u00DFe",    "Grossist"    };    char *icuDataDir = safeGetICUDataDirectory();    UErrorCode status = U_ZERO_ERROR;    UCollator *coll = ucol_open("es", &status);    if(U_FAILURE(status)) {        log_err("Couldn't open collator/n");        return;    }    ucol_close(coll);    coll = NULL;    u_cleanup();    u_setDataDirectory(icuDataDir);    coll = ucol_open("de_DE", &status);    if(U_FAILURE(status)) {        log_err("Couldn't open collator/n");        return;    }    ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);    genericOrderingTest(coll, test, 2);    ucol_close(coll);    free(icuDataDir);}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:29,


示例9: icu_Collator_set_upper_first

static inticu_Collator_set_upper_first(icu_Collator *self, PyObject *val, void *closure) {    UErrorCode status = U_ZERO_ERROR;    ucol_setAttribute(self->collator, UCOL_CASE_FIRST, (val == Py_None) ? UCOL_OFF : ((PyObject_IsTrue(val)) ? UCOL_UPPER_FIRST : UCOL_LOWER_FIRST), &status);    if (U_FAILURE(status)) { PyErr_SetString(PyExc_ValueError, u_errorName(status)); return -1; }    return 0;}
开发者ID:IvoNet,项目名称:calibre,代码行数:7,


示例10: ucol_setStrength

U_CAPI void U_EXPORT2ucol_setStrength(    UCollator                *coll,            UCollationStrength        strength){    UErrorCode status = U_ZERO_ERROR;    ucol_setAttribute(coll, UCOL_STRENGTH, strength, &status);}
开发者ID:GuillaumeSmaha,项目名称:stringi,代码行数:7,


示例11: TestSecondary

static void TestSecondary(){    int32_t i,j, testAcuteSize;    UCollationResult expected=UCOL_EQUAL;    UErrorCode status = U_ZERO_ERROR;    myCollation = ucol_open("fr_CA", &status);    if(U_FAILURE(status)) {        log_err_status(status, "ERROR: in creation of rule based collator: %s/n", myErrorName(status));        return;    }    ucol_setAttribute(myCollation, UCOL_STRENGTH, UCOL_SECONDARY, &status);    if(U_FAILURE(status)) {        log_err("ERROR: in creation of rule based collator: %s/n", myErrorName(status));        return;    }    log_verbose("Testing fr_CA Collation with Secondary strength/n");    /*test acute and grave ordering (compare to french collation)*/    testAcuteSize = UPRV_LENGTHOF(testAcute);    for (i = 0; i < testAcuteSize; i++)    {        for (j = 0; j < testAcuteSize; j++)        {            if (i <  j) expected = UCOL_LESS;            if (i == j) expected = UCOL_EQUAL;            if (i >  j) expected = UCOL_GREATER;            doTest(myCollation, testAcute[i], testAcute[j], expected );        }    }    ucol_close(myCollation);}
开发者ID:cyrusimap,项目名称:icu4c,代码行数:30,


示例12: TestFCDCrash

static voidTestFCDCrash(void) {    static const char *test[] = {    "Gr//u00F6//u00DFe",    "Grossist"    };    UErrorCode status = U_ZERO_ERROR;    UCollator *coll = ucol_open("es", &status);    if(U_FAILURE(status)) {        log_err_status(status, "Couldn't open collator -> %s/n", u_errorName(status));        return;    }    ucol_close(coll);    coll = NULL;    ctest_resetICU();    coll = ucol_open("de_DE", &status);    if(U_FAILURE(status)) {        log_err_status(status, "Couldn't open collator -> %s/n", u_errorName(status));        return;    }    ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);    genericOrderingTest(coll, test, 2);    ucol_close(coll);}
开发者ID:icu-project,项目名称:icu4c,代码行数:25,


示例13: ASSERT

void Collator::createCollator() const{    ASSERT(!m_collator);    UErrorCode status = U_ZERO_ERROR;    {        Locker<Mutex> lock(cachedCollatorMutex());        if (cachedCollator) {            const char* cachedCollatorLocale = ucol_getLocaleByType(cachedCollator, ULOC_REQUESTED_LOCALE, &status);            ASSERT(U_SUCCESS(status));            ASSERT(cachedCollatorLocale);            UColAttributeValue cachedCollatorLowerFirst = ucol_getAttribute(cachedCollator, UCOL_CASE_FIRST, &status);            ASSERT(U_SUCCESS(status));            // FIXME: default locale is never matched, because ucol_getLocaleByType returns the actual one used, not 0.            if (m_locale && 0 == strcmp(cachedCollatorLocale, m_locale)                && ((UCOL_LOWER_FIRST == cachedCollatorLowerFirst && m_lowerFirst) || (UCOL_UPPER_FIRST == cachedCollatorLowerFirst && !m_lowerFirst))) {                m_collator = cachedCollator;                cachedCollator = 0;                return;            }        }    }    m_collator = ucol_open(m_locale, &status);    if (U_FAILURE(status)) {        status = U_ZERO_ERROR;        m_collator = ucol_open("", &status); // Fallback to Unicode Collation Algorithm.    }    ASSERT(U_SUCCESS(status));    ucol_setAttribute(m_collator, UCOL_CASE_FIRST, m_lowerFirst ? UCOL_LOWER_FIRST : UCOL_UPPER_FIRST, &status);    ASSERT(U_SUCCESS(status));}
开发者ID:sptramer,项目名称:tijscore,代码行数:35,


示例14: Java_com_ibm_icu4jni_text_NativeCollation_setAttribute

//static void NativeCollation_setAttribute(JNIEnv* env, jclass, jint address, jint type, jint value) {JNIEXPORT void JNICALLJava_com_ibm_icu4jni_text_NativeCollation_setAttribute(JNIEnv* env, jclass,		jint address, jint type, jint value) {	UErrorCode status = U_ZERO_ERROR;	ucol_setAttribute(toCollator(address), (UColAttribute) type,			(UColAttributeValue) value, &status);	icu4jni_error(env, status);}
开发者ID:webos21,项目名称:xi,代码行数:9,


示例15: Java_com_ibm_icu4jni_text_NativeCollation_setNormalization

//static void NativeCollation_setNormalization(JNIEnv* env, jclass, jint address, jint mode) {JNIEXPORT void JNICALLJava_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);}
开发者ID:webos21,项目名称:xi,代码行数:9,


示例16: icu4r_col_set_attr

/** * call-seq: *     collator.set_attr(attribute, value) *     collator[attribute]=value  *  * Universal attribute setter. See above for valid attributes and their values **/VALUE icu4r_col_set_attr(VALUE self, VALUE obj, VALUE new_val){    UErrorCode status = U_ZERO_ERROR;    Check_Type(obj, T_FIXNUM);    Check_Type(new_val, T_FIXNUM);    ucol_setAttribute(UCOLLATOR(self), FIX2INT(obj), FIX2INT(new_val), &status);    ICU_RAISE(status);    return Qnil;}
开发者ID:jchris,项目名称:icu4r,代码行数:16,


示例17: LOG_TRACE

MojErr MojDbTextCollator::init(const MojChar* locale, MojDbCollationStrength level){    LOG_TRACE("Entering function %s", __FUNCTION__);	MojAssert(locale);	MojAssert(!m_ucol);	UCollationStrength strength = UCOL_PRIMARY;	switch (level) {	case MojDbCollationPrimary:		strength = UCOL_PRIMARY;		break;	case MojDbCollationSecondary:		strength = UCOL_SECONDARY;		break;	case MojDbCollationTertiary:		strength = UCOL_TERTIARY;		break;    case MojDbCollationQuaternary:        strength = UCOL_QUATERNARY;        break;	case MojDbCollationIdentical:		strength = UCOL_IDENTICAL;		break;	default:		MojAssertNotReached();	}	UErrorCode status = U_ZERO_ERROR;	m_ucol = ucol_open(locale, &status);	MojUnicodeErrCheck(status);	MojAssert(m_ucol);	ucol_setAttribute(m_ucol, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);    if (level == MojDbCollationIdentical) {        // Combination of IDENTICAL and NUMERIC option cover full-width comparison and ["001","01","1"] ordering.        // NUMERIC option converts number charcter to numeric "a021" -> ["a",21]        ucol_setAttribute(m_ucol, UCOL_NUMERIC_COLLATION, UCOL_ON, &status);    }	MojUnicodeErrCheck(status);	ucol_setStrength(m_ucol, strength);	return MojErrNone;}
开发者ID:ctbrowser,项目名称:db8,代码行数:42,


示例18: HHVM_METHOD

static bool HHVM_METHOD(Collator, setAttribute, int64_t attr, int64_t val) {  FETCH_COL(data, this_, false);  data->clearError();  UErrorCode error = U_ZERO_ERROR;  ucol_setAttribute(data->collator(), (UColAttribute)attr,                                      (UColAttributeValue)val, &error);  if (U_FAILURE(error)) {    data->setError(error, "Error setting attribute value");    return false;  }  return true;}
开发者ID:Dream-Seeker,项目名称:hhvm,代码行数:12,


示例19: do_iterator_options

static int do_iterator_options(ErlNifEnv* env, UCollator* col,     const ERL_NIF_TERM in, unsigned int& i) {    ERL_NIF_TERM out, list;    ERL_NIF_TERM* tuple;    unsigned int count;    UErrorCode status = U_ZERO_ERROR;    int32_t len;     char    value[ATOM_LEN], key[ATOM_LEN];    int     parsed_value,    parsed_key;        i = 0;    if (!enif_get_list_length(env, in, &count))         return 0;    list = in;    while (enif_get_list_cell(env, list, &out, &list)) {        if (enif_get_tuple(env, out, &len, (const ERL_NIF_TERM**) &tuple)            && (len == 2)) {             /* Set an attribute start */            if (!(enif_get_atom(env, tuple[0], (char*) key,                           ATOM_LEN, ERL_NIF_LATIN1)                && enif_get_atom(env, tuple[1], (char*) value,                         ATOM_LEN, ERL_NIF_LATIN1)))                 return 0;                                parsed_key   = parseAttrKey(key);            parsed_value = parseAttrValue(value);            if ((parsed_value == -1) || (parsed_key == -1))                 return 0;             ucol_setAttribute(col,                (UColAttribute)      parsed_key,                (UColAttributeValue) parsed_value,                &status);            if (U_FAILURE(status))                return 0;                        /* Set an attribute end */        } else             return 0;    }    return 1;}
开发者ID:djui,项目名称:i18n,代码行数:52,


示例20: GetCollatorForLocaleAndOptions

/* * To collator returned by this function is owned by the callee and must be *closed when this method returns * with a U_SUCCESS UErrorCode. * * On error, the return value is undefined. */UCollator* GetCollatorForLocaleAndOptions(const char* lpLocaleName, int32_t options, UErrorCode* pErr){    UCollator* pColl = nullptr;    pColl = ucol_open(lpLocaleName, pErr);    if ((options & CompareOptionsIgnoreCase) == CompareOptionsIgnoreCase)    {        ucol_setAttribute(pColl, UCOL_STRENGTH, UCOL_SECONDARY, pErr);    }    return pColl;}
开发者ID:hickford,项目名称:coreclr,代码行数:20,


示例21: TestChooonKigoo

/** Test Choo-on kigoo*/static void TestChooonKigoo(void){    int32_t i;    UErrorCode status = U_ZERO_ERROR;    myCollation = ucol_open("ja_JP", &status);    if (U_FAILURE(status))    {        log_err_status(status, "ERROR: in creation of rule based collator: %s/n",            myErrorName(status));        return;    }    log_verbose("Testing Japanese Choo-on Kigoo Characters Collation/n");    ucol_setAttribute(myCollation, UCOL_STRENGTH, UCOL_QUATERNARY, &status);    ucol_setAttribute(myCollation, UCOL_CASE_LEVEL, UCOL_ON, &status);    for (i = 0; i < 7 ; i++) {        doTest(myCollation, testChooonKigooCases[i], testChooonKigooCases[i + 1],            UCOL_LESS);    }    ucol_close(myCollation);}
开发者ID:icu-project,项目名称:icu4c,代码行数:25,


示例22: raise_warning

bool c_Collator::t_setattribute(int64_t attr, int64_t val) {  if (!m_ucoll) {    raise_warning("setattribute called on uninitialized Collator object");    return false;  }  m_errcode.clearError();  UErrorCode error = U_ZERO_ERROR;  ucol_setAttribute(m_ucoll, (UColAttribute)attr,                    (UColAttributeValue)val, &error);  if (U_FAILURE(error)) {    m_errcode.setError(error, "Error setting attribute value");    return false;  }  return true;}
开发者ID:artursmolarek,项目名称:hhvm,代码行数:15,


示例23: raise_warning

bool c_Collator::t_setattribute(int64_t attr, int64_t val) {  if (!m_ucoll) {    raise_warning("setattribute called on uninitialized Collator object");    return false;  }  m_errcode.clear();  ucol_setAttribute(m_ucoll, (UColAttribute)attr,                    (UColAttributeValue)val, &(m_errcode.code));  s_intl_error->m_error.clear();  s_intl_error->m_error.code = m_errcode.code;  if (U_FAILURE(m_errcode.code)) {    m_errcode.custom_error_message = "Error setting attribute value";    s_intl_error->m_error.custom_error_message = m_errcode.custom_error_message;    return false;  }  return true;}
开发者ID:360buyliulei,项目名称:hiphop-php,代码行数:17,


示例24: NS_ENSURE_TRUE

nsresult nsCollationMacUC::EnsureCollator(const int32_t newStrength) {  NS_ENSURE_TRUE(mInit, NS_ERROR_NOT_INITIALIZED);  if (mHasCollator && (mLastStrength == newStrength))    return NS_OK;  nsresult res;  res = CleanUpCollator();  NS_ENSURE_SUCCESS(res, res);  if (mUseICU) {    NS_ENSURE_TRUE(mLocaleICU, NS_ERROR_NOT_INITIALIZED);    UErrorCode status;    status = U_ZERO_ERROR;    mCollatorICU = ucol_open(mLocaleICU, &status);    NS_ENSURE_TRUE(U_SUCCESS(status), NS_ERROR_FAILURE);    UCollationStrength strength;    UColAttributeValue caseLevel;    res = ConvertStrength(newStrength, &strength, &caseLevel);    NS_ENSURE_SUCCESS(res, res);    status = U_ZERO_ERROR;    ucol_setAttribute(mCollatorICU, UCOL_STRENGTH, strength, &status);    NS_ENSURE_TRUE(U_SUCCESS(status), NS_ERROR_FAILURE);    ucol_setAttribute(mCollatorICU, UCOL_CASE_LEVEL, caseLevel, &status);    NS_ENSURE_TRUE(U_SUCCESS(status), NS_ERROR_FAILURE);    ucol_setAttribute(mCollatorICU, UCOL_ALTERNATE_HANDLING, UCOL_DEFAULT, &status);    NS_ENSURE_TRUE(U_SUCCESS(status), NS_ERROR_FAILURE);    ucol_setAttribute(mCollatorICU, UCOL_NUMERIC_COLLATION, UCOL_OFF, &status);    NS_ENSURE_TRUE(U_SUCCESS(status), NS_ERROR_FAILURE);    ucol_setAttribute(mCollatorICU, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);    NS_ENSURE_TRUE(U_SUCCESS(status), NS_ERROR_FAILURE);    ucol_setAttribute(mCollatorICU, UCOL_CASE_FIRST, UCOL_DEFAULT, &status);    NS_ENSURE_TRUE(U_SUCCESS(status), NS_ERROR_FAILURE);  } else {    OSStatus err;    UCCollateOptions newOptions;    res = StrengthToOptions(newStrength, &newOptions);    NS_ENSURE_SUCCESS(res, res);    LocaleOperationVariant opVariant = 0; // default variant for now    err = ::UCCreateCollator(mLocale, opVariant, newOptions, &mCollator);    NS_ENSURE_TRUE((err == noErr), NS_ERROR_FAILURE);  }  mHasCollator = true;  mLastStrength = newStrength;  return NS_OK;}
开发者ID:Acidburn0zzz,项目名称:tor-browser,代码行数:52,


示例25: TestTertiary

static void TestTertiary( ){    int32_t i;    UErrorCode status = U_ZERO_ERROR;    myCollation = ucol_open("ja_JP", &status);    if(U_FAILURE(status)){        log_err_status(status, "ERROR: in creation of rule based collator: %s/n", myErrorName(status));        return;    }    log_verbose("Testing Kanna(Japan) Collation with Tertiary strength/n");    ucol_setStrength(myCollation, UCOL_TERTIARY);    ucol_setAttribute(myCollation, UCOL_CASE_LEVEL, UCOL_ON, &status);    for (i = 0; i < 6 ; i++)    {        doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);    }    ucol_close(myCollation);}
开发者ID:icu-project,项目名称:icu4c,代码行数:18,


示例26: TestSmallLarge

/** Test Small, Large letters*/static void TestSmallLarge(void){    int32_t i;    UErrorCode status = U_ZERO_ERROR;    myCollation = ucol_open("ja_JP", &status);    if (U_FAILURE(status))    {        log_err_status(status, "ERROR: in creation of rule based collator: %s/n",            myErrorName(status));        return;    }    log_verbose("Testing Japanese Small and Large Characters Collation/n");    ucol_setStrength(myCollation, UCOL_TERTIARY);    ucol_setAttribute(myCollation, UCOL_CASE_LEVEL, UCOL_ON, &status);    for (i = 0; i < 3 ; i++)        doTest(myCollation, testSmallLargeCases[i], testSmallLargeCases[i + 1],        UCOL_LESS);    ucol_close(myCollation);}
开发者ID:icu-project,项目名称:icu4c,代码行数:24,


示例27: genericLocaleStarterWithOptionsAndResult

void genericLocaleStarterWithOptionsAndResult(const char *locale, const char * const s[], uint32_t size, const UColAttribute *attrs, const UColAttributeValue *values, uint32_t attsize, UCollationResult result) {  UErrorCode status = U_ZERO_ERROR;  uint32_t i;  UCollator *coll = ucol_open(locale, &status);  log_verbose("Locale starter for %s/n", locale);  if(U_SUCCESS(status)) {    log_verbose("Setting attributes/n");    for(i = 0; i < attsize; i++) {      ucol_setAttribute(coll, attrs[i], values[i], &status);    }    genericOrderingTestWithResult(coll, s, size, result);  } else {    log_err("Unable to open collator for locale %s/n", locale);  }  ucol_close(coll);}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:21,


示例28: genericRulesStarterWithOptionsAndResult

/* currently not used with options */void genericRulesStarterWithOptionsAndResult(const char *rules, const char * const s[], uint32_t size, const UColAttribute *attrs, const UColAttributeValue *values, uint32_t attsize, UCollationResult result) {  UErrorCode status = U_ZERO_ERROR;  UChar rlz[RULE_BUFFER_LEN] = { 0 };  uint32_t rlen = u_unescape(rules, rlz, RULE_BUFFER_LEN);  uint32_t i;  UCollator *coll = ucol_openRules(rlz, rlen, UCOL_DEFAULT, UCOL_DEFAULT,NULL, &status);  log_verbose("Rules starter for %s/n", rules);  if(U_SUCCESS(status)) {    log_verbose("Setting attributes/n");    for(i = 0; i < attsize; i++) {      ucol_setAttribute(coll, attrs[i], values[i], &status);    }    genericOrderingTestWithResult(coll, s, size, result);  } else {    log_err("Unable to open collator with rules %s/n", rules);  }  ucol_close(coll);}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:23,


示例29: TestTertiary

static void TestTertiary( ){    int32_t i;    UErrorCode status = U_ZERO_ERROR;    myCollation = ucol_open("fr_CA", &status);    if(U_FAILURE(status) || !myCollation) {        log_err_status(status, "ERROR: in creation of rule based collator: %s/n", myErrorName(status));        return;    }    ucol_setAttribute(myCollation, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, &status);    if(U_FAILURE(status)) {        log_err("ERROR: in creation of rule based collator: %s/n", myErrorName(status));        return;    }    log_verbose("Testing fr_CA Collation with Tertiary strength/n");    ucol_setStrength(myCollation, UCOL_QUATERNARY);    for (i = 0; i < 12 ; i++)    {        doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);    }    ucol_close(myCollation);}
开发者ID:cyrusimap,项目名称:icu4c,代码行数:24,



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


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