本文整理汇总了C++中DataWriter::WriteToken方法的典型用法代码示例。如果您正苦于以下问题:C++ DataWriter::WriteToken方法的具体用法?C++ DataWriter::WriteToken怎么用?C++ DataWriter::WriteToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataWriter
的用法示例。
在下文中一共展示了DataWriter::WriteToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteEconomy
void GameData::WriteEconomy(DataWriter &out)
{
out.Write("economy");
out.BeginChild();
{
if(!purchases.empty())
{
out.Write("purchases");
out.BeginChild();
for(const auto &pit : purchases)
for(const auto &cit : pit.second)
out.Write(pit.first->Name(), cit.first, cit.second);
out.EndChild();
}
out.WriteToken("system");
for(const auto &cit : GameData::Commodities())
out.WriteToken(cit.name);
out.Write();
for(const auto &sit : GameData::Systems())
{
out.WriteToken(sit.second.Name());
for(const auto &cit : GameData::Commodities())
out.WriteToken(static_cast<int>(sit.second.Supply(cit.name)));
out.Write();
}
}
out.EndChild();
}
示例2: Save
void Planet::Save(DataWriter &file) const
{
file.Write("planet", name);
file.BeginChild();
{
if(!attributes.empty())
{
file.WriteToken("attributes");
for(const QString &it : attributes)
file.WriteToken(it);
file.Write();
}
file.Write("landscape", landscape);
// Break the descriptions into paragraphs.
for(const QString &str : description.split('\n', QString::SkipEmptyParts))
{
file.WriteToken("description");
file.WriteToken(str, '`');
file.Write();
}
for(const QString &str : spaceport.split('\n', QString::SkipEmptyParts))
{
file.WriteToken("spaceport");
file.WriteToken(str, '`');
file.Write();
}
for(const QString &it : shipyard)
file.Write("shipyard", it);
for(const QString &it : outfitter)
file.Write("outfitter", it);
if(!std::isnan(requiredReputation))
file.Write("required reputation", requiredReputation);
if(!std::isnan(bribe))
file.Write("bribe", bribe);
if(!std::isnan(security))
file.Write("security", security);
for(const DataNode &node : unparsed)
file.Write(node);
}
file.EndChild();
}