本文整理汇总了C++中StringPairArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ StringPairArray::end方法的具体用法?C++ StringPairArray::end怎么用?C++ StringPairArray::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringPairArray
的用法示例。
在下文中一共展示了StringPairArray::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveGame
size_t GameDatabase::SaveGame(const Game &game,
const StringPairArray &rulesets,
const StringPairArray& options,
const ISerialize& stats,
const bool reload)
{
wxString file = FilePath::Data(DataFileGames);
wxString keyfile = FilePath::Data(DataFileGameKeys);
// Save the game.
wxFile gamedb;
gamedb.Open(file, wxFile::write_append);
wxFileOutputStream x(gamedb);
wxDataOutputStream games(x);
// Move to the end.
gamedb.SeekEnd();
// Get the starting position
wxUint32 pos = gamedb.Tell();
// Write out the rulesets loaded.
games << (wxUint32) rulesets.size();
GameDatabase::StringPairArray::const_iterator it, itEnd = rulesets.end();
for(it = rulesets.begin(); it != itEnd; ++it)
{
games << it->first;
games << it->second;
}
// options data
games << (wxUint32) options.size();
itEnd = options.end();
for(it = options.begin(); it != itEnd; ++it)
{
games << it->first;
games << it->second;
}
// Write out the game.
game.save(games);
// Stats must always go at the end so we can ignore them while loading if
// desired.
stats.save(games);
// Close the file.
gamedb.Close();
// Now update the key file.
wxFile keydb;
keydb.Open(keyfile, wxFile::write_append);
wxFileOutputStream y(keydb);
wxDataOutputStream keys(y);
// Move to the end
keydb.SeekEnd();
// Write the offset
keys << pos;
wxUint32 keyLength;
keyLength = keydb.Length();
// Flush it.
keydb.Close();
if(true == reload)
{
InitializeDatabase();
}
// Calculate the number of games.
size_t index = (keyLength / sizeof(size_t)) - 1;
return index;
}