]> git.tdb.fi Git - libs/core.git/commitdiff
Use IO::cout rather than std::cout
authorMikko Rasa <tdb@tdb.fi>
Sat, 18 Jun 2011 18:34:15 +0000 (21:34 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 18 Jun 2011 18:36:07 +0000 (21:36 +0300)
source/core/application.cpp

index 6bfa6289f1174b604293c09464bd9746d783e46e..51f013e72c3cb5876429035d2604c95eb1a1f578 100644 (file)
@@ -2,9 +2,9 @@
 #include <windows.h>
 #endif
 #include <signal.h>
-#include <iostream>
 #include <typeinfo>
 #include <msp/debug/demangle.h>
+#include <msp/io/print.h>
 #include "application.h"
 #include "getopt.h"
 
@@ -33,14 +33,14 @@ int Application::run(int argc, char **argv, void *data)
        static bool called = false;
        if(called)
        {
-               cerr<<"Trying to call Application::run_app twice!\n";
+               IO::cerr.write("Trying to call Application::run_app twice!\n");
                return 125;
        }
        called = true;
 
        if(!starter_)
        {
-               cerr<<"Trying to run with no RegisteredApplication class!\n";
+               IO::cerr.write("Trying to run with no RegisteredApplication class!\n");
                return 126;
        }
 
@@ -54,8 +54,7 @@ int Application::run(int argc, char **argv, void *data)
                }
                catch(const usage_error &e)
                {
-                       cerr<<e.what()<<'\n';
-                       cerr<<e.help()<<'\n';
+                       IO::print(IO::cerr, "%s\n%s\n", e.what(), e.help());
                        return 1;
                }
 
@@ -73,9 +72,9 @@ int Application::run(int argc, char **argv, void *data)
                string msg = Debug::demangle(typeid(e).name())+":\n"+e.what();
                MessageBoxA(0, msg.c_str(), "Uncaught exception", MB_OK|MB_ICONERROR);
 #else
-               cerr<<"An uncaught exception occurred.\n";
-               cerr<<"  type:   "<<Debug::demangle(typeid(e).name())<<'\n';
-               cerr<<"  what(): "<<e.what()<<'\n';
+               IO::print(IO::cerr, "An uncaught exception occurred.\n");
+               IO::print(IO::cerr, "  type:   %s\n", Debug::demangle(typeid(e).name()));
+               IO::print(IO::cerr, "  what(): %s\n", e.what());
 #endif
 
                return 124;