本文整理汇总了C++中StringTable::Push方法的典型用法代码示例。如果您正苦于以下问题:C++ StringTable::Push方法的具体用法?C++ StringTable::Push怎么用?C++ StringTable::Push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringTable
的用法示例。
在下文中一共展示了StringTable::Push方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Write
//.........这里部分代码省略.........
writer.Write((const lemon::byte_t*)&stringTableSize,sizeof(stringTableSize));
//i18n -> l10n text table
{
TextTable::const_iterator iter,end = _textTable.end();
for(iter = _textTable.begin() ; iter != end; ++ iter)
{
const I18nText & text = iter->second;
lemon::uint32_t index = htonl(text.key);
writer.Write((const lemon::byte_t*)&index,sizeof(index));
index = htonl(text.Message);
writer.Write((const lemon::byte_t*)&index,sizeof(index));
}
}
//trace message table size
{
TraceMessageTable::const_iterator iter,end = _traceMessageTable.end();
for(iter = _traceMessageTable.begin() ; iter != end; ++ iter)
{
const TraceMessage & text = iter->second;
lemon::uint32_t index = htonl(text.Id);
writer.Write((const lemon::byte_t*)&index,sizeof(index));
index = htonl(text.Message);
writer.Write((const lemon::byte_t*)&index,sizeof(index));
}
}
//trace catalog table size
{
TraceCatalogTable::const_iterator iter,end = _traceCatalogTable.end();
for(iter = _traceCatalogTable.begin() ; iter != end; ++ iter)
{
const TraceCatalog & text = iter->second;
lemon::uint32_t index = htonl(text.Value);
writer.Write((const lemon::byte_t*)&index,sizeof(index));
index = htonl(text.Name);
writer.Write((const lemon::byte_t*)&index,sizeof(index));
index = htonl(text.Description);
writer.Write((const lemon::byte_t*)&index,sizeof(index));
}
}
// error message
{
ErrorMessageTable::const_iterator iter,end = _errorMessageTable.end();
for(iter = _errorMessageTable.begin() ; iter != end; ++ iter)
{
const ErrorMessage & text = iter->second;
lemon::uint32_t index = htonl(text.Code);
writer.Write((const lemon::byte_t*)&index,sizeof(index));
index = htonl(text.Name);
writer.Write((const lemon::byte_t*)&index,sizeof(index));
index = htonl(text.Description);
writer.Write((const lemon::byte_t*)&index,sizeof(index));
}
}
// string table
StringTable table;
for(size_t i = 0 ; i < _stringTable.Items(); ++ i)
{
tuple<const lemon::byte_t*,size_t> result = _stringTable.Get((lemon::uint32_t)i);
std::string utf8 = lemon::to_utf8((const char_t*)get<0>(result));
table.Push(__cbuf(utf8.c_str()));
}
table.Write(writer);
}