本文整理汇总了C++中StringPairArray::reserve方法的典型用法代码示例。如果您正苦于以下问题:C++ StringPairArray::reserve方法的具体用法?C++ StringPairArray::reserve怎么用?C++ StringPairArray::reserve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringPairArray
的用法示例。
在下文中一共展示了StringPairArray::reserve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadGame
void GameDatabase::LoadGame(const size_t index, Game &game,
const GameObjectEnginePtr &engine,
ISerialize& stats)
{
wxASSERT(mOffsets.size() > index);
wxFileInputStream x(FilePath::Data(DataFileGames));
wxDataInputStream games(x);
// Seek to this position in the game file.
x.SeekI(mOffsets[index]);
// Read in the rulesets this game was using.
wxUint32 size;
games >> size;
StringPairArray rulesets;
rulesets.reserve(size);
for(wxUint32 i = 0; i < size; ++i)
{
wxString module, ruleset;
games >> module;
games >> ruleset;
rulesets.push_back(StringPair(module, ruleset));
}
games >> size;
StringPairArray options;
options.reserve(size);
for(wxUint32 i = 0; i < size; ++i)
{
wxString module, ruleset;
games >> module;
games >> ruleset;
options.push_back(StringPair(module, ruleset));
}
// Fire off the load event for any listeners to deal with it.
if(engine)
{
Controller::get().Transmit(shEventLoadRulesets, rulesets);
Controller::get().Transmit(shEventLoadOptions, options);
// Immediately start up the game, too.
Controller::get().Transmit(shEventStartGame, false);
}
game.load(games, engine);
// Stats must always go at the end so we can ignore them while loading if
// desired.
stats.load(games);
}