[glibmm] tests: Remove remaining use of std::cout.



commit c4729dc272de46881feb6bd2ac7d7a47ba22423d
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Feb 24 13:48:19 2011 +0100

    tests: Remove remaining use of std::cout.
    
    * tests/giomm_ioerror/main.cc:
    * tests/giomm_simple/main.cc: Hid some use of std::cout that I missed in my
    previous commit.

 ChangeLog                   |    8 ++++++++
 tests/giomm_ioerror/main.cc |    9 ++++++++-
 tests/giomm_simple/main.cc  |    9 ++++++++-
 3 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 497d72c..1600230 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-02-24  Murray Cumming  <murrayc murrayc com>
 
+	tests: Remove remaining use of std::cout.
+
+	* tests/giomm_ioerror/main.cc:
+	* tests/giomm_simple/main.cc: Hid some use of std::cout that I missed in my 
+	previous commit.
+
+2011-02-24  Murray Cumming  <murrayc murrayc com>
+
 	tests: Use EXIT_* for clarity.
 
 	* tests/*.cc: Use EXIT_SUCCESS rather than 0 because I think that is clearer.
diff --git a/tests/giomm_ioerror/main.cc b/tests/giomm_ioerror/main.cc
index a375e94..0a44d33 100644
--- a/tests/giomm_ioerror/main.cc
+++ b/tests/giomm_ioerror/main.cc
@@ -6,6 +6,13 @@
 #include <iostream>
 #include <string.h>
 
+//Use this line if you want debug output:
+//std::ostream& ostr = std::cout;
+
+//This seems nicer and more useful than putting an ifdef around the use of ostr:
+std::stringstream debug;
+std::ostream& ostr = debug;
+
 // This is just to test a workaround in the error.h header.  We save and #undef
 // HOST_NOT_FOUND if it was defined by another header, and then restore it at
 // the end of the header.  Here I'm just making sure that our temporary value
@@ -40,7 +47,7 @@ int main(int, char**)
     const gsize bytes_read = stream->read(buffer, sizeof buffer - 1);
 
     if(bytes_read)
-      std::cout << "File contents read: " << buffer << std::endl;
+      ostr << "File contents read: " << buffer << std::endl;
     else
     {
       std::cerr << "Gio::InputStream::read() read 0 bytes." << std::endl;
diff --git a/tests/giomm_simple/main.cc b/tests/giomm_simple/main.cc
index 274fb66..35f5cbf 100644
--- a/tests/giomm_simple/main.cc
+++ b/tests/giomm_simple/main.cc
@@ -2,6 +2,13 @@
 #include <iostream>
 #include <string.h>
 
+//Use this line if you want debug output:
+//std::ostream& ostr = std::cout;
+
+//This seems nicer and more useful than putting an ifdef around the use of ostr:
+std::stringstream debug;
+std::ostream& ostr = debug;
+
 int main(int, char**)
 {
   Glib::init();
@@ -28,7 +35,7 @@ int main(int, char**)
     const gsize bytes_read = stream->read(buffer, sizeof buffer - 1);
 
     if(bytes_read)
-      std::cout << "File contents read: " << buffer << std::endl;
+      ostr << "File contents read: " << buffer << std::endl;
     else
     {
       std::cerr << "Gio::InputStream::read() read 0 bytes." << std::endl;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]