当前位置: 首页>>代码示例>>C++>>正文


C++ QXmlStreamWriter::writeCharacters方法代码示例

本文整理汇总了C++中QXmlStreamWriter::writeCharacters方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlStreamWriter::writeCharacters方法的具体用法?C++ QXmlStreamWriter::writeCharacters怎么用?C++ QXmlStreamWriter::writeCharacters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QXmlStreamWriter的用法示例。


在下文中一共展示了QXmlStreamWriter::writeCharacters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write

void Vector::write(QXmlStreamWriter& writer) {
	writer.writeStartElement("spirit:vector");

	
    // start the spirit:left tag
    writer.writeStartElement("spirit:left");

    // write the attributes for the element
    XmlUtils::writeAttributes(writer, leftAttributes_);

    // write the value of the element and close the tag
    writer.writeCharacters(QString::number(left_));
    writer.writeEndElement(); // spirit:left

	// start the spirit:right tag
    writer.writeStartElement("spirit:right");

    // write the attributes for the element
    XmlUtils::writeAttributes(writer, rightAttributes_);

    // write the value of the element and close the tag
    writer.writeCharacters(QString::number(right_));
    writer.writeEndElement(); // spirit:right

	writer.writeEndElement(); // spirit:vector
}
开发者ID:kammoh,项目名称:kactus2,代码行数:26,代码来源:vector.cpp

示例2: serialize

void UniAssociation::serialize(QXmlStreamWriter& writer) const {
    beginSerialization(writer, "unidirection");

    if (items.count()) {
        writer.writeStartElement("role");

        if (!_role.name.isEmpty()) {
            writer.writeStartElement("name");
            writer.writeAttribute("trans", QString::number(items[0]->translation()));
            writer.writeAttribute("rot", QString::number(items[0]->rotation()));

            writer.writeCharacters(_role.name);

            writer.writeEndElement();
        }
        if (!_role.multiplicity.isEmpty()) {
            writer.writeStartElement("multiplicity");
            int index = _role.name.isEmpty() ? 0 : 1;
            writer.writeAttribute("trans", QString::number(items[index]->translation()));
            writer.writeAttribute("rot", QString::number(items[index]->rotation()));

            writer.writeCharacters(_role.multiplicity);

            writer.writeEndElement();
        }

        writer.writeTextElement("visibility", Member::visibilityText(_role.visibility));

        writer.writeEndElement();
    }

    endSerialization(writer);
}
开发者ID:Zycon42,项目名称:qumledt,代码行数:33,代码来源:uniassociation.cpp

示例3: writeCharacters

void QTableModelHtmlWriter::writeCharacters(QXmlStreamWriter & stream, const QString & text)
{
	if (text.isEmpty()){
		stream.writeCharacters(QChar(QChar::Nbsp));
	} else {
		stream.writeCharacters(text);
	}
}
开发者ID:lit-uriy,项目名称:QAdvancedItemViews,代码行数:8,代码来源:qtablemodeltmlwriter.cpp

示例4: dumpGPX

void CRouteContainer::dumpGPX( QXmlStreamWriter & _rqXmlStreamWriter, bool bOnlySelected ) const
{
  // GPX format reference: see http://www.topografix.com/GPX/1/1/

  // Data
  _rqXmlStreamWriter.writeStartElement( "rte" );
  // ... name
  if( !qsName.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "name" );
    _rqXmlStreamWriter.writeCharacters( qsName );
    _rqXmlStreamWriter.writeEndElement(); // name
  }
  // ... 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
  }
  // ... url
  if( !qsUrl.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "link" );
    _rqXmlStreamWriter.writeAttribute( "href", qsUrl );
    _rqXmlStreamWriter.writeEndElement(); // link
  }
  // ... points
  int __iCount = QTreeWidgetItem::childCount();
  for( int __i = 0; __i < __iCount; __i++ )
  {
    CRoutePoint* __poRoutePoint = (CRoutePoint*)QTreeWidgetItem::child( __i );
    if( bOnlySelected && !__poRoutePoint->isMultiSelected() ) continue;
    __poRoutePoint->dumpGPX( _rqXmlStreamWriter );
  }
  // ... [end]
  _rqXmlStreamWriter.writeEndElement(); // rte
}
开发者ID:alex-spataru,项目名称:qvct,代码行数:52,代码来源:CRouteContainer.cpp

示例5: file

void
SoundSettings::saveXML (
        const QString   &xmlFileName,
        const QString   &origFileName,
        const QString   &copyFileName,
        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 ();
}
开发者ID:deztructor,项目名称:meegotouch-controlpanelapplets,代码行数:50,代码来源:soundsettingsutils.cpp

示例6: WriteXml

void PlatformInfo::WriteXml(QXmlStreamWriter& xml) const
{
	xml.writeStartElement("platform");

	xml.writeStartElement("name");
	xml.writeCharacters(name);
	xml.writeEndElement();

	xml.writeStartElement("version");
	xml.writeCharacters(version);
	xml.writeEndElement();

	xml.writeEndElement();
}
开发者ID:0x2b,项目名称:Heimdall,代码行数:14,代码来源:FirmwareInfo.cpp

示例7: _saveQStringList

static void _saveQStringList(QXmlStreamWriter &xmlWriter, const QString &sec, const QStringList &list)
{
    foreach(const QString &str, list) {
        xmlWriter.writeStartElement(sec);
        xmlWriter.writeCharacters(str);
        xmlWriter.writeEndElement();
    }
开发者ID:bkchr,项目名称:Rockete,代码行数:7,代码来源:ProjectManager.cpp

示例8: handleInsertLink

	void RichEditorWidget::handleInsertLink ()
	{
		if (!Ui_.View_->selectedText ().isEmpty ())
		{
			const QString& url = QInputDialog::getText (this,
					tr ("Insert link"), tr ("Enter URL:"));
			const QUrl& guess = QUrl::fromUserInput (url);
			if (guess.isValid ())
				ExecCommand ("createLink", guess.toString ());

			return;
		}

		HyperlinkDialog dia (this);
		if (dia.exec () != QDialog::Accepted)
			return;

		const QString& link = dia.GetLink ();
		const QString& text = dia.GetText ();
		if (link.isEmpty () || text.isEmpty ())
			return;

		QString html;
		QXmlStreamWriter w (&html);
		w.writeStartElement ("a");
		w.writeAttribute ("href", link);
		if (!dia.GetTitle ().isEmpty ())
			w.writeAttribute ("title", dia.GetTitle ());
		if (!dia.GetTarget ().isEmpty ())
			w.writeAttribute ("target", dia.GetTarget ());
		w.writeCharacters (text);
		w.writeEndElement ();

		ExecCommand ("insertHTML", html);
	}
开发者ID:Kalarel,项目名称:leechcraft,代码行数:35,代码来源:richeditorwidget.cpp

示例9: sauvegarde

void Livre::sauvegarde(QXmlStreamWriter & stream)
{
    stream.writeStartElement ("media");
    stream.writeTextElement ("nom", nom ());
    if(!cycle ().isEmpty ())
    {
        stream.writeStartElement ("cycle");
        stream.writeAttribute ("tome", QString::number (numeroTome ()));
        stream.writeCharacters (cycle());
        stream.writeEndElement ();
    }
    stream.writeTextElement ("editeur", editeur ());
    stream.writeTextElement ("sortie", date ().toString ());

    if(!url ().isEmpty ())
    {
        stream.writeTextElement ("url", url ().toString ());
    }

    stream.writeTextElement ("genre", genre ());
    stream.writeTextElement ("lu", QString::number (isFini ()));

    foreach(QString atlas, auteur ())
    {
        stream.writeTextElement ("auteur", atlas);
    }
开发者ID:Chewnonobelix,项目名称:ProduitMedia,代码行数:26,代码来源:livre.cpp

示例10:

void SymbolSetTool::TranslationEntry::write(QXmlStreamWriter& xml, const QString& language)
{
	if (source.isEmpty())
	{
		QVERIFY(!comment.isEmpty());
		return;
	}
	
	xml.writeStartElement(QLatin1String("message"));
	xml.writeTextElement(QLatin1String("source"), source);
	xml.writeTextElement(QLatin1String("comment"), comment);
	xml.writeStartElement(QLatin1String("translation"));
	for (const auto& translation : translations)
	{
		if (translation.language == language)
		{
			if (!translation.type.isEmpty())
			{
				xml.writeAttribute(QLatin1String("type"), translation.type);
			}
			xml.writeCharacters(translation.translation);		
			break;
		}
	}
	xml.writeEndElement();  //  translation
	xml.writeEndElement();  // message
}
开发者ID:sikmir,项目名称:mapper,代码行数:27,代码来源:symbol_set_t.cpp

示例11:

	inline void writeBase64(QXmlStreamWriter &x, const QString &ns, const QString &name, const QByteArray &data)
	{
		x.writeStartElement(ns, name);
		for(int i = 0; i < data.size(); i+=48)
			x.writeCharacters(data.mid(i, 48).toBase64() + "\n");
		x.writeEndElement();
	}
开发者ID:sander85,项目名称:qdigidoc,代码行数:7,代码来源:CryptoDoc.cpp

示例12: writeElementContents

void KDSoapValue::writeElementContents(KDSoapNamespacePrefixes &namespacePrefixes, QXmlStreamWriter &writer, KDSoapValue::Use use, const QString &messageNamespace) const
{
    const QVariant value = this->value();

    if (isNil() && d->m_nillable) {
        writer.writeAttribute(KDSoapNamespaceManager::xmlSchemaInstance2001(), QLatin1String("nil"), QLatin1String("true"));
    }

    if (use == EncodedUse) {
        // use=encoded means writing out xsi:type attributes. http://www.eherenow.com/soapfight.htm taught me that.
        QString type;
        if (!this->type().isEmpty()) {
            type = namespacePrefixes.resolve(this->typeNs(), this->type());
        }
        if (type.isEmpty() && !value.isNull()) {
            type = variantToXMLType(value);    // fallback
        }
        if (!type.isEmpty()) {
            writer.writeAttribute(KDSoapNamespaceManager::xmlSchemaInstance2001(), QLatin1String("type"), type);
        }

        // cppcheck-suppress redundantCopyLocalConst
        const KDSoapValueList list = this->childValues();
        const bool isArray = !list.arrayType().isEmpty();
        if (isArray) {
            writer.writeAttribute(KDSoapNamespaceManager::soapEncoding(), QLatin1String("arrayType"), namespacePrefixes.resolve(list.arrayTypeNs(), list.arrayType()) + QLatin1Char('[') + QString::number(list.count()) + QLatin1Char(']'));
        }
    }
    writeChildren(namespacePrefixes, writer, use, messageNamespace, false);

    if (!value.isNull()) {
        writer.writeCharacters(variantToTextValue(value, this->typeNs(), this->type()));
    }
}
开发者ID:Knarf64,项目名称:KDSoap,代码行数:34,代码来源:KDSoapValue.cpp

示例13: writeElementAttribute

void XMLUtility::writeElementAttribute(QXmlStreamWriter& writer, const QString& elementName, const QString& elementValue, const QString& attributeName, const QString& attributeValue)
{
  if (elementName.length() == 0)
  {
    return;
  }
  if (elementValue.length() > 0)
  {
    writer.writeStartElement(elementName);
  }
  else
  {
    writer.writeEmptyElement(elementName);
  }
  if (attributeName.length() > 0 && attributeValue.length() > 0)
  {
    writer.writeAttribute(attributeName, attributeValue);
  }

  if (elementValue.length() > 0)
  {
    writer.writeCharacters(elementValue);
    writer.writeEndElement();
  }
}
开发者ID:pitonyak,项目名称:ADPStampInventory,代码行数:25,代码来源:xmlutility.cpp

示例14: writeXMLparameter

void OrthotropicSecantCoefficientOfThermalExpansion::writeXMLparameter(QXmlStreamWriter& stream, Parameter* parameter)
{
    Unit::VUnit * vunit = parameter->getValueUnit();

    stream.writeStartElement("ParameterValue");
    stream.writeAttribute("parameter", parameter->getIdString());
    stream.writeAttribute("format", "float");

    QString values;
    for (std::vector<ParameterValue>::const_iterator it=parameter->getValues().begin();
         it!=parameter->getValues().end();
         ++it) {

        const ParameterValue& pv = *it;
        if (it!=parameter->getValues().begin()) values += ",";
        if (pv.isValueValid()) {
            if (vunit->hasXMLExportUnit()) {
                values += QString::number(vunit->convertToXMLExport(pv.getValue()), 'e', 6);
            } else {
                values += QString::number(pv.getValue(), 'e', 6);
            }
        } else {
            values += undefindedIdentifyerAsString();
        }
    }
    if (parameter->getValues().size()==0) values = undefindedIdentifyerAsString();
    stream.writeTextElement("Data", values);

    stream.writeStartElement("Qualifier");
    stream.writeAttribute("name", "Variable Type");
    stream.writeCharacters("Dependent");
    stream.writeEndElement(); // Qualifier

    stream.writeEndElement(); // ParameterValue
}
开发者ID:Negusbuk,项目名称:MatDB,代码行数:35,代码来源:cteproperty.cpp

示例15: writeHtmlLink

void HtmlExporter::writeHtmlLink(QXmlStreamWriter& stream, const QString& url, const QString& text)
{
  stream.writeStartElement("a");
  stream.writeAttribute("href", url);
  stream.writeCharacters(text);
  stream.writeEndElement(); // a
}
开发者ID:albar965,项目名称:littlenavmap,代码行数:7,代码来源:htmlexporter.cpp


注:本文中的QXmlStreamWriter::writeCharacters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。