comparison plugin/PluginXml.cpp @ 843:e802e550a1f2

Drop std:: from cout, cerr, endl -- pull these in through Debug.h
author Chris Cannam
date Tue, 26 Nov 2013 13:35:08 +0000
parents 1424aa29ae95
children f5cd33909744
comparison
equal deleted inserted replaced
842:23d3a6eca5c3 843:e802e550a1f2
115 } 115 }
116 116
117 #define CHECK_ATTRIBUTE(ATTRIBUTE, ACCESSOR) \ 117 #define CHECK_ATTRIBUTE(ATTRIBUTE, ACCESSOR) \
118 QString ATTRIBUTE = attrs.value(#ATTRIBUTE); \ 118 QString ATTRIBUTE = attrs.value(#ATTRIBUTE); \
119 if (ATTRIBUTE != "" && ATTRIBUTE != ACCESSOR().c_str()) { \ 119 if (ATTRIBUTE != "" && ATTRIBUTE != ACCESSOR().c_str()) { \
120 std::cerr << "WARNING: PluginXml::setParameters: Plugin " \ 120 cerr << "WARNING: PluginXml::setParameters: Plugin " \
121 << #ATTRIBUTE << " does not match (attributes have \"" \ 121 << #ATTRIBUTE << " does not match (attributes have \"" \
122 << ATTRIBUTE << "\", my " \ 122 << ATTRIBUTE << "\", my " \
123 << #ATTRIBUTE << " is \"" << ACCESSOR() << "\")" << std::endl; \ 123 << #ATTRIBUTE << " is \"" << ACCESSOR() << "\")" << endl; \
124 } 124 }
125 125
126 void 126 void
127 PluginXml::setParameters(const QXmlAttributes &attrs) 127 PluginXml::setParameters(const QXmlAttributes &attrs)
128 { 128 {
133 CHECK_ATTRIBUTE(copyright, m_plugin->getCopyright); 133 CHECK_ATTRIBUTE(copyright, m_plugin->getCopyright);
134 134
135 bool ok; 135 bool ok;
136 int version = attrs.value("version").trimmed().toInt(&ok); 136 int version = attrs.value("version").trimmed().toInt(&ok);
137 if (ok && version != m_plugin->getPluginVersion()) { 137 if (ok && version != m_plugin->getPluginVersion()) {
138 std::cerr << "WARNING: PluginXml::setParameters: Plugin version does not match (attributes have " << version << ", my version is " << m_plugin->getPluginVersion() << ")" << std::endl; 138 cerr << "WARNING: PluginXml::setParameters: Plugin version does not match (attributes have " << version << ", my version is " << m_plugin->getPluginVersion() << ")" << endl;
139 } 139 }
140 140
141 RealTimePluginInstance *rtpi = 141 RealTimePluginInstance *rtpi =
142 dynamic_cast<RealTimePluginInstance *>(m_plugin); 142 dynamic_cast<RealTimePluginInstance *>(m_plugin);
143 if (rtpi) { 143 if (rtpi) {
146 QStringList configList = config.split(";"); 146 QStringList configList = config.split(";");
147 for (QStringList::iterator i = configList.begin(); 147 for (QStringList::iterator i = configList.begin();
148 i != configList.end(); ++i) { 148 i != configList.end(); ++i) {
149 QStringList kv = i->split("="); 149 QStringList kv = i->split("=");
150 if (kv.count() < 2) { 150 if (kv.count() < 2) {
151 std::cerr << "WARNING: PluginXml::setParameters: Malformed configure pair string: \"" << i->toStdString() << "\"" << std::endl; 151 cerr << "WARNING: PluginXml::setParameters: Malformed configure pair string: \"" << i->toStdString() << "\"" << endl;
152 continue; 152 continue;
153 } 153 }
154 QString key(kv[0]), value(kv[1]); 154 QString key(kv[0]), value(kv[1]);
155 key = decodeConfigurationChars(key); 155 key = decodeConfigurationChars(key);
156 value = decodeConfigurationChars(value); 156 value = decodeConfigurationChars(value);
183 if (ok) { 183 if (ok) {
184 // SVDEBUG << "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 cerr << "WARNING: PluginXml::setParameters: Invalid value \"" << attrs.value(pname) << "\" for parameter \"" << i->identifier << "\" (attribute \"" << pname << "\")" << endl;
189 } 189 }
190 } 190 }
191 } 191 }
192 192
193 void 193 void
201 201
202 // SVDEBUG << "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 cerr << "PluginXml::setParametersFromXml: Error in parsing XML: " << error << " at line " << errorLine << ", column " << errorColumn << endl;
207 std::cerr << "Input follows:" << std::endl; 207 cerr << "Input follows:" << endl;
208 std::cerr << xml << std::endl; 208 cerr << xml << endl;
209 std::cerr << "Input ends." << std::endl; 209 cerr << "Input ends." << endl;
210 return; 210 return;
211 } 211 }
212 212
213 QDomElement pluginElt = doc.firstChildElement("plugin"); 213 QDomElement pluginElt = doc.firstChildElement("plugin");
214 QDomNamedNodeMap attrNodes = pluginElt.attributes(); 214 QDomNamedNodeMap attrNodes = pluginElt.attributes();