Mercurial > hg > svcore
diff plugin/PluginXml.cpp @ 314:70a232b1f12a
* Make XmlExportable::toXml the function that is universally overridden (and
pure virtual) instead of toXmlString. Tidies up some classes, notably the
model classes, significantly. Closes #1794561.
author | Chris Cannam |
---|---|
date | Thu, 18 Oct 2007 10:15:07 +0000 |
parents | d4a33cdca86f |
children | a70dcfed59c1 |
line wrap: on
line diff
--- a/plugin/PluginXml.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/plugin/PluginXml.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -23,6 +23,8 @@ #include <QDomNamedNodeMap> #include <QDomAttr> +#include <QTextStream> + #include "vamp-sdk/PluginBase.h" #include "RealTimePluginInstance.h" @@ -53,13 +55,13 @@ return rv; } -QString -PluginXml::toXmlString(QString indent, QString extraAttributes) const +void +PluginXml::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - QString s; - s += indent; + stream << indent; - s += QString("<plugin identifier=\"%1\" name=\"%2\" description=\"%3\" maker=\"%4\" version=\"%5\" copyright=\"%6\" %7 ") + stream << QString("<plugin identifier=\"%1\" name=\"%2\" description=\"%3\" maker=\"%4\" version=\"%5\" copyright=\"%6\" %7 ") .arg(encodeEntities(QString(m_plugin->getIdentifier().c_str()))) .arg(encodeEntities(QString(m_plugin->getName().c_str()))) .arg(encodeEntities(QString(m_plugin->getDescription().c_str()))) @@ -69,7 +71,7 @@ .arg(extraAttributes); if (!m_plugin->getPrograms().empty()) { - s += QString("program=\"%1\" ") + stream << QString("program=\"%1\" ") .arg(encodeEntities(m_plugin->getCurrentProgram().c_str())); } @@ -79,11 +81,11 @@ for (Vamp::PluginBase::ParameterList::const_iterator i = parameters.begin(); i != parameters.end(); ++i) { -// std::cerr << "PluginXml::toXmlString: parameter name \"" +// std::cerr << "PluginXml::toXml: parameter name \"" // << i->name.c_str() << "\" has value " // << m_plugin->getParameter(i->name) << std::endl; - s += QString("param-%1=\"%2\" ") + stream << QString("param-%1=\"%2\" ") .arg(stripInvalidParameterNameCharacters(QString(i->identifier.c_str()))) .arg(m_plugin->getParameter(i->identifier)); } @@ -104,13 +106,12 @@ config += QString("%1=%2").arg(key).arg(value); } if (config != "") { - s += QString("configuration=\"%1\" ") + stream << QString("configuration=\"%1\" ") .arg(encodeEntities(config)); } } - s += "/>\n"; - return s; + stream << "/>\n"; } #define CHECK_ATTRIBUTE(ATTRIBUTE, ACCESSOR) \