本文整理汇总了C++中StringVec::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ StringVec::begin方法的具体用法?C++ StringVec::begin怎么用?C++ StringVec::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringVec
的用法示例。
在下文中一共展示了StringVec::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMeshNames
//
// Returns a vector of strings containing mesh names for this domain
//
StringVec SpeckleyDomain::getMeshNames() const
{
StringVec res;
if (initialized) {
StringVec tmpVec;
tmpVec = cells->getMeshNames();
res.insert(res.end(), tmpVec.begin(), tmpVec.end());
tmpVec = faces->getMeshNames();
res.insert(res.end(), tmpVec.begin(), tmpVec.end());
}
return res;
}
示例2: createStringVec
/*static*/ bool StructureParser::test_matchCppType () {
// Test 1 (regression)
{
StringVec v = createStringVec ("static std :: pair < string , int > var");
bool result;
CppType type;
StringVec::const_iterator i = matchCppType (v.begin(), v.end(), &result, &type);
if (!result || i != v.begin() + 9){
fprintf (stderr, "test_matchCppType1 failed\n");
markPosition (v.begin(), v.end(), i);
return false;
}
}
// Test2
{
StringVec v = createStringVec ("void");
bool result;
CppType type;
StringVec::const_iterator i = matchCppType (v.begin(), v.end(), &result, &type);
if (!result || i != v.end()){
fprintf (stderr, "test_matchCppType2 failed\n");
markPosition (v.begin(), v.end(), i);
return false;
}
}
// Test 3 with reference
{
StringVec v = createStringVec ("std :: string &");
bool result;
CppType type;
StringVec::const_iterator i = matchCppType (v.begin(), v.end(), &result, &type);
if (!result || i != v.end()){
fprintf (stderr, "test_matchCppType3 failed: %d %s\n", result, sf::toJSON (type).c_str());
markPosition (v.begin(), v.end(), i);
return false;
}
}
// Test 4 const reference
{
StringVec v = createStringVec ("const std :: string & bla");
bool result;
CppType type;
StringVec::const_iterator i = matchCppType (v.begin(), v.end(), &result, &type);
if (!result || i != v.begin() + 5){
fprintf (stderr, "test_matchCppType4 failed: %d %s\n", result, sf::toJSON (type).c_str());
markPosition (v.begin(), v.end(), i);
return false;
}
}
return true;
}
示例3: lua_WordWrap
int D_Typeface::lua_WordWrap(lua_State *L) {
D_Typeface::Ref self = lua::SharedPtr::Get<D_Typeface>(L, "D_Typeface", 1, true);
bool kern = (lua_gettop(L) < 4) || (lua_toboolean(L, 4) ? true : false);
float kernScale = (lua_gettop(L) < 5) ? 1.f : (float)luaL_checknumber(L, 5);
self->typeface->font->SetPixelSize(
self->typeface->width,
self->typeface->height
);
StringVec strings = self->typeface->font->WordWrapString(
luaL_checkstring(L, 2),
(float)luaL_checknumber(L, 3),
kern,
kernScale
);
if (strings.empty())
return 0;
int ofs = 1;
lua_createtable(L, (int)strings.size(), 0);
for (StringVec::const_iterator it = strings.begin(); it != strings.end(); ++it) {
lua_pushinteger(L, ofs++);
lua_pushstring(L, (*it).c_str);
lua_settable(L, -3);
}
return 1;
}
示例4: getRelativePaths
void getRelativePaths(const String& fromAbsPath, StringVec& toAbsPaths)
{
StringVec::iterator pathsIt = toAbsPaths.begin();
for (; pathsIt != toAbsPaths.end(); pathsIt++) {
*pathsIt = getRelativePath(fromAbsPath, *pathsIt);
}
}
示例5: 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, " ");
}
示例6: loadLoot
bool Monsters::loadLoot(xmlNodePtr node, LootBlock& lootBlock)
{
std::string strValue;
if(readXMLString(node, "id", strValue) || readXMLString(node, "ids", strValue))
{
IntegerVec idsVec;
parseIntegerVec(strValue, idsVec);
for(IntegerVec::iterator it = idsVec.begin(); it != idsVec.end(); ++it)
{
lootBlock.ids.push_back(*it);
if(Item::items[(*it)].isContainer())
loadChildLoot(node, lootBlock);
}
}
else if(readXMLString(node, "name", strValue) || readXMLString(node, "names", strValue))
{
StringVec names = explodeString(strValue, ";");
for(StringVec::iterator it = names.begin(); it != names.end(); ++it)
{
uint16_t tmp = Item::items.getItemIdByName(strValue);
if(!tmp)
continue;
lootBlock.ids.push_back(tmp);
if(Item::items[tmp].isContainer())
loadChildLoot(node, lootBlock);
}
}
if(lootBlock.ids.empty())
return false;
int32_t intValue;
if(readXMLInteger(node, "count", intValue) || readXMLInteger(node, "countmax", intValue))
lootBlock.count = intValue;
else
lootBlock.count = 1;
if(readXMLInteger(node, "chance", intValue) || readXMLInteger(node, "chance1", intValue))
lootBlock.chance = std::min(MAX_LOOTCHANCE, intValue);
else
lootBlock.chance = MAX_LOOTCHANCE;
if(readXMLInteger(node, "subtype", intValue) || readXMLInteger(node, "subType", intValue))
lootBlock.subType = intValue;
if(readXMLInteger(node, "actionId", intValue) || readXMLInteger(node, "actionid", intValue)
|| readXMLInteger(node, "aid", intValue))
lootBlock.actionId = intValue;
if(readXMLInteger(node, "uniqueId", intValue) || readXMLInteger(node, "uniqueid", intValue)
|| readXMLInteger(node, "uid", intValue))
lootBlock.uniqueId = intValue;
if(readXMLString(node, "text", strValue))
lootBlock.text = strValue;
return true;
}
示例7: vectorAtoi
IntegerVec vectorAtoi(StringVec stringVector)
{
IntegerVec returnVector;
for(StringVec::iterator it = stringVector.begin(); it != stringVector.end(); ++it)
returnVector.push_back(atoi((*it).c_str()));
return returnVector;
}
示例8: vectorAtoi
IntegerVec vectorAtoi(const StringVec& stringVector)
{
IntegerVec returnVector;
for (auto it = stringVector.begin(); it != stringVector.end(); ++it) {
returnVector.push_back(atoi(it->c_str()));
}
return returnVector;
}
示例9: getMountInfo
MountInfoVec getMountInfo()
{
int exitCode;
StringVec tcOutput = splitToLines(executeCommand("truecrypt", "-l", exitCode));
if(exitCode != 0)
{
if(tcOutput.size() > 0)
{
throw std::runtime_error(tcOutput[0]);
}
else
{
throw std::runtime_error("unknown error while querying mounted images");
}
}
StringVec mntOutput = splitToLines(executeCommand("mount", exitCode));
MountInfoVec info;
for(StringVec::const_iterator tcIt = tcOutput.begin(); tcIt != tcOutput.end(); ++tcIt)
{
StringVec tcWords = splitToWords(*tcIt);
std::string device = tcWords[0];
std::string image = tcWords[1];
for(StringVec::const_iterator mntIt = mntOutput.begin(); mntIt != mntOutput.end(); ++mntIt)
{
StringVec mntWords = splitToWords(*mntIt);
std::string mntDev = mntWords[0];
std::string mntPoint = mntWords[2];
if(mntDev == device)
{
info.push_back(MountInfo(image, mntPoint));
break;
}
}
}
return info;
}
示例10: Load
int SkAnimSetParser::Load(
const xtime::TimeSlice &time,
Engine &engine,
const pkg::Asset::Ref &asset,
int flags
) {
const String *s = asset->entry->KeyValue<String>("Source.File", P_TARGET_FLAGS(flags));
if (!s)
return SR_MetaError;
StringVec sourceVec;
tools::SkaCompressionMap compression;
int r = LoadToolsFile(
s->c_str,
engine,
&sourceVec,
&compression
);
if (r != SR_Success)
return r;
tools::SceneFileVec sources;
for (StringVec::const_iterator it = sourceVec.begin(); it != sourceVec.end(); ++it) {
file::MMFileInputBuffer::Ref scene = engine.sys->files->OpenInputBuffer((*it).c_str, ZTools);
if (!scene) {
COut(C_Error) << "ERROR: Unable to open file '" << *it << "'" << std::endl;
return SR_FileNotFound;
}
stream::InputStream is(*scene);
tools::SceneFileRef source(new (ZTools) tools::SceneFile());
if (!tools::LoadSceneFile(is, *source, false))
return SR_ParseError;
if (source->worldspawn->models.size() != 1) {
COut(C_Error) << "ERROR: 3DX file should only contain 1 model, it contains " << source->worldspawn->models.size() << ". File: '" << *it << "'" << std::endl;
return SR_ParseError;
}
sources.push_back(source);
}
m_skad = tools::CompileSkaData(
asset->name,
sources,
0,
&compression
);
return m_skad ? SR_Success : SR_ParseError;
}
示例11: replaceWlArgs
// "Expand" -Wl and -Xlinker tokens
// This is OK to do since we're interested in a small subset of flags.
// Preserving correctness is not important.
static void replaceWlArgs(const StringVec& inArgs, StringVec& outArgs) {
for (auto arg : inArgs) {
if (strBeginsWith(arg, "-Wl,")) {
StringVec tokens;
tokenize(arg, tokens, ",", "", "", "", "");
outArgs.insert(outArgs.end(), tokens.begin() + 1, tokens.end());
} else if (arg != "-Xlinker") {
outArgs.push_back(arg);
}
}
}
示例12: kick
void Spectators::kick(StringVec list)
{
for(StringVec::const_iterator it = list.begin(); it != list.end(); ++it)
{
for(SpectatorList::iterator sit = spectators.begin(); sit != spectators.end(); ++sit)
{
if(asLowerCaseString(sit->second.first) == *it)
sit->first->disconnect();
}
}
}
示例13: vectorAtoi
IntegerVec vectorAtoi(StringVec stringVector)
{
IntegerVec returnVector;
for(StringVec::iterator it = stringVector.begin(); it != stringVector.end(); ++it)
{
int32_t number = atoi((*it).c_str());
if(number || (*it) == "0")
returnVector.push_back(number);
}
return returnVector;
}
示例14: diffSupers
MojErr MojDbKind::diffSupers(const KindMap& map, const StringVec& vec1, const StringVec& vec2, KindVec& diffOut)
{
for (StringVec::ConstIterator i = vec1.begin(); i != vec1.end(); ++i) {
if (vec2.find(*i) == MojInvalidIndex) {
KindMap::ConstIterator kindIter = map.find(*i);
if (kindIter != map.end()) {
MojErr err = diffOut.push(kindIter->get());
MojErrCheck(err);
}
}
}
return MojErrNone;
}
示例15: reduceLinkerToken
static String reduceLinkerToken(const String& token) {
static const char* const _prefixes[] = { "-weak", "-reexport", "-lazy", "-upward" };
static StringVec prefixes(_prefixes, _prefixes + sizeof(_prefixes) / sizeof(char*));
StringVec::const_iterator pIt = prefixes.begin();
for (; pIt != prefixes.end(); ++pIt) {
size_t prefixLen = pIt->length();
if (token.length() > prefixLen && strBeginsWith(token, *pIt) && (token[prefixLen] == '_' || token[prefixLen] == '-'))
return "-" + token.substr(prefixLen + 1);
}
return token;
}