comparison transform/FileFeatureWriter.cpp @ 686:b4a8d8221eaf debug-output

Remove most toStdString calls (no longer needed, with debug header)
author Chris Cannam
date Thu, 12 May 2011 17:31:24 +0100
parents cd1fa6387cb9
children 06f13a3b9e9e
comparison
equal deleted inserted replaced
685:99222d4bfc78 686:b4a8d8221eaf
59 m_streams.erase(m_streams.begin()); 59 m_streams.erase(m_streams.begin());
60 } 60 }
61 while (!m_files.empty()) { 61 while (!m_files.empty()) {
62 if (m_files.begin()->second) { 62 if (m_files.begin()->second) {
63 cerr << "FileFeatureWriter::~FileFeatureWriter: NOTE: Closing feature file \"" 63 cerr << "FileFeatureWriter::~FileFeatureWriter: NOTE: Closing feature file \""
64 << m_files.begin()->second->fileName().toStdString() << "\"" << endl; 64 << m_files.begin()->second->fileName() << "\"" << endl;
65 delete m_files.begin()->second; 65 delete m_files.begin()->second;
66 } 66 }
67 m_files.erase(m_files.begin()); 67 m_files.erase(m_files.begin());
68 } 68 }
69 } 69 }
168 FileFeatureWriter::getOutputFilename(QString trackId, 168 FileFeatureWriter::getOutputFilename(QString trackId,
169 TransformId transformId) 169 TransformId transformId)
170 { 170 {
171 if (m_singleFileName != "") { 171 if (m_singleFileName != "") {
172 if (QFileInfo(m_singleFileName).exists() && !(m_force || m_append)) { 172 if (QFileInfo(m_singleFileName).exists() && !(m_force || m_append)) {
173 cerr << endl << "FileFeatureWriter: ERROR: Specified output file \"" << m_singleFileName.toStdString() << "\" exists and neither --" << getWriterTag().toStdString() << "-force nor --" << getWriterTag().toStdString() << "-append flag is specified -- not overwriting" << endl; 173 cerr << endl << "FileFeatureWriter: ERROR: Specified output file \"" << m_singleFileName << "\" exists and neither --" << getWriterTag() << "-force nor --" << getWriterTag() << "-append flag is specified -- not overwriting" << endl;
174 cerr << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag().toStdString() << "-force" << endl << "and --" << getWriterTag().toStdString() << "-append options" << endl; 174 cerr << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag() << "-force" << endl << "and --" << getWriterTag() << "-append options" << endl;
175 return ""; 175 return "";
176 } 176 }
177 return m_singleFileName; 177 return m_singleFileName;
178 } 178 }
179 179
191 basename = QFileInfo(infilename).completeBaseName(); 191 basename = QFileInfo(infilename).completeBaseName();
192 if (scheme.length() == 1) { 192 if (scheme.length() == 1) {
193 infilename = scheme + ":" + infilename; // DOS drive! 193 infilename = scheme + ":" + infilename; // DOS drive!
194 } 194 }
195 195
196 // cerr << "trackId = " << trackId.toStdString() << ", url = " << url.toString().toStdString() << ", infilename = " 196 // cerr << "trackId = " << trackId << ", url = " << url.toString() << ", infilename = "
197 // << infilename.toStdString() << ", basename = " << basename.toStdString() << ", m_baseDir = " << m_baseDir.toStdString() << endl; 197 // << infilename << ", basename = " << basename << ", m_baseDir = " << m_baseDir << endl;
198 198
199 if (m_baseDir != "") dirname = QFileInfo(m_baseDir).absoluteFilePath(); 199 if (m_baseDir != "") dirname = QFileInfo(m_baseDir).absoluteFilePath();
200 else if (local) dirname = QFileInfo(infilename).absolutePath(); 200 else if (local) dirname = QFileInfo(infilename).absolutePath();
201 else dirname = QDir::currentPath(); 201 else dirname = QDir::currentPath();
202 202
203 // cerr << "dirname = " << dirname.toStdString() << endl; 203 // cerr << "dirname = " << dirname << endl;
204 204
205 QString filename; 205 QString filename;
206 206
207 if (m_manyFiles && transformId != "") { 207 if (m_manyFiles && transformId != "") {
208 filename = QString("%1_%2.%3").arg(basename).arg(transformId).arg(m_extension); 208 filename = QString("%1_%2.%3").arg(basename).arg(transformId).arg(m_extension);
213 filename.replace(':', '_'); // ':' not permitted in Windows 213 filename.replace(':', '_'); // ':' not permitted in Windows
214 214
215 filename = QDir(dirname).filePath(filename); 215 filename = QDir(dirname).filePath(filename);
216 216
217 if (QFileInfo(filename).exists() && !(m_force || m_append)) { 217 if (QFileInfo(filename).exists() && !(m_force || m_append)) {
218 cerr << endl << "FileFeatureWriter: ERROR: Output file \"" << filename.toStdString() << "\" exists (for input file or URL \"" << trackId.toStdString() << "\" and transform \"" << transformId.toStdString() << "\") and neither --" << getWriterTag().toStdString() << "-force nor --" << getWriterTag().toStdString() << "-append is specified -- not overwriting" << endl; 218 cerr << endl << "FileFeatureWriter: ERROR: Output file \"" << filename << "\" exists (for input file or URL \"" << trackId << "\" and transform \"" << transformId << "\") and neither --" << getWriterTag() << "-force nor --" << getWriterTag() << "-append is specified -- not overwriting" << endl;
219 cerr << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag().toStdString() << "-force" << endl << "and --" << getWriterTag().toStdString() << "-append options" << endl; 219 cerr << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag() << "-force" << endl << "and --" << getWriterTag() << "-append options" << endl;
220 return ""; 220 return "";
221 } 221 }
222 222
223 return filename; 223 return filename;
224 } 224 }
262 if (filename == "") { // stdout or failure 262 if (filename == "") { // stdout or failure
263 return 0; 263 return 0;
264 } 264 }
265 265
266 cerr << "FileFeatureWriter: NOTE: Using output filename \"" 266 cerr << "FileFeatureWriter: NOTE: Using output filename \""
267 << filename.toStdString() << "\"" << endl; 267 << filename << "\"" << endl;
268 268
269 if (m_append) { 269 if (m_append) {
270 cerr << "FileFeatureWriter: NOTE: Calling reviewFileForAppending" << endl; 270 cerr << "FileFeatureWriter: NOTE: Calling reviewFileForAppending" << endl;
271 reviewFileForAppending(filename); 271 reviewFileForAppending(filename);
272 } 272 }
339 m_streams.erase(m_streams.begin()); 339 m_streams.erase(m_streams.begin());
340 } 340 }
341 while (!m_files.empty()) { 341 while (!m_files.empty()) {
342 if (m_files.begin()->second) { 342 if (m_files.begin()->second) {
343 cerr << "FileFeatureWriter::finish: NOTE: Closing feature file \"" 343 cerr << "FileFeatureWriter::finish: NOTE: Closing feature file \""
344 << m_files.begin()->second->fileName().toStdString() << "\"" << endl; 344 << m_files.begin()->second->fileName() << "\"" << endl;
345 delete m_files.begin()->second; 345 delete m_files.begin()->second;
346 } 346 }
347 m_files.erase(m_files.begin()); 347 m_files.erase(m_files.begin());
348 } 348 }
349 m_prevstream = 0; 349 m_prevstream = 0;