12 #ifndef ZYPP_BASE_LOGTOOLS_H
13 #define ZYPP_BASE_LOGTOOLS_H
22 #include <zypp-core/base/Hash.h>
23 #include <zypp-core/base/Logger.h>
24 #include <zypp-core/base/Iterator.h>
25 #include <zypp-core/Globals.h>
90 template<
class TIterator>
92 TIterator begin, TIterator end,
93 const std::string & intro =
"{",
94 const std::string & pfx =
"\n ",
95 const std::string & sep =
"\n ",
96 const std::string & sfx =
"\n",
97 const std::string & extro =
"}" )
102 str << pfx << *begin;
103 for ( ++begin; begin != end; ++begin )
104 str << sep << *begin;
113 template<
class TIterator>
115 TIterator begin, TIterator end )
116 {
return dumpRange(
str, begin, end,
"(",
"",
", ",
"",
")" ); }
118 template<
class TContainer>
130 template<
class TIterator>
142 template<
class TIterator>
156 template<
class TIterator>
160 template<
class TContainer>
162 {
return rangeLine( cont.begin(), cont.end() ); }
165 std::ostream &
operator<<( std::ostream &
str,
const std::vector<Tp> & obj )
168 template<
class Tp,
class TCmp,
class TAlloc>
169 std::ostream &
operator<<( std::ostream &
str,
const std::set<Tp,TCmp,TAlloc> & obj )
173 std::ostream &
operator<<( std::ostream &
str,
const std::unordered_set<Tp> & obj )
177 std::ostream &
operator<<( std::ostream &
str,
const std::multiset<Tp> & obj )
189 namespace _logtoolsdetail
201 template<
class TPair>
217 template<
class TPair>
220 return str <<
'[' << obj.
pair().first <<
"] = " << obj.
pair().second;
224 template<
class TPair>
244 struct Transformer :
public std::unary_function<PairType, MapEntryType>
247 {
return mapEntry( pair_r ); }
250 typedef transform_iterator<Transformer, typename MapType::const_iterator>
376 using _logtoolsdetail::mapEntry;
377 using _logtoolsdetail::dumpMap;
378 using _logtoolsdetail::dumpKeys;
379 using _logtoolsdetail::dumpValues;
381 template<
class TKey,
class Tp>
382 std::ostream &
operator<<( std::ostream &
str,
const std::map<TKey, Tp> & obj )
383 {
return str << dumpMap( obj ); }
385 template<
class TKey,
class Tp>
386 std::ostream &
operator<<( std::ostream &
str,
const std::unordered_map<TKey, Tp> & obj )
387 {
return str << dumpMap( obj ); }
389 template<
class TKey,
class Tp>
390 std::ostream &
operator<<( std::ostream &
str,
const std::multimap<TKey, Tp> & obj )
391 {
return str << dumpMap( obj ); }
402 inline std::ostream &
operator<<( std::ostream &
str,
const std::basic_ios<char> & obj )
404 std::string ret(
"[" );
405 ret += ( obj.good() ?
'g' :
'_' );
406 ret += ( obj.eof() ?
'e' :
'_' );
407 ret += ( obj.fail() ?
'F' :
'_' );
408 ret += ( obj.bad() ?
'B' :
'_' );
Iomanip helper printing dumpRangeLine style.
iterator_type begin() const
iterator_type end() const
std::pair wrapper for std::map output.
const TPair & pair() const
MapEntry(const TPair &pair_r)
std::ostream & operator<<(std::ostream &str, const MapEntry< TPair > &obj)
Stream output.
MapEntry< TPair > mapEntry(const TPair &pair_r)
Convenience function to create MapEntry from std::pair.
String related utilities and Regular expression matching.
std::ostream & dumpOn(std::ostream &str, const PoolQueryIterator &obj)
std::ostream & operator<<(std::ostream &str, const Dump< Tp > &obj)
Easy-to use interface to the ZYPP dependency resolver.
MapKVIteratorTraits< TMap >::Key_const_iterator make_map_key_end(const TMap &map_r)
Convenience to create the key iterator from container::end()
std::ostream & dumpRangeLine(std::ostream &str, TIterator begin, TIterator end)
Print range defined by iterators (single line style).
detail::Dump< Tp > dump(const Tp &obj_r)
MapKVIteratorTraits< TMap >::Key_const_iterator make_map_key_begin(const TMap &map_r)
Convenience to create the key iterator from container::begin()
MapKVIteratorTraits< TMap >::Value_const_iterator make_map_value_end(const TMap &map_r)
Convenience to create the value iterator from container::end()
MapKVIteratorTraits< TMap >::Value_const_iterator make_map_value_begin(const TMap &map_r)
Convenience to create the value iterator from container::begin()
iomanip::RangeLine< TIterator > rangeLine(TIterator begin, TIterator end)
Iomanip printing dumpRangeLine style.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
std::ostream & dumpRange(std::ostream &str, TIterator begin, TIterator end, const std::string &intro="{", const std::string &pfx="\n ", const std::string &sep="\n ", const std::string &sfx="\n", const std::string &extro="}")
Print range defined by iterators (multiline style).
transform_iterator< GetPairFirst< typename MapType::value_type >, typename MapType::const_iterator > Key_const_iterator
The key iterator type.
transform_iterator< GetPairSecond< typename MapType::value_type >, typename MapType::const_iterator > Value_const_iterator
The value iterator type.
std::ostream & operator<<(std::ostream &str, const RangeLine< TIterator > &obj)
<TIterator>
RangeLine(TIterator begin, TIterator end)