CData* CDecodeFlowData::readData ( const QDomElement& data) { bool bOk = false; CData* d = NULL; QDomElement id = data.firstChildElement("id"); QDomElement name = data.firstChildElement("name"); QDomElement cl = data.firstChildElement("class"); QDomElement flowType = data.firstChildElement("flow-type"); if (!id.isNull() && !name.isNull() && !cl.isNull() && !flowType.isNull()) { bOk = true; d = new CData(name.text()); d->setID(id.text().toInt(&bOk)); d->setDataType((CData::dataType) (flowType.text().toInt(&bOk)) ); CClass* c = m_typeFactory->getTypeById(d->getID()); if (c != NULL) d->setClass(c); else bOk = false; } if ((d != NULL) && (bOk == false)) { delete d; d = NULL; } return d; }
bool CDecodeFlowData::decode ( const QDomElement& item ) { CData* d = readData(item); bool bCorrectlyDecoded; if (d != NULL) { m_dataFactory->insertData(d, d->getID()); bCorrectlyDecoded = true; } else bCorrectlyDecoded = false; return bCorrectlyDecoded; }