From 1da11953de82511aff507ba10ac00b4b1d40eaed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radovan=20=C4=8Cerven=C3=BD?= <radovan.cerveny@gmail.com> Date: Thu, 11 Feb 2016 15:27:11 +0100 Subject: [PATCH] changed how default ostream measreuemnts result formatting works --- alib2measure/src/measurements/MeasurementResults.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/alib2measure/src/measurements/MeasurementResults.cpp b/alib2measure/src/measurements/MeasurementResults.cpp index 9193ed7a92..e767ad3cd9 100644 --- a/alib2measure/src/measurements/MeasurementResults.cpp +++ b/alib2measure/src/measurements/MeasurementResults.cpp @@ -110,7 +110,13 @@ void MeasurementResults::print_as_tree ( std::ostream & os, unsigned idx, std::s const int MeasurementXalloc::FORMAT = std::ios::xalloc ( ); std::ostream & operator <<( std::ostream & os, const MeasurementResults & mr ) { - MeasurementFormat mf = static_cast < MeasurementFormat > ( os.iword ( MeasurementXalloc::FORMAT ) ); + MeasurementFormat mf = MeasurementFormat::XML; + + int os_format = os.iword ( MeasurementXalloc::FORMAT ); + + // if format was set, use that format, otherwise default to XML + if ( os_format ) + mf = static_cast < MeasurementFormat > ( os_format ); switch ( mf ) { case MeasurementFormat::LIST: @@ -121,7 +127,7 @@ std::ostream & operator <<( std::ostream & os, const MeasurementResults & mr ) { mr.print_as_tree ( os ); break; - default: /* MeasurementFormat::XML: */ + case MeasurementFormat::XML: sax::SaxComposeInterface::printStream ( os, mr.xml_tokens ( ) ); break; } -- GitLab