本文整理汇总了C++中QXmlStreamWriter::writeComment方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlStreamWriter::writeComment方法的具体用法?C++ QXmlStreamWriter::writeComment怎么用?C++ QXmlStreamWriter::writeComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlStreamWriter
的用法示例。
在下文中一共展示了QXmlStreamWriter::writeComment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteChannel
void WriteChannel (QXmlStreamWriter& w,
const ChannelShort& cs, const QList<Item_ptr>& items)
{
w.writeStartElement ("section");
w.writeAttribute ("id", QString::number (cs.ChannelID_));
w.writeStartElement ("title");
w.writeTextElement ("p", FixContents (cs.Title_));
w.writeEndElement ();
w.writeTextElement ("annotation",
Export2FB2Dialog::tr ("%n unread item(s)", "", cs.Unread_));
Q_FOREACH (Item_ptr item, items)
{
w.writeStartElement ("title");
w.writeStartElement ("p");
w.writeComment ("p");
w.device ()->write (FixContents (item->Title_).toUtf8 ());
w.writeEndElement ();
w.writeEndElement ();
bool hasDate = item->PubDate_.isValid ();
bool hasAuthor = item->Author_.size ();
if (hasDate || hasAuthor)
{
w.writeStartElement ("epigraph");
if (hasDate)
w.writeTextElement ("p",
Export2FB2Dialog::tr ("Published on %1")
.arg (item->PubDate_.toString ()));
if (hasAuthor)
w.writeTextElement ("p",
Export2FB2Dialog::tr ("By %1")
.arg (item->Author_));
w.writeEndElement ();
w.writeEmptyElement ("empty-line");
}
w.writeStartElement ("p");
w.writeComment ("p");
w.device ()->write (FixContents (item->Description_).toUtf8 ());
w.writeEndElement ();
w.writeEmptyElement ("empty-line");
}
示例2: id
void Argument1DString::writeData(QXmlStreamWriter &xmlWriter)
{
xmlWriter.writeStartElement("Argument1D");
{
xmlWriter.writeAttribute("Id" , id());
xmlWriter.writeAttribute("Caption" , caption());
xmlWriter.writeAttribute("IsOptional" , isOptional() ? "True" : "False");
for(const QString& comment : comments())
{
xmlWriter.writeComment(comment);
}
//write value definition;
valueDefinitionInternal()->writeData(xmlWriter);
xmlWriter.writeStartElement("Dimensions");
{
xmlWriter.writeStartElement("Dimension");
{
xmlWriter.writeAttribute("Id" , m_dimension->id());
xmlWriter.writeAttribute("Caption" , m_dimension->caption());
xmlWriter.writeAttribute("Length" , QString::number(length()));
}
xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();
xmlWriter.writeStartElement("Values");
{
int ind[1] = {0};
int str[1] = {length()};
QString* values = new QString[length()];
getValues(ind,str,values);
for(int i = 0 ; i < length() ; i++)
{
xmlWriter.writeStartElement("Value");
{
xmlWriter.writeCharacters(values[i]);
}
xmlWriter.writeEndElement();
}
delete[] values;
}
xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();
}
示例3: WriteReport
bool ErrorReport::WriteReport(const fs::path & fileName) {
fs::path fullPath = m_ReportFolder / fileName;
QFile file(fullPath.string().c_str());
if(!file.open(QIODevice::WriteOnly)) {
m_DetailedError = "Unable to open report manifest for writing.";
return false;
}
QXmlStreamWriter xml;
xml.setDevice(&file);
xml.setAutoFormatting(true);
xml.writeStartDocument();
xml.writeStartElement("CrashReport");
xml.writeComment("Information related to the crashed process");
xml.writeStartElement("Process");
xml.writeTextElement("Path", m_pCrashInfo->executablePath);
xml.writeTextElement("Version", m_pCrashInfo->executableVersion);
if(m_ProcessMemoryUsage != 0) {
xml.writeTextElement("MemoryUsage", QString::number(m_ProcessMemoryUsage));
}
xml.writeTextElement("Architecture", m_ProcessArchitecture);
if(m_RunningTimeSec > 0) {
xml.writeTextElement("RunningTime", QString::number(m_RunningTimeSec));
}
xml.writeTextElement("CrashDateTime", m_CrashDateTime.toString("dd.MM.yyyy hh:mm:ss"));
xml.writeEndElement();
xml.writeComment("Information related to the OS");
xml.writeStartElement("OS");
if(!m_OSName.isEmpty()) {
xml.writeTextElement("Name", m_OSName);
}
if(!m_OSArchitecture.isEmpty()) {
xml.writeTextElement("Architecture", m_OSArchitecture);
}
if(!m_OSDistribution.isEmpty()) {
xml.writeTextElement("Distribution", m_OSDistribution);
}
xml.writeEndElement();
xml.writeComment("List of files generated by the crash reporter");
xml.writeComment("Note that some of these files could have been manually excluded from the report");
xml.writeStartElement("Files");
for(FileList::const_iterator it = m_AttachedFiles.begin();
it != m_AttachedFiles.end(); ++it) {
xml.writeTextElement("File", it->path.string().c_str());
}
xml.writeEndElement();
xml.writeComment("Variables attached by the crashed process");
xml.writeStartElement("Variables");
for(int i = 0; i < m_pCrashInfo->nbVariables; ++i)
{
xml.writeStartElement("Variable");
xml.writeAttribute("Name", m_pCrashInfo->variables[i].name);
xml.writeAttribute("Value", m_pCrashInfo->variables[i].value);
xml.writeEndElement();
}
xml.writeEndElement();
xml.writeEndElement();
xml.writeEndDocument();
file.close();
AddFile(fullPath);
return true;
}