这篇教程C++ u_strcmp函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中u_strcmp函数的典型用法代码示例。如果您正苦于以下问题:C++ u_strcmp函数的具体用法?C++ u_strcmp怎么用?C++ u_strcmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了u_strcmp函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: engine_bin_whole_line_matchstatic engine_return_t engine_bin_whole_line_match(error_t **UNUSED(error), void *data, const UString *subject){ FETCH_DATA(data, p, bin_pattern_t); /* If search is case insensitive, we don't do case folding here, u_strcasecmp suffice (it does full case folding internally) */ if (ustring_empty(p->pattern)) { return ustring_empty(subject) ? ENGINE_WHOLE_LINE_MATCH : ENGINE_NO_MATCH; } else { if (IS_CASE_INSENSITIVE(p->flags)) { return (0 == u_strcasecmp(p->pattern->ptr, subject->ptr, 0) ? ENGINE_WHOLE_LINE_MATCH : ENGINE_NO_MATCH); } else { return (0 == u_strcmp(p->pattern->ptr, subject->ptr) ? ENGINE_WHOLE_LINE_MATCH : ENGINE_NO_MATCH); } }}
开发者ID:julp,项目名称:ugrep,代码行数:15,
示例2: remove_keywordvoid remove_keyword(unichar* keyword,struct string_hash_ptr* keywords) {unichar* lower=u_strdup(keyword);u_tolower(lower);KeyWord* k=(KeyWord*)get_value(lower,keywords);free(lower);if (k==NULL) return;while (k!=NULL) { if (k->sequence!=NULL && !u_strcmp(keyword,k->sequence)) { free(k->sequence); k->sequence=NULL; return; } k=k->next;}}
开发者ID:anukat2015,项目名称:unitex-core,代码行数:15,
示例3: TestMessageFormatWithValist/* Test u_vformatMessage() with various test patterns. */static void TestMessageFormatWithValist( void ) { UChar *str; UChar* result; int32_t resultLengthOut,resultlength,i, patternlength; UErrorCode status = U_ZERO_ERROR; UDate d1=1000000000.0; ctest_setTimeZone(NULL, &status); str=(UChar*)malloc(sizeof(UChar) * 7); u_uastrcpy(str, "MyDisk"); resultlength=1; result=(UChar*)malloc(sizeof(UChar) * 1); log_verbose("Testing u_formatMessage90/n"); InitStrings(); for (i = 0; i < cnt_testCases; i++) { status=U_ZERO_ERROR; patternlength=u_strlen(testCasePatterns[i]); resultLengthOut=CallFormatMessage( "en_US",testCasePatterns[i], patternlength, result, resultlength, &status, 1, 3456.00, d1); if(status== U_BUFFER_OVERFLOW_ERROR) { status=U_ZERO_ERROR; resultlength=resultLengthOut+1; result=(UChar*)realloc(result,sizeof(UChar) * resultlength); CallFormatMessage( "en_US",testCasePatterns[i], patternlength, result, resultlength, &status, 1, 3456.00, d1); } if(U_FAILURE(status)){ log_data_err("ERROR: failure in message format on testcase %d: %s (Are you missing data?)/n", i, myErrorName(status) ); } else if(u_strcmp(result, testResultStrings[i])==0){ log_verbose("PASS: MessagFormat successful on testcase : %d/n", i); } else{ log_err("FAIL: Error in MessageFormat on testcase : %d/n GOT %s EXPECTED %s/n", i, austrdup(result), austrdup(testResultStrings[i]) ); } } free(result); free(str); FreeStrings(); ctest_resetTimeZone();}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:48,
示例4: cache_match_internal/** * Caches the given token sequence in the given cache. Note that * match is supposed to contain a single match, not a match list. */static void cache_match_internal(struct match_list* match,const int* tab,int start,int end,LocateCache *c,Abstract_allocator prv_alloc) {int token=-1;struct match_list* m=match;if (start<=end) { token=tab[start]; m=NULL;}/* No node */if (*c==NULL) { *c=new_LocateCache(token,m,prv_alloc); if (token!=-1) { cache_match_internal(match,tab,start+1,end,&((*c)->middle),prv_alloc); } return;}/* There is a node */if (token<(*c)->token) { /* If we have to move on the left */ return cache_match_internal(match,tab,start,end,&((*c)->left),prv_alloc);}if (token>(*c)->token) { /* If we have to move on the right */ return cache_match_internal(match,tab,start,end,&((*c)->right),prv_alloc);}/* We have the correct token */if (token==-1) { /* If we are in a final node that already existed, we just add * the new match at the end of the match list to get the same match order as * if the cache system had not been used, but only if the match is not already present */ struct match_list* *ptr=&((*c)->matches); struct match_list* z; match->next=NULL; while ((*ptr)!=NULL) { z=*ptr; if (compare_matches(&(z->m),&(match->m))==A_EQUALS_B && !u_strcmp(z->output,match->output)) { /* We discard a match that was already in cache */ free_match_list_element(match,prv_alloc); return; } ptr=&((*ptr)->next); } (*ptr)=match; return;}cache_match_internal(match,tab,start+1,end,&((*c)->middle),prv_alloc);}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:51,
示例5: doTestUCharNamesstatic UBool doTestUCharNames(const char *name, const char *standard, const char **expected, int32_t size) { UErrorCode err = U_ZERO_ERROR; UEnumeration *myEnum = ucnv_openStandardNames(name, standard, &err); int32_t enumCount = uenum_count(myEnum, &err); int32_t idx, repeatTimes = 3; if (err == U_FILE_ACCESS_ERROR) { log_data_err("Unable to open standard names for %s of standard: %s/n", name, standard); return 0; } if (size != enumCount) { log_err("FAIL: different size arrays. Got %d. Expected %d/n", enumCount, size); return 0; } if (size < 0 && myEnum) { log_err("FAIL: size < 0, but recieved an actual object/n"); return 0; } log_verbose("/n%s %s/n", name, standard); while (repeatTimes-- > 0) { for (idx = 0; idx < enumCount; idx++) { UChar testName[256]; int32_t len; const UChar *enumName = uenum_unext(myEnum, &len, &err); u_uastrncpy(testName, expected[idx], UPRV_LENGTHOF(testName)); if (u_strcmp(enumName, testName) != 0 || U_FAILURE(err) || len != (int32_t)uprv_strlen(expected[idx])) { log_err("FAIL: uenum_next(%d) == /"%s/". expected /"%s/", len=%d, error=%s/n", idx, enumName, testName, len, u_errorName(err)); } log_verbose("%s/n", expected[idx]); err = U_ZERO_ERROR; } log_verbose("/n reset/n"); uenum_reset(myEnum, &err); if (U_FAILURE(err)) { log_err("FAIL: uenum_reset() for %s{%s} failed with %s/n", name, standard, u_errorName(err)); err = U_ZERO_ERROR; } } uenum_close(myEnum); return 1;}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:46,
示例6: set_dic_variable/** * Sets the given dic variable, inserting it in the variable list if absent. */void set_dic_variable(const unichar* name,struct dela_entry* dic_entry,struct dic_variable* *list,int must_clone) {while (*list!=NULL) { if (!u_strcmp((*list)->name,name)) { /* If we have found the variable we were looking for */ /* We have to free the previous value */ free_dela_entry((*list)->dic_entry); if (must_clone) { (*list)->dic_entry=clone_dela_entry(dic_entry); } else { (*list)->dic_entry=dic_entry; } return; } list=&((*list)->next);}*list=new_dic_variable(name,dic_entry,NULL,must_clone);}
开发者ID:anukat2015,项目名称:unitex-core,代码行数:20,
示例7: Wordlist_selectionsEqualbool Wordlist_selectionsEqual( unichar_t* s1, unichar_t* s2 ){ static unichar_t s1stripped[ PATH_MAX ]; static unichar_t s2stripped[ PATH_MAX ]; int s1HasSelection = 0; int s2HasSelection = 0; u_strcpy( s1stripped, Wordlist_selectionStringOnly( s1, &s1HasSelection )); u_strcpy( s2stripped, Wordlist_selectionStringOnly( s2, &s2HasSelection )); if( s1HasSelection && !s2HasSelection ) return false; if( !s1HasSelection && s2HasSelection ) return false; return !u_strcmp( s1stripped, s2stripped );}
开发者ID:jtanx,项目名称:fontforge,代码行数:17,
示例8: ncnfArgExtractor::ArgExtractor(const NumberFormat& nf, const Formattable& obj, UErrorCode& status) : ncnf((NumberFormat*) &nf), num(&obj), setCurr(FALSE) { const UObject* o = obj.getObject(); // most commonly o==NULL const CurrencyAmount* amt; if (o != NULL && (amt = dynamic_cast<const CurrencyAmount*>(o)) != NULL) { // getISOCurrency() returns a pointer to internal storage, so we // copy it to retain it across the call to setCurrency(). const UChar* curr = amt->getISOCurrency(); u_strcpy(save, nf.getCurrency()); setCurr = (u_strcmp(curr, save) != 0); if (setCurr) { ncnf->setCurrency(curr, status); } num = &amt->getNumber(); }}
开发者ID:Ashod,项目名称:WinCairoRequirements,代码行数:17,
示例9: TestMessageWithUnusedArgNumberstatic void TestMessageWithUnusedArgNumber() { UErrorCode errorCode = U_ZERO_ERROR; U_STRING_DECL(pattern, "abc {1} def", 11); UChar x[2] = { 0x78, 0 }; // "x" UChar y[2] = { 0x79, 0 }; // "y" U_STRING_DECL(expected, "abc y def", 9); UChar result[20]; int32_t length; U_STRING_INIT(pattern, "abc {1} def", 11); U_STRING_INIT(expected, "abc y def", 9); length = u_formatMessage("en", pattern, -1, result, LENGTHOF(result), &errorCode, x, y); if (U_FAILURE(errorCode) || length != u_strlen(expected) || u_strcmp(result, expected) != 0) { log_err("u_formatMessage(pattern with only {1}, 2 args) failed: result length %d, UErrorCode %s /n", (int)length, u_errorName(errorCode)); }}
开发者ID:Congle,项目名称:platform_external_icu4c,代码行数:17,
示例10: is_entry_compatible_with_pattern/** * Returns 1 if the given DELAF entry is compatible with the given pattern; * 0 otherwise. */int is_entry_compatible_with_pattern(const struct dela_entry* entry,const struct pattern* pattern) {switch(pattern->type) { case LEMMA_PATTERN: return (!u_strcmp(entry->lemma,pattern->lemma)); case CODE_PATTERN: return is_compatible_code_pattern(entry,pattern); case LEMMA_AND_CODE_PATTERN: return (!u_strcmp(entry->lemma,pattern->lemma)) && is_compatible_code_pattern(entry,pattern); case FULL_PATTERN: return (!u_strcmp(entry->inflected,pattern->inflected)) && (!u_strcmp(entry->lemma,pattern->lemma)) && is_compatible_code_pattern(entry,pattern); case AMBIGUOUS_PATTERN: return !u_strcmp(entry->lemma,pattern->lemma) || dic_entry_contain_gram_code(entry,pattern->lemma); case INFLECTED_AND_LEMMA_PATTERN: return (!u_strcmp(entry->inflected,pattern->inflected)) && (!u_strcmp(entry->lemma,pattern->lemma)); default: fatal_error("Unexpected case in is_entry_compatible_with_pattern/n");}return 0;}
开发者ID:anukat2015,项目名称:unitex-core,代码行数:16,
示例11: unif_desinstantiate//////////////////////////////////////////////////////////////////////////////////// Desinstantiates the unification variable "var". int unif_desinstantiate(MultiFlex_ctx* p_multiFlex_ctx,unichar* var) { int v, w, found; found = 0; for (v=0; v<(p_multiFlex_ctx->UNIF_VARS).no_vars; v++) if (!u_strcmp(var,(p_multiFlex_ctx->UNIF_VARS).vars[v].id)) { found = 1; break; } // if found v points to the variable following the one we want to eliminate if (found) { free((p_multiFlex_ctx->UNIF_VARS).vars[v].id); for (w=v+1; w<(p_multiFlex_ctx->UNIF_VARS).no_vars;w++) (p_multiFlex_ctx->UNIF_VARS).vars[w-1] = (p_multiFlex_ctx->UNIF_VARS).vars[w]; (p_multiFlex_ctx->UNIF_VARS).no_vars--; } return 0;}
开发者ID:adri87,项目名称:Q-A,代码行数:20,
示例12: hashset_get/** * Get the id of the given property or 0 if not there * @param hs the hashset in question * @param prop the property to find * @return id > 0 if found, else 0 */int hashset_get( hashset *hs, UChar *prop ){ unsigned slot = hash(prop, u_strlen(prop))%(unsigned)hs->num_buckets; if ( hs->buckets[slot] == NULL ) return 0; else { struct hs_bucket *b = hs->buckets[slot]; while ( b != NULL ) { if ( u_strcmp(b->key,prop)==0 ) return b->id; b = b->next; } return 0; }}
开发者ID:Ecdosis,项目名称:calliope,代码行数:24,
示例13: unif_desinstantiate//////////////////////////////////////////////////////////////////////////////////// Desinstantiates the unification variable "var". int unif_desinstantiate(unif_vars_T* UNIF_VARS,unichar* var) { int v, w, found; found = 0; for (v=0; v<UNIF_VARS->no_vars; v++) if (!u_strcmp(var,UNIF_VARS->vars[v].id)) { found = 1; break; } // if found v points to the variable following the one we want to eliminate if (found) { free(UNIF_VARS->vars[v].id); for (w=v+1; w<UNIF_VARS->no_vars;w++) UNIF_VARS->vars[w-1] = UNIF_VARS->vars[w]; UNIF_VARS->no_vars--; } return 0;}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:20,
示例14: TestCurrency/** * Test localized currency patterns. */static void TestCurrency(void){ UNumberFormat *currencyFmt; UChar *str; int32_t lneed, i; UFieldPosition pos; UChar res[100]; UErrorCode status = U_ZERO_ERROR; const char* locale[]={"fr_CA", "de_DE_PREEURO", "fr_FR_PREEURO"}; const char* result[]={"1,50//u00a0$", "1,50//u00a0DM", "1,50//u00a0F"}; log_verbose("/nTesting the number format with different currency patterns/n"); for(i=0; i < 3; i++) { str=NULL; currencyFmt = unum_open(UNUM_CURRENCY, NULL,0,locale[i],NULL, &status); if(U_FAILURE(status)){ log_data_err("Error in the construction of number format with style currency: %s (Are you missing data?)/n", myErrorName(status)); } else { lneed=0; lneed= unum_formatDouble(currencyFmt, 1.50, NULL, lneed, NULL, &status); if(status==U_BUFFER_OVERFLOW_ERROR){ status=U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); pos.field = 0; unum_formatDouble(currencyFmt, 1.50, str, lneed+1, &pos, &status); } if(U_FAILURE(status)) { log_err("Error in formatting using unum_formatDouble(.....): %s/n", myErrorName(status) ); } else { u_unescape(result[i], res, (int32_t)strlen(result[i])+1); if (u_strcmp(str, res) != 0){ log_err("FAIL: Expected %s Got: %s for locale: %s/n", result[i], aescstrdup(str, -1), locale[i]); } } } unum_close(currencyFmt); free(str); }}
开发者ID:winlibs,项目名称:icu4c,代码行数:47,
示例15: isEuroAwareUBool isEuroAware(UConverter* myConv){ static const UChar euroString[2] = { 0x20AC, 0x0000 }; char target[20]; UChar euroBack[2]; int32_t targetSize, euroBackSize; UErrorCode err = U_ZERO_ERROR; /*const char* myName = ucnv_getName(myConv, &err);*/ targetSize = ucnv_fromUChars(myConv, target, sizeof(target), euroString, -1, &err); if (U_FAILURE(err)) { log_err("Failure Occured in ucnv_fromUChars euro roundtrip test/n"); return FALSE; } euroBackSize = ucnv_toUChars(myConv, euroBack, 2, target, targetSize, &err); if (U_FAILURE(err)) { log_err("Failure Occured in ucnv_toUChars euro roundtrip test/n"); return FALSE; } if (u_strcmp(euroString, euroBack)) { /* log_err("%s FAILED Euro rountrip/n", myName);*/ return FALSE; } else { /* log_verbose("%s PASSED Euro rountrip/n", myName);*/ return TRUE; }}
开发者ID:mason105,项目名称:red5cpp,代码行数:43,
示例16: argUnicodeString&NumberFormat::format(const Formattable& obj, UnicodeString& appendTo, FieldPositionIterator* posIter, UErrorCode& status) const{ if (U_FAILURE(status)) return appendTo; ArgExtractor arg(*this, obj, status); const Formattable *n = arg.number(); const UChar *iso = arg.iso(); if(arg.wasCurrency() && u_strcmp(iso, getCurrency())) { // trying to format a different currency. // Right now, we clone. LocalPointer<NumberFormat> cloneFmt((NumberFormat*)this->clone()); cloneFmt->setCurrency(iso, status); // next line should NOT recurse, because n is numeric whereas obj was a wrapper around currency amount. return cloneFmt->format(*n, appendTo, posIter, status); } if (n->isNumeric() && n->getDigitList() != NULL) { // Decimal Number format(*n->getDigitList(), appendTo, posIter, status); } else { switch (n->getType()) { case Formattable::kDouble: format(n->getDouble(), appendTo, posIter, status); break; case Formattable::kLong: format(n->getLong(), appendTo, posIter, status); break; case Formattable::kInt64: format(n->getInt64(), appendTo, posIter, status); break; default: status = U_INVALID_FORMAT_ERROR; break; } } return appendTo;}
开发者ID:balagopalraj,项目名称:clearlinux,代码行数:43,
示例17: compare_variables/** * This function compares two variables. Input and output variables are * considered as text content. For dictionary variables, it's the inflected * form that is taken into account. * * Note 1: you can compare variables of different kinds * Note 2: you can compare a variable to a constant string. To do that, the string * must start with # */int compare_variables(const unichar* var1,const unichar* var2,struct locate_parameters* p,int case_matters) {int free_v1;unichar* v1=get_var_content_str(var1,p,&free_v1);if (!v1) { return VAR_CMP_ERROR;}int free_v2;unichar* v2=get_var_content_str(var2,p,&free_v2);if (!v2) { if (free_v1) free(v1); return VAR_CMP_ERROR;}int ret=case_matters?u_strcmp(v1,v2):u_strcmp_ignore_case(v1,v2);if (free_v1) free(v1);if (free_v2) free(v2);if (ret==0) { return VAR_CMP_EQUAL;}return VAR_CMP_DIFF;}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:29,
示例18: MessageLengthstatic void MessageLength(void){ UErrorCode status = U_ZERO_ERROR; const char patChars[] = {"123{0}456{0}"}; const char expectedChars[] = {"123abc"}; UChar pattern[sizeof(patChars)]; UChar arg[] = {0x61,0x62,0x63,0}; UChar result[128] = {0}; UChar expected[sizeof(expectedChars)]; u_uastrncpy(pattern, patChars, sizeof(pattern)/sizeof(pattern[0])); u_uastrncpy(expected, expectedChars, sizeof(expected)/sizeof(expected[0])); u_formatMessage("en_US", pattern, 6, result, sizeof(result)/sizeof(result[0]), &status, arg); if (U_FAILURE(status)) { log_err("u_formatMessage method failed. Error: %s /n",u_errorName(status)); } if (u_strcmp(result, expected) != 0) { log_err("u_formatMessage didn't return expected result/n"); }}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:21,
示例19: VerifysetSymbolsstatic void VerifysetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, int32_t idx, const char* expected){ UChar *result=NULL; UChar *value=NULL; int32_t resultlength, resultlengthout; UErrorCode status = U_ZERO_ERROR; value=(UChar*)malloc(sizeof(UChar) * (strlen(expected) + 1)); u_uastrcpy(value, expected); udat_setSymbols(datfor, type, idx, value, u_strlen(value), &status); if(U_FAILURE(status)) { log_err("FAIL: Error in udat_setSymbols() %s/n", myErrorName(status) ); return; } resultlength=0; resultlengthout=udat_getSymbols(datfor, type, idx, NULL, resultlength, &status); if(status==U_BUFFER_OVERFLOW_ERROR){ status=U_ZERO_ERROR; resultlength=resultlengthout+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); udat_getSymbols(datfor, type, idx, result, resultlength, &status); } if(U_FAILURE(status)){ log_err("FAIL: error in retrieving the value using getSymbols after setting it previously/n %s/n", myErrorName(status) ); return; } if(u_strcmp(result, value)!=0){ log_err("FAIL:Error in setting and then getting symbols/n Expected %s Got %s/n", austrdup(value), austrdup(result) ); } else log_verbose("PASS: setSymbols successful/n"); free(value); free(result);}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:40,
示例20: mallocunichar *protect_braced_string(const unichar *s){ unichar *result; unichar *stop_sentence; stop_sentence = (unichar*) malloc(sizeof(unichar) * (1 + 1)); if (stop_sentence == NULL) { perror("malloc/n"); fprintf(stderr, "Impossible to allocate memory/n"); exit(1); } u_sprintf(stop_sentence, "S"); if (u_strcmp(stop_sentence, s) == 0) { return stop_sentence; } else { unichar* text = protect_text_in_braced_string(s); unichar* lem = protect_lem_in_braced_string(s); //u_printf("text / lem = %S --- %S/n",text, lem); int length_t = u_strlen(text); int length_l = u_strlen(lem); result = (unichar*) malloc(sizeof(unichar) * (length_t + length_l + 2 + 1)); if (result == NULL) { perror("malloc/n"); fprintf(stderr, "Impossible to allocate memory/n"); exit(1); } u_sprintf(result, "%S,.%S", text, lem); free(lem); free(text); free(stop_sentence); } return result;}
开发者ID:adri87,项目名称:Q-A,代码行数:40,
示例21: matches_E/** * Returns 1 if the given tag does not match anything in the text. * */static int matches_E(Fst2* fst2,int tag_number) {if (tag_number<0) { return 0;}if (tag_number==0) { return 1;}Fst2Tag tag=fst2->tags[tag_number];switch (tag->type) {/* WARNING: this is important not to use a default clause here! * By enumerating all values instead, we make sure that there will * be a compiler warning if one day a new value is added to the enum tag_type * that is not taken into account here. */case UNDEFINED_TAG: // used at initialization of a tagcase META_TAG: // <MOT>, <MIN>, etc.case PATTERN_TAG: // <be.V>case PATTERN_NUMBER_TAG: // used when patterns have been numberedcase TOKEN_LIST_TAG: break; // used when the tag matches a list of tokens. This will/* The following matches E */case BEGIN_VAR_TAG: // $a(case END_VAR_TAG: // $a)case BEGIN_OUTPUT_VAR_TAG: // $|a(case END_OUTPUT_VAR_TAG: // $|a)case BEGIN_POSITIVE_CONTEXT_TAG: // $[case BEGIN_NEGATIVE_CONTEXT_TAG: // $![case END_CONTEXT_TAG: // $]case LEFT_CONTEXT_TAG: // $*case BEGIN_MORPHO_TAG: // $<case END_MORPHO_TAG: // $>case TEXT_START_TAG: // {^}case TEXT_END_TAG: return 1; // {$}}/* Finally, we test if we have a <E> transition with an output */if (!u_strcmp(tag->input,"<E>")) { return 1;}return 0;}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:43,
|