这篇教程C++ ucol_close函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ucol_close函数的典型用法代码示例。如果您正苦于以下问题:C++ ucol_close函数的具体用法?C++ ucol_close怎么用?C++ ucol_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ucol_close函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ucol_closeRuleBasedCollator::~RuleBasedCollator(){ if (dataIsOwned) { ucol_close(ucollator); delete urulestring; } ucollator = 0; urulestring = 0;}
开发者ID:fyatao,项目名称:firebird,代码行数:10,
示例2: lockvoid Collator::releaseCollator(){ { Locker<Mutex> lock(cachedCollatorMutex()); if (cachedCollator) ucol_close(cachedCollator); cachedCollator = m_collator; m_collator = 0; }}
开发者ID:fmalita,项目名称:webkit,代码行数:10,
示例3: INSTANCE_METHOD_INJECTION_BUILTINvoid c_Collator::t___construct(CStrRef locale) { INSTANCE_METHOD_INJECTION_BUILTIN(Collator, Collator::__construct); if (m_ucoll) { ucol_close(m_ucoll); m_ucoll = NULL; } m_errcode.clear(); if (!locale.empty()) { m_locale = locale; m_ucoll = ucol_open(locale.data(), &(m_errcode.code)); if (!U_FAILURE(m_errcode.code)) { // If the specified locale opened successfully, return s_intl_error->m_error.clear(); s_intl_error->m_error.code = m_errcode.code; return; } } // If the empty string was given or if the specified locale did // not open successfully, so fall back to using the default locale m_errcode.code = U_USING_FALLBACK_WARNING; s_intl_error->m_error.clear(); s_intl_error->m_error.code = m_errcode.code; if (m_ucoll) { ucol_close(m_ucoll); m_ucoll = NULL; } UErrorCode errcode = U_ZERO_ERROR; m_locale = String(uloc_getDefault(), CopyString); m_ucoll = ucol_open(m_locale.data(), &errcode); if (U_FAILURE(errcode)) { m_errcode.code = errcode; m_errcode.custom_error_message = "collator_create: unable to open ICU collator"; s_intl_error->m_error.clear(); s_intl_error->m_error.code = m_errcode.code; s_intl_error->m_error.custom_error_message = m_errcode.custom_error_message; if (m_ucoll) { ucol_close(m_ucoll); m_ucoll = NULL; } }}
开发者ID:cdnewbee,项目名称:hiphop-php,代码行数:42,
示例4: lockCollator::~Collator(){ std::lock_guard<Lock> lock(cachedCollatorMutex); if (cachedCollator) { ucol_close(cachedCollator); fastFree(cachedCollatorLocale); } cachedCollator = m_collator; cachedCollatorLocale = m_locale; cachedCollatorShouldSortLowercaseFirst = m_shouldSortLowercaseFirst;}
开发者ID:wolfviking0,项目名称:webcl-webkit,代码行数:11,
示例5: ucol_openFromShortStringvoid CollationRegressionTest::TestT7189() { UErrorCode status = U_ZERO_ERROR; UCollator *coll; uint32_t i; static const UChar text1[][CollationRegressionTest::MAX_TOKEN_LEN] = { // "Achter De Hoven" { 0x41, 0x63, 0x68, 0x74, 0x65, 0x72, 0x20, 0x44, 0x65, 0x20, 0x48, 0x6F, 0x76, 0x65, 0x6E, 0x00 }, // "ABC" { 0x41, 0x42, 0x43, 0x00 }, // "HELLO world!" { 0x48, 0x45, 0x4C, 0x4C, 0x4F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00 } }; static const UChar text2[][CollationRegressionTest::MAX_TOKEN_LEN] = { // "Achter de Hoven" { 0x41, 0x63, 0x68, 0x74, 0x65, 0x72, 0x20, 0x64, 0x65, 0x20, 0x48, 0x6F, 0x76, 0x65, 0x6E, 0x00 }, // "abc" { 0x61, 0x62, 0x63, 0x00 }, // "hello world!" { 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00 } }; // Open the collator coll = ucol_openFromShortString("EO_S1", FALSE, NULL, &status); if (U_FAILURE(status)) { errln("Failed to create a collator for short string EO_S1"); return; } for (i = 0; i < sizeof(text1) / (CollationRegressionTest::MAX_TOKEN_LEN * sizeof(UChar)); i++) { uint8_t key1[100], key2[100]; int32_t len1, len2; len1 = calcKeyIncremental(coll, text1[i], -1, key1, sizeof(key1), status); if (U_FAILURE(status)) { errln(UnicodeString("Failed to get a partial collation key for ") + text1[i]); break; } len2 = calcKeyIncremental(coll, text2[i], -1, key2, sizeof(key2), status); if (U_FAILURE(status)) { errln(UnicodeString("Failed to get a partial collation key for ") + text2[i]); break; } if (len1 == len2 && uprv_memcmp(key1, key2, len1) == 0) { errln(UnicodeString("Failed: Identical key/n") + " text1: " + text1[i] + "/n" + " text2: " + text2[i] + "/n" + " key : " + TestUtility::hex(key1, len1)); } else { logln(UnicodeString("Keys produced -/n") + " text1: " + text1[i] + "/n" + " key1 : " + TestUtility::hex(key1, len1) + "/n" + " text2: " + text2[i] + "/n" + " key2 : " + TestUtility::hex(key2, len2)); } } ucol_close(coll);}
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:54,
示例6: TestJitterbug1098static voidTestJitterbug1098(){ UChar rule[1000]; UCollator* c1 = NULL; UErrorCode status = U_ZERO_ERROR; UParseError parseError; char preContext[200]={0}; char postContext[200]={0}; int i=0; const char* rules[] = { "&''<////", "&//'<////", "&///"<'//'", "&'/"'<//'", '/0' }; const UCollationResult results1098[] = { UCOL_LESS, UCOL_LESS, UCOL_LESS, UCOL_LESS, }; const UChar input[][2]= { {0x0027,0x005c}, {0x0027,0x005c}, {0x0022,0x005c}, {0x0022,0x0027}, }; UChar X[2] ={0}; UChar Y[2] ={0}; u_memset(parseError.preContext,0x0000,U_PARSE_CONTEXT_LEN); u_memset(parseError.postContext,0x0000,U_PARSE_CONTEXT_LEN); for(;rules[i]!=0;i++){ u_uastrcpy(rule, rules[i]); c1 = ucol_openRules(rule, u_strlen(rule), UCOL_OFF, UCOL_DEFAULT_STRENGTH, &parseError, &status); if(U_FAILURE(status)){ log_err("Could not parse the rules syntax. Error: %s ", u_errorName(status)); if (status == U_PARSE_ERROR) { u_UCharsToChars(parseError.preContext,preContext,20); u_UCharsToChars(parseError.postContext,postContext,20); log_verbose("/n/tPre-Context: %s /n/tPost-Context:%s /n",preContext,postContext); } return; } X[0] = input[i][0]; Y[0] = input[i][1]; doTest(c1,X,Y,results1098[i]); ucol_close(c1); }}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:53,
示例7: ucol_closevoidRuleBasedCollator::setUCollator(const char *locale, UErrorCode &status){ if (U_FAILURE(status)) return; if (ucollator && dataIsOwned) ucol_close(ucollator); ucollator = ucol_open_internal(locale, &status); dataIsOwned = TRUE; isWriteThroughAlias = FALSE;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:12,
示例8: lockvoid Collator::releaseCollator(){#ifndef USE_TI_UCOL_REPLACEMENTS { Locker<Mutex> lock(cachedCollatorMutex()); if (cachedCollator) ucol_close(cachedCollator); cachedCollator = m_collator; m_collator = 0; }#endif}
开发者ID:BlainHamon,项目名称:tijscore,代码行数:12,
示例9: lockvoid Collator::releaseCollator(){ { Locker<Mutex> lock(cachedCollatorMutex()); if (cachedCollator) ucol_close(cachedCollator); cachedCollator = m_collator; strncpy(cachedEquivalentLocale, m_equivalentLocale, ulocFullnameCapacity); m_collator = 0; } m_collator = 0;}
开发者ID:dstockwell,项目名称:blink,代码行数:12,
示例10: TestJB581static void TestJB581(void){ UChar dispName [100]; int32_t bufferLen = 0; UChar source [100]; UChar target [100]; UCollationResult result = UCOL_EQUAL; uint8_t sourceKeyArray [100]; uint8_t targetKeyArray [100]; int32_t sourceKeyOut = 0, targetKeyOut = 0; UCollator *myCollator = 0; UErrorCode status = U_ZERO_ERROR; /*u_uastrcpy(source, "This is a test.");*/ /*u_uastrcpy(target, "THISISATEST.");*/ u_uastrcpy(source, "THISISATEST."); u_uastrcpy(target, "Thisisatest."); myCollator = ucol_open("en_US", &status); if (U_FAILURE(status)){ bufferLen = uloc_getDisplayName("en_US", 0, dispName, 100, &status); /*Report the error with display name... */ log_err("ERROR: Failed to create the collator for : /"%s/"/n", dispName); return; } result = ucol_strcoll(myCollator, source, -1, target, -1); /* result is 1, secondary differences only for ignorable space characters*/ if (result != 1) { log_err("Comparing two strings with only secondary differences in C failed./n"); } /* To compare them with just primary differences */ ucol_setStrength(myCollator, UCOL_PRIMARY); result = ucol_strcoll(myCollator, source, -1, target, -1); /* result is 0 */ if (result != 0) { log_err("Comparing two strings with no differences in C failed./n"); } /* Now, do the same comparison with keys */ sourceKeyOut = ucol_getSortKey(myCollator, source, -1, sourceKeyArray, 100); targetKeyOut = ucol_getSortKey(myCollator, target, -1, targetKeyArray, 100); bufferLen = ((targetKeyOut > 100) ? 100 : targetKeyOut); if (memcmp(sourceKeyArray, targetKeyArray, bufferLen) != 0) { log_err("Comparing two strings with sort keys in C failed./n"); } ucol_close(myCollator);}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:50,
示例11: on_unloadvoidon_unload(ErlNifEnv* env, void* priv_data){ couch_ejson_global_ctx_t *globalCtx = (couch_ejson_global_ctx_t *) priv_data; int i; for (i = 0; i < globalCtx->numCollators; i++) { ucol_close(globalCtx->collators[i]); } enif_free(globalCtx->collators); enif_mutex_destroy(globalCtx->collMutex); enif_free(globalCtx);}
开发者ID:aatwgen,项目名称:couchdb,代码行数:14,
示例12: ucol_res_cleanupU_CDECL_BEGINstatic UBool U_CALLCONVucol_res_cleanup(void){ if (UCA_DATA_MEM) { udata_close(UCA_DATA_MEM); UCA_DATA_MEM = NULL; } if (_staticUCA) { ucol_close(_staticUCA); _staticUCA = NULL; } return TRUE;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:14,
示例13: ASSERTvoid IntlCollator::createCollator(ExecState& state){ ASSERT(!m_collator); if (!m_initializedCollator) { initializeCollator(state, jsUndefined(), jsUndefined()); ASSERT(!state.hadException()); } UErrorCode status = U_ZERO_ERROR; UCollator* collator = 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, UCOL_STRENGTH, strength, &status); ucol_setAttribute(collator, UCOL_CASE_LEVEL, caseLevel, &status); ucol_setAttribute(collator, 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, 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, UCOL_NORMALIZATION_MODE, UCOL_ON, &status); if (U_FAILURE(status)) { ucol_close(collator); return; } m_collator = collator;}
开发者ID:EthanK28,项目名称:webkit,代码行数:50,
示例14: mainint main() { UErrorCode status = U_ZERO_ERROR; UCollator *coll = ucol_open(0, &status); ucol_setStrength(coll, UCOL_PRIMARY); for (int i = 0; i < PASSES; ++i) { UCollationResult coll_res = ucol_strcollUTF8(coll, INPUT1, -1, INPUT2, -1, &status); (void)(coll_res); } ucol_close(coll); return 0;}
开发者ID:nextgis-borsch,项目名称:lib_nunicode,代码行数:14,
示例15: icu_chain_destroyvoid icu_chain_destroy(struct icu_chain *chain){ if (chain) { if (chain->coll) ucol_close(chain->coll); if (chain->iter) icu_iter_destroy(chain->iter); icu_chain_step_destroy(chain->csteps); xfree(chain->locale); xfree(chain); }}
开发者ID:dcrossleyau,项目名称:yaz,代码行数:14,
示例16: ucol_closensresult nsCollationMacUC::CleanUpCollator(void){ if (mHasCollator) { if (mUseICU) { ucol_close(mCollatorICU); mHasCollator = false; } else { OSStatus err = ::UCDisposeCollator(&mCollator); mHasCollator = false; NS_ENSURE_TRUE((err == noErr), NS_ERROR_FAILURE); } } return NS_OK;}
开发者ID:Acidburn0zzz,项目名称:tor-browser,代码行数:15,
示例17: genericLocaleStarterWithResultvoid genericLocaleStarterWithResult(const char *locale, const char * const s[], uint32_t size, UCollationResult result) { UErrorCode status = U_ZERO_ERROR; UCollator *coll = ucol_open(locale, &status); log_verbose("Locale starter for %s/n", locale); if(U_SUCCESS(status)) { genericOrderingTestWithResult(coll, s, size, result); } else if(status == U_FILE_ACCESS_ERROR) { log_data_err("Is your data around?/n"); return; } else { log_err("Unable to open collator for locale %s/n", locale); } ucol_close(coll);}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:16,
|