本文整理汇总了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;
}
示例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(".");
}
示例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;
}
示例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());
}