7 #include "zypp/base/Logger.h"
8 #include "zypp/base/PtrTypes.h"
9 #include <zypp/base/String.h>
10 #include <zypp/base/Iterator.h>
11 #include <zypp/base/Algorithm.h>
12 #include <zypp/base/Functional.h>
14 ///////////////////////////////////////////////////////////////////
17 struct Print : public std::unary_function<_Tp, bool>
19 bool operator()( const _Tp & obj )
21 USR << obj << std::endl;
27 struct PrintPtr : public std::unary_function<_Tp, bool>
29 bool operator()( const _Tp & obj )
32 USR << *obj << std::endl;
34 USR << "(NULL)" << std::endl;
39 template<class _Container>
40 void print( const _Container & c )
42 INT << c.size() << " " << __PRETTY_FUNCTION__ << std::endl;
43 std::for_each( c.begin(), c.end(),
44 Print<typename _Container::value_type>() );
47 template<class _Container>
48 void printPtr( const _Container & c )
50 INT << c.size() << " " << __PRETTY_FUNCTION__ << std::endl;
51 std::for_each( c.begin(), c.end(),
52 PrintPtr<typename _Container::value_type>() );
55 template<class _Container>
56 void printMK( const _Container & c )
58 for ( typename _Container::const_iterator it = c.begin(); it != c.end(); ++it )
60 USR << it->first << std::endl;
63 template<class _Container>
64 void printMV( const _Container & c )
66 for ( typename _Container::const_iterator it = c.begin(); it != c.end(); ++it )
68 USR << it->second << std::endl;
72 template<class _Container>
73 void printMKV( const _Container & c )
75 for ( typename _Container::const_iterator it = c.begin(); it != c.end(); ++it )
77 USR << it->first << '\t' << it->second << std::endl;
81 ///////////////////////////////////////////////////////////////////
82 #endif // MA_PRINTING_H