当前位置: 首页>>代码示例>>C++>>正文


C++ Serializable::toXml方法代码示例

本文整理汇总了C++中Serializable::toXml方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializable::toXml方法的具体用法?C++ Serializable::toXml怎么用?C++ Serializable::toXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Serializable的用法示例。


在下文中一共展示了Serializable::toXml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: serialize

bool RangeProfilePlotManager::serialize(SessionItemSerializer& serializer) const
{
   XMLWriter writer("RangeProfilePlotManager");
   writer.addAttr("viewId", mpView->getId());

#pragma message(__FILE__ "(" STRING(__LINE__) ") : warning : We should be able to save the plot's session id and restore " \
"using that but the PlotWidget is not really part of the session. The following code is a work around and should be changed " \
"when OPTICKS-542 is implemented. (tclarke)")

   writer.pushAddPoint(writer.addElement("plot"));
   Serializable* pPlotSer = dynamic_cast<Serializable*>(mpPlot); // The imp side is serializable
   VERIFY(pPlotSer);
   if (!pPlotSer->toXml(&writer))
   {
      return false;
   }
   writer.popAddPoint();
   writer.pushAddPoint(writer.addElement("plotView"));
   Serializable* pPlotViewSer = dynamic_cast<Serializable*>(mpView); // The imp side is serializable
   VERIFY(pPlotViewSer);
   if (!pPlotViewSer->toXml(&writer))
   {
      return false;
   }
   writer.popAddPoint();

   for (std::map<Signature*, std::string>::const_iterator sig = mSigPointSets.begin();
      sig != mSigPointSets.end(); ++sig)
   {
      writer.pushAddPoint(writer.addElement("signature"));
      writer.addAttr("sigId", sig->first->getId());
      writer.addAttr("pointSetName", sig->second);
      writer.popAddPoint();
   }

   if (!serializer.serialize(writer))
   {
      return false;
   }
   serializer.endBlock();
   return DockWindowShell::serialize(serializer);
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:42,代码来源:RangeProfilePlotManager.cpp


注:本文中的Serializable::toXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。