summaryrefslogtreecommitdiffstats
path: root/qmake/generators/xmloutput.cpp
diff options
context:
space:
mode:
authorMartin Petersson <martin.petersson@nokia.com>2010-03-03 17:18:09 (GMT)
committerMarius Storm-Olsen <marius.storm-olsen@nokia.com>2010-04-21 10:31:11 (GMT)
commitcd601ef53385962c4affdb2020cfcb415d117bc1 (patch)
treef49d98fea77c3a9dd4319f005f220ec53a5cf90b /qmake/generators/xmloutput.cpp
parent69c4893008ccd4f89bf190c6ca930363b9d65efc (diff)
downloadQt-cd601ef53385962c4affdb2020cfcb415d117bc1.zip
Qt-cd601ef53385962c4affdb2020cfcb415d117bc1.tar.gz
Qt-cd601ef53385962c4affdb2020cfcb415d117bc1.tar.bz2
Add support for MSBuild, which is the project format for MSVC 2010
Reviewed-by: Marius SO
Diffstat (limited to 'qmake/generators/xmloutput.cpp')
-rw-r--r--qmake/generators/xmloutput.cpp42
1 files changed, 40 insertions, 2 deletions
diff --git a/qmake/generators/xmloutput.cpp b/qmake/generators/xmloutput.cpp
index e8578aa..718bdd6 100644
--- a/qmake/generators/xmloutput.cpp
+++ b/qmake/generators/xmloutput.cpp
@@ -81,6 +81,11 @@ void XmlOutput::setState(XMLState state)
currentState = state;
}
+void XmlOutput::setFormat(XMLFormat newFormat)
+{
+ format = newFormat;
+}
+
XmlOutput::XMLState XmlOutput::state()
{
return currentState;
@@ -172,6 +177,20 @@ XmlOutput& XmlOutput::operator<<(const xml_output& o)
case tTag:
newTagOpen(o.xo_text);
break;
+ case tTagValue:
+ addRaw(QString("\n%1<%2>").arg(currentIndent).arg(o.xo_text));
+ addRaw(QString("%1").arg(o.xo_value));
+ addRaw(QString("</%1>").arg(o.xo_text));
+ break;
+ case tValueTag:
+ addRaw(QString("%1").arg(doConversion(o.xo_text)));
+ setFormat(NoNewLine);
+ closeTag();
+ setFormat(NewLine);
+ break;
+ case tImport:
+ addRaw(QString("\n%1<Import %2=\"%3\" />").arg(currentIndent).arg(o.xo_text).arg(o.xo_value));
+ break;
case tCloseTag:
if (o.xo_value.count())
closeAll();
@@ -183,6 +202,9 @@ XmlOutput& XmlOutput::operator<<(const xml_output& o)
case tAttribute:
addAttribute(o.xo_text, o.xo_value);
break;
+ case tAttributeTag:
+ addAttributeTag(o.xo_text, o.xo_value);
+ break;
case tData:
{
// Special case to be able to close tag in normal
@@ -266,7 +288,7 @@ void XmlOutput::closeTag()
tagStack.pop_back();
break;
case Attribute:
- xmlFile << "/>";
+ xmlFile << " />";
tagStack.pop_back();
currentState = Tag;
decreaseIndent(); // <--- Post-decrease indent
@@ -307,7 +329,7 @@ void XmlOutput::addDeclaration(const QString &version, const QString &encoding)
qDebug("<%s>: Cannot add declaration when not in bare state", tagStack.last().toLatin1().constData());
return;
}
- QString outData = QString("<?xml version=\"%1\" encoding = \"%2\"?>")
+ QString outData = QString("<?xml version=\"%1\" encoding=\"%2\"?>")
.arg(doConversion(version))
.arg(doConversion(encoding));
addRaw(outData);
@@ -337,4 +359,20 @@ void XmlOutput::addAttribute(const QString &attribute, const QString &value)
xmlFile << currentIndent << doConversion(attribute) << "=\"" << doConversion(value) << "\"";
}
+void XmlOutput::addAttributeTag(const QString &attribute, const QString &value)
+{
+ switch(currentState) {
+ case Bare:
+ case Tag:
+ //warn_msg(WarnLogic, "<%s>: Cannot add attribute since tags not open", tagStack.last().toLatin1().constData());
+ qDebug("<%s>: Cannot add attribute (%s) since tag's not open",
+ (tagStack.count() ? tagStack.last().toLatin1().constData() : "Root"),
+ attribute.toLatin1().constData());
+ return;
+ case Attribute:
+ break;
+ }
+ xmlFile << " " << doConversion(attribute) << "=\"" << doConversion(value) << "\"";
+}
+
QT_END_NAMESPACE