20 mBaseNodeName(baseNodeName)
30 mGetFunctions[nodeName] = getValueFunction;
31 mSetFunctions[nodeName] = setValueFunction;
35 void PatientStorage::duringSavePatientSlot(QDomElement& node)
38 QDomElement baseNode = root.descend(mBaseNodeName).node().toElement();
39 this->addXml(baseNode);
42 void PatientStorage::duringLoadPatientSlot(QDomElement& node)
44 XMLNodeParser root(node);
45 QDomElement baseNode = root.descend(mBaseNodeName).node().toElement();
46 if (!baseNode.isNull())
47 this->parseXml(baseNode);
50 void PatientStorage::addXml(QDomNode& parentNode)
52 QDomDocument doc = parentNode.ownerDocument();
54 std::map<QString, boost::function<QString()> >::iterator iter;
55 for(iter = mGetFunctions.begin(); iter != mGetFunctions.end(); ++iter)
57 QDomElement newDataNode = doc.createElement(iter->first);
58 newDataNode.appendChild(doc.createTextNode(iter->second()));
59 parentNode.appendChild(newDataNode);
63 void PatientStorage::parseXml(QDomNode& dataNode)
65 std::map<QString, boost::function<void(QString value)> >::iterator iter;
66 for(iter = mSetFunctions.begin(); iter != mSetFunctions.end(); ++iter)
68 QString nodeValue = dataNode.namedItem(iter->first).toElement().text();
69 iter->second(nodeValue);