Wrap all char * string with QStringLiteral or QLatin1String

This commit is contained in:
Debao Zhang
2013-08-30 00:26:20 +08:00
parent c1654876fd
commit d87b50a4b7
11 changed files with 358 additions and 358 deletions
+28 -28
View File
@@ -31,17 +31,17 @@ namespace QXlsx {
ContentTypes::ContentTypes()
{
m_package_prefix = "application/vnd.openxmlformats-package.";
m_document_prefix = "application/vnd.openxmlformats-officedocument.";
m_package_prefix = QStringLiteral("application/vnd.openxmlformats-package.");
m_document_prefix = QStringLiteral("application/vnd.openxmlformats-officedocument.");
m_defaults.insert("rels", m_package_prefix + "relationships+xml");
m_defaults.insert("xml", "application/xml");
m_defaults.insert(QStringLiteral("rels"), m_package_prefix + QStringLiteral("relationships+xml"));
m_defaults.insert(QStringLiteral("xml"), QStringLiteral("application/xml"));
m_overrides.insert("/docProps/app.xml", m_document_prefix + "extended-properties+xml");
m_overrides.insert("/docProps/core.xml", m_package_prefix + "core-properties+xml");
m_overrides.insert("/xl/styles.xml", m_document_prefix + "spreadsheetml.styles+xml");
m_overrides.insert("/xl/theme/theme1.xml", m_document_prefix + "theme+xml");
m_overrides.insert("/xl/workbook.xml", m_document_prefix + "spreadsheetml.sheet.main+xml");
m_overrides.insert(QStringLiteral("/docProps/app.xml"), m_document_prefix + QStringLiteral("extended-properties+xml"));
m_overrides.insert(QStringLiteral("/docProps/core.xml"), m_package_prefix + QStringLiteral("core-properties+xml"));
m_overrides.insert(QStringLiteral("/xl/styles.xml"), m_document_prefix + QStringLiteral("spreadsheetml.styles+xml"));
m_overrides.insert(QStringLiteral("/xl/theme/theme1.xml"), m_document_prefix + QStringLiteral("theme+xml"));
m_overrides.insert(QStringLiteral("/xl/workbook.xml"), m_document_prefix + QStringLiteral("spreadsheetml.sheet.main+xml"));
}
void ContentTypes::addDefault(const QString &key, const QString &value)
@@ -56,71 +56,71 @@ void ContentTypes::addOverride(const QString &key, const QString &value)
void ContentTypes::addWorksheetName(const QString &name)
{
addOverride(QString("/xl/worksheets/%1.xml").arg(name), m_document_prefix + "spreadsheetml.worksheet+xml");
addOverride(QStringLiteral("/xl/worksheets/%1.xml").arg(name), m_document_prefix + QStringLiteral("spreadsheetml.worksheet+xml"));
}
void ContentTypes::addChartsheetName(const QString &name)
{
addOverride(QString("/xl/chartsheets/%1.xml").arg(name), m_document_prefix + "spreadsheetml.chartsheet+xml");
addOverride(QStringLiteral("/xl/chartsheets/%1.xml").arg(name), m_document_prefix + QStringLiteral("spreadsheetml.chartsheet+xml"));
}
void ContentTypes::addChartName(const QString &name)
{
addOverride(QString("/xl/charts/%1.xml").arg(name), m_document_prefix + "drawingml.chart+xml");
addOverride(QStringLiteral("/xl/charts/%1.xml").arg(name), m_document_prefix + QStringLiteral("drawingml.chart+xml"));
}
void ContentTypes::addCommentName(const QString &name)
{
addOverride(QString("/xl/%1.xml").arg(name), m_document_prefix + "spreadsheetml.comments+xml");
addOverride(QStringLiteral("/xl/%1.xml").arg(name), m_document_prefix + QStringLiteral("spreadsheetml.comments+xml"));
}
void ContentTypes::addImageTypes(const QStringList &imageTypes)
{
foreach (QString type, imageTypes)
addOverride(type, "image/" + type);
addOverride(type, QStringLiteral("image/") + type);
}
void ContentTypes::addTableName(const QString &name)
{
addOverride(QString("/xl/tables/%1.xml").arg(name), m_document_prefix + "spreadsheetml.table+xml");
addOverride(QStringLiteral("/xl/tables/%1.xml").arg(name), m_document_prefix + QStringLiteral("spreadsheetml.table+xml"));
}
void ContentTypes::addSharedString()
{
addOverride("/xl/sharedStrings.xml", m_document_prefix + "spreadsheetml.sharedStrings+xml");
addOverride(QStringLiteral("/xl/sharedStrings.xml"), m_document_prefix + QStringLiteral("spreadsheetml.sharedStrings+xml"));
}
void ContentTypes::addVmlName()
{
addOverride("vml", m_document_prefix + "vmlDrawing");
addOverride(QStringLiteral("vml"), m_document_prefix + QStringLiteral("vmlDrawing"));
}
void ContentTypes::addCalcChain()
{
addOverride("/xl/calcChain.xml", m_document_prefix + "spreadsheetml.calcChain+xml");
addOverride(QStringLiteral("/xl/calcChain.xml"), m_document_prefix + QStringLiteral("spreadsheetml.calcChain+xml"));
}
void ContentTypes::addVbaProject()
{
//:TODO
addOverride("bin", "application/vnd.ms-office.vbaProject");
addOverride(QStringLiteral("bin"), QStringLiteral("application/vnd.ms-office.vbaProject"));
}
void ContentTypes::saveToXmlFile(QIODevice *device)
{
XmlStreamWriter writer(device);
writer.writeStartDocument("1.0", true);
writer.writeStartElement("Types");
writer.writeAttribute("xmlns", "http://schemas.openxmlformats.org/package/2006/content-types");
writer.writeStartDocument(QStringLiteral("1.0"), true);
writer.writeStartElement(QStringLiteral("Types"));
writer.writeAttribute(QStringLiteral("xmlns"), QStringLiteral("http://schemas.openxmlformats.org/package/2006/content-types"));
{
QMapIterator<QString, QString> it(m_defaults);
while(it.hasNext()) {
it.next();
writer.writeStartElement("Default");
writer.writeAttribute("Extension", it.key());
writer.writeAttribute("ContentType", it.value());
writer.writeStartElement(QStringLiteral("Default"));
writer.writeAttribute(QStringLiteral("Extension"), it.key());
writer.writeAttribute(QStringLiteral("ContentType"), it.value());
writer.writeEndElement();//Default
}
}
@@ -129,9 +129,9 @@ void ContentTypes::saveToXmlFile(QIODevice *device)
QMapIterator<QString, QString> it(m_overrides);
while(it.hasNext()) {
it.next();
writer.writeStartElement("Override");
writer.writeAttribute("PartName", it.key());
writer.writeAttribute("ContentType", it.value());
writer.writeStartElement(QStringLiteral("Override"));
writer.writeAttribute(QStringLiteral("PartName"), it.key());
writer.writeAttribute(QStringLiteral("ContentType"), it.value());
writer.writeEndElement(); //Override
}
}