本文整理汇总了C++中StringVec::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ StringVec::erase方法的具体用法?C++ StringVec::erase怎么用?C++ StringVec::erase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringVec
的用法示例。
在下文中一共展示了StringVec::erase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processClangFlags
void processClangFlags(String& clangFlags, const String& absProjDirOld, const String& absProjDirNew) {
// Tokenize the flags
StringVec clangFlagTokens;
tokenize(clangFlags, clangFlagTokens, " \t", "", "\"'", "", "", true, false);
reduceClangTokens(clangFlagTokens);
auto tokensIt = clangFlagTokens.begin();
while (tokensIt != clangFlagTokens.end()) {
if (strBeginsWith(*tokensIt, "-iquote")) {
String newPath = makeRelativePath(tokensIt->substr(7), absProjDirOld, absProjDirNew);
*tokensIt = "-iquote" + quoteIfNeeded(newPath);
} else if (strBeginsWith(*tokensIt, "-I")) {
String newPath = makeRelativePath(tokensIt->substr(2), absProjDirOld, absProjDirNew);
*tokensIt = "-I" + quoteIfNeeded(newPath);
} else if (strBeginsWith(*tokensIt, "-F")) {
tokensIt = clangFlagTokens.erase(tokensIt);
continue; // don't increment iterator
} else {
*tokensIt = quoteIfNeeded(*tokensIt);
}
tokensIt++;
}
clangFlags = joinStrings(clangFlagTokens, " ");
}
示例2: reduceClangTokens
static void reduceClangTokens(StringVec& otherFlagTokens) {
String savedToken;
auto tokensIt = otherFlagTokens.begin();
while (tokensIt != otherFlagTokens.end()) {
if (!savedToken.empty()) {
*tokensIt = savedToken + *tokensIt;
savedToken.clear();
} else if (*tokensIt == "-I" || *tokensIt == "-iquote" || *tokensIt == "-F") {
savedToken = *tokensIt;
tokensIt = otherFlagTokens.erase(tokensIt);
continue; // don't increment iterator
}
tokensIt++;
}
}