本文整理汇总了C++中Serializable::fromXml方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializable::fromXml方法的具体用法?C++ Serializable::fromXml怎么用?C++ Serializable::fromXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Serializable
的用法示例。
在下文中一共展示了Serializable::fromXml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserialize
bool RangeProfilePlotManager::deserialize(SessionItemDeserializer& deserializer)
{
XmlReader reader(NULL, false);
DOMElement* pRootElement = deserializer.deserialize(reader, "RangeProfilePlotManager");
if (pRootElement)
{
std::string viewId = A(pRootElement->getAttribute(X("viewId")));
mpView = dynamic_cast<PlotView*>(Service<SessionManager>()->getSessionItem(viewId));
mpPlot = Service<DesktopServices>()->createPlotWidget(getName(), CARTESIAN_PLOT);
VERIFY(mpPlot);
Serializable* pPlotSer = dynamic_cast<Serializable*>(mpPlot); // The imp side is serializable
VERIFY(pPlotSer);
if (!pPlotSer->fromXml(findChildNode(pRootElement, "plot"), reader.VERSION))
{
return false;
}
mpView = mpPlot->getPlot();
VERIFY(mpView);
Serializable* pPlotViewSer = dynamic_cast<Serializable*>(mpView); // The imp side is serializable
VERIFY(pPlotViewSer);
if (!pPlotViewSer->fromXml(findChildNode(pRootElement, "plotView"), reader.VERSION))
{
return false;
}
std::list<PlotObject*> objects;
mpView->getObjects(POINT_SET, objects);
FOR_EACH_DOMNODE(pRootElement, pChild)
{
if (XMLString::equals(pChild->getNodeName(), X("signature")))
{
DOMElement* pChldElmnt = static_cast<DOMElement*>(pChild);
std::string sigId = A(pChldElmnt->getAttribute(X("sigId")));
std::string pointSetName = A(pChldElmnt->getAttribute(X("pointSetName")));
Signature* pSignature = static_cast<Signature*>(Service<SessionManager>()->getSessionItem(sigId));
if (pSignature == NULL)
{
return false;
}
mSigPointSets[pSignature] = pointSetName;
pSignature->attach(SIGNAL_NAME(Subject, Deleted), Slot(this, &RangeProfilePlotManager::signatureDeleted));
pSignature->getDataDescriptor()->attach(SIGNAL_NAME(DataDescriptor, Renamed),
Slot(this, &RangeProfilePlotManager::signatureRenamed));
}
}
deserializer.nextBlock();
return DockWindowShell::deserialize(deserializer);
}
return false;
}