From d729ee8284f2829d650cf89fa40a9e0043f6e31c Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 7 Nov 2017 16:23:53 +0100 Subject: [PATCH] change std::cerr to common::Streams::err --- aaccess2/src/aaccess.cpp | 4 +- aarbology2/src/aarbology.cpp | 4 +- acast2/src/acast.cpp | 6 +-- acompare2/src/acompare.cpp | 6 +-- aconversions2/src/aconversion.cpp | 6 +-- aconvert2/src/aconvert.cpp | 6 +-- aderivation2/src/aderivation.cpp | 6 +-- adeterminize2/src/adeterminize.cpp | 6 +-- aecho2/src/aecho.cpp | 6 +-- aepsilon2/src/aepsilon.cpp | 4 +- agenerate2/src/agenerate.cpp | 4 +- aintegral2/src/aintegral.cpp | 4 +- aintrospection2/src/aintrospection.cpp | 6 +-- alangop2/src/alangop.cpp | 4 +- .../simplify/EpsilonRemoverOutgoing.h | 2 +- .../ToPostfixPushdownAutomatonGlushkov.cpp | 40 +++++++++---------- ...oPostfixPushdownAutomatonGlushkovNaive.cpp | 22 +++++----- alib2common/src/global/GlobalData.cpp | 20 +++++++--- alib2common/src/global/GlobalData.h | 34 ++++++++++++---- alib2xml/src/core/xmlApi.hpp | 2 +- aminimize2/src/aminimize.cpp | 4 +- anormalize2/src/anormalize.cpp | 4 +- aql2/src/aql.cpp | 4 +- aquery2/src/aquery.cpp | 4 +- arand2/src/arand.cpp | 4 +- araw2/src/araw.cpp | 6 +-- arename2/src/arename.cpp | 4 +- areverse2/src/areverse.cpp | 4 +- arun2/src/arun.cpp | 4 +- astat2/src/astat.cpp | 4 +- astringology2/src/astringology.cpp | 4 +- atrim2/src/atrim.cpp | 4 +- tniceprint/src/tniceprint.cpp | 6 +-- 33 files changed, 138 insertions(+), 110 deletions(-) diff --git a/aaccess2/src/aaccess.cpp b/aaccess2/src/aaccess.cpp index daf91b7e4f..dacb61676e 100644 --- a/aaccess2/src/aaccess.cpp +++ b/aaccess2/src/aaccess.cpp @@ -218,10 +218,10 @@ int main ( int argc, char * argv[] ) { std::cout << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/aarbology2/src/aarbology.cpp b/aarbology2/src/aarbology.cpp index 7116a1a1db..3a020142e9 100644 --- a/aarbology2/src/aarbology.cpp +++ b/aarbology2/src/aarbology.cpp @@ -231,10 +231,10 @@ int main ( int argc, char * argv[] ) { std::cout << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/acast2/src/acast.cpp b/acast2/src/acast.cpp index c680c38079..ac1ab0b421 100644 --- a/acast2/src/acast.cpp +++ b/acast2/src/acast.cpp @@ -76,13 +76,13 @@ int main(int argc, char** argv) { alib::XmlDataFactory::toStdout(exception); return 1; } catch(const TCLAP::ArgException& exception) { - std::cerr << exception.error() << std::endl; + common::Streams::err << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch(...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/acompare2/src/acompare.cpp b/acompare2/src/acompare.cpp index 1a91dbed33..f45b898e34 100644 --- a/acompare2/src/acompare.cpp +++ b/acompare2/src/acompare.cpp @@ -90,13 +90,13 @@ int main ( int argc, char * * argv ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cerr << exception.error ( ) << std::endl; + common::Streams::err << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/aconversions2/src/aconversion.cpp b/aconversions2/src/aconversion.cpp index ae63ccebd3..ac92e263d6 100644 --- a/aconversions2/src/aconversion.cpp +++ b/aconversions2/src/aconversion.cpp @@ -90,13 +90,13 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout(exception); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cerr << exception.error ( ) << std::endl; + common::Streams::err << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/aconvert2/src/aconvert.cpp b/aconvert2/src/aconvert.cpp index 89e2263f96..25eeebaba4 100644 --- a/aconvert2/src/aconvert.cpp +++ b/aconvert2/src/aconvert.cpp @@ -156,13 +156,13 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cerr << exception.error ( ) << std::endl; + common::Streams::err << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/aderivation2/src/aderivation.cpp b/aderivation2/src/aderivation.cpp index 658e249cdc..03decd27f1 100644 --- a/aderivation2/src/aderivation.cpp +++ b/aderivation2/src/aderivation.cpp @@ -75,13 +75,13 @@ int main(int argc, char** argv) { alib::XmlDataFactory::toStdout(exception); return 1; } catch(const TCLAP::ArgException& exception) { - std::cerr << exception.error() << std::endl; + common::Streams::err << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch(...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/adeterminize2/src/adeterminize.cpp b/adeterminize2/src/adeterminize.cpp index aa2be2e2b4..ebf1582a1a 100644 --- a/adeterminize2/src/adeterminize.cpp +++ b/adeterminize2/src/adeterminize.cpp @@ -70,13 +70,13 @@ int main ( int argc, char * * argv ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cerr << exception.error ( ) << std::endl; + common::Streams::err << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/aecho2/src/aecho.cpp b/aecho2/src/aecho.cpp index 2acb4b3520..6c5baa392b 100644 --- a/aecho2/src/aecho.cpp +++ b/aecho2/src/aecho.cpp @@ -69,13 +69,13 @@ int main(int argc, char** argv) { alib::XmlDataFactory::toStdout(exception); return 1; } catch(const TCLAP::ArgException& exception) { - std::cerr << exception.error() << std::endl; + common::Streams::err << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch(...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/aepsilon2/src/aepsilon.cpp b/aepsilon2/src/aepsilon.cpp index 6757f8c1b0..8101346466 100644 --- a/aepsilon2/src/aepsilon.cpp +++ b/aepsilon2/src/aepsilon.cpp @@ -99,10 +99,10 @@ int main(int argc, char** argv) { std::cout << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch(...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/agenerate2/src/agenerate.cpp b/agenerate2/src/agenerate.cpp index 633a890458..2c6ab11256 100644 --- a/agenerate2/src/agenerate.cpp +++ b/agenerate2/src/agenerate.cpp @@ -109,10 +109,10 @@ int main ( int argc, char * argv[] ) { std::cout << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/aintegral2/src/aintegral.cpp b/aintegral2/src/aintegral.cpp index bda22e659f..7139720175 100644 --- a/aintegral2/src/aintegral.cpp +++ b/aintegral2/src/aintegral.cpp @@ -78,10 +78,10 @@ int main(int argc, char** argv) { std::cout << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch(...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/aintrospection2/src/aintrospection.cpp b/aintrospection2/src/aintrospection.cpp index 5aa9c1e45f..85f752eaa9 100644 --- a/aintrospection2/src/aintrospection.cpp +++ b/aintrospection2/src/aintrospection.cpp @@ -178,13 +178,13 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cerr << exception.error ( ) << std::endl; + common::Streams::err << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/alangop2/src/alangop.cpp b/alangop2/src/alangop.cpp index ad6f226ae6..46f2018c44 100644 --- a/alangop2/src/alangop.cpp +++ b/alangop2/src/alangop.cpp @@ -110,10 +110,10 @@ int main(int argc, char* argv[]) { std::cout << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch(...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/alib2algo/src/automaton/simplify/EpsilonRemoverOutgoing.h b/alib2algo/src/automaton/simplify/EpsilonRemoverOutgoing.h index 78d2fedda8..5fe44f2c1c 100644 --- a/alib2algo/src/automaton/simplify/EpsilonRemoverOutgoing.h +++ b/alib2algo/src/automaton/simplify/EpsilonRemoverOutgoing.h @@ -65,7 +65,7 @@ automaton::MultiInitialStateNFA < SymbolType, StateType > EpsilonRemoverOutgoing const ext::set<StateType> middleClosure = automaton::properties::EpsilonClosure::epsilonClosure( origFSM, middle ); if( common::GlobalData::verbose ) { - std::cerr << "E-clos(" << middle << ") -> " << middleClosure << std::endl; + common::Streams::err << "E-clos(" << middle << ") -> " << middleClosure << std::endl; } for( const auto & symbol : origFSM.getInputAlphabet() ) { diff --git a/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkov.cpp b/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkov.cpp index 30d8dc8304..8584a92bcc 100644 --- a/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkov.cpp +++ b/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkov.cpp @@ -92,45 +92,45 @@ ToPostfixPushdownAutomatonGlushkov::convert ( const rte::FormalRTE < > & rte ) { /* DEBUG */ if ( common::GlobalData::verbose ) { - std::cerr << "RTE:" << std::endl; + common::Streams::err << "RTE:" << std::endl; for ( const auto & symbol : indexedRTE.getAlphabet ( ) ) - std::cerr << "\t" << symbol << std::endl; + common::Streams::err << "\t" << symbol << std::endl; - std::cerr << std::endl; + common::Streams::err << std::endl; - std::cerr << "First(RTE):" << std::endl; + common::Streams::err << "First(RTE):" << std::endl; for ( const auto & symbol : firstSet ) - std::cerr << "\t" << symbol << std::endl; + common::Streams::err << "\t" << symbol << std::endl; - std::cerr << std::endl; + common::Streams::err << std::endl; // ext::map < common::ranked_symbol < >, ext::set < GlushkovFollow::TFollowTuple < SymbolType, RankType > > > followSet; for ( const std::pair < const common::ranked_symbol < >, ext::set < GlushkovFollow::TFollowTuple < SymbolType, RankType > > >& kv : followSet ) { - std::cerr << "Follow(RTE, " << kv.first << "):" << std::endl; + common::Streams::err << "Follow(RTE, " << kv.first << "):" << std::endl; if ( kv.second.empty ( ) ) - std::cerr << "\t" << "{}" << std::endl; + common::Streams::err << "\t" << "{}" << std::endl; for ( const GlushkovFollow::TFollowTuple < SymbolType, RankType > & followTuple : kv.second ) { // TFollowTuple = vector < set < ranked_symbol > > - std::cerr << " \t - FollowTuple:" << std::endl; + common::Streams::err << " \t - FollowTuple:" << std::endl; for ( const ext::set < common::ranked_symbol < > > & child : followTuple ) - std::cerr << "\t\t - " << child << std::endl; + common::Streams::err << "\t\t - " << child << std::endl; - std::cerr << std::endl; + common::Streams::err << std::endl; } - std::cerr << std::endl; + common::Streams::err << std::endl; } - std::cerr << "---------------------------------------------------------" << std::endl; - std::cerr << "PDA:" << std::endl; - std::cerr << "pds symbols" << std::endl; + common::Streams::err << "---------------------------------------------------------" << std::endl; + common::Streams::err << "PDA:" << std::endl; + common::Streams::err << "pds symbols" << std::endl; for ( const auto & symb : automaton.getPushdownStoreAlphabet ( ) ) - std::cerr << "\t" << symb << std::endl; - std::cerr << std::endl; + common::Streams::err << "\t" << symb << std::endl; + common::Streams::err << std::endl; } /* DEBUG END */ @@ -143,7 +143,7 @@ ToPostfixPushdownAutomatonGlushkov::convert ( const rte::FormalRTE < > & rte ) { push.push_back( ext::set < common::ranked_symbol < SymbolType, RankType > > { symb } ); if ( common::GlobalData::verbose ) { - std::cerr << "Transition 3: " << rte::GlushkovIndexate::getSymbolFromGlushkovPair ( symb ).getSymbol ( ) << " | " << std::endl << + common::Streams::err << "Transition 3: " << rte::GlushkovIndexate::getSymbolFromGlushkovPair ( symb ).getSymbol ( ) << " | " << std::endl << "\t" << "[]" << std::endl << "\t ->" << std::endl << "\t" << push << std::endl << std::endl; @@ -160,7 +160,7 @@ ToPostfixPushdownAutomatonGlushkov::convert ( const rte::FormalRTE < > & rte ) { push.push_back( ext::set < common::ranked_symbol < SymbolType, RankType > > { symb } ); if ( common::GlobalData::verbose ) { - std::cerr << "Transition 2: " << rte::GlushkovIndexate::getSymbolFromGlushkovPair ( symb ).getSymbol ( ) << " | " << std::endl << + common::Streams::err << "Transition 2: " << rte::GlushkovIndexate::getSymbolFromGlushkovPair ( symb ).getSymbol ( ) << " | " << std::endl << "\t" << pop << std::endl << "\t ->" << std::endl << "\t" << push << std::endl << std::endl; @@ -192,7 +192,7 @@ ToPostfixPushdownAutomatonGlushkov::convert ( const rte::FormalRTE < > & rte ) { push.push_back( kv2.second ); if ( common::GlobalData::verbose ) { - std::cerr << "Transition 1" << ( pop.empty() ? "a" : "b" ) << ": " << rte::GlushkovIndexate::getSymbolFromGlushkovPair ( symb ).getSymbol ( ) << " | " << std::endl << + common::Streams::err << "Transition 1" << ( pop.empty() ? "a" : "b" ) << ": " << rte::GlushkovIndexate::getSymbolFromGlushkovPair ( symb ).getSymbol ( ) << " | " << std::endl << "\t" << pop << std::endl << "\t ->" << std::endl << "\t" << push << std::endl << std::endl; diff --git a/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkovNaive.cpp b/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkovNaive.cpp index b3d467503b..ab92295df3 100644 --- a/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkovNaive.cpp +++ b/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkovNaive.cpp @@ -77,34 +77,34 @@ automaton::NPDA < > ToPostfixPushdownAutomatonGlushkovNaive::convert ( const rte /* DEBUG */ if ( common::GlobalData::verbose ) { - std::cerr << "RTE:" << std::endl; + common::Streams::err << "RTE:" << std::endl; for ( const auto & symbol : indexedRTE.getAlphabet ( ) ) - std::cerr << "\t" << symbol << std::endl; + common::Streams::err << "\t" << symbol << std::endl; - std::cerr << std::endl; + common::Streams::err << std::endl; - std::cerr << "First(RTE):" << std::endl; + common::Streams::err << "First(RTE):" << std::endl; for ( const auto & symbol : firstSet ) - std::cerr << "\t" << symbol << std::endl; + common::Streams::err << "\t" << symbol << std::endl; - std::cerr << std::endl; + common::Streams::err << std::endl; for ( const auto & kv : followSet ) { - std::cerr << "Follow(RTE, " << kv.first << "):" << std::endl; + common::Streams::err << "Follow(RTE, " << kv.first << "):" << std::endl; if ( kv.second.empty ( ) ) - std::cerr << "\t" << "{}" << std::endl; + common::Streams::err << "\t" << "{}" << std::endl; for ( const auto & follow : kv.second ) { for ( const auto & symbol : follow ) - std::cerr << "\t" << symbol << std::endl; + common::Streams::err << "\t" << symbol << std::endl; - std::cerr << std::endl; + common::Streams::err << std::endl; } - std::cerr << std::endl; + common::Streams::err << std::endl; } } /* DEBUG END */ diff --git a/alib2common/src/global/GlobalData.cpp b/alib2common/src/global/GlobalData.cpp index 977b577610..a96766db36 100644 --- a/alib2common/src/global/GlobalData.cpp +++ b/alib2common/src/global/GlobalData.cpp @@ -9,6 +9,7 @@ #include <cstdlib> #include <iostream> +#include <string> namespace common { @@ -22,10 +23,19 @@ int GlobalData::argc = 0; char * * GlobalData::argv = NULL; -std::reference_wrapper < std::istream > Streams::in = std::cin; -std::reference_wrapper < std::ostream > Streams::out = std::cout; -std::reference_wrapper < std::ostream > Streams::err = std::cerr; -std::reference_wrapper < std::ostream > Streams::log = std::clog; -std::reference_wrapper < std::ostream > Streams::measure = ext::cmeasure; +ext::reference_wrapper < std::istream > Streams::in = std::cin; +ext::reference_wrapper < std::ostream > Streams::out = std::cout; +ext::reference_wrapper < std::ostream > Streams::err = std::cerr; +ext::reference_wrapper < std::ostream > Streams::log = std::clog; +ext::reference_wrapper < std::ostream > Streams::measure = ext::cmeasure; } /* common */ + +namespace ext { + +std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, std::ostream & ( * func ) ( std::ostream & ) ) { + os.get () << func; + return os; +} + +} /* namespace ext */ diff --git a/alib2common/src/global/GlobalData.h b/alib2common/src/global/GlobalData.h index d08654d778..1c017db2ba 100644 --- a/alib2common/src/global/GlobalData.h +++ b/alib2common/src/global/GlobalData.h @@ -5,8 +5,8 @@ * Author: Jan Travnicek */ -#ifndef _GLOBAL_DATAH_ -#define _GLOBAL_DATAH_ +#ifndef _GLOBAL_DATA_H_ +#define _GLOBAL_DATA_H_ #include <functional> #include <istream> @@ -26,13 +26,31 @@ public: class Streams { public: - static std::reference_wrapper < std::istream > in; - static std::reference_wrapper < std::ostream > out; - static std::reference_wrapper < std::ostream > err; - static std::reference_wrapper < std::ostream > log; - static std::reference_wrapper < std::ostream > measure; + static ext::reference_wrapper < std::istream > in; + static ext::reference_wrapper < std::ostream > out; + static ext::reference_wrapper < std::ostream > err; + static ext::reference_wrapper < std::ostream > log; + static ext::reference_wrapper < std::ostream > measure; }; } /* common */ -#endif /* _GLOBAL_DATAH_ */ +namespace ext { + +template < class T > +std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, T & data ) { + os.get ( ) << data; + return os; +} + +template < class T > +std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, T && data ) { + os.get ( ) << data; + return os; +} + +std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, std::ostream & ( * func ) ( std::ostream & ) ); + +} /* namespace ext */ + +#endif /* _GLOBAL_DATA_H_ */ diff --git a/alib2xml/src/core/xmlApi.hpp b/alib2xml/src/core/xmlApi.hpp index 67d4921ed1..e2a72879f3 100644 --- a/alib2xml/src/core/xmlApi.hpp +++ b/alib2xml/src/core/xmlApi.hpp @@ -170,7 +170,7 @@ public: ext::map < int, WrapperBaseBase * >::iterator elem = input.idToInstance ( ext::to_string < Group > ( ) ).find ( id ); if ( elem == input.idToInstance ( ext::to_string < Group > ( ) ).end ( ) ) { - std::cerr << input.dump ( ) << std::endl; + common::Streams::err << input.dump ( ) << std::endl; throw exception::CommonException ( "XML Inconsistent ( id not found " + ext::to_string ( id ) + " )" ); } diff --git a/aminimize2/src/aminimize.cpp b/aminimize2/src/aminimize.cpp index 80994a095e..b35726b9c6 100644 --- a/aminimize2/src/aminimize.cpp +++ b/aminimize2/src/aminimize.cpp @@ -85,10 +85,10 @@ int main(int argc, char** argv) { std::cout << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch (...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/anormalize2/src/anormalize.cpp b/anormalize2/src/anormalize.cpp index f340f745c2..ed7fd9b9a1 100644 --- a/anormalize2/src/anormalize.cpp +++ b/anormalize2/src/anormalize.cpp @@ -118,10 +118,10 @@ int main ( int argc, char * * argv ) { std::cout << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/aql2/src/aql.cpp b/aql2/src/aql.cpp index 2b697ea38f..9d724b26b4 100644 --- a/aql2/src/aql.cpp +++ b/aql2/src/aql.cpp @@ -114,10 +114,10 @@ int main ( int argc, char * argv[] ) { std::cout << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/aquery2/src/aquery.cpp b/aquery2/src/aquery.cpp index 2f5fdfe86c..72e95dbb29 100644 --- a/aquery2/src/aquery.cpp +++ b/aquery2/src/aquery.cpp @@ -140,10 +140,10 @@ int main ( int argc, char * argv[] ) { std::cout << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/arand2/src/arand.cpp b/arand2/src/arand.cpp index 810466a114..513fc477e8 100644 --- a/arand2/src/arand.cpp +++ b/arand2/src/arand.cpp @@ -210,10 +210,10 @@ int main ( int argc, char * argv[] ) { std::cout << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/araw2/src/araw.cpp b/araw2/src/araw.cpp index 60f3ae9850..6f088cde02 100644 --- a/araw2/src/araw.cpp +++ b/araw2/src/araw.cpp @@ -112,13 +112,13 @@ int main(int argc, char** argv) { alib::XmlDataFactory::toStdout(exception); return 1; } catch(const TCLAP::ArgException& exception) { - std::cerr << exception.error() << std::endl; + common::Streams::err << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch(...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/arename2/src/arename.cpp b/arename2/src/arename.cpp index 29da8c7f1d..001efb98af 100644 --- a/arename2/src/arename.cpp +++ b/arename2/src/arename.cpp @@ -85,10 +85,10 @@ int main ( int argc, char * * argv ) { std::cout << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/areverse2/src/areverse.cpp b/areverse2/src/areverse.cpp index 9d3249e0ac..59f00c1578 100644 --- a/areverse2/src/areverse.cpp +++ b/areverse2/src/areverse.cpp @@ -73,10 +73,10 @@ int main(int argc, char** argv) { std::cout << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch(...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/arun2/src/arun.cpp b/arun2/src/arun.cpp index be4785f260..f2a69ab3f6 100644 --- a/arun2/src/arun.cpp +++ b/arun2/src/arun.cpp @@ -113,10 +113,10 @@ int main(int argc, char* argv[]) { std::cout << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch (...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/astat2/src/astat.cpp b/astat2/src/astat.cpp index d39dc73aa3..c263424088 100644 --- a/astat2/src/astat.cpp +++ b/astat2/src/astat.cpp @@ -88,10 +88,10 @@ int main ( int argc, char * argv[] ) { std::cout << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/astringology2/src/astringology.cpp b/astringology2/src/astringology.cpp index b40fa1c087..70691b793c 100644 --- a/astringology2/src/astringology.cpp +++ b/astringology2/src/astringology.cpp @@ -235,10 +235,10 @@ int main ( int argc, char * argv[] ) { std::cout << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { - std::cerr << "Exception caught: " << exception.what ( ) << std::endl; + common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; return 3; } catch ( ... ) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/atrim2/src/atrim.cpp b/atrim2/src/atrim.cpp index 29c65c1e20..426d80f886 100644 --- a/atrim2/src/atrim.cpp +++ b/atrim2/src/atrim.cpp @@ -137,10 +137,10 @@ int main(int argc, char* argv[]) { std::cout << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch(...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } diff --git a/tniceprint/src/tniceprint.cpp b/tniceprint/src/tniceprint.cpp index 2e6cba48c2..113f9d2368 100644 --- a/tniceprint/src/tniceprint.cpp +++ b/tniceprint/src/tniceprint.cpp @@ -72,13 +72,13 @@ int main(int argc, char** argv) { alib::XmlDataFactory::toStdout(exception); return 1; } catch(const TCLAP::ArgException& exception) { - std::cerr << exception.error() << std::endl; + common::Streams::err << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { - std::cerr << "Exception caught: " << exception.what() << std::endl; + common::Streams::err << "Exception caught: " << exception.what() << std::endl; return 3; } catch(...) { - std::cerr << "Unknown exception caught." << std::endl; + common::Streams::err << "Unknown exception caught." << std::endl; return 127; } } -- GitLab