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


C++ StringVec::begin方法代码示例

本文整理汇总了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;
}
开发者ID:svn2github,项目名称:Escript,代码行数:15,代码来源:SpeckleyDomain.cpp

示例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;
}
开发者ID:byzhang,项目名称:sfserialization,代码行数:52,代码来源:StructureParser.cpp

示例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;
}
开发者ID:joeriedel,项目名称:Radiance,代码行数:31,代码来源:D_Typeface.cpp

示例4: getRelativePaths

void getRelativePaths(const String& fromAbsPath, StringVec& toAbsPaths)
{
  StringVec::iterator pathsIt = toAbsPaths.begin();
  for (; pathsIt != toAbsPaths.end(); pathsIt++) {
    *pathsIt = getRelativePath(fromAbsPath, *pathsIt);
  }
}
开发者ID:GoogleInternetAuthorityG2SUNGHAN,项目名称:WinObjC,代码行数:7,代码来源:fileutils.cpp

示例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, " ");
}
开发者ID:bbowman,项目名称:WinObjC,代码行数:26,代码来源:clangoptparser.cpp

示例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;
}
开发者ID:milbradt,项目名称:TFS,代码行数:59,代码来源:monsters.cpp

示例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;
}
开发者ID:AhmedWaly,项目名称:CastOnly,代码行数:8,代码来源:tools.cpp

示例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;
}
开发者ID:nclx,项目名称:forgottenserver,代码行数:8,代码来源:tools.cpp

示例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;
}
开发者ID:max-silent,项目名称:easytc,代码行数:45,代码来源:MountInfo.cpp

示例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;
}
开发者ID:joeriedel,项目名称:Radiance,代码行数:57,代码来源:SkAnimSetParser.cpp

示例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);
        }
    }
}
开发者ID:bbowman,项目名称:WinObjC,代码行数:14,代码来源:clangoptparser.cpp

示例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();
		}
	}
}
开发者ID:Azuen,项目名称:RealOTX-7.72,代码行数:11,代码来源:spectators.cpp

示例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;
}
开发者ID:milbradt,项目名称:TFS,代码行数:12,代码来源:tools.cpp

示例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;
}
开发者ID:webOS101,项目名称:db8,代码行数:13,代码来源:MojDbKind.cpp

示例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;
}
开发者ID:bbowman,项目名称:WinObjC,代码行数:13,代码来源:clangoptparser.cpp


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