void CLandmarkPoint::dumpGPX( QXmlStreamWriter & _rqXmlStreamWriter ) const { // GPX format reference: see http://www.topografix.com/GPX/1/1/ // Data _rqXmlStreamWriter.writeStartElement( "wpt" ); // ... position _rqXmlStreamWriter.writeAttribute( "lon", QString::number( CDataPosition::getLongitude() ) ); _rqXmlStreamWriter.writeAttribute( "lat", QString::number( CDataPosition::getLatitude() ) ); // ... name if( !qsName.isEmpty() ) { _rqXmlStreamWriter.writeStartElement( "name" ); _rqXmlStreamWriter.writeCharacters( qsName ); _rqXmlStreamWriter.writeEndElement(); // name } // ... elevation if( CDataPosition::getElevation() != CDataPosition::UNDEFINED_ELEVATION ) { _rqXmlStreamWriter.writeStartElement( "ele" ); _rqXmlStreamWriter.writeCharacters( QString::number( CDataPosition::getElevation() ) ); _rqXmlStreamWriter.writeEndElement(); // ele } // ... type if( !qsType.isEmpty() ) { _rqXmlStreamWriter.writeStartElement( "type" ); _rqXmlStreamWriter.writeCharacters( qsType ); _rqXmlStreamWriter.writeEndElement(); // type } // ... description if( !qsDescription.isEmpty() ) { _rqXmlStreamWriter.writeStartElement( "desc" ); _rqXmlStreamWriter.writeCDATA( qsDescription ); _rqXmlStreamWriter.writeEndElement(); // desc } // ... comment if( !qsComment.isEmpty() ) { _rqXmlStreamWriter.writeStartElement( "cmt" ); _rqXmlStreamWriter.writeCDATA( qsComment ); _rqXmlStreamWriter.writeEndElement(); // cmt } // ... symbol if( !qsSymbol.isEmpty() ) { _rqXmlStreamWriter.writeStartElement( "sym" ); _rqXmlStreamWriter.writeCharacters( qsSymbol ); _rqXmlStreamWriter.writeEndElement(); // sym } // ... url if( !qsUrl.isEmpty() ) { _rqXmlStreamWriter.writeStartElement( "link" ); _rqXmlStreamWriter.writeAttribute( "href", qsUrl ); _rqXmlStreamWriter.writeEndElement(); // link } // ... [end] _rqXmlStreamWriter.writeEndElement(); // wpt }
void radeon_profile::saveTopbarItemsSchemas(QXmlStreamWriter &xml) { xml.writeStartElement("TopbarItems"); for (const TopbarItemDefinitionSchema &tis : topbarManager.schemas) { xml.writeStartElement("topbarItem"); xml.writeAttribute("type", QString::number(tis.type)); xml.writeAttribute("primaryValueId", QString::number(tis.primaryValueId)); xml.writeAttribute("primaryColor", tis.primaryColor.name()); xml.writeAttribute("secondaryValueIdEnabled", QString::number(tis.secondaryValueIdEnabled)); xml.writeAttribute("secondaryValueId", QString::number(tis.secondaryValueId)); xml.writeAttribute("secondaryColor", tis.secondaryColor.name()); xml.writeAttribute("pieMaxValue", QString::number(tis.pieMaxValue)); xml.writeEndElement(); } xml.writeEndElement(); }
void ProfileManagement::on_pushButton_4_clicked() { int AllRowNumber; AllRowNumber = ui->tableWidget->rowCount(); QDateTime DateTime = QDateTime::currentDateTime(); QString DateTime11 = DateTime.toString(); if(AllRowNumber==0) { ui->textEdit->setText("<"+DateTime11+"> Brak danych do zapisu!\n"); return; } QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "", tr("Files (*.xml)")); if(fileName==0) { ui->textEdit->setText("<"+DateTime11+"> Brak sciezki!\n"); return; } else { ui->textEdit->setText("<"+DateTime11+"> Plik pomyślnie wczytany!\n"); } QFile file(fileName); file.open(QIODevice::WriteOnly); QXmlStreamWriter *xmlWriter = new QXmlStreamWriter(&file); xmlWriter->writeStartDocument(); xmlWriter->setAutoFormatting(true); int tmpsila; int tmpkat; int tmppozycja; QString tmprotacja; int tmpprocent; int hitss; for(int i2=0; i2<AllRowNumber; i2++) { hitss = Profil::Profile_Array.at(i2)->Hits; xmlWriter->writeStartElement("Uderzenia"); xmlWriter->writeAttribute("Ilosc", QString::number(hitss)); xmlWriter->writeTextElement("Nazwa", ui->tableWidget->item(i2,0)->text()); for(int i=0;i<Profil::Profile_Array.at(i2)->Rows;i++) { tmppozycja = Profil::Profile_Array.at(i2)->Position.at(i); tmpkat = Profil::Profile_Array.at(i2)->Angle.at(i); tmpsila = Profil::Profile_Array.at(i2)->Power.at(i); tmprotacja = Profil::Profile_Array.at(i2)->Rotation.at(i); tmpprocent = (float)Profil::Profile_Array.at(i2)->Percent.at(i); xmlWriter->writeStartElement("Uderzenie"); xmlWriter->writeTextElement("Procent", QString::number(tmpprocent/100.0)); xmlWriter->writeTextElement("Sila",QString::number(tmpsila)); QString Rotacja = tmprotacja; if(Rotacja=="Boczna") { xmlWriter->writeTextElement("Rotacja","Boczna"); } if(Rotacja=="Wsteczna") { xmlWriter->writeTextElement("Rotacja","Wsteczna"); } if(Rotacja=="Gorna") { xmlWriter->writeTextElement("Rotacja","Gorna"); } if(Rotacja=="Brak") { xmlWriter->writeTextElement("Rotacja","Brak"); } xmlWriter->writeTextElement("Kat",QString::number(tmpkat)); xmlWriter->writeTextElement("Pozycja",QString::number(tmppozycja)); xmlWriter->writeEndElement(); } } xmlWriter->writeEndElement(); xmlWriter->writeEndDocument(); ui->textEdit->setText("<"+DateTime11+">Plik pomyślnie zapisany!\n"); file.close(); }
void Generate_Xml::appendXMLFile(QLineEdit *s,QVector<QLineEdit *> p,int track_subfield,int track_tabchild,int track_tabsibling) { int j=0; QFile Default("default1.xml"); std::cout << "You are now inside appendXmlFile"; QXmlStreamWriter *xmlWriter = new QXmlStreamWriter(); QXmlStreamWriter *xmlWriter2 = new QXmlStreamWriter(); if (!Default.open(QIODevice::Append)) { /* show wrror message if not able to open file */ QMessageBox::warning(0, "Read only", "The file is in read only mode"); } else { QString tem; QString temp1; xmlWriter->setAutoFormatting (true); xmlWriter->setDevice(&Default); xmlWriter2->setDevice(&Default); xmlWriter->autoFormatting(); tem=s->displayText(); xmlWriter2->writeEndDocument(); for(int i=0;i<track_tabchild;i++) { xmlWriter->writeCharacters("\t"); } xmlWriter->writeStartElement(tem); /* std::cout << "You are now appending to the file";*/ /*xmlWriter1->setDevice(&Default);*/ /*xmlWriter1->autoFormatting();*/ /*xmlWriter1->setAutoFormatting (true);*/ //while(i<t) //{ // if(p.at(i)==0 && i != (t-1)) // { // i++; // // tem=(p.at(i))->displayText(); // /*temp=tem.toStdString();*/ // xmlWriter->writeStartElement(tem); // i++; // // // } // if(p.at(i-1)!= 0 && p.at(i)== 0) // { // //xmlWriter1->writeCharacters(" "); // xmlWriter->writeEndDocument(); // i++; // // if(i=t) // break; // // } // if(p.at(i)!= 0) // { // tem=(p.at(i))->displayText(); // i++; // // temp1=(p.at(i))->displayText(); // i++; // // xmlWriter->writeAttribute(tem,temp1); // // } //} xmlWriter->writeCharacters(" "); Default.close(); for(int i=0;i<track_subfield;++i) j=rewriteXMLFile(p,j+1,track_tabsibling); //xmlWriter->writeStartDocument(); //xmlWriter->writeAttribute("name"," ");//This is only useful //xmlWriter->writeEndDocument(); } delete xmlWriter2; bool a; Default.open(QIODevice::Append); QXmlStreamWriter *xmlWriter1 = new QXmlStreamWriter(); xmlWriter1->setDevice(&Default); xmlWriter1->writeEndDocument(); a=xmlWriter->autoFormatting(); xmlWriter->setAutoFormatting(a); //xmlWriter->writeCharacters(" "); for(int i=0;i<track_tabchild;i++) { xmlWriter->writeCharacters("\t"); } xmlWriter->writeEndDocument(); delete xmlWriter; delete xmlWriter1; }
void radeon_profile::saveOcProfiles(QXmlStreamWriter &xml) { xml.writeStartElement("OcProfiles"); for (QString k : ocProfiles.keys()) { xml.writeStartElement("ocProfile"); xml.writeAttribute("name", k); auto oct = ocProfiles.value(k); xml.writeAttribute("powerCap", QString::number(oct.powerCap)); for (auto tk : oct.tables.keys()) { const FVTable &fvt = oct.tables.value(tk); xml.writeStartElement("table"); xml.writeAttribute("tableName", tk); for (auto fvtk : fvt.keys()) { const FreqVoltPair &fvp = fvt.value(fvtk); xml.writeStartElement("state"); xml.writeAttribute("enabled", QString::number(true)); xml.writeAttribute("stateNumber", QString::number(fvtk)); xml.writeAttribute("frequency", QString::number(fvp.frequency)); xml.writeAttribute("voltage", QString::number(fvp.voltage)); xml.writeEndElement(); } xml.writeEndElement(); } xml.writeEndElement(); } xml.writeEndElement(); }
void Distance::writeXml(QXmlStreamWriter& writer) const { writer.writeStartElement("distance"); writer.writeTextElement("dist", QString::number(dist)); writer.writeTextElement("unit", unitToQString(unit)); writer.writeEndElement(); }
void ScaleBarOverlay::writeCurrentConfig(QXmlStreamWriter &writer) { RectOverlay::writeCurrentConfig(writer); writer.writeTextElement("color", mPen.color().name()); }
/** Writes <tagName>Base64_encoded_value</tagName> to the XML stream. */ void PwStreamUtilsV4::writeBase64(QXmlStreamWriter& xml, const QString& tagName, const QByteArray& value) { xml.writeTextElement(tagName, value.toBase64()); }
/** Writes <tagName>bool_value_as_string</tagName> to the XML stream. */ void PwStreamUtilsV4::writeBool(QXmlStreamWriter& xml, const QString& tagName, const bool value) { xml.writeTextElement(tagName, value ? XML_TRUE : XML_FALSE); }
/** Writes <tagName>time_value</tagName> to the XML stream. */ void PwStreamUtilsV4::writeTime(QXmlStreamWriter& xml, const QString& tagName, const QDateTime& time) { xml.writeTextElement(tagName, time.toTimeSpec(Qt::UTC).toString(Qt::ISODate)); // YYYY-MM-DDTHH:mm:ssZ }
/** Writes <tagName>UUID_as_base64</tagName> to the XML stream. */ void PwStreamUtilsV4::writeUuid(QXmlStreamWriter& xml, const QString& tagName, const PwUuid& uuid) { xml.writeTextElement(tagName, uuid.toByteArray().toBase64()); }
void OsmWriter::_writeRelations(shared_ptr<const OsmMap> map, QXmlStreamWriter& writer) { RelationMap::const_iterator it = map->getRelationMap().begin(); while (it != map->getRelationMap().end()) { const shared_ptr<Relation>& r = it->second; writer.writeStartElement("relation"); writer.writeAttribute("visible", "true"); writer.writeAttribute("id", QString::number(r->getId())); _writeMetadata(writer, r.get()); const vector<RelationData::Entry>& members = r->getMembers(); for (size_t j = 0; j < members.size(); j++) { const RelationData::Entry& e = members[j]; writer.writeStartElement("member"); writer.writeAttribute("type", _typeName(e.getElementId().getType())); writer.writeAttribute("ref", QString::number(e.getElementId().getId())); writer.writeAttribute("role", _e(e.role)); writer.writeEndElement(); } const Tags& tags = r->getTags(); for (Tags::const_iterator tit = tags.constBegin(); tit != tags.constEnd(); ++tit) { if (tit.key().isEmpty() == false && tit.value().isEmpty() == false) { writer.writeStartElement("tag"); writer.writeAttribute("k", _e(tit.key())); writer.writeAttribute("v", _e(tit.value())); writer.writeEndElement(); } } if (r->getType() != "") { writer.writeStartElement("tag"); writer.writeAttribute("k", "type"); writer.writeAttribute("v", _e(r->getType())); writer.writeEndElement(); } if (r->getCircularError() >= 0) { writer.writeStartElement("tag"); writer.writeAttribute("k", "error:circular"); writer.writeAttribute("v", QString("%1").arg(r->getCircularError())); writer.writeEndElement(); } if (_includeDebug || _includeIds) { writer.writeStartElement("tag"); writer.writeAttribute("k", "hoot:id"); writer.writeAttribute("v", QString("%1").arg(r->getId())); writer.writeEndElement(); } if (_includeDebug) { writer.writeStartElement("tag"); writer.writeAttribute("k", "hoot:status"); writer.writeAttribute("v", QString("%1").arg(r->getStatus().getEnum())); writer.writeEndElement(); } writer.writeEndElement(); ++it; } }
void OsmWriter::_writeWays(shared_ptr<const OsmMap> map, QXmlStreamWriter& writer) { WayMap::const_iterator it = map->getWays().begin(); while (it != map->getWays().end()) { const Way* w = it->second.get(); writer.writeStartElement("way"); writer.writeAttribute("visible", "true"); writer.writeAttribute("id", QString::number(w->getId())); _writeMetadata(writer, w); for (size_t j = 0; j < w->getNodeCount(); j++) { writer.writeStartElement("nd"); long nid = w->getNodeId(j); writer.writeAttribute("ref", QString::number(w->getNodeId(j))); if (_includePointInWays) { shared_ptr<const Node> n = map->getNode(nid); writer.writeAttribute("x", QString::number(n->getX(), 'g', _precision)); writer.writeAttribute("y", QString::number(n->getY(), 'g', _precision)); } writer.writeEndElement(); } const Tags& tags = w->getTags(); for (Tags::const_iterator tit = tags.constBegin(); tit != tags.constEnd(); ++tit) { if (tit.key().isEmpty() == false && tit.value().isEmpty() == false) { writer.writeStartElement("tag"); writer.writeAttribute("k", _e(tit.key())); writer.writeAttribute("v", _e(tit.value())); writer.writeEndElement(); } } if (w->getCircularError() >= 0) { writer.writeStartElement("tag"); writer.writeAttribute("k", "error:circular"); writer.writeAttribute("v", QString("%1").arg(w->getCircularError())); writer.writeEndElement(); } if (_includeDebug || _includeIds) { writer.writeStartElement("tag"); writer.writeAttribute("k", "hoot:id"); writer.writeAttribute("v", QString("%1").arg(w->getId())); writer.writeEndElement(); } if (_includeDebug) { writer.writeStartElement("tag"); writer.writeAttribute("k", "hoot:status"); writer.writeAttribute("v", QString("%1").arg(w->getStatus().getEnum())); writer.writeEndElement(); } writer.writeEndElement(); ++it; } }
void OsmWriter::_writeNodes(shared_ptr<const OsmMap> map, QXmlStreamWriter& writer) { QList<long> nids; NodeMap::const_iterator it = map->getNodeMap().begin(); while (it != map->getNodeMap().end()) { nids.append(it->first); ++it; } // sort the values to give consistent results. qSort(nids.begin(), nids.end(), qGreater<long>()); for (int i = 0; i < nids.size(); i++) { const Node* n = map->getNode(nids[i]).get(); writer.writeStartElement("node"); writer.writeAttribute("visible", "true"); writer.writeAttribute("id", QString::number(n->getId())); _writeMetadata(writer, n); writer.writeAttribute("lat", QString::number(n->getY(), 'f', _precision)); writer.writeAttribute("lon", QString::number(n->getX(), 'f', _precision)); const Tags& tags = n->getTags(); for (Tags::const_iterator it = tags.constBegin(); it != tags.constEnd(); it++) { if (it.key().isEmpty() == false && it.value().isEmpty() == false) { writer.writeStartElement("tag"); writer.writeAttribute("k", _e(it.key())); writer.writeAttribute("v", _e(it.value())); writer.writeEndElement(); } } // turn this on when we start using node circularError. if (n->getCircularError() >= 0 && n->getTags().getNonDebugCount() > 0) { writer.writeStartElement("tag"); writer.writeAttribute("k", "error:circular"); writer.writeAttribute("v", QString("%1").arg(n->getCircularError())); writer.writeEndElement(); } if (_includeDebug || _includeIds) { writer.writeStartElement("tag"); writer.writeAttribute("k", "hoot:id"); writer.writeAttribute("v", QString("%1").arg(n->getId())); writer.writeEndElement(); } if (_includeDebug) { writer.writeStartElement("tag"); writer.writeAttribute("k", "hoot:status"); writer.writeAttribute("v", QString("%1").arg(n->getStatus().getEnum())); writer.writeEndElement(); } writer.writeEndElement(); } }
void SharedStrings::writeRichStringPart_rPr(QXmlStreamWriter &writer, const Format &format) const { if (!format.hasFontData()) return; if (format.fontBold()) writer.writeEmptyElement(QStringLiteral("b")); if (format.fontItalic()) writer.writeEmptyElement(QStringLiteral("i")); if (format.fontStrikeOut()) writer.writeEmptyElement(QStringLiteral("strike")); if (format.fontOutline()) writer.writeEmptyElement(QStringLiteral("outline")); if (format.boolProperty(FormatPrivate::P_Font_Shadow)) writer.writeEmptyElement(QStringLiteral("shadow")); if (format.hasProperty(FormatPrivate::P_Font_Underline)) { Format::FontUnderline u = format.fontUnderline(); if (u != Format::FontUnderlineNone) { writer.writeEmptyElement(QStringLiteral("u")); if (u== Format::FontUnderlineDouble) writer.writeAttribute(QStringLiteral("val"), QStringLiteral("double")); else if (u == Format::FontUnderlineSingleAccounting) writer.writeAttribute(QStringLiteral("val"), QStringLiteral("singleAccounting")); else if (u == Format::FontUnderlineDoubleAccounting) writer.writeAttribute(QStringLiteral("val"), QStringLiteral("doubleAccounting")); } } if (format.hasProperty(FormatPrivate::P_Font_Script)) { Format::FontScript s = format.fontScript(); if (s != Format::FontScriptNormal) { writer.writeEmptyElement(QStringLiteral("vertAlign")); if (s == Format::FontScriptSuper) writer.writeAttribute(QStringLiteral("val"), QStringLiteral("superscript")); else writer.writeAttribute(QStringLiteral("val"), QStringLiteral("subscript")); } } if (format.hasProperty(FormatPrivate::P_Font_Size)) { writer.writeEmptyElement(QStringLiteral("sz")); writer.writeAttribute(QStringLiteral("val"), QString::number(format.fontSize())); } if (format.hasProperty(FormatPrivate::P_Font_Color)) { XlsxColor color = format.property(FormatPrivate::P_Font_Color).value<XlsxColor>(); color.saveToXml(writer); } if (!format.fontName().isEmpty()) { writer.writeEmptyElement(QStringLiteral("rFont")); writer.writeAttribute(QStringLiteral("val"), format.fontName()); } if (format.hasProperty(FormatPrivate::P_Font_Family)) { writer.writeEmptyElement(QStringLiteral("family")); writer.writeAttribute(QStringLiteral("val"), QString::number(format.intProperty(FormatPrivate::P_Font_Family))); } if (format.hasProperty(FormatPrivate::P_Font_Scheme)) { writer.writeEmptyElement(QStringLiteral("scheme")); writer.writeAttribute(QStringLiteral("val"), format.stringProperty(FormatPrivate::P_Font_Scheme)); } }
/** Writes <tagName>value</tagName> to the XML stream. */ void PwStreamUtilsV4::writeInt32(QXmlStreamWriter& xml, const QString& tagName, const qint32 value) { xml.writeTextElement(tagName, QString::number(value)); }
void Film::sauvegarde(QXmlStreamWriter & stream) { qDebug()<<"Sauvegade de "<<nom(); stream.writeStartElement("media"); stream.writeTextElement("nom", nom()); stream.writeTextElement("genre", genre()); stream.writeTextElement("date", date().toString("d/M/yyyy")); stream.writeTextElement("vue", QString::number(isFini())); stream.writeTextElement("url", url().toString()); stream.writeTextElement("type", getType()); stream.writeTextElement("realisateur", getRealisateur()); stream.writeTextElement("scenariste", getScenariste()); stream.writeTextElement("support", QString::number(getSupport())); stream.writeTextElement("duree", getDuree().toString()); foreach(QString jupiter, getActeursPrincipaux()) { stream.writeTextElement("acteur", jupiter); }
bool TrainingSetFile::flush() { QXmlStreamWriter tsWriteXML; int nPatterns = ts->getPatternCount(), nInputs = ts->getInputsSize(), nTargets = ts->getTargetsSize(); QString strInputs, strTargets; vector<vector<double> > inputs = ts->getInputs(), targets = ts->getTargets(); Normalization *inputsNorm = ts->getInputsNormalization(), *targetsNorm = ts->getTargetsNormalization(); QString strInputsNorm = inputsNorm->getName(), strTargetsNorm = targetsNorm->getName(); DataRepresentation *idr = ts->getInputsDataRepresentation(), *tdr = ts->getTargetsDataRepresentation(); tsWriteXML.setDevice(this); tsWriteXML.setAutoFormatting(true); tsWriteXML.setAutoFormattingIndent(3); tsWriteXML.writeStartDocument(); tsWriteXML.writeStartElement(STR_TRAININGSET); //Indica el numero de patrones a almacenar tsWriteXML.writeAttribute(STR_PATTERNSIZE, QString::number(nPatterns)); //Indica el tamaño de las entradas tsWriteXML.writeAttribute(STR_INPUTSSIZE, QString::number(nInputs)); //Indica el tamaño de las salidas tsWriteXML.writeAttribute(STR_TARGETSSIZE, QString::number(nTargets)); //Indica propiedades particulares del archivo tsWriteXML.writeStartElement(STR_PROPERTIES); tsWriteXML.writeAttribute(STR_VERSION, "1.0.0"); tsWriteXML.writeEndElement(); //Este parametro indica que representacion grafica se usara para visualizar entradas tsWriteXML.writeStartElement(STR_INPUTSDATAREPRESENTATION); tsWriteXML.writeAttribute(STR_NAME, idr->getName()); tsWriteXML.writeAttribute(STR_FORMAT, idr->getImageFormatName()); tsWriteXML.writeAttribute(STR_WIDTH, QString::number(idr->getWidth())); tsWriteXML.writeAttribute(STR_HEIGHT, QString::number(idr->getHeight())); tsWriteXML.writeEndElement(); //Este parametro indica que representacion grafica se usara para visualizar las salidas tsWriteXML.writeStartElement(STR_TARGETSDATAREPRESENTATION); tsWriteXML.writeAttribute(STR_NAME, tdr->getName()); tsWriteXML.writeAttribute(STR_FORMAT, tdr->getImageFormatName()); tsWriteXML.writeAttribute(STR_WIDTH, QString::number(tdr->getWidth())); tsWriteXML.writeAttribute(STR_HEIGHT, QString::number(tdr->getHeight())); tsWriteXML.writeEndElement(); //Normalizacion de entradas tsWriteXML.writeStartElement(STR_INPUTSNORMALIZATION); tsWriteXML.writeAttribute(STR_TYPE, strInputsNorm); tsWriteXML.writeAttribute(STR_MAXVALUE, QString::number(inputsNorm->getMaxValue(), decimalformat, decimals)); tsWriteXML.writeAttribute(STR_MINVALUE, QString::number(inputsNorm->getMinValue(), decimalformat, decimals)); tsWriteXML.writeAttribute(STR_THRESHOLD, QString::number(inputsNorm->getThreshold(), decimalformat, decimals)); tsWriteXML.writeAttribute(STR_AMPLITUDE, QString::number(inputsNorm->getAmplitude(), decimalformat, decimals)); tsWriteXML.writeAttribute(STR_ELONGATION, QString::number(inputsNorm->getElongation(), decimalformat, decimals)); tsWriteXML.writeEndElement(); //Normalizacion de salidas tsWriteXML.writeStartElement(STR_TARGETSNORMALIZATION); tsWriteXML.writeAttribute(STR_TYPE, strTargetsNorm); tsWriteXML.writeAttribute(STR_MAXVALUE, QString::number(targetsNorm->getMaxValue(), decimalformat, decimals)); tsWriteXML.writeAttribute(STR_MINVALUE, QString::number(targetsNorm->getMinValue(), decimalformat, decimals)); tsWriteXML.writeAttribute(STR_THRESHOLD, QString::number(targetsNorm->getThreshold(), decimalformat, decimals)); tsWriteXML.writeAttribute(STR_AMPLITUDE, QString::number(targetsNorm->getAmplitude(), decimalformat, decimals)); tsWriteXML.writeAttribute(STR_ELONGATION, QString::number(targetsNorm->getElongation(), decimalformat, decimals)); tsWriteXML.writeEndElement(); for(int p = 0; p < nPatterns; p++){ tsWriteXML.writeStartElement(STR_PATTERN); tsWriteXML.writeAttribute(STR_INDEX, QString::number(p)); //Se escriben las entradas tsWriteXML.writeStartElement(STR_INPUTS); strInputs = ""; for(int i = 0; i < nInputs; i++){ strInputs += QString::number(inputs[p][i], decimalformat, decimals); if(i != nInputs - 1){ strInputs += STR_SEPARATOR; } } tsWriteXML.writeCharacters(strInputs); tsWriteXML.writeEndElement();//inputs //Se escriben las salidas tsWriteXML.writeStartElement(STR_TARGETS); strTargets = ""; for(int t = 0; t < nTargets; t++){ strTargets += QString::number(targets[p][t], decimalformat, decimals); if(t != nTargets - 1){ strTargets += STR_SEPARATOR; } } // tsXML.writeTextElement("targets", strTargets); tsWriteXML.writeCharacters(strTargets); tsWriteXML.writeEndElement();//targets tsWriteXML.writeEndElement();//pattern } tsWriteXML.writeEndElement();//trainingset tsWriteXML.writeEndDocument(); return true; }
void SoundSettings::saveXML ( const QString &xmlFileName, const QString &origFileName, const QString ©FileName, const QString &title) { QXmlStreamWriter *writer; QFile file (xmlFileName); SYS_DEBUG ("-----------------------------------------------------"); SYS_DEBUG ("*** xmlFileName = %s", SYS_STR(xmlFileName)); if (!file.open(QIODevice::WriteOnly)) { SYS_WARNING ("Unable to open file for writing: %s", SYS_STR(xmlFileName)); return; } /* * */ writer = new QXmlStreamWriter(); writer->setDevice (&file); writer->setAutoFormatting(true); writer->setCodec ("UTF-8"); writer->writeStartDocument (); writer->writeStartElement ("soundsettings-applet"); writer->writeStartElement("orig-file"); writer->writeCharacters (origFileName); writer->writeEndElement (); writer->writeStartElement("copy-file"); writer->writeCharacters (copyFileName); writer->writeEndElement (); writer->writeStartElement("title"); writer->writeCharacters (title); writer->writeEndElement (); /* * */ writer->writeEndElement(); writer->writeEndDocument(); delete writer; file.close (); }
void CVesselContainer::dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter, bool bOnlySelected ) const { // Data _rqXmlStreamWriter.writeStartElement( "Flotilla" ); // ... name if( !qsName.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "name", qsName ); // ... visibility _rqXmlStreamWriter.writeAttribute( "visibility", QString::number( COverlayVisibility::getVisibility() ) ); // ... type if( !qsType.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "type", qsType ); // ... url if( !qsUrl.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "url", qsUrl ); // ... description if( !qsDescription.isEmpty() ) { _rqXmlStreamWriter.writeStartElement( "Description" ); _rqXmlStreamWriter.writeCDATA( qsDescription ); _rqXmlStreamWriter.writeEndElement(); // Description } // ... comment if( !qsComment.isEmpty() ) { _rqXmlStreamWriter.writeStartElement( "Comment" ); _rqXmlStreamWriter.writeCDATA( qsComment ); _rqXmlStreamWriter.writeEndElement(); // Comment } // ... points if( !bDynamic ) { int __iCount = QTreeWidgetItem::childCount(); for( int __i = 0; __i < __iCount; __i++ ) { CVesselPoint* __poVesselPoint = (CVesselPoint*)QTreeWidgetItem::child( __i ); if( bOnlySelected && !__poVesselPoint->isMultiSelected() ) continue; __poVesselPoint->dumpQVCT( _rqXmlStreamWriter ); } } else { CVesselContainerDevice* __poVesselContainerDevice = (CVesselContainerDevice*)QTreeWidgetItem::child( 0 ); __poVesselContainerDevice->dumpQVCT( _rqXmlStreamWriter ); } // ... [end] _rqXmlStreamWriter.writeEndElement(); // Flotilla }
bool TrackNode::toGPX(QXmlStreamWriter& stream, QProgressDialog * progress, QString element, bool forExport) { bool OK = true; if (isVirtual()) return OK; if (!tagValue("_waypoint_","").isEmpty() ||!sizeParents()) stream.writeStartElement("wpt"); else stream.writeStartElement(element); if (!forExport) stream.writeAttribute("xml:id", xmlId()); stream.writeAttribute("lon",COORD2STRING(BBox.topRight().x())); stream.writeAttribute("lat", COORD2STRING(BBox.topRight().y())); stream.writeTextElement("time", time().toString(Qt::ISODate)+"Z"); QString s = tagValue("name",""); if (!s.isEmpty()) { stream.writeTextElement("name", s); } if (elevation()) { stream.writeTextElement("ele", QString::number(elevation(),'f',6)); } if (speed()) { stream.writeTextElement("speed", QString::number(speed(),'f',6)); } s = tagValue("_comment_",""); if (!s.isEmpty()) { stream.writeTextElement("cmt", s); } s = tagValue("_description_",""); if (!s.isEmpty()) { stream.writeTextElement("desc", s); } // OpenStreetBug s = tagValue("_special_",""); if (!s.isEmpty() && id().type & IFeature::Special) { stream.writeStartElement("extensions"); QString sid = stripToOSMId(id()); stream.writeTextElement("id", sid); stream.writeEndElement(); } stream.writeEndElement(); if (progress) progress->setValue(progress->value()+1); return OK; }
void DB::save() const { /* The QFile class provides an interface for reading from and writing to files. QFile is an I/O device for reading and writing text and binary files and resources. A QFile may be used by itself or, more conveniently, with a QTextStream or QDataStream. */ QFile* file = new QFile("../database.xml"); /* The QIODevice class is the base interface class of all I/O devices in Qt. QIODevice provides both a common implementation and an abstract interface for devices that support reading and writing of blocks of data, such as QFile, QBuffer and QTcpSocket. QIODevice is abstract and can not be instantiated, but it is common to use the interface it defines to provide device-independent I/O features. For example, Qt's XML classes operate on a QIODevice pointer, allowing them to be used with various devices (such as files and buffers). */ if(!file->open(QIODevice::WriteOnly | QIODevice::Text)) { QMessageBox err; err.setText("Errore nell'apertura del file"); err.exec(); } else { /* The QXmlStreamWriter class provides an XML writer with a simple streaming API. QXmlStreamWriter is the counterpart to QXmlStreamReader for writing XML. Like its related class, it operates on a QIODevice specified with setDevice(). The API is simple and straightforward: for every XML token or event you want to write, the writer provides a specialized function. You start a document with writeStartDocument() and end it with writeEndDocument(). This will implicitly close all remaining open tags. */ QXmlStreamWriter* inp = new QXmlStreamWriter; inp->setAutoFormatting(true); //Sets the current device to device. inp->setDevice(file); inp->writeStartDocument(); inp->writeStartElement("utenti"); for(vector<Utente*>::const_iterator it = db.begin(); it != db.end(); ++it) { inp->writeStartElement("utente"); inp->writeTextElement("nome", QString::fromStdString(((*it)->getProfilo()).getNome())); inp->writeTextElement("cognome", QString::fromStdString(((*it)->getProfilo()).getCognome())); inp->writeTextElement("username", QString::fromStdString(((*it)->getUsername()).getLogin())); inp->writeTextElement("email", QString::fromStdString(((*it)->getProfilo()).getEmail())); if(dynamic_cast<UtenteBasic*>(*(it))) { inp->writeTextElement("tipoutente", QString::fromStdString("Utente Basic")); } else if(dynamic_cast<UtenteBusiness*>(*(it))) { inp->writeTextElement("tipoutente", QString::fromStdString("Utente Business")); } else { inp->writeTextElement("tipoutente", QString::fromStdString("Utente Executive")); } inp->writeTextElement("competenze", QString::fromStdString((*it)->getProfilo().tutteCompetenze())); inp->writeTextElement("esperienze", QString::fromStdString((*it)->getProfilo().tutteEsperienze())); inp->writeTextElement("lingue", QString::fromStdString((*it)->getProfilo().tutteLingue())); inp->writeTextElement("titolistudio", QString::fromStdString((*it)->getProfilo().tuttiTitoliStudio())); inp->writeTextElement("contatti", QString::fromStdString(((*it)->getRete())->tuttiContatti())); inp->writeEndElement(); } inp->writeEndElement(); inp->writeEndDocument(); file->close(); QMessageBox msgBox; msgBox.setText("Salvataggio avvenuto con successo"); msgBox.exec(); } }
int Generate_Xml::rewriteXMLFile(QVector<QLineEdit *> p,int j,int track_tabsibling) { bool tab; int tab_get; QFile Default("default1.xml"); QXmlStreamWriter *xmlWriter = new QXmlStreamWriter(); QXmlStreamWriter *newline = new QXmlStreamWriter(); xmlWriter->setDevice(&Default); newline->setDevice(&Default); xmlWriter->setAutoFormatting (true); xmlWriter->setAutoFormatting(true); tab=xmlWriter->autoFormatting(); xmlWriter->setAutoFormattingIndent(-10); tab_get=xmlWriter->autoFormattingIndent(); if (!Default.open(QIODevice::Append)) { /* show wrror message if not able to open file */ QMessageBox::warning(0, "Read only", "The file is in read only mode"); } QString temp1; QString temp2; temp1=(p.at(j))->displayText(); newline->writeEndDocument(); for(int i=0;i<track_tabsibling;i++)//changed tab here actaully multiplied by two xmlWriter->writeCharacters("\t"); xmlWriter->writeStartElement(temp1); j++; while(p.at(j)!=0) { temp1=(p.at(j))->displayText(); j++; temp2=(p.at(j))->displayText(); j++; xmlWriter->writeAttribute(temp1,temp2); } xmlWriter->writeEndElement(); Default.close(); delete xmlWriter; delete newline; return j; }
void CSD::save(QXmlStreamWriter &s) { s.writeStartElement(staticTypeTag); s.writeAttribute("vector", _inputVectors[CSD_INVECTOR]->Name()); s.writeAttribute("samplerate", QString::number(_frequency)); s.writeAttribute("gaussiansigma", QString::number(_gaussianSigma)); s.writeAttribute("average", QVariant(_average).toString()); s.writeAttribute("fftlength", QString::number(int(ceil(log(double(_length*2)) / log(2.0))))); s.writeAttribute("removemean", QVariant(_removeMean).toString()); s.writeAttribute("apodize", QVariant(_apodize).toString()); s.writeAttribute("apodizefunction", QString::number(_apodizeFxn)); s.writeAttribute("windowsize", QString::number(_windowSize)); s.writeAttribute("vectorunits", _vectorUnits); s.writeAttribute("rateunits", _rateUnits); s.writeAttribute("outputtype", QString::number(_outputType)); saveNameInfo(s,VNUM|XNUM|MNUM|CSDNUM); s.writeEndElement(); }
void radeon_profile::writePlotAxisSchemaToXml(QXmlStreamWriter &xml, const QString side, const PlotAxisSchema &pas) { xml.writeStartElement("axis"); xml.writeAttribute("align", side); xml.writeAttribute("enabled", QString::number(pas.enabled)); xml.writeAttribute("unit", QString::number(pas.unit)); xml.writeAttribute("ticks", QString::number(pas.ticks)); xml.writeAttribute("penStyle", QString::number(pas.penGrid.style())); xml.writeAttribute("penWidth", QString::number(pas.penGrid.width())); xml.writeAttribute("penColor", pas.penGrid.color().name()); xml.writeEndElement(); for (const ValueID &sk : pas.dataList.keys()) { xml.writeStartElement("serie"); xml.writeAttribute("align", side); xml.writeAttribute("id", QString::number(sk)); xml.writeAttribute("color", pas.dataList.value(sk).name()); xml.writeEndElement(); } }
void DeviceInfo::WriteXml(QXmlStreamWriter& xml) const { xml.writeStartElement("device"); xml.writeStartElement("manufacturer"); xml.writeCharacters(manufacturer); xml.writeEndElement(); xml.writeStartElement("product"); xml.writeCharacters(product); xml.writeEndElement(); xml.writeStartElement("name"); xml.writeCharacters(name); xml.writeEndElement(); xml.writeEndElement(); }
void radeon_profile::saveRpevents(QXmlStreamWriter &xml) { xml.writeStartElement("RPEvents"); for (RPEvent rpe : events) { xml.writeStartElement("rpevent"); xml.writeAttribute("name", rpe.name); xml.writeAttribute("enabled", QString::number(rpe.enabled)); xml.writeAttribute("tiggerType", QString::number(rpe.type)); xml.writeAttribute("activationBinary", rpe.activationBinary); xml.writeAttribute("activationTemperature", QString::number(rpe.activationTemperature)); xml.writeAttribute("dpmProfileChange", QString::number(rpe.dpmProfileChange)); xml.writeAttribute("powerLevelChange", QString::number(rpe.powerLevelChange)); xml.writeAttribute("fixedFanSpeedChange", QString::number(rpe.fixedFanSpeedChange)); xml.writeAttribute("fanProfileNameChange",rpe.fanProfileNameChange); xml.writeAttribute("fanComboIndex", QString::number(rpe.fanComboIndex)); xml.writeEndElement(); } xml.writeEndElement(); }
void FirmwareInfo::WriteXml(QXmlStreamWriter& xml) const { xml.writeStartDocument(); xml.writeStartElement("firmware"); xml.writeAttribute("version", QString::number(FirmwareInfo::kVersion)); xml.writeStartElement("name"); xml.writeCharacters(name); xml.writeEndElement(); xml.writeStartElement("version"); xml.writeCharacters(version); xml.writeEndElement(); platformInfo.WriteXml(xml); xml.writeStartElement("developers"); for (int i = 0; i < developers.length(); i++) { xml.writeStartElement("name"); xml.writeCharacters(developers[i]); xml.writeEndElement(); } xml.writeEndElement(); if (!url.isEmpty()) { xml.writeStartElement("url"); xml.writeCharacters(url); xml.writeEndElement(); } if (!donateUrl.isEmpty()) { xml.writeStartElement("donateurl"); xml.writeCharacters(donateUrl); xml.writeEndElement(); } xml.writeStartElement("devices"); for (int i = 0; i < deviceInfos.length(); i++) deviceInfos[i].WriteXml(xml); xml.writeEndElement(); xml.writeStartElement("pit"); int lastSlash = pitFilename.lastIndexOf('/'); if (lastSlash < 0) lastSlash = pitFilename.lastIndexOf('\\'); xml.writeCharacters(pitFilename.mid(lastSlash + 1)); xml.writeEndElement(); xml.writeStartElement("repartition"); xml.writeCharacters((repartition) ? "1" : "0"); xml.writeEndElement(); xml.writeStartElement("noreboot"); xml.writeCharacters((noReboot) ? "1" : "0"); xml.writeEndElement(); xml.writeStartElement("files"); for (int i = 0; i < fileInfos.length(); i++) { fileInfos[i].WriteXml(xml, Packaging::ClashlessFilename(fileInfos, i)); } xml.writeEndElement(); xml.writeEndElement(); xml.writeEndDocument(); }
bool OsmAnd::FavoriteLocationsGpxCollection_P::saveTo(QXmlStreamWriter& writer) const { QReadLocker scopedLocker(&_collectionLock); writer.writeStartDocument(QLatin1String("1.0"), true); //<gpx // version="1.1" // creator="OsmAnd" // xmlns="http://www.topografix.com/GPX/1/1" // xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" // xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"> writer.writeStartElement(QLatin1String("gpx")); writer.writeAttribute(QLatin1String("version"), QLatin1String("1.1")); writer.writeAttribute(QLatin1String("creator"), QLatin1String("OsmAnd")); writer.writeAttribute(QLatin1String("xmlns"), QLatin1String("http://www.topografix.com/GPX/1/1")); writer.writeAttribute(QLatin1String("xmlns:xsi"), QLatin1String("http://www.w3.org/2001/XMLSchema-instance")); writer.writeAttribute(QLatin1String("xsi:schemaLocation"), QLatin1String("http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd")); for (const auto& item : constOf(_collection)) { // <wpt> writer.writeStartElement(QLatin1String("wpt")); writer.writeAttribute(QLatin1String("lat"), QString::number(item->latLon.latitude, 'f', 12)); writer.writeAttribute(QLatin1String("lon"), QString::number(item->latLon.longitude, 'f', 12)); // <name> writer.writeTextElement(QLatin1String("name"), item->getTitle()); const auto group = item->getGroup(); if (!group.isEmpty()) { // <category> writer.writeTextElement(QLatin1String("category"), group); } const auto color = item->getColor(); if (color != ColorRGB()) { // <extensions> writer.writeStartElement(QLatin1String("extensions")); // <color> const auto colorValue = color.toString(); writer.writeTextElement(QLatin1String("color"), colorValue); // <hidden> if (item->isHidden()) writer.writeEmptyElement(QLatin1String("hidden")); // </extensions> writer.writeEndElement(); } // </wpt> writer.writeEndElement(); } // </gpx> writer.writeEndElement(); writer.writeEndDocument(); return true; }
void CLandmarkPoint::dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter ) const { // Data _rqXmlStreamWriter.writeStartElement( "Point" ); // ... name if( !qsName.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "name", qsName ); // ... visibility _rqXmlStreamWriter.writeAttribute( "visibility", QString::number( COverlayVisibility::getVisibility() ) ); // ... position _rqXmlStreamWriter.writeAttribute( "longitude", QString::number( CDataPosition::getLongitude() ) ); _rqXmlStreamWriter.writeAttribute( "latitude", QString::number( CDataPosition::getLatitude() ) ); // ... elevation if( CDataPosition::getElevation() != CDataPosition::UNDEFINED_ELEVATION ) _rqXmlStreamWriter.writeAttribute( "elevation", QString::number( CDataPosition::getElevation() ) ); // ... type if( !qsType.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "type", qsType ); // ... symbol if( !qsSymbol.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "symbol", qsSymbol ); // ... url if( !qsUrl.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "url", qsUrl ); // ... description if( !qsDescription.isEmpty() ) { _rqXmlStreamWriter.writeStartElement( "Description" ); _rqXmlStreamWriter.writeCDATA( qsDescription ); _rqXmlStreamWriter.writeEndElement(); // Description } // ... comment if( !qsComment.isEmpty() ) { _rqXmlStreamWriter.writeStartElement( "Comment" ); _rqXmlStreamWriter.writeCDATA( qsComment ); _rqXmlStreamWriter.writeEndElement(); // Comment } // ... [end] _rqXmlStreamWriter.writeEndElement(); // Point }