当前位置: 首页>>代码示例>>C++>>正文


C++ CharString类代码示例

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


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

示例1: CharString

/* Desc: Find the location of a node
*  Input: node
*  Output: String location of node
 */
CharString FileSystem::getStringFromNode(FileStructureNode* location) {
    // place a string before the current string.
    CharString cstring = CharString();

    FileStructureNode* current = location;

    // loop through and append "/" to all the names
    while(current != 0x0 && current != Root) {
        cstring.concatb(current->name);
        cstring.concatb("/",1);

        current = current->Parent;
    }
    //cstring.concatb("/",1);
    return cstring;
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例2: Variant

Variant _Marshalls::base64_to_variant(const String& p_str) {

    int strlen = p_str.length();
    CharString cstr = p_str.ascii();

    DVector<uint8_t> buf;
    buf.resize(strlen / 4 * 3 + 1);
    DVector<uint8_t>::Write w = buf.write();

    int len = base64_decode((char*)(&w[0]), (char*)cstr.get_data(), strlen);

    Variant v;
    Error err = decode_variant(v, &w[0], len);
    ERR_FAIL_COND_V( err!=OK, Variant() );

    return v;
};
开发者ID:,项目名称:,代码行数:17,代码来源:

示例3: processLog

void Logger::processLog(CharString data){
    if(console){
        cout << data.get() << endl;
        cout.flush();
    }
    
    // push data to file
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例4: strcpy

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CProcessor::ProcessStopApply(TradeRecord *trade,
                                 const ConGroup *group, const int isTP)
{
    char *groupStr = new char[50];
    strcpy(groupStr, group->group);
    if (CheckGroup(m_groups, groupStr) == FALSE)
    {
        delete []groupStr;
        return FALSE;
    }
    delete []groupStr;

    double price = 0;
    // получим текущие цены для группы и установки символа
    double    prices[2] = { 0, 0 };
    int orderSide = trade->cmd == OP_BUY ? 1 : 0;
    if (ExtServer->HistoryPricesGroup(trade->symbol, group, prices) == RET_OK)
    {
        int orderSide = trade->cmd == OP_BUY ? 0 : 1; // меняется от знака сделки
        price = prices[orderSide];
    }

    CharString strMsg;
    strMsg.Printf(FALSE, "%s (%s at %g) is applying to order %d",
                  isTP ? "TP" : "SL",
                  orderSide == 1 ? "BUY" : "SELL",
                  price,
                  trade->order);
    ExtServer->LogsOut(CmdOK, PROGRAM_TITLE, strMsg.ToArray());

    SLTPOrderRequest req = { trade->order, price };
    m_orderRequests.Enqueue(&req);

    // отправить запрос на сервер
    int requestId = m_nextStopRequestId++;
    strMsg.Printf(FALSE, "requestId=%d;type=%s;price=%g;login=%d;symbol=%s;volume=%d;",
                  trade->order,
                  isTP ? "TP" : "SL",
                  price,
                  trade->login,
                  trade->symbol,
                  trade->volume);
    m_sender->SendTo(&strMsg, m_sendHost, m_sendPort);

    return TRUE;
}
开发者ID:johnmensen,项目名称:TradeSharp,代码行数:49,代码来源:Processor.cpp

示例5: transform

 void transform(const UnicodeString &word, CharString &buf, UErrorCode &errorCode) {
     UChar32 c = 0;
     int32_t len = word.length();
     for (int32_t i = 0; i < len; i += U16_LENGTH(c)) {
         c = word.char32At(i);
         buf.append(transform(c, errorCode), errorCode);
     }
 }
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:8,代码来源:gendict.cpp

示例6: indexOf

	//find W(word) in S(sentence)
	//return the index of the first appearance
	//implementing KMP algorithm
	int CharString::indexOf(CharString W, int start) const{
		if(W.length() == 0)
			return NOT_FOUND;
		if(W.length() == 1)
			return indexOf(W[0], start);

		//first, make the table
		int* T = new int[W.length()];
		int pos=2, cnd=0;
		T[0] = -1;
		T[1] = 0;

		while(pos < W.length()){
			if(W[pos-1] == W[cnd]){
				cnd = cnd + 1;
				T[pos] = cnd;
				pos = pos + 1;
			}else if(cnd > 0){
				cnd = T[cnd];
			}else{
				T[pos] = 0;
				pos = pos + 1;
			}
		}


		//now let's do KMP 
		int m=start, i=0;
		while((m + i) < length()){
			if(W[i] == operator[](m+i)){
				if(i == W.length() - 1)
					return m;
				i = i + 1;
			}else{
				if(T[i] > -1){
					m = m + i - T[i];
					i = T[i];
				}else{
					i = 0;
					m = m + 1;
				}
			}
		}
		return NOT_FOUND;
	}
开发者ID:lizy14,项目名称:iMusic,代码行数:48,代码来源:CharString.cpp

示例7: getDecimal

/**
 *  Return a string form of this number.
 *     Format is as defined by the decNumber library, for interchange of
 *     decimal numbers.
 */
void DigitList::getDecimal(CharString &str, UErrorCode &status) {
    if (U_FAILURE(status)) {
        return;
    }

    // A decimal number in string form can, worst case, be 14 characters longer
    //  than the number of digits.  So says the decNumber library doc.
    int32_t maxLength = fDecNumber->digits + 14;
    int32_t capacity = 0;
    char *buffer = str.clear().getAppendBuffer(maxLength, 0, capacity, status);
    if (U_FAILURE(status)) {
        return;    // Memory allocation error on growing the string.
    }
    U_ASSERT(capacity >= maxLength);
    uprv_decNumberToString(this->fDecNumber, buffer);
    U_ASSERT((int32_t)uprv_strlen(buffer) <= maxLength);
    str.append(buffer, -1, status);
}
开发者ID:TestOrgPleaseIgnore,项目名称:node,代码行数:23,代码来源:digitlst.cpp

示例8: _file_selected

void RichTextEditor::_file_selected(const String& p_path) {

	CharString cs;
	FileAccess *fa = FileAccess::open(p_path,FileAccess::READ);
	if (!fa) {
		ERR_FAIL();
	}

	while(!fa->eof_reached())
		cs.push_back(fa->get_8());
	cs.push_back(0);
	memdelete(fa);

	String bbcode;
	bbcode.parse_utf8(&cs[0]);
	node->parse_bbcode(bbcode);

}
开发者ID:0871087123,项目名称:godot,代码行数:18,代码来源:rich_text_editor_plugin.cpp

示例9: U_ASSERT

void
NamesPropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
                            UErrorCode &errorCode) {
    if(U_FAILURE(errorCode)) { return; }
    if(!newValues.contains(UCHAR_NAME) && !newValues.contains(PPUCD_NAME_ALIAS)) {
        return;
    }

    U_ASSERT(props.start==props.end);

    const char *names[4]={ NULL, NULL, NULL, NULL };
    int16_t lengths[4]={ 0, 0, 0, 0 };

    /* get the character name */
    if(props.name!=NULL) {
        names[0]=props.name;
        lengths[0]=(int16_t)uprv_strlen(props.name);
        parseName(names[0], lengths[0]);
    }

    CharString buffer;
    if(props.nameAlias!=NULL) {
        /*
         * Only use "correction" aliases for now, from Unicode 6.1 NameAliases.txt with 3 fields per line.
         * TODO: Work on ticket #8963 to deal with multiple type:alias pairs per character.
         */
        const char *corr=uprv_strstr(props.nameAlias, "correction=");
        if(corr!=NULL) {
            corr+=11;  // skip "correction="
            const char *limit=uprv_strchr(corr, ',');
            if(limit!=NULL) {
                buffer.append(corr, limit-corr, errorCode);
                names[3]=buffer.data();
                lengths[3]=(int16_t)(limit-corr);
            } else {
                names[3]=corr;
                lengths[3]=(int16_t)uprv_strlen(corr);
            }
            parseName(names[3], lengths[3]);
        }
    }

    addLine(props.start, names, lengths, LENGTHOF(names));
}
开发者ID:icu-project,项目名称:icu-tools,代码行数:44,代码来源:namespropsbuilder.cpp

示例10: ucurr_getName

void
CurrencyAffixInfo::set(
        const char *locale,
        const PluralRules *rules,
        const UChar *currency,
        UErrorCode &status) {
    if (U_FAILURE(status)) {
        return;
    }
    fIsDefault = FALSE;
    if (currency == NULL) {
        fSymbol.setTo(gDefaultSymbols, 1);
        fISO.setTo(gDefaultSymbols, 2);
        fLong.remove();
        fLong.append(gDefaultSymbols, 3);
        fIsDefault = TRUE;
        return;
    }
    int32_t len;
    UBool unusedIsChoice;
    const UChar *symbol = ucurr_getName(
            currency, locale, UCURR_SYMBOL_NAME, &unusedIsChoice,
            &len, &status);
    if (U_FAILURE(status)) {
        return;
    }
    fSymbol.setTo(symbol, len);
    fISO.setTo(currency, u_strlen(currency));
    fLong.remove();
    StringEnumeration* keywords = rules->getKeywords(status);
    if (U_FAILURE(status)) {
        return;
    }
    const UnicodeString* pluralCount;
    while ((pluralCount = keywords->snext(status)) != NULL) {
        CharString pCount;
        pCount.appendInvariantChars(*pluralCount, status);
        const UChar *pluralName = ucurr_getPluralName(
            currency, locale, &unusedIsChoice, pCount.data(),
            &len, &status);
        fLong.setVariant(pCount.data(), UnicodeString(pluralName, len), status);
    }
    delete keywords;
}
开发者ID:icu-project,项目名称:icu4c,代码行数:44,代码来源:affixpatternparser.cpp

示例11: get_token

String FileAccess::get_token() const {

	CharString token;

	CharType c = get_8();

	while (!eof_reached()) {

		if (c <= ' ') {
			if (token.length())
				break;
		} else {
			token += c;
		}
		c = get_8();
	}

	return String::utf8(token.get_data());
}
开发者ID:93i,项目名称:godot,代码行数:19,代码来源:file_access.cpp

示例12: while

// figure out what mods have good dependencies
bool APIMod::compareModDependencies(LinkedList<APIMod*> othermods){
    LinkedListIterator<CharString> depstrs = dependencyversions.getIterator();
    
    while(depstrs.hasNext()){
        CharString depstr = depstrs.next();
        if(depstr.contains(":")){
            LinkedListIterator<APIMod*> modit = othermods.getIterator();
            while(modit.hasNext()){
                APIMod *mod = modit.next();
                // compare direct
                if(! version.compareVersion(mod->version)){
                    // not the same or and older version
                    return false;
                }
            }
            
        } // else invalid!
    }
}
开发者ID:EterniaLogic,项目名称:EterniaLibrary,代码行数:20,代码来源:APIMod.cpp

示例13: ufmt_getDecNumChars

U_DRAFT const char * U_EXPORT2
ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status) {
  if(U_FAILURE(*status)) {
    return "";
  }
  Formattable *obj = Formattable::fromUFormattable(fmt);
  CharString *charString = obj->internalGetCharString(*status);
  if(U_FAILURE(*status)) {
    return "";
  }
  if(charString == NULL) {
    *status = U_MEMORY_ALLOCATION_ERROR;
    return "";
  } else {
    if(len!=NULL) {
      *len = charString->length();
    }
    return charString->data();
  }
}
开发者ID:MIPS,项目名称:external-icu,代码行数:20,代码来源:fmtable.cpp

示例14: get_token

String FileAccess::get_token() const {

	CharString token;

	CharType c = get_8();

	while (!eof_reached()) {

		if (c <= ' ') {
			if (!token.empty())
				break;
		} else {
			token.push_back(c);
		}
		c = get_8();
	}

	token.push_back(0);
	return String::utf8(token.get_data());
}
开发者ID:Bonfi96,项目名称:godot,代码行数:20,代码来源:file_access.cpp

示例15: convert

	void convert(DipData &dipData, VariablePtr DPEValue, const CharString & tagName) const{
		TextVar * val = (TextVar *)DPEValue;
		if (!val){
			throw BadTypeConversionException(BadTypeConversionException::BADTYPE);
		}
		if (tagName.len() == 0){
			dipData.insert((char *)val->getValue());
		} else {
			dipData.insert((char *)val->getValue(), tagName); 
		}
	}
开发者ID:waqarphd,项目名称:RPCDCS,代码行数:11,代码来源:PVSS_DIP_TypeMap.cpp


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