diff framework/SVFileReader.cpp @ 293:068235cf5bf7

Drop std:: from cout, cerr, endl -- pull these in through Debug.h
author Chris Cannam
date Tue, 26 Nov 2013 14:12:50 +0000
parents ecbf3b75c562
children 933b5aed341a
line wrap: on
line diff
--- a/framework/SVFileReader.cpp	Wed Oct 09 14:56:20 2013 +0100
+++ b/framework/SVFileReader.cpp	Tue Nov 26 14:12:50 2013 +0000
@@ -97,9 +97,9 @@
 SVFileReader::~SVFileReader()
 {
     if (!m_awaitingDatasets.empty()) {
-	std::cerr << "WARNING: SV-XML: File ended with "
+	cerr << "WARNING: SV-XML: File ended with "
 		  << m_awaitingDatasets.size() << " unfilled model dataset(s)"
-		  << std::endl;
+		  << endl;
     }
 
     std::set<Model *> unaddedModels;
@@ -112,9 +112,9 @@
     }
 
     if (!unaddedModels.empty()) {
-	std::cerr << "WARNING: SV-XML: File contained "
+	cerr << "WARNING: SV-XML: File contained "
 		  << unaddedModels.size() << " unused models"
-		  << std::endl;
+		  << endl;
 	while (!unaddedModels.empty()) {
 	    delete *unaddedModels.begin();
 	    unaddedModels.erase(unaddedModels.begin());
@@ -235,13 +235,13 @@
         ok = readParameter(attributes);
 
     } else {
-        std::cerr << "WARNING: SV-XML: Unexpected element \""
-                  << name.toLocal8Bit().data() << "\"" << std::endl;
+        cerr << "WARNING: SV-XML: Unexpected element \""
+                  << name.toLocal8Bit().data() << "\"" << endl;
     }
 
     if (!ok) {
-	std::cerr << "WARNING: SV-XML: Failed to completely process element \""
-		  << name.toLocal8Bit().data() << "\"" << std::endl;
+	cerr << "WARNING: SV-XML: Failed to completely process element \""
+		  << name.toLocal8Bit().data() << "\"" << endl;
     }
 
     return true;
@@ -255,7 +255,7 @@
     if (m_inRow) {
 	ok = readRowData(text);
 	if (!ok) {
-	    std::cerr << "WARNING: SV-XML: Failed to read row data content for row " << m_rowNumber << std::endl;
+	    cerr << "WARNING: SV-XML: Failed to read row data content for row " << m_rowNumber << endl;
 	}
     }
 
@@ -285,7 +285,7 @@
 	    }
 
 	    if (!foundInAwaiting) {
-		std::cerr << "WARNING: SV-XML: Dataset precedes model, or no model uses dataset" << std::endl;
+		cerr << "WARNING: SV-XML: Dataset precedes model, or no model uses dataset" << endl;
 	    }
 	}
 
@@ -300,12 +300,12 @@
 
         if (!m_currentDerivedModel) {
             if (m_currentDerivedModel < 0) {
-                std::cerr << "WARNING: SV-XML: Bad derivation output model id "
-                          << m_currentDerivedModelId << std::endl;
+                cerr << "WARNING: SV-XML: Bad derivation output model id "
+                          << m_currentDerivedModelId << endl;
             } else if (haveModel(m_currentDerivedModelId)) {
-                std::cerr << "WARNING: SV-XML: Derivation has existing model "
+                cerr << "WARNING: SV-XML: Derivation has existing model "
                           << m_currentDerivedModelId
-                          << " as target, not regenerating" << std::endl;
+                          << " as target, not regenerating" << endl;
             } else {
                 QString message;
                 m_currentDerivedModel = m_models[m_currentDerivedModelId] =
@@ -362,7 +362,7 @@
 	.arg(exception.message())
 	.arg(exception.lineNumber())
 	.arg(exception.columnNumber());
-    std::cerr << m_errorString.toLocal8Bit().data() << std::endl;
+    cerr << m_errorString.toLocal8Bit().data() << endl;
     return QXmlDefaultHandler::error(exception);
 }
 
@@ -374,7 +374,7 @@
 	.arg(exception.message())
 	.arg(exception.lineNumber())
 	.arg(exception.columnNumber());
-    std::cerr << m_errorString.toLocal8Bit().data() << std::endl;
+    cerr << m_errorString.toLocal8Bit().data() << endl;
     return QXmlDefaultHandler::fatalError(exception);
 }
 
@@ -382,7 +382,7 @@
 #define READ_MANDATORY(TYPE, NAME, CONVERSION)		      \
     TYPE NAME = attributes.value(#NAME).trimmed().CONVERSION(&ok); \
     if (!ok) { \
-	std::cerr << "WARNING: SV-XML: Missing or invalid mandatory " #TYPE " attribute \"" #NAME "\"" << std::endl; \
+	cerr << "WARNING: SV-XML: Missing or invalid mandatory " #TYPE " attribute \"" #NAME "\"" << endl; \
 	return false; \
     }
 
@@ -435,8 +435,8 @@
     READ_MANDATORY(int, id, toInt);
 
     if (haveModel(id)) {
-	std::cerr << "WARNING: SV-XML: Ignoring duplicate model id " << id
-		  << std::endl;
+	cerr << "WARNING: SV-XML: Ignoring duplicate model id " << id
+		  << endl;
 	return false;
     }
 
@@ -465,9 +465,9 @@
         file.waitForStatus();
 
         if (!file.isOK()) {
-            std::cerr << "SVFileReader::readModel: Failed to retrieve file \"" << path << "\" for wave file model: " << file.getErrorString() << std::endl;
+            cerr << "SVFileReader::readModel: Failed to retrieve file \"" << path << "\" for wave file model: " << file.getErrorString() << endl;
         } else if (!file.isAvailable()) {
-            std::cerr << "SVFileReader::readModel: Failed to retrieve file \"" << path << "\" for wave file model: Source unavailable" << std::endl;
+            cerr << "SVFileReader::readModel: Failed to retrieve file \"" << path << "\" for wave file model: Source unavailable" << endl;
         } else {
 
             file.waitForData();
@@ -537,8 +537,8 @@
 
 	} else {
 
-	    std::cerr << "WARNING: SV-XML: Unexpected dense model dimension ("
-		      << dimensions << ")" << std::endl;
+	    cerr << "WARNING: SV-XML: Unexpected dense model dimension ("
+		      << dimensions << ")" << endl;
 	}
     } else if (type == "sparse") {
 
@@ -649,8 +649,8 @@
 
 	} else {
 
-	    std::cerr << "WARNING: SV-XML: Unexpected sparse model dimension ("
-		      << dimensions << ")" << std::endl;
+	    cerr << "WARNING: SV-XML: Unexpected sparse model dimension ("
+		      << dimensions << ")" << endl;
 	}
 
     } else if (type == "alignment") {
@@ -664,25 +664,25 @@
         if (m_models.find(reference) != m_models.end()) {
             refModel = m_models[reference];
         } else {
-            std::cerr << "WARNING: SV-XML: Unknown reference model id "
+            cerr << "WARNING: SV-XML: Unknown reference model id "
                       << reference << " in alignment model id " << id
-                      << std::endl;
+                      << endl;
         }
 
         if (m_models.find(aligned) != m_models.end()) {
             alignedModel = m_models[aligned];
         } else {
-            std::cerr << "WARNING: SV-XML: Unknown aligned model id "
+            cerr << "WARNING: SV-XML: Unknown aligned model id "
                       << aligned << " in alignment model id " << id
-                      << std::endl;
+                      << endl;
         }
 
         if (m_models.find(path) != m_models.end()) {
             pathModel = m_models[path];
         } else {
-            std::cerr << "WARNING: SV-XML: Unknown path model id "
+            cerr << "WARNING: SV-XML: Unknown path model id "
                       << path << " in alignment model id " << id
-                      << std::endl;
+                      << endl;
         }
 
         if (refModel && alignedModel && pathModel) {
@@ -690,9 +690,9 @@
                 (refModel, alignedModel, 0, 0);
             PathModel *pm = dynamic_cast<PathModel *>(pathModel);
             if (!pm) {
-                std::cerr << "WARNING: SV-XML: Model id " << path
+                cerr << "WARNING: SV-XML: Model id " << path
                           << " referenced as path for alignment " << id
-                          << " is not a path model" << std::endl;
+                          << " is not a path model" << endl;
             } else {
                 model->setPath(pm);
                 pm->setCompletion(100);
@@ -705,8 +705,8 @@
         
     } else {
 
-	std::cerr << "WARNING: SV-XML: Unexpected model type \""
-		  << type.toLocal8Bit().data() << "\" for model id " << id << std::endl;
+	cerr << "WARNING: SV-XML: Unexpected model type \""
+		  << type.toLocal8Bit().data() << "\" for model id " << id << endl;
     }
 
     return false;
@@ -719,16 +719,16 @@
     m_currentPane = 0;
     
     if (type != "pane") {
-	std::cerr << "WARNING: SV-XML: Unexpected view type \""
-		  << type.toLocal8Bit().data() << "\"" << std::endl;
+	cerr << "WARNING: SV-XML: Unexpected view type \""
+		  << type.toLocal8Bit().data() << "\"" << endl;
 	return false;
     }
 
     m_currentPane = m_paneCallback.addPane();
 
     if (!m_currentPane) {
-	std::cerr << "WARNING: SV-XML: Internal error: Failed to add pane!"
-		  << std::endl;
+	cerr << "WARNING: SV-XML: Internal error: Failed to add pane!"
+		  << endl;
 	return false;
     }
 
@@ -777,9 +777,9 @@
     id = attributes.value("id").trimmed().toInt(&ok);
 
     if (!ok) {
-	std::cerr << "WARNING: SV-XML: No layer id for layer of type \""
+	cerr << "WARNING: SV-XML: No layer id for layer of type \""
 		  << type.toLocal8Bit().data()
-		  << "\"" << std::endl;
+		  << "\"" << endl;
 	return false;
     }
 
@@ -795,8 +795,8 @@
     if (m_inData) {
 
 	if (m_layers.find(id) != m_layers.end()) {
-	    std::cerr << "WARNING: SV-XML: Ignoring duplicate layer id " << id
-		      << " in data section" << std::endl;
+	    cerr << "WARNING: SV-XML: Ignoring duplicate layer id " << id
+		      << " in data section" << endl;
 	    return false;
 	}
 
@@ -811,8 +811,8 @@
     } else {
 
 	if (!m_currentPane) {
-	    std::cerr << "WARNING: SV-XML: No current pane for layer " << id
-		      << " in view section" << std::endl;
+	    cerr << "WARNING: SV-XML: No current pane for layer " << id
+		      << " in view section" << endl;
 	    return false;
 	}
 
@@ -821,9 +821,9 @@
 	    layer = m_layers[id];
 	
 	} else {
-	    std::cerr << "WARNING: SV-XML: Layer id " << id 
+	    cerr << "WARNING: SV-XML: Layer id " << id 
 		      << " in view section has not been defined -- defining it here"
-		      << std::endl;
+		      << endl;
 
 	    layer = m_document->createLayer
 		(LayerFactory::getInstance()->getLayerTypeForName(type));
@@ -836,9 +836,9 @@
     }
 	    
     if (!layer) {
-	std::cerr << "WARNING: SV-XML: Failed to add layer of type \""
+	cerr << "WARNING: SV-XML: Failed to add layer of type \""
 		  << type.toLocal8Bit().data()
-		  << "\"" << std::endl;
+		  << "\"" << endl;
 	return false;
     }
 
@@ -859,8 +859,8 @@
 		Model *model = m_models[modelId];
 		m_document->setModel(layer, model);
 	    } else {
-		std::cerr << "WARNING: SV-XML: Unknown model id " << modelId
-			  << " in layer definition" << std::endl;
+		cerr << "WARNING: SV-XML: Unknown model id " << modelId
+			  << " in layer definition" << endl;
 	    }
 	}
 
@@ -901,7 +901,7 @@
     READ_MANDATORY(int, dimensions, toInt);
     
     if (m_awaitingDatasets.find(id) == m_awaitingDatasets.end()) {
-	std::cerr << "WARNING: SV-XML: Unwanted dataset " << id << std::endl;
+	cerr << "WARNING: SV-XML: Unwanted dataset " << id << endl;
 	return false;
     }
     
@@ -911,8 +911,8 @@
     if (haveModel(modelId)) {
 	model = m_models[modelId];
     } else {
-	std::cerr << "WARNING: SV-XML: Internal error: Unknown model " << modelId
-		  << " expecting dataset " << id << std::endl;
+	cerr << "WARNING: SV-XML: Internal error: Unknown model " << modelId
+		  << " expecting dataset " << id << endl;
 	return false;
     }
 
@@ -941,7 +941,7 @@
     }
 
     if (!good) {
-	std::cerr << "WARNING: SV-XML: Model id " << modelId << " has wrong number of dimensions or inappropriate type for " << dimensions << "-D dataset " << id << std::endl;
+	cerr << "WARNING: SV-XML: Model id " << modelId << " has wrong number of dimensions or inappropriate type for " << dimensions << "-D dataset " << id << endl;
 	m_currentDataset = 0;
 	return false;
     }
@@ -963,7 +963,7 @@
 	(m_currentDataset);
 
     if (sodm) {
-//        std::cerr << "Current dataset is a sparse one dimensional model" << std::endl;
+//        cerr << "Current dataset is a sparse one dimensional model" << endl;
 	QString label = attributes.value("label");
 	sodm->addPoint(SparseOneDimensionalModel::Point(frame, label));
 	return true;
@@ -973,7 +973,7 @@
 	(m_currentDataset);
 
     if (stvm) {
-//        std::cerr << "Current dataset is a sparse time-value model" << std::endl;
+//        cerr << "Current dataset is a sparse time-value model" << endl;
 	float value = 0.0;
 	value = attributes.value("value").trimmed().toFloat(&ok);
 	QString label = attributes.value("label");
@@ -984,7 +984,7 @@
     NoteModel *nm = dynamic_cast<NoteModel *>(m_currentDataset);
 
     if (nm) {
-//        std::cerr << "Current dataset is a note model" << std::endl;
+//        cerr << "Current dataset is a note model" << endl;
 	float value = 0.0;
 	value = attributes.value("value").trimmed().toFloat(&ok);
 	size_t duration = 0;
@@ -1002,7 +1002,7 @@
     RegionModel *rm = dynamic_cast<RegionModel *>(m_currentDataset);
 
     if (rm) {
-//        std::cerr << "Current dataset is a note model" << std::endl;
+//        cerr << "Current dataset is a note model" << endl;
 	float value = 0.0;
 	value = attributes.value("value").trimmed().toFloat(&ok);
 	size_t duration = 0;
@@ -1015,7 +1015,7 @@
     TextModel *tm = dynamic_cast<TextModel *>(m_currentDataset);
 
     if (tm) {
-//        std::cerr << "Current dataset is a text model" << std::endl;
+//        cerr << "Current dataset is a text model" << endl;
 	float height = 0.0;
 	height = attributes.value("height").trimmed().toFloat(&ok);
 	QString label = attributes.value("label");
@@ -1027,7 +1027,7 @@
     PathModel *pm = dynamic_cast<PathModel *>(m_currentDataset);
 
     if (pm) {
-//        std::cerr << "Current dataset is a path model" << std::endl;
+//        cerr << "Current dataset is a path model" << endl;
         int mapframe = attributes.value("mapframe").trimmed().toInt(&ok);
 //        SVDEBUG << "SVFileReader::addPointToDataset: PathModel: frame = " << frame << ", mapframe = " << mapframe << ", ok = " << ok << endl;
 	pm->addPoint(PathModel::Point(frame, mapframe));
@@ -1037,7 +1037,7 @@
     ImageModel *im = dynamic_cast<ImageModel *>(m_currentDataset);
 
     if (im) {
-//        std::cerr << "Current dataset is an image model" << std::endl;
+//        cerr << "Current dataset is an image model" << endl;
 	QString image = attributes.value("image");
 	QString label = attributes.value("label");
 //        SVDEBUG << "SVFileReader::addPointToDataset: ImageModel: frame = " << frame << ", image = " << image << ", label = " << label << ", ok = " << ok << endl;
@@ -1045,7 +1045,7 @@
 	return ok;
     }
 
-    std::cerr << "WARNING: SV-XML: Point element found in non-point dataset" << std::endl;
+    cerr << "WARNING: SV-XML: Point element found in non-point dataset" << endl;
 
     return false;
 }
@@ -1062,8 +1062,8 @@
 	bool ok = false;
 	int n = attributes.value("number").trimmed().toInt(&ok);
 	if (!ok) {
-	    std::cerr << "WARNING: SV-XML: Missing or invalid bin number"
-		      << std::endl;
+	    cerr << "WARNING: SV-XML: Missing or invalid bin number"
+		      << endl;
 	    return false;
 	}
 
@@ -1073,7 +1073,7 @@
 	return true;
     }
 
-    std::cerr << "WARNING: SV-XML: Bin definition found in incompatible dataset" << std::endl;
+    cerr << "WARNING: SV-XML: Bin definition found in incompatible dataset" << endl;
 
     return false;
 }
@@ -1087,14 +1087,14 @@
     bool ok = false;
     m_rowNumber = attributes.value("n").trimmed().toInt(&ok);
     if (!ok) {
-	std::cerr << "WARNING: SV-XML: Missing or invalid row number"
-		  << std::endl;
+	cerr << "WARNING: SV-XML: Missing or invalid row number"
+		  << endl;
 	return false;
     }
     
     m_inRow = true;
 
-//    std::cerr << "SV-XML: In row " << m_rowNumber << std::endl;
+//    cerr << "SV-XML: In row " << m_rowNumber << endl;
     
     return true;
 }
@@ -1117,8 +1117,8 @@
 
 	    if (values.size() == dtdm->getHeight()) {
 		if (!warned) {
-		    std::cerr << "WARNING: SV-XML: Too many y-bins in 3-D dataset row "
-			      << m_rowNumber << std::endl;
+		    cerr << "WARNING: SV-XML: Too many y-bins in 3-D dataset row "
+			      << m_rowNumber << endl;
 		    warned = true;
 		}
 	    }
@@ -1126,9 +1126,9 @@
 	    bool ok;
 	    float value = i->toFloat(&ok);
 	    if (!ok) {
-		std::cerr << "WARNING: SV-XML: Bad floating-point value "
+		cerr << "WARNING: SV-XML: Bad floating-point value "
 			  << i->toLocal8Bit().data()
-			  << " in row data" << std::endl;
+			  << " in row data" << endl;
 	    } else {
 		values.push_back(value);
 	    }
@@ -1138,7 +1138,7 @@
 	return true;
     }
 
-    std::cerr << "WARNING: SV-XML: Row data found in non-row dataset" << std::endl;
+    cerr << "WARNING: SV-XML: Row data found in non-row dataset" << endl;
 
     return false;
 }
@@ -1151,7 +1151,7 @@
     modelId = attributes.value("model").trimmed().toInt(&modelOk);
 
     if (!modelOk) {
-	std::cerr << "WARNING: SV-XML: No model id specified for derivation" << std::endl;
+	cerr << "WARNING: SV-XML: No model id specified for derivation" << endl;
 	return false;
     }
 
@@ -1243,7 +1243,7 @@
     modelId = attributes.value("model").trimmed().toInt(&modelOk);
 
     if (!modelOk) {
-	std::cerr << "WARNING: SV-XML: No model id specified for play parameters" << std::endl;
+	cerr << "WARNING: SV-XML: No model id specified for play parameters" << endl;
 	return false;
     }
 
@@ -1255,10 +1255,10 @@
             getPlayParameters(m_models[modelId]);
 
         if (!parameters) {
-            std::cerr << "WARNING: SV-XML: Play parameters for model "
+            cerr << "WARNING: SV-XML: Play parameters for model "
                       << modelId
                       << " not found - has model been added to document?"
-                      << std::endl;
+                      << endl;
             return false;
         }
         
@@ -1276,12 +1276,12 @@
         
         m_currentPlayParameters = parameters;
 
-//        std::cerr << "Current play parameters for model: " << m_models[modelId] << ": " << m_currentPlayParameters << std::endl;
+//        cerr << "Current play parameters for model: " << m_models[modelId] << ": " << m_currentPlayParameters << endl;
 
     } else {
 
-	std::cerr << "WARNING: SV-XML: Unknown model " << modelId
-		  << " for play parameters" << std::endl;
+	cerr << "WARNING: SV-XML: Unknown model " << modelId
+		  << " for play parameters" << endl;
         return false;
     }
 
@@ -1292,7 +1292,7 @@
 SVFileReader::readPlugin(const QXmlAttributes &attributes)
 {
     if (m_currentDerivedModelId < 0 && !m_currentPlayParameters) {
-        std::cerr << "WARNING: SV-XML: Plugin found outside derivation or play parameters" << std::endl;
+        cerr << "WARNING: SV-XML: Plugin found outside derivation or play parameters" << endl;
         return false;
     }
 
@@ -1325,7 +1325,7 @@
 SVFileReader::readTransform(const QXmlAttributes &attributes)
 {
     if (m_currentDerivedModelId < 0) {
-        std::cerr << "WARNING: SV-XML: Transform found outside derivation" << std::endl;
+        cerr << "WARNING: SV-XML: Transform found outside derivation" << endl;
         return false;
     }
 
@@ -1338,14 +1338,14 @@
 SVFileReader::readParameter(const QXmlAttributes &attributes)
 {
     if (m_currentDerivedModelId < 0) {
-        std::cerr << "WARNING: SV-XML: Parameter found outside derivation" << std::endl;
+        cerr << "WARNING: SV-XML: Parameter found outside derivation" << endl;
         return false;
     }
 
     QString name = attributes.value("name");
     if (name == "") {
-        std::cerr << "WARNING: SV-XML: Ignoring nameless transform parameter"
-                  << std::endl;
+        cerr << "WARNING: SV-XML: Ignoring nameless transform parameter"
+                  << endl;
         return false;
     }
 
@@ -1375,7 +1375,7 @@
               << m_inLayer << ", layer " << m_currentLayer << endl;
 
     if (!m_inLayer) {
-        std::cerr << "WARNING: SV-XML: Measurement found outside layer" << std::endl;
+        cerr << "WARNING: SV-XML: Measurement found outside layer" << endl;
         return false;
     }