本文整理汇总了C++中astringvector::const_iterator::find方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::find方法的具体用法?C++ const_iterator::find怎么用?C++ const_iterator::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astringvector::const_iterator
的用法示例。
在下文中一共展示了const_iterator::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadRecipes
void cCraftingRecipes::LoadRecipes(void)
{
LOGD("Loading crafting recipes from crafting.txt...");
ClearRecipes();
// Load the crafting.txt file:
cFile f;
if (!f.Open("crafting.txt", cFile::fmRead))
{
LOGWARNING("Cannot open file \"crafting.txt\", no crafting recipes will be available!");
return;
}
AString Everything;
if (!f.ReadRestOfFile(Everything))
{
LOGWARNING("Cannot read file \"crafting.txt\", no crafting recipes will be available!");
return;
}
f.Close();
// Split it into lines, then process each line as a single recipe:
AStringVector Split = StringSplit(Everything, "\n");
int LineNum = 1;
for (AStringVector::const_iterator itr = Split.begin(); itr != Split.end(); ++itr, ++LineNum)
{
// Remove anything after a '#' sign and trim away the whitespace:
AString Recipe = TrimString(itr->substr(0, itr->find('#')));
if (Recipe.empty())
{
// Empty recipe
continue;
}
AddRecipeLine(LineNum, Recipe);
} // for itr - Split[]
LOG("Loaded " SIZE_T_FMT " crafting recipes", m_Recipes.size());
}