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


C++ StringList::join方法代码示例

本文整理汇总了C++中StringList::join方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::join方法的具体用法?C++ StringList::join怎么用?C++ StringList::join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringList的用法示例。


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

示例1: keywordReturn

string keywordReturn(MavenCompiler* c, string line) {
	// we have to be in a function to use this
	if(c->currentFunction == "") {
		pushError(c, "Can not return out of non-function");
		return MAVEN_INVALID;
	}
	
	// it could be a void return
	if(line.length() == 6)
		return "return";
	
	StringList types;
	MavenMutability mut;
	string newCode = dissectCode(c, line.substr(7, line.length() - 7), types, mut);
	
	// check the return type matches the function its in
	int nID = findNamespaceID(c, c->currentNamespace);
	smartAssert(nID >= 0);
	int oID = findObjectID(c, nID, c->currentClass);
	smartAssert(oID >= 0);
	
	for(int i = 0; i < c->namespaces->at(nID).objects->at(oID)->functions->length(); ++i) {
		if(c->namespaces->at(nID).objects->at(oID)->functions->at(i).name == c->currentFunction) {
			if(canCastBetween(c, types.join(","), c->namespaces->at(nID).objects->at(oID)->functions->at(i).returnType)) {
				return "return " + newCode;
			} else {
				pushError(c, "Can not cast return type %s to %s", types.join(","),
						  c->namespaces->at(nID).objects->at(oID)->functions->at(i).returnType);
				return MAVEN_INVALID;
			}
		}
	}
	
	// if it gets to here something really bad has gone wrong
	return MAVEN_INVALID;
}
开发者ID:elliotchance,项目名称:maven,代码行数:36,代码来源:func_keywordReturn.cpp

示例2: unresolveMavenPath

string unresolveMavenPath(MavenCompiler* c, string path) {
	// remove "$static", "->a", spaces and brackets
	while(path.find("$static") != string::npos)
		path = path.erase(path.find("$static"), strlen("$static"));
	while(path.find("->a") != string::npos)
		path = path.erase(path.find("->a"), strlen("->a"));
	while(path.find(" ") != string::npos)
		path = path.erase(path.find(" "), strlen(" "));
	while(path.find("(") != string::npos)
		path = path.erase(path.find("("), strlen("("));
	while(path.find(")") != string::npos)
		path = path.erase(path.find(")"), strlen(")"));
	
	// finalise
	StringList parts = split("::", path);
	return parts.join(".");
}
开发者ID:elliotchance,项目名称:maven,代码行数:17,代码来源:func_unresolveMavenPath.cpp

示例3: tokenizer

Path& Path::normalize()
{
	StringTokenizer tokenizer(_path);
	tokenizer.onCharset("/");

	std::string elem;

	StringList parts;

	while(tokenizer.next(elem))
	{
		if(elem == ".." && ! parts.empty())
			parts.pop();
		else if(elem != ".")
			parts << elem;
	}

	_path = parts.join('/');

	return *this;
}
开发者ID:ryancalhoun,项目名称:fit,代码行数:21,代码来源:Path.cpp

示例4: readValue

String HaxeMessageSyntax::readValue(String message, Ref<Token> token)
{
	if (token->firstChild()) {
		StringList list;
		Ref<Token> child = token->firstChild();
		int i = token->i0();
		while (child) {
			if (i < child->i0())
				list.append(message->copy(i, child->i0()));
			String s;
			if (child->keyword() == gt_) s = ">";
			else if (child->keyword() == lt_) s = "<";
			else s = message->copy(child->i0(), child->i1());
			list.append(s);
			i = child->i1();
			child = child->nextSibling();
		}
		if (i < token->i1())
			list.append(message->copy(i, token->i1()));
		return list.join();
	}
	else
		return message->copy(token->i0(), token->i1());
}
开发者ID:frankencode,项目名称:libcodetips,代码行数:24,代码来源:HaxeMessageSyntax.cpp


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