本文整理汇总了C++中StringTable::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ StringTable::Write方法的具体用法?C++ StringTable::Write怎么用?C++ StringTable::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringTable
的用法示例。
在下文中一共展示了StringTable::Write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Write
void ResourceTable::Write(const lemon::String & locale,IWriter & writer) const
{
std::string utf8 = lemon::to_utf8(locale);
char localeString[5] = {0};
memset(localeString,0,5);
size_t localeStringLength = utf8.size();
if(utf8.size() > 5) localeStringLength = 5;
memcpy(localeString,utf8.c_str(),localeStringLength);
writer.Write((const lemon::byte_t*)&localeString,5);
//i18n -> l10n text table size
lemon::uint16_t i18nTextTableSize = htons((lemon::uint16_t)_textTable.size());
writer.Write((const lemon::byte_t*)&i18nTextTableSize,sizeof(i18nTextTableSize));
//trace message table size
lemon::uint16_t traceMessageTableSize = htons((lemon::uint16_t)_traceMessageTable.size());
writer.Write((const lemon::byte_t*)&traceMessageTableSize,sizeof(traceMessageTableSize));
//trace catalog table size
lemon::uint16_t traceCatalogTableSize = htons((lemon::uint16_t)_traceCatalogTable.size());
writer.Write((const lemon::byte_t*)&traceCatalogTableSize,sizeof(traceCatalogTableSize));
//trace catalog table size
lemon::uint16_t errorMessageTableSize = htons((lemon::uint16_t)_errorMessageTable.size());
writer.Write((const lemon::byte_t*)&errorMessageTableSize,sizeof(errorMessageTableSize));
// string table size
lemon::uint16_t stringTableSize = htons((lemon::uint16_t)_stringTable.Items());
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);
//.........这里部分代码省略.........