Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / devel / devel.ma / Printing.h
index 8ae48cb..4e42a55 100644 (file)
 #include <zypp/base/Algorithm.h>
 #include <zypp/base/Functional.h>
 
-///////////////////////////////////////////////////////////////////
-#if 0
-///////////////////////////////////////////////////////////////////
-struct FormatStream
-{
-  explicit
-  FormatStream( std::ostream & stream_r )
-  : _stream( stream_r )
-  {}
+using std::endl;
 
-  FormatStream & operator<<( std::ostream & (*fnc)( std::ostream & ) )
-  { _stream << fnc; return *this; }
-
-  template<class _Tp>
-    FormatStream & operator<<( const _Tp & obj )
-    { _stream << "@(" << obj << ")@"; return *this; }
+///////////////////////////////////////////////////////////////////
 
-  std::ostream & _stream;
+struct Print
+{
+  template<class Tp>
+    bool operator()( const Tp & val_r ) const
+    { USR << val_r << endl; return true; }
 };
-///////////////////////////////////////////////////////////////////
-#undef XXX
-#undef DBG
-#undef MIL
-#undef WAR
-#undef ERR
-#undef SEC
-#undef INT
-#undef USR
 
-#define XXX FormatStream(_XXX( ZYPP_BASE_LOGGER_LOGGROUP ))
-#define DBG FormatStream(_DBG( ZYPP_BASE_LOGGER_LOGGROUP ))
-#define MIL FormatStream(_MIL( ZYPP_BASE_LOGGER_LOGGROUP ))
-#define WAR FormatStream(_WAR( ZYPP_BASE_LOGGER_LOGGROUP ))
-#define ERR FormatStream(_ERR( ZYPP_BASE_LOGGER_LOGGROUP ))
-#define SEC FormatStream(_SEC( ZYPP_BASE_LOGGER_LOGGROUP ))
-#define INT FormatStream(_INT( ZYPP_BASE_LOGGER_LOGGROUP ))
-#define USR FormatStream(_USR( ZYPP_BASE_LOGGER_LOGGROUP ))
 ///////////////////////////////////////////////////////////////////
-#endif
-///////////////////////////////////////////////////////////////////
-
 
-template<class _Tp>
-  struct PrintOn : public std::unary_function<_Tp, bool>
+template<class Tp>
+  struct PrintOn : public std::unary_function<Tp, bool>
   {
-    bool operator()( const _Tp & obj ) const
+    bool operator()( const Tp & obj ) const
     {
       if ( _leadNL )
         _str << std::endl << _prfx << obj;