本文整理汇总了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
}
示例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);
}
示例3: writeCharacters
void QTableModelHtmlWriter::writeCharacters(QXmlStreamWriter & stream, const QString & text)
{
if (text.isEmpty()){
stream.writeCharacters(QChar(QChar::Nbsp));
} else {
stream.writeCharacters(text);
}
}
示例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
}
示例5: file
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 ();
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
示例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
}
示例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();
}
示例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()));
}
}
示例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();
}
}
示例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
}
示例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
}