这篇教程C++ uprv_strcmp函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uprv_strcmp函数的典型用法代码示例。如果您正苦于以下问题:C++ uprv_strcmp函数的具体用法?C++ uprv_strcmp怎么用?C++ uprv_strcmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uprv_strcmp函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: getCutoffTypeFromString // Translate "before" to CUTOFF_TYPE_BEFORE, for example. static CutoffType getCutoffTypeFromString(const char *type_str) { if (uprv_strcmp(type_str, "from") == 0) { return CUTOFF_TYPE_FROM; } else if (uprv_strcmp(type_str, "before") == 0) { return CUTOFF_TYPE_BEFORE; } else if (uprv_strcmp(type_str, "after") == 0) { return CUTOFF_TYPE_AFTER; } else if (uprv_strcmp(type_str, "at") == 0) { return CUTOFF_TYPE_AT; } else { return CUTOFF_TYPE_UNKNOWN; } }
开发者ID:icu-project,项目名称:icu4c,代码行数:14,
示例2: string_write_java/* Writing Functions */static void string_write_java(struct SResource *res,UErrorCode *status) { if(uprv_strcmp(srBundle->fKeys+res->fKey,"%%UCARULES")==0 ){ char fileName[1024] ={0}; const char* file = "UCARules.utf8"; FileStream* datFile = NULL; const char* type = "new ICUListResourceBundle.ResourceString("; char* dest = (char*) uprv_malloc( 8 * res->u.fString.fLength); int32_t len = 0; if(outDir){ uprv_strcat(fileName,outDir); if(outDir[uprv_strlen(outDir)-1]!=U_FILE_SEP_CHAR){ uprv_strcat(fileName,U_FILE_SEP_STRING); } } uprv_strcat(fileName,file);/* UCARULES.utf8 UTF-8 file */ write_tabs(out); T_FileStream_write(out, type, (int32_t)uprv_strlen(type)); T_FileStream_write(out, "/"", 1); T_FileStream_write(out, file, (int32_t)uprv_strlen(file)); T_FileStream_write(out, "/")/n", 3); datFile=T_FileStream_open(fileName,"w"); if(!dest){ *status=U_MEMORY_ALLOCATION_ERROR; } u_strToUTF8(dest,8*res->u.fString.fLength,&len,res->u.fString.fChars,res->u.fString.fLength,status); if(U_FAILURE(*status)){ T_FileStream_close(datFile); uprv_free(dest); return; } T_FileStream_write(datFile,dest,len); T_FileStream_close(datFile); uprv_free(dest); }else{ str_write_java(res->u.fString.fChars,res->u.fString.fLength,TRUE,status); if(uprv_strcmp(srBundle->fKeys+res->fKey,"Rule")==0){ UChar* buf = (UChar*) uprv_malloc(sizeof(UChar)*res->u.fString.fLength); uprv_memcpy(buf,res->u.fString.fChars,res->u.fString.fLength); uprv_free(buf); } }}
开发者ID:gitpan,项目名称:ponie,代码行数:51,
示例3: langTypeFromLocaleAlphabeticIndex::ELangType AlphabeticIndex::langTypeFromLocale(const Locale &loc) { const char *lang = loc.getLanguage(); if (uprv_strcmp(lang, "zh") != 0) { return kNormal; } const char *script = loc.getScript(); if (uprv_strcmp(script, "Hant") == 0) { return kTraditional; } const char *country = loc.getCountry(); if (uprv_strcmp(country, "TW") == 0) { return kTraditional; } return kSimplified;}
开发者ID:0omega,项目名称:platform_external_icu4c,代码行数:15,
示例4: uprv_strcmpUBoolDecimalFormatSymbols::operator==(const DecimalFormatSymbols& that) const{ if (this == &that) { return TRUE; } for(int32_t i = 0; i < (int32_t)kFormatSymbolCount; ++i) { if(fSymbols[(ENumberFormatSymbol)i] != that.fSymbols[(ENumberFormatSymbol)i]) { return FALSE; } } return locale == that.locale && uprv_strcmp(validLocale, that.validLocale) == 0 && uprv_strcmp(actualLocale, that.actualLocale) == 0;}
开发者ID:TheTypoMaster,项目名称:patch-hosting-for-android-x86-support,代码行数:15,
示例5: initSingletons// UInitOnce singleton initialization functionstatic void U_CALLCONV initSingletons(const char *what, UErrorCode &errorCode) {#if !NORM2_HARDCODE_NFC_DATA if (uprv_strcmp(what, "nfc") == 0) { nfcSingleton = Norm2AllModes::createInstance(NULL, "nfc", errorCode); } else#endif if (uprv_strcmp(what, "nfkc") == 0) { nfkcSingleton = Norm2AllModes::createInstance(NULL, "nfkc", errorCode); } else if (uprv_strcmp(what, "nfkc_cf") == 0) { nfkc_cfSingleton = Norm2AllModes::createInstance(NULL, "nfkc_cf", errorCode); } else { U_ASSERT(FALSE); // Unknown singleton } ucln_common_registerCleanup(UCLN_COMMON_LOADED_NORMALIZER2, uprv_loaded_normalizer2_cleanup);}
开发者ID:JoeDoyle23,项目名称:node,代码行数:16,
示例6: setlocale/* Return just the POSIX id, whatever happens to be in it */static const char *uprv_getPOSIXID(void){ static const char* posixID = NULL; if (posixID == 0) { /* * On Solaris two different calls to setlocale can result in * different values. Only get this value once. * * We must check this first because an application can set this. * * LC_ALL can't be used because it's platform dependent. The LANG * environment variable seems to affect LC_CTYPE variable by default. * Here is what setlocale(LC_ALL, NULL) can return. * HPUX can return 'C C C C C C C' * Solaris can return /en_US/C/C/C/C/C on the second try. * Linux can return LC_CTYPE=C;LC_NUMERIC=C;... * * The default codepage detection also needs to use LC_CTYPE. * * Do not call setlocale(LC_*, "")! Using an empty string instead * of NULL, will modify the libc behavior. */ posixID = setlocale(LC_CTYPE, NULL); if ((posixID == 0) || (uprv_strcmp("C", posixID) == 0) || (uprv_strcmp("POSIX", posixID) == 0)) { /* Maybe we got some garbage. Try something more reasonable */ posixID = getenv("LC_ALL"); if (posixID == 0) { posixID = getenv("LC_CTYPE"); if (posixID == 0) { posixID = getenv("LANG"); } } } if ((posixID==0) || (uprv_strcmp("C", posixID) == 0) || (uprv_strcmp("POSIX", posixID) == 0)) { /* Nothing worked. Give it a nice POSIX default value. */ posixID = "en_US_POSIX"; } } return posixID;}
开发者ID:mathtexts,项目名称:uimacpp,代码行数:49,
示例7: idForLocalestatic voididForLocale(const char* locale, char* buffer, int capacity, UErrorCode* ec){ // !!! this is internal only, assumes buffer is not null and capacity is sufficient // Extract the country name and variant name. We only // recognize two variant names, EURO and PREEURO. char variant[ULOC_FULLNAME_CAPACITY]; uloc_getCountry(locale, buffer, capacity, ec); uloc_getVariant(locale, variant, sizeof(variant), ec); if (0 == uprv_strcmp(variant, VAR_PRE_EURO) || 0 == uprv_strcmp(variant, VAR_EURO)) { uprv_strcat(buffer, VAR_DELIM); uprv_strcat(buffer, variant); }}
开发者ID:gitpan,项目名称:ponie,代码行数:16,
示例8: ures_compareRowsstatic int32_tures_compareRows(const void * context, const void * left, const void * right){ const char * keyChars = (const char *)context; return (int32_t)uprv_strcmp(keyChars + ((const Row *)left)->keyIndex, keyChars + ((const Row *)right)->keyIndex);}
开发者ID:Botyto,项目名称:Core,代码行数:7,
示例9: u_locbund_initU_CAPI ULocaleBundle *u_locbund_init(ULocaleBundle *result, const char *loc){ int32_t len; if(result == 0) return 0; if (loc == NULL) { loc = uloc_getDefault(); } uprv_memset(result, 0, sizeof(ULocaleBundle)); len = (int32_t)strlen(loc); result->fLocale = (char*) uprv_malloc(len + 1); if(result->fLocale == 0) { return 0; } uprv_strcpy(result->fLocale, loc); result->isInvariantLocale = uprv_strcmp(result->fLocale, "en_US_POSIX") == 0; return result;}
开发者ID:icu-project,项目名称:icu4c,代码行数:26,
示例10: ustrValueUnicodeString&LocaleDisplayNamesImpl::keyValueDisplayName(const char* key, const char* value, UnicodeString& result, UBool skipAdjust) const { if (uprv_strcmp(key, "currency") == 0) { // ICU4C does not have ICU4J CurrencyDisplayInfo equivalent for now. UErrorCode sts = U_ZERO_ERROR; UnicodeString ustrValue(value, -1, US_INV); int32_t len; UBool isChoice = FALSE; const UChar *currencyName = ucurr_getName(ustrValue.getTerminatedBuffer(), locale.getBaseName(), UCURR_LONG_NAME, &isChoice, &len, &sts); if (U_FAILURE(sts)) { // Return the value as is on failure result = ustrValue; return result; } result.setTo(currencyName, len); return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKeyValue, result); } if (nameLength == UDISPCTX_LENGTH_SHORT) { langData.get("Types%short", key, value, result); if (!result.isBogus()) { return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKeyValue, result); } } langData.get("Types", key, value, result); return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKeyValue, result);}
开发者ID:119120119,项目名称:node,代码行数:31,
示例11: getLocaleIDUBool MeasureFormat::operator==(const Format &other) const { if (this == &other) { // Same object, equal return TRUE; } if (!Format::operator==(other)) { return FALSE; } const MeasureFormat &rhs = static_cast<const MeasureFormat &>(other); // Note: Since the ListFormatter depends only on Locale and width, we // don't have to check it here. // differing widths aren't equivalent if (fWidth != rhs.fWidth) { return FALSE; } // Width the same check locales. // We don't need to check locales if both objects have same cache. if (cache != rhs.cache) { UErrorCode status = U_ZERO_ERROR; const char *localeId = getLocaleID(status); const char *rhsLocaleId = rhs.getLocaleID(status); if (U_FAILURE(status)) { // On failure, assume not equal return FALSE; } if (uprv_strcmp(localeId, rhsLocaleId) != 0) { return FALSE; } } // Locales same, check NumberFormat if shared data differs. return ( numberFormat == rhs.numberFormat || **numberFormat == **rhs.numberFormat);}
开发者ID:winlibs,项目名称:icu4c,代码行数:35,
示例12: compareToCEntriesU_CDECL_BEGINstatic int32_t U_CALLCONVcompareToCEntries(const void *context, const void *left, const void *right) { const char *chars=(const char *)context; return (int32_t)uprv_strcmp(chars+((const ToCEntry *)left)->nameOffset, chars+((const ToCEntry *)right)->nameOffset);}
开发者ID:andrewleech,项目名称:firebird,代码行数:7,
示例13: dotestconvstatic int dotestconv(const char *name, const char *standard, const char *expected) { int res = 1; UErrorCode error; const char *tag; error = U_ZERO_ERROR; tag = ucnv_getCanonicalName(name, standard, &error); if (tag && !expected) { log_err("FAIL: Unexpectedly found %s canonical name for %s, got %s/n", standard, name, tag); res = 0; } else if (!tag && expected) { log_err_status(error, "FAIL: could not find %s canonical name for %s/n", (standard ? "/"/"" : standard), name); res = 0; } else if (expected && (name == tag || uprv_strcmp(expected, tag) != 0)) { log_err("FAIL: expected %s for %s canonical name for %s, got %s/n", expected, standard, name, tag); res = 0; } else { log_verbose("PASS: (/"%s/", /"%s/") -> %s == %s /n", name, standard, tag, expected); } return res;}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:26,
示例14: U_ASSERTvoid UnifiedCacheThread::exerciseByLocale(const Locale &locale) { UErrorCode status = U_ZERO_ERROR; const UCTMultiThreadItem *origItem = NULL; fCache->get( LocaleCacheKey<UCTMultiThreadItem>(locale), fCache, origItem, status); U_ASSERT(U_SUCCESS(status)); if (uprv_strcmp(locale.getLanguage(), origItem->value)) { IntlTest::gTest->errln( "%s:%d Expected %s, got %s", __FILE__, __LINE__, locale.getLanguage(), origItem->value); } // Fetch the same item again many times. We should always get the same // pointer since this client is already holding onto it for (int32_t i = 0; i < 1000; ++i) { const UCTMultiThreadItem *item = NULL; fCache->get( LocaleCacheKey<UCTMultiThreadItem>(locale), fCache, item, status); if (item != origItem) { IntlTest::gTest->errln( "%s:%d Expected to get the same pointer", __FILE__, __LINE__); } if (item != NULL) { item->removeRef(); } } origItem->removeRef();}
开发者ID:Cyril2004,项目名称:proto-quic,代码行数:31,
示例15: loglnvoid CalendarLimitTest::TestLimitsThread(int32_t threadNum) { logln("thread %d starting", threadNum); int32_t testIndex = 0; LocalPointer<Calendar> cal; while (gTestCaseIterator.next(testIndex)) { TestCase &testCase = TestCases[testIndex]; logln("begin test of %s calendar.", testCase.type); UErrorCode status = U_ZERO_ERROR; char buf[64]; uprv_strcpy(buf, "[email C++ uprv_strlen函数代码示例 C++ uprv_strcat函数代码示例
|