- Removed deprecated oldstyle commit methods.
[platform/upstream/libzypp.git] / devel / devel.ma / Printing.h
1 #ifndef MA_PRINTING_H
2 #define MA_PRINTING_H
3
4 #include <iostream>
5
6 #include "zypp/base/LogControl.h"
7 #include "zypp/base/LogTools.h"
8 #include <zypp/base/Logger.h>
9
10 #include <zypp/base/String.h>
11 #include <zypp/base/Iterator.h>
12 #include <zypp/base/Algorithm.h>
13 #include <zypp/base/Functional.h>
14
15 ///////////////////////////////////////////////////////////////////
16
17 template<class _Tp>
18   struct PrintOn : public std::unary_function<_Tp, bool>
19   {
20     bool operator()( const _Tp & obj ) const
21     {
22       if ( _leadNL )
23         _str << std::endl << _prfx << obj;
24       else
25         _str << _prfx << obj << std::endl;
26       return true;
27     }
28
29     PrintOn( std::ostream & str, const std::string & prfx = std::string(), bool leadNL = false )
30     : _str( str )
31     , _prfx( prfx )
32     , _leadNL( leadNL )
33     {}
34
35     std::ostream & _str;
36     std::string _prfx;
37     bool _leadNL;
38   };
39
40 ///////////////////////////////////////////////////////////////////
41 #endif // MA_PRINTING_H