本文整理汇总了C++中OutputStream::EndCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputStream::EndCommand方法的具体用法?C++ OutputStream::EndCommand怎么用?C++ OutputStream::EndCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputStream
的用法示例。
在下文中一共展示了OutputStream::EndCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Write
//.........这里部分代码省略.........
layout_desc = Impl::LayoutDescPtr ();
Impl::LayoutMap::iterator layout_iter = impl->layouts.find (layout.Id ());
if (layout_iter != impl->layouts.end ())
layout_desc = layout_iter->second;
}
}
else
{
Impl::LayoutMap::iterator layout_iter = impl->layouts.find (layout.Id ());
if (layout_iter != impl->layouts.end ())
layout_desc = layout_iter->second;
}
//синхронизация идентификатора карты
PropertyMapHeader header = {static_cast<object_id_t> (properties.Id ()), false, false};
if (!layout_desc || layout_desc->hash != layout.Hash ())
{
header.has_layout = true;
}
else //we always send layout id so reader will have possibility to restore layout after exception
{
header.has_layout_id = true;
}
stream.BeginCommand (CommandId_UpdatePropertyMap);
stream.Write (header);
//синхронизация лэйаута
if (header.has_layout)
{
impl->WriteLayout (stream, layout, layout_desc);
}
if (header.has_layout_id)
{
write (stream, static_cast<object_id_t> (layout.Id ()));
}
//создание объекта слежения за картой свойств
bool need_add_new_map = !map_desc;
if (!map_desc)
{
map_desc = Impl::MapDescPtr (new Impl::MapDesc, false);
map_desc->layout = layout_desc;
}
//синхронизация буфера карты свойств
write (stream, static_cast<uint32> (properties.BufferSize ()));
stream.WriteData (properties.BufferData (), properties.BufferSize ());
//синхронизация строк
for (IndexArray::iterator iter=layout_desc->string_indices.begin (), end=layout_desc->string_indices.end (); iter!=end; ++iter)
write (stream, properties.GetString (*iter));
//обновление полей и карт
if (need_add_new_map)
{
properties.Trackable ().connect_tracker (xtl::bind (&Impl::RemovePropertyMap, impl.get (), properties.Id ()), *impl);
impl->property_maps.insert_pair (properties.Id (), map_desc);
}
if (map_desc->layout != layout_desc)
map_desc->layout = layout_desc;
//обновление хэша
map_desc->hash = properties.Hash ();
//закрытие команды
stream.EndCommand ();
}
catch (xtl::exception& e)
{
stream.SetPosition (saved_position);
e.touch ("render::scene::interchange::PropertyMapWriter::Write");
throw;
}
catch (...)
{
stream.SetPosition (saved_position);
throw;
}
}