Mercurial > hg > svcore
comparison plugin/PluginXml.cpp @ 690:1424aa29ae95
Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author | Chris Cannam |
---|---|
date | Tue, 14 Jun 2011 15:26:52 +0100 |
parents | 06f13a3b9e9e |
children | e802e550a1f2 |
comparison
equal
deleted
inserted
replaced
689:573d45e9487b | 690:1424aa29ae95 |
---|---|
79 m_plugin->getParameterDescriptors(); | 79 m_plugin->getParameterDescriptors(); |
80 | 80 |
81 for (Vamp::PluginBase::ParameterList::const_iterator i = parameters.begin(); | 81 for (Vamp::PluginBase::ParameterList::const_iterator i = parameters.begin(); |
82 i != parameters.end(); ++i) { | 82 i != parameters.end(); ++i) { |
83 | 83 |
84 // DEBUG << "PluginXml::toXml: parameter name \"" | 84 // SVDEBUG << "PluginXml::toXml: parameter name \"" |
85 // << i->name.c_str() << "\" has value " | 85 // << i->name.c_str() << "\" has value " |
86 // << m_plugin->getParameter(i->name) << endl; | 86 // << m_plugin->getParameter(i->name) << endl; |
87 | 87 |
88 stream << QString("param-%1=\"%2\" ") | 88 stream << QString("param-%1=\"%2\" ") |
89 .arg(stripInvalidParameterNameCharacters(QString(i->identifier.c_str()))) | 89 .arg(stripInvalidParameterNameCharacters(QString(i->identifier.c_str()))) |
172 QString pname = QString("param-%1") | 172 QString pname = QString("param-%1") |
173 .arg(stripInvalidParameterNameCharacters | 173 .arg(stripInvalidParameterNameCharacters |
174 (QString(i->identifier.c_str()))); | 174 (QString(i->identifier.c_str()))); |
175 | 175 |
176 if (attrs.value(pname) == "") { | 176 if (attrs.value(pname) == "") { |
177 // DEBUG << "PluginXml::setParameters: no parameter \"" << i->name << "\" (attribute \"" << name << "\")" << endl; | 177 // SVDEBUG << "PluginXml::setParameters: no parameter \"" << i->name << "\" (attribute \"" << name << "\")" << endl; |
178 continue; | 178 continue; |
179 } | 179 } |
180 | 180 |
181 bool ok; | 181 bool ok; |
182 float value = attrs.value(pname).trimmed().toFloat(&ok); | 182 float value = attrs.value(pname).trimmed().toFloat(&ok); |
183 if (ok) { | 183 if (ok) { |
184 // DEBUG << "PluginXml::setParameters: setting parameter \"" | 184 // SVDEBUG << "PluginXml::setParameters: setting parameter \"" |
185 // << i->identifier << "\" to value " << value << endl; | 185 // << i->identifier << "\" to value " << value << endl; |
186 m_plugin->setParameter(i->identifier, value); | 186 m_plugin->setParameter(i->identifier, value); |
187 } else { | 187 } else { |
188 std::cerr << "WARNING: PluginXml::setParameters: Invalid value \"" << attrs.value(pname) << "\" for parameter \"" << i->identifier << "\" (attribute \"" << pname << "\")" << std::endl; | 188 std::cerr << "WARNING: PluginXml::setParameters: Invalid value \"" << attrs.value(pname) << "\" for parameter \"" << i->identifier << "\" (attribute \"" << pname << "\")" << std::endl; |
189 } | 189 } |
197 | 197 |
198 QString error; | 198 QString error; |
199 int errorLine; | 199 int errorLine; |
200 int errorColumn; | 200 int errorColumn; |
201 | 201 |
202 // DEBUG << "PluginXml::setParametersFromXml: XML is \"" | 202 // SVDEBUG << "PluginXml::setParametersFromXml: XML is \"" |
203 // << xml.toLocal8Bit().data() << "\"" << endl; | 203 // << xml.toLocal8Bit().data() << "\"" << endl; |
204 | 204 |
205 if (!doc.setContent(xml, false, &error, &errorLine, &errorColumn)) { | 205 if (!doc.setContent(xml, false, &error, &errorLine, &errorColumn)) { |
206 std::cerr << "PluginXml::setParametersFromXml: Error in parsing XML: " << error << " at line " << errorLine << ", column " << errorColumn << std::endl; | 206 std::cerr << "PluginXml::setParametersFromXml: Error in parsing XML: " << error << " at line " << errorLine << ", column " << errorColumn << std::endl; |
207 std::cerr << "Input follows:" << std::endl; | 207 std::cerr << "Input follows:" << std::endl; |
215 QXmlAttributes attrs; | 215 QXmlAttributes attrs; |
216 | 216 |
217 for (unsigned int i = 0; i < attrNodes.length(); ++i) { | 217 for (unsigned int i = 0; i < attrNodes.length(); ++i) { |
218 QDomAttr attr = attrNodes.item(i).toAttr(); | 218 QDomAttr attr = attrNodes.item(i).toAttr(); |
219 if (attr.isNull()) continue; | 219 if (attr.isNull()) continue; |
220 // DEBUG << "PluginXml::setParametersFromXml: Adding attribute \"" << attr.name()// << "\" with value \"" << attr.value() << "\"" << endl; | 220 // SVDEBUG << "PluginXml::setParametersFromXml: Adding attribute \"" << attr.name()// << "\" with value \"" << attr.value() << "\"" << endl; |
221 attrs.append(attr.name(), "", "", attr.value()); | 221 attrs.append(attr.name(), "", "", attr.value()); |
222 } | 222 } |
223 | 223 |
224 setParameters(attrs); | 224 setParameters(attrs); |
225 } | 225 } |