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

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

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

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

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

示例1: split

int32_t FieldsSet::parseFrom(const UnicodeString& str, const                             FieldsSet* inheritFrom, UErrorCode& status) {    int goodFields = 0;    if(U_FAILURE(status)) {        return -1;    }    int32_t destCount = 0;    UnicodeString *dest = split(str, 0x002C /* ',' */, destCount);    for(int i = 0; i < destCount; i += 1) {        int32_t dc = 0;        UnicodeString *kv = split(dest[i], 0x003D /* '=' */, dc);        if(dc != 2) {            it_errln(UnicodeString("dc == ") + dc + UnicodeString("?"));        }        int32_t field = handleParseName(inheritFrom, kv[0], kv[1], status);        if(U_FAILURE(status)) {            char ch[256];            const UChar *u = kv[0].getBuffer();            int32_t len = kv[0].length();            u_UCharsToChars(u, ch, len);            ch[len] = 0; /* include terminating /0 */            it_errln(UnicodeString("Parse Failed: Field ") + UnicodeString(ch) + UnicodeString(", err ") + UnicodeString(u_errorName(status)));            return -1;        }        if(field != -1) {            handleParseValue(inheritFrom, field, kv[1], status);            if(U_FAILURE(status)) {                char ch[256];                const UChar *u = kv[1].getBuffer();                int32_t len = kv[1].length();                u_UCharsToChars(u, ch, len);                ch[len] = 0; /* include terminating /0 */                it_errln(UnicodeString("Parse Failed: Value ") + UnicodeString(ch) + UnicodeString(", err ") + UnicodeString(u_errorName(status)));                return -1;            }            goodFields += 1;        }        delete[] kv;    }    delete[] dest;    return goodFields;}
开发者ID:harrykipper,项目名称:Alcatel_OT_985_kernel,代码行数:55,


示例2: TestJitterbug1098

static 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,


示例3: ures_open

const CompactTrieDictionary *ICULanguageBreakFactory::loadDictionaryFor(UScriptCode script, int32_t /*breakType*/) {    UErrorCode status = U_ZERO_ERROR;    // Open root from brkitr tree.    char dictnbuff[256];    char ext[4]={'/0'};    UResourceBundle *b = ures_open(U_ICUDATA_BRKITR, "", &status);    b = ures_getByKeyWithFallback(b, "dictionaries", b, &status);    b = ures_getByKeyWithFallback(b, uscript_getShortName(script), b, &status);    int32_t dictnlength = 0;    const UChar *dictfname = ures_getString(b, &dictnlength, &status);    if (U_SUCCESS(status) && (size_t)dictnlength >= sizeof(dictnbuff)) {        dictnlength = 0;        status = U_BUFFER_OVERFLOW_ERROR;    }    if (U_SUCCESS(status) && dictfname) {        UChar* extStart=u_strchr(dictfname, 0x002e);        int len = 0;        if(extStart!=NULL){            len = extStart-dictfname;            u_UCharsToChars(extStart+1, ext, sizeof(ext)); // nul terminates the buff            u_UCharsToChars(dictfname, dictnbuff, len);        }        dictnbuff[len]=0; // nul terminate    }    ures_close(b);    UDataMemory *file = udata_open(U_ICUDATA_BRKITR, ext, dictnbuff, &status);    if (U_SUCCESS(status)) {        const CompactTrieDictionary *dict = new CompactTrieDictionary(            file, status);        if (U_SUCCESS(status) && dict == NULL) {            status = U_MEMORY_ALLOCATION_ERROR;        }        if (U_FAILURE(status)) {            delete dict;            dict = NULL;        }        return dict;    } else if (dictfname != NULL){        //create dummy dict if dictionary filename not valid        UChar c = 0x0020;        status = U_ZERO_ERROR;        MutableTrieDictionary *mtd = new MutableTrieDictionary(c, status, TRUE);        mtd->addWord(&c, 1, status, 1);        return new CompactTrieDictionary(*mtd, status);      }    return NULL;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:49,


示例4: u_strlen

const UChar*ZoneMeta::getShortIDFromCanonical(const UChar* canonicalID) {    const UChar* shortID = NULL;    int32_t len = u_strlen(canonicalID);    char tzidKey[ZID_KEY_MAX + 1];    u_UCharsToChars(canonicalID, tzidKey, len);    tzidKey[len] = (char) 0; // Make sure it is null terminated.    // replace '/' with ':'    char *p = tzidKey;    while (*p++) {        if (*p == '/') {            *p = ':';        }    }    UErrorCode status = U_ZERO_ERROR;    UResourceBundle *rb = ures_openDirect(NULL, gKeyTypeData, &status);    ures_getByKey(rb, gTypeMapTag, rb, &status);    ures_getByKey(rb, gTimezoneTag, rb, &status);    shortID = ures_getStringByKey(rb, tzidKey, NULL, &status);    ures_close(rb);    return shortID;}
开发者ID:basti1302,项目名称:node,代码行数:26,


示例5: sizeof

NumberingSystem* U_EXPORT2NumberingSystem::createInstance(const Locale & inLocale, UErrorCode& status) {    char buffer[ULOC_KEYWORDS_CAPACITY];    int32_t count = inLocale.getKeywordValue("numbers",buffer, sizeof(buffer),status);    if ( count > 0 ) { // @numbers keyword was specified in the locale        buffer[count] = '/0'; // Make sure it is null terminated.        return NumberingSystem::createInstanceByName(buffer,status);    } else { // Find the default numbering system for this locale.        LocalUResourceBundlePointer resource(ures_open(NULL, inLocale.getName(), &status));        if (U_FAILURE(status)) {            status = U_USING_FALLBACK_WARNING;            NumberingSystem *ns = new NumberingSystem();            return ns;        }         const UChar *defaultNSName =            ures_getStringByKeyWithFallback(resource.getAlias(), gDefaultNumberingSystem, &count, &status);        if (U_FAILURE(status)) {               return NULL;        }        if ( count > 0 && count < ULOC_KEYWORDS_CAPACITY ) { // Default numbering system found           u_UCharsToChars(defaultNSName,buffer,count);            buffer[count] = '/0'; // Make sure it is null terminated.           return NumberingSystem::createInstanceByName(buffer,status);        } else {            status = U_USING_FALLBACK_WARNING;            NumberingSystem *ns = new NumberingSystem();            return ns;        }            }}
开发者ID:CucasLoon,项目名称:in-the-box,代码行数:32,


示例6: oneUCharToChar

/* This only works for invariant BMP chars */static char oneUCharToChar(UChar32 c) {    UChar ubuf[1];    char buf[1];    ubuf[0] = (UChar) c;    u_UCharsToChars(ubuf, buf, 1);    return buf[0];}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:8,


示例7: create

  virtual UObject* create(const ICUServiceKey& key, const ICUService* /*service*/, UErrorCode& status) const  {  LocaleKey &lkey = (LocaleKey&)key;  Locale loc;  lkey.currentLocale(loc);#ifdef U_DEBUG_CALSVC  fprintf(stderr, "DefaultCalendar factory %p: looking up %s/n",           this, (const char*)loc.getName());#endif  UErrorCode resStatus = U_ZERO_ERROR;  UResourceBundle *rb = ures_open(NULL, (const char*)loc.getName(), &resStatus);#ifdef U_DEBUG_CALSVC  fprintf(stderr, "... ures_open -> %s/n", u_errorName(resStatus));#endif  if(U_FAILURE(resStatus) ||      (resStatus == U_USING_DEFAULT_WARNING) || (resStatus==U_USING_FALLBACK_WARNING)) { //Don't want to handle fallback data.    ures_close(rb);    status = resStatus; // propagate err back to caller#ifdef U_DEBUG_CALSVC    fprintf(stderr, "... exitting (NULL)/n");#endif    return NULL;  }  int32_t len = 0;  UnicodeString myString = ures_getUnicodeStringByKey(rb, Calendar::kDefaultCalendar, &status);#ifdef U_DEBUG_CALSVC  UErrorCode debugStatus = U_ZERO_ERROR;  const UChar *defCal = ures_getStringByKey(rb, Calendar::kDefaultCalendar, &len,  &debugStatus);  fprintf(stderr, "... get string(%d) -> %s/n", len, u_errorName(debugStatus));#endif  ures_close(rb);     if(U_FAILURE(status)) {    return NULL;  } #ifdef U_DEBUG_CALSVC   {     char defCalStr[200];     if(len > 199) {       len = 199;     }     u_UCharsToChars(defCal, defCalStr, len);     defCalStr[len]=0;     fprintf(stderr, "DefaultCalendarFactory: looked up %s, got DefaultCalendar= %s/n",  (const char*)loc.getName(), defCalStr);   }#endif   return myString.clone(); }
开发者ID:gitpan,项目名称:ponie,代码行数:60,


示例8: UMTX_CHECK

const char*TimeZone::getTZDataVersion(UErrorCode& status){    /* This is here to prevent race conditions. */    UBool needsInit;    UMTX_CHECK(&LOCK, !TZDataVersionInitialized, needsInit);    if (needsInit) {        int32_t len = 0;        UResourceBundle *bundle = ures_openDirect(NULL, "zoneinfo", &status);        const UChar *tzver = ures_getStringByKey(bundle, "TZVersion",            &len, &status);        if (U_SUCCESS(status)) {            if (len >= (int32_t)sizeof(TZDATA_VERSION)) {                // Ensure that there is always space for a trailing nul in TZDATA_VERSION                len = sizeof(TZDATA_VERSION) - 1;            }            umtx_lock(&LOCK);            if (!TZDataVersionInitialized) {                u_UCharsToChars(tzver, TZDATA_VERSION, len);                TZDataVersionInitialized = TRUE;            }            umtx_unlock(&LOCK);            ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);        }        ures_close(bundle);    }    if (U_FAILURE(status)) {        return NULL;    }    return (const char*)TZDATA_VERSION;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:33,


示例9: u_UCharsToChars

U_NAMESPACE_BEGINCStr::CStr(const UnicodeString &in) {    UErrorCode status = U_ZERO_ERROR;#if !UCONFIG_NO_CONVERSION || U_CHARSET_IS_UTF8    int32_t length = in.extract(0, in.length(), static_cast<char *>(NULL), static_cast<uint32_t>(0));    int32_t resultCapacity = 0;    char *buf = s.getAppendBuffer(length, length, resultCapacity, status);    if (U_SUCCESS(status)) {        in.extract(0, in.length(), buf, resultCapacity);        s.append(buf, length, status);    }#else    // No conversion available. Convert any invariant characters; substitute '?' for the rest.    // Note: can't just call u_UCharsToChars() or CharString.appendInvariantChars() on the     //       whole string because they require that the entire input be invariant.    char buf[2];    for (int i=0; i<in.length(); i = in.moveIndex32(i, 1)) {        if (uprv_isInvariantUString(in.getBuffer()+i, 1)) {            u_UCharsToChars(in.getBuffer()+i, buf, 1);        } else {            buf[0] = '?';        }        s.append(buf, 1, status);    }#endif}
开发者ID:icu-project,项目名称:icu4c,代码行数:27,


示例10: demoUnicodeStringInit

static voiddemoUnicodeStringInit() {    // *** Make sure to read about invariant characters in utypes.h! ***    // Initialization of Unicode strings from C literals works _only_ for    // invariant characters!    printf("/n* demoUnicodeStringInit() ---------- ***/n/n");    // the string literal is 32 chars long - this must be counted for the macro    UnicodeString invariantOnly=UNICODE_STRING("such characters are safe 123 %-.", 32);    /*     * In C, we need two macros: one to declare the UChar[] array, and     * one to populate it; the second one is a noop on platforms where     * wchar_t is compatible with UChar and ASCII-based.     * The length of the string literal must be counted for both macros.     */    /* declare the invString array for the string */    U_STRING_DECL(invString, "such characters are safe 123 %-.", 32);    /* populate it with the characters */    U_STRING_INIT(invString, "such characters are safe 123 %-.", 32);    // compare the C and C++ strings    printf("C and C++ Unicode strings are equal: %d/n", invariantOnly==UnicodeString(TRUE, invString, 32));    /*     * convert between char * and UChar * strings that     * contain only invariant characters     */    static const char *cs1="such characters are safe 123 %-.";    static UChar us1[40];    static char cs2[40];    u_charsToUChars(cs1, us1, 33); /* include the terminating NUL */    u_UCharsToChars(us1, cs2, 33);    printf("char * -> UChar * -> char * with only "           "invariant characters: /"%s/"/n",           cs2);    // initialize a UnicodeString from a string literal that contains    // escape sequences written with invariant characters    // do not forget to duplicate the backslashes for ICU to see them    // then, count each double backslash only once!    UnicodeString german=UNICODE_STRING(        "Sch//u00f6nes Auto: //u20ac 11240.//fPrivates Zeichen: //U00102345//n", 64).        unescape();    printUnicodeString("german UnicodeString from unescaping:/n    ", german);    /*     * C: convert and unescape a char * string with only invariant     * characters to fill a UChar * string     */    UChar buffer[200];    int32_t length;    length=u_unescape(        "Sch//u00f6nes Auto: //u20ac 11240.//fPrivates Zeichen: //U00102345//n",        buffer, UPRV_LENGTHOF(buffer));    printf("german C Unicode string from char * unescaping: (length %d)/n    ", length);    printUnicodeString("", UnicodeString(buffer));}
开发者ID:icu-project,项目名称:icu4c,代码行数:59,


示例11: sizeof

NumberingSystem* U_EXPORT2NumberingSystem::createInstance(const Locale & inLocale, UErrorCode& status) {    if (U_FAILURE(status)) {        return NULL;    }    UBool nsResolved = TRUE;    UBool usingFallback = FALSE;    char buffer[ULOC_KEYWORDS_CAPACITY];    int32_t count = inLocale.getKeywordValue("numbers",buffer, sizeof(buffer),status);    if ( count > 0 ) { // @numbers keyword was specified in the locale        buffer[count] = '/0'; // Make sure it is null terminated.        if ( !uprv_strcmp(buffer,gDefault) || !uprv_strcmp(buffer,gNative) ||             !uprv_strcmp(buffer,gTraditional) || !uprv_strcmp(buffer,gFinance)) {            nsResolved = FALSE;        }    } else {        uprv_strcpy(buffer,gDefault);        nsResolved = FALSE;    }    if (!nsResolved) { // Resolve the numbering system ( default, native, traditional or finance ) into a "real" numbering system        UErrorCode localStatus = U_ZERO_ERROR;        UResourceBundle *resource = ures_open(NULL, inLocale.getName(), &localStatus);        UResourceBundle *numberElementsRes = ures_getByKey(resource,gNumberElements,NULL,&localStatus);        while (!nsResolved) {            localStatus = U_ZERO_ERROR;            count = 0;            const UChar *nsName = ures_getStringByKeyWithFallback(numberElementsRes, buffer, &count, &localStatus);            if ( count > 0 && count < ULOC_KEYWORDS_CAPACITY ) { // numbering system found                u_UCharsToChars(nsName,buffer,count);                buffer[count] = '/0'; // Make sure it is null terminated.                nsResolved = TRUE;            }            if (!nsResolved) { // Fallback behavior per TR35 - traditional falls back to native, finance and native fall back to default                if (!uprv_strcmp(buffer,gNative) || !uprv_strcmp(buffer,gFinance)) {                    uprv_strcpy(buffer,gDefault);                } else if (!uprv_strcmp(buffer,gTraditional)) {                    uprv_strcpy(buffer,gNative);                } else { // If we get here we couldn't find even the default numbering system                    usingFallback = TRUE;                    nsResolved = TRUE;                }            }        }        ures_close(numberElementsRes);        ures_close(resource);    }    if (usingFallback) {        status = U_USING_FALLBACK_WARNING;        NumberingSystem *ns = new NumberingSystem();        return ns;    } else {        return NumberingSystem::createInstanceByName(buffer,status);    } }
开发者ID:DavidCai1993,项目名称:node,代码行数:59,


示例12: ucol_prepareShortStringOpen

U_CAPI void U_EXPORT2ucol_prepareShortStringOpen( const char *definition,                          UBool,                          UParseError *parseError,                          UErrorCode *status){    if(U_FAILURE(*status)) return;    UParseError internalParseError;    if(!parseError) {        parseError = &internalParseError;    }    parseError->line = 0;    parseError->offset = 0;    parseError->preContext[0] = 0;    parseError->postContext[0] = 0;    // first we want to pick stuff out of short string.    // we'll end up with an UCA version, locale and a bunch of    // settings    // analyse the string in order to get everything we need.    CollatorSpec s;    ucol_sit_initCollatorSpecs(&s);    ucol_sit_readSpecs(&s, definition, parseError, status);    ucol_sit_calculateWholeLocale(&s);    char buffer[internalBufferSize];    uprv_memset(buffer, 0, internalBufferSize);    uloc_canonicalize(s.locale, buffer, internalBufferSize, status);    UResourceBundle *b = ures_open(U_ICUDATA_COLL, buffer, status);    /* we try to find stuff from keyword */    UResourceBundle *collations = ures_getByKey(b, "collations", NULL, status);    UResourceBundle *collElem = NULL;    char keyBuffer[256];    // if there is a keyword, we pick it up and try to get elements    if(!uloc_getKeywordValue(buffer, "collation", keyBuffer, 256, status)) {      // no keyword. we try to find the default setting, which will give us the keyword value      UResourceBundle *defaultColl = ures_getByKeyWithFallback(collations, "default", NULL, status);      if(U_SUCCESS(*status)) {        int32_t defaultKeyLen = 0;        const UChar *defaultKey = ures_getString(defaultColl, &defaultKeyLen, status);        u_UCharsToChars(defaultKey, keyBuffer, defaultKeyLen);        keyBuffer[defaultKeyLen] = 0;      } else {        *status = U_INTERNAL_PROGRAM_ERROR;        return;      }      ures_close(defaultColl);    }    collElem = ures_getByKeyWithFallback(collations, keyBuffer, collElem, status);    ures_close(collElem);    ures_close(collations);    ures_close(b);}
开发者ID:119120119,项目名称:node,代码行数:58,


示例13: udbg_stod

U_CAPI doubleudbg_stod(const UnicodeString &s){    char ch[256];    const UChar *u = s.getBuffer();    int32_t len = s.length();    u_UCharsToChars(u, ch, len);    ch[len] = 0; /* include terminating /0 */    return atof(ch);}
开发者ID:119120119,项目名称:node,代码行数:10,


示例14: u_UCharsToChars

int32_t DataMap::utoi(const UnicodeString &s) const{  char ch[256];  const UChar *u = s.getBuffer();  int32_t len = s.length();  u_UCharsToChars(u, ch, len);  ch[len] = 0; /* include terminating /0 */  return atoi(ch);}
开发者ID:LittoCats,项目名称:OT_4010D,代码行数:10,


示例15: checkAlias

/* * Check for the alias from the string or alias resource res. */static voidcheckAlias(const char *itemName,           Resource res, const UChar *alias, int32_t length, UBool useResSuffix,           CheckDependency check, void *context, UErrorCode *pErrorCode) {    int32_t i;    if(!uprv_isInvariantUString(alias, length)) {        fprintf(stderr, "icupkg/ures_enumDependencies(%s res=%08x) alias string contains non-invariant characters/n",                        itemName, res);        *pErrorCode=U_INVALID_CHAR_FOUND;        return;    }    // extract the locale ID from alias strings like    // locale_ID/key1/key2/key3    // locale_ID    // search for the first slash    for(i=0; i<length && alias[i]!=SLASH; ++i) {}    if(res_getPublicType(res)==URES_ALIAS) {        // ignore aliases with an initial slash:        // /ICUDATA/... and /pkgname/... go to a different package        // /LOCALE/... are for dynamic sideways fallbacks and don't go to a fixed bundle        if(i==0) {            return; // initial slash ('/')        }        // ignore the intra-bundle path starting from the first slash ('/')        length=i;    } else /* URES_STRING */ {        // the whole string should only consist of a locale ID        if(i!=length) {            fprintf(stderr, "icupkg/ures_enumDependencies(%s res=%08x) %%ALIAS contains a '/'/n",                            itemName, res);            *pErrorCode=U_UNSUPPORTED_ERROR;            return;        }    }    // convert the Unicode string to char *    char localeID[32];    if(length>=(int32_t)sizeof(localeID)) {        fprintf(stderr, "icupkg/ures_enumDependencies(%s res=%08x) alias locale ID length %ld too long/n",                        itemName, res, (long)length);        *pErrorCode=U_BUFFER_OVERFLOW_ERROR;        return;    }    u_UCharsToChars(alias, localeID, length);    localeID[length]=0;    checkIDSuffix(itemName, localeID, -1, (useResSuffix ? ".res" : ""), check, context, pErrorCode);}
开发者ID:icu-project,项目名称:icu4c,代码行数:56,


示例16: ures_openU

U_CAPI UResourceBundle * U_EXPORT2ures_openU(const UChar *myPath,            const char *localeID,            UErrorCode *status){    char pathBuffer[1024];    int32_t length;    char *path = pathBuffer;    if(status==NULL || U_FAILURE(*status)) {        return NULL;    }    if(myPath==NULL) {        path = NULL;    }    else {        length=u_strlen(myPath);        if(length>=sizeof(pathBuffer)) {            *status=U_ILLEGAL_ARGUMENT_ERROR;            return NULL;        } else if(uprv_isInvariantUString(myPath, length)) {            /*             * the invariant converter is sufficient for package and tree names             * and is more efficient             */            u_UCharsToChars(myPath, path, length+1); /* length+1 to include the NUL */        } else {#if !UCONFIG_NO_CONVERSION            /* use the default converter to support variant-character paths */            UConverter *cnv=u_getDefaultConverter(status);            length=ucnv_fromUChars(cnv, path, (int32_t)sizeof(pathBuffer), myPath, length, status);            u_releaseDefaultConverter(cnv);            if(U_FAILURE(*status)) {                return NULL;            }            if(length>=sizeof(pathBuffer)) {                /* not NUL-terminated - path too long */                *status=U_ILLEGAL_ARGUMENT_ERROR;                return NULL;            }#else            /* the default converter is not available */            *status=U_UNSUPPORTED_ERROR;            return NULL;#endif        }    }    return ures_open(path, localeID, status);}
开发者ID:MoonchildProductions,项目名称:Pale-Moon,代码行数:50,


示例17: u_strcpy

U_NAMESPACE_BEGINCurrencyUnit::CurrencyUnit(ConstChar16Ptr _isoCode, UErrorCode& ec) {    *isoCode = 0;    if (U_SUCCESS(ec)) {        if (_isoCode != nullptr && u_strlen(_isoCode)==3) {            u_strcpy(isoCode, _isoCode);            char simpleIsoCode[4];            u_UCharsToChars(isoCode, simpleIsoCode, 4);            initCurrency(simpleIsoCode);        } else {            ec = U_ILLEGAL_ARGUMENT_ERROR;        }    }}
开发者ID:MIPS,项目名称:external-icu,代码行数:15,


示例18: findLikelySubtags

/** * This function looks for the localeID in the likelySubtags resource. * * @param localeID The tag to find. * @param buffer A buffer to hold the matching entry * @param bufferLength The length of the output buffer * @return A pointer to "buffer" if found, or a null pointer if not. */static const char*  U_CALLCONVfindLikelySubtags(const char* localeID,                  char* buffer,                  int32_t bufferLength,                  UErrorCode* err) {    const char* result = NULL;    if (!U_FAILURE(*err)) {        int32_t resLen = 0;        const UChar* s = NULL;        UErrorCode tmpErr = U_ZERO_ERROR;        UResourceBundle* subtags = ures_openDirect(NULL, "likelySubtags", &tmpErr);        if (U_SUCCESS(tmpErr)) {            s = ures_getStringByKey(subtags, localeID, &resLen, &tmpErr);            if (U_FAILURE(tmpErr)) {                /*                 * If a resource is missing, it's not really an error, it's                 * just that we don't have any data for that particular locale ID.                 */                if (tmpErr != U_MISSING_RESOURCE_ERROR) {                    *err = tmpErr;                }            }            else if (resLen >= bufferLength) {                /* The buffer should never overflow. */                *err = U_INTERNAL_PROGRAM_ERROR;            }            else {                u_UCharsToChars(s, buffer, resLen + 1);                result = buffer;            }            ures_close(subtags);        } else {            *err = tmpErr;        }    }    return result;}
开发者ID:Abocer,项目名称:android-4.2_r1,代码行数:49,


示例19: GetLocale

Locale GetLocale(const UChar* localeName, bool canonize){	char localeNameTemp[ULOC_FULLNAME_CAPACITY];	if (localeName != NULL)	{		int32_t len = u_strlen(localeName);		u_UCharsToChars(localeName, localeNameTemp, len + 1);	}	Locale loc;	if (canonize)	{		loc = Locale::createCanonical(localeName == NULL ? NULL : localeNameTemp);	}	else	{		loc = Locale::createFromName(localeName == NULL ? NULL : localeNameTemp);	}	return loc;}
开发者ID:krixalis,项目名称:coreclr,代码行数:22,


示例20: uenum_nextDefault

/* Don't call this directly. Only uenum_next should be calling this. */U_CAPI const char* U_EXPORT2uenum_nextDefault(UEnumeration* en,            int32_t* resultLength,            UErrorCode* status){    if (en->uNext != NULL) {        char *tempCharVal;        const UChar *tempUCharVal = en->uNext(en, resultLength, status);        if (tempUCharVal == NULL) {            return NULL;        }        tempCharVal = (char*)            _getBuffer(en, (*resultLength+1) * sizeof(char));        if (!tempCharVal) {            *status = U_MEMORY_ALLOCATION_ERROR;            return NULL;        }        u_UCharsToChars(tempUCharVal, tempCharVal, *resultLength + 1);        return tempCharVal;    } else {        *status = U_UNSUPPORTED_ERROR;        return NULL;    }}
开发者ID:MoonchildProductions,项目名称:Pale-Moon,代码行数:25,


示例21: TestInvariant

/* test invariant-character handling */static voidTestInvariant() {    /* all invariant graphic chars and some control codes (not /n!) */    const char invariantChars[]=        "/t/r /"%&'()*+,-./"        "0123456789:;<=>?"        "ABCDEFGHIJKLMNOPQRSTUVWXYZ_"        "abcdefghijklmnopqrstuvwxyz";    const UChar invariantUChars[]={        9, 0xd, 0x20, 0x22, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,        0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,        0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5f,        0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,        0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0    };    const char variantChars[]="/n!#[email
C++ u_arraylist_length函数代码示例
C++ uPtr函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。