KeyFace::KeyFace(VAC * vac, XmlStreamReader & xml) : Cell(vac, xml), KeyCell(vac, xml), FaceCell(vac, xml) { // Cycles QString str; QStringRef d = xml.attributes().value("cycles"); bool opened = false; for(int i=0; i<d.length(); ++i) { QChar c = d.at(i); if(c == '[') opened = true; if(opened) str += c; if(c==']') { cycles_ << Cycle(); cycles_.last().fromString(str); opened = false; str.clear(); } } }
InbetweenVertex::InbetweenVertex(VAC * vac, XmlStreamReader & xml) : Cell(vac, xml), InbetweenCell(vac, xml), VertexCell(vac, xml), beforeVertex_(0), afterVertex_(0) { color_[0] = 0; color_[1] = 0; color_[2] = 0; color_[3] = 1; tmp_ = new TempRead(); tmp_->before = xml.attributes().value("beforevertex").toInt(); tmp_->after = xml.attributes().value("aftervertex").toInt(); }
KeyEdge::KeyEdge(VAC * vac, XmlStreamReader & xml) : Cell(vac, xml), KeyCell(vac, xml), EdgeCell(vac, xml) { tmp_ = new TempRead(); if(xml.attributes().hasAttribute("startvertex")) tmp_->left = xml.attributes().value("startvertex").toInt(); else tmp_->left = -1; if(xml.attributes().hasAttribute("endvertex")) tmp_->right = xml.attributes().value("endvertex").toInt(); else tmp_->right = -1; geometry_ = EdgeGeometry::read(xml); }
// Constructor for parser function Message::Message(XmlStreamReader& xml) : QObject(), m_timeStamp(), m_timeStampPresent( false ), m_code( 0 ), m_codePresent( false ), m_version( "1.0.0" ), // initialize fixed value m_versionPresent( true ), m_changed(true) { QXmlStreamAttributes attr = xml.attributes(); if ( attr.hasAttribute( "TimeStamp" ) ) { if ( !setTimeStamp( QDateTime::fromString(attr.value( "TimeStamp" ).toString(), Qt::ISODate)) ) xml.validationError( "error set TimeStamp = " + attr.value( "TimeStamp" ).toString() ); } if ( attr.hasAttribute( "Code" ) ) { if ( !setCode( attr.value( "Code" ).toString().toInt() ) ) xml.validationError( "error set Code = " + attr.value( "Code" ).toString() ); } if ( attr.hasAttribute( "Version" ) ) { if ( !setVersion( attr.value( "Version" ).toString() ) ) xml.validationError( "error set Version = " + attr.value( "Version" ).toString() ); } bool stop(false); while(!xml.atEnd() && !stop) { QXmlStreamReader::TokenType token = xml.readNext(); switch ( token ) { case QXmlStreamReader::EndElement: if ( xml.name() == "Message" ) stop = true; break; case QXmlStreamReader::StartElement: if ( xml.name() == "Argument" ) { QString val = xml.readElementText(); if ( xml.name() != "Argument" ) xml.raiseError( "tag mismatch Argument" ); else if ( !addArgument( val ) ) xml.validationError( "error add Argument" ); } else { xml.validationError( "unexpected element " + xml.name().toString() ); } break; default: break; } } }
InbetweenEdge::InbetweenEdge(VAC * vac, XmlStreamReader & xml) : Cell(vac,xml), InbetweenCell(vac, xml), EdgeCell(vac, xml) { if(xml.attributes().hasAttribute("beforecycle")) { beforeCycle_.fromString(xml.attributes().value("beforecycle").toString()); afterCycle_.fromString(xml.attributes().value("aftercycle").toString()); // Cycle offset if(xml.attributes().hasAttribute("cycleoffset")) afterCycle_.setStartingPoint(xml.attributes().value("cycleoffset").toDouble()); } else { beforePath_.fromString(xml.attributes().value("beforepath").toString()); afterPath_.fromString(xml.attributes().value("afterpath").toString()); startAnimatedVertex_.fromString(xml.attributes().value("startanimatedvertex").toString()); endAnimatedVertex_.fromString(xml.attributes().value("endanimatedvertex").toString()); } }
KeyVertex::KeyVertex(VAC * vac, XmlStreamReader & xml) : Cell(vac, xml), KeyCell(vac, xml), VertexCell(vac, xml) { initColor(); // Position QString stringPos = xml.attributes().value("position").toString(); QStringList list = stringPos.split(","); pos_[0] = list[0].toDouble(); pos_[1] = list[1].toDouble(); // Size //in >> field >> size_; // Tangent Edges //in >> tangentEdges_; }