libzypp 17.38.5

LogTools.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_BASE_LOGTOOLS_H
13#define ZYPP_BASE_LOGTOOLS_H
14
15#include <iostream>
16#include <optional>
17#include <string>
18#include <vector>
19#include <list>
20#include <set>
21#include <map>
22
23#include <zypp-core/base/Hash.h>
24#include <zypp-core/base/Logger.h>
25#include <zypp-core/base/String.h>
26#include <zypp-core/base/Iterator.h>
27#include <zypp-core/Globals.h>
28
29#ifdef __GNUG__
30#include <cstdlib>
31#include <memory>
32#include <cxxabi.h>
33#endif
34
36 namespace zypp
37{
38
45 namespace str {
46
47 namespace detail {
48
50 template <typename T> class RefStore;
51
53 template <typename T>
54 struct RefStore
55 {
56 constexpr RefStore( T && val_r )
57 : _val { std::move(val_r) }
58 {}
59
60 RefStore( const RefStore & ) = delete;
61
62 constexpr RefStore( RefStore && rhs )
63 : _val { std::move(rhs._val) }
64 {}
65
66 T & get() { return _val; }
67 const T & get() const { return _val; }
68
69 private:
70 T _val;
71 };
72
74 template <typename T>
75 struct RefStore<T&>
76 {
77 constexpr RefStore( T & t )
78 : _val { t }
79 {}
80
81 RefStore( const RefStore & ) = delete;
82
83 constexpr RefStore( RefStore && rhs )
84 : _val { rhs._val }
85 {}
86
87 T & get() { return _val; }
88 const T & get() const { return _val; }
89
90 private:
91 T & _val;
92 };
93
95 template <typename T>
96 constexpr auto makeRefStore( T && t ) ->/* c++-11 can not deduce return value! */ RefStore<T>
97 { return RefStore<T>( std::forward<T>(t) ); }
98
100 template <typename T>
101 std::ostream & operator<<( std::ostream & str, const RefStore<T> & obj )
102 { return str << obj.get(); }
103
104
106 struct NoPrint {};
107
108 inline std::ostream & operator<<( std::ostream & str, const NoPrint & obj )
109 { return str; }
110
111 template <>
112 struct RefStore<NoPrint>
113 { constexpr RefStore() {} constexpr RefStore( NoPrint && ) {} };
114
115 template <>
116 inline std::ostream & operator<<( std::ostream & str, const RefStore<NoPrint> & obj )
117 { return str; }
118
119 template <>
120 struct RefStore<NoPrint&>
121 { constexpr RefStore() {} constexpr RefStore( const NoPrint & ) {} };
122
123 template <>
124 inline std::ostream & operator<<( std::ostream & str, const RefStore<NoPrint&> & obj )
125 { return str; }
126
127
139 template <typename Intro, typename Pfx, typename Sep, typename Sfx, typename Extro, typename Pel, typename Sel>
140 struct JoinFormat
141 {
142 constexpr JoinFormat( Intro && intro, Pfx && pfx, Sep && sep, Sfx && sfx, Extro && extro, Pel && pel, Sel && sel )
143 : _intro { std::forward<Intro>(intro) }
144 , _pfx { std::forward<Pfx>(pfx) }
145 , _sep { std::forward<Sep>(sep) }
146 , _sfx { std::forward<Sfx>(sfx) }
147 , _extro { std::forward<Extro>(extro) }
148 , _pel { std::forward<Pel>(pel) }
149 , _sel { std::forward<Sel>(sel) }
150 {}
151
152 RefStore<Intro> _intro;
153 RefStore<Pfx> _pfx;
154 RefStore<Sep> _sep;
155 RefStore<Sfx> _sfx;
156 RefStore<Extro> _extro;
157 RefStore<Pel> _pel;
158 RefStore<Sel> _sel;
159 };
160
161 } //namespace detail
162
163 // Drag it into str:: namespace
164 using NoPrint = detail::NoPrint;
165 inline constexpr NoPrint noPrint;
166
195 template <typename Intro, typename Pfx, typename Sep, typename Sfx, typename Extro, typename Pel=NoPrint, typename Sel=NoPrint>
196 constexpr auto makeJoinFormat( Intro && intro, Pfx && pfx, Sep && sep, Sfx && sfx, Extro && extro, Pel && pel = Pel(), Sel && sel = Sel() ) ->/* c++-11 can not deduce return value! */ detail::JoinFormat<Intro,Pfx,Sep,Sfx,Extro,Pel,Sel>
197 { return detail::JoinFormat<Intro,Pfx,Sep,Sfx,Extro,Pel,Sel>( std::forward<Intro>(intro), std::forward<Pfx>(pfx), std::forward<Sep>(sep), std::forward<Sfx>(sfx), std::forward<Extro>(extro), std::forward<Pel>(pel), std::forward<Sel>(sel) ); }
198
199
200 // A few default formats:
202 inline constexpr auto FormatConcat = makeJoinFormat( noPrint, noPrint, noPrint, noPrint, noPrint );
204 inline constexpr auto FormatWords = makeJoinFormat( noPrint, noPrint, " ", noPrint, noPrint );
206 inline constexpr auto FormatLine = makeJoinFormat( noPrint, noPrint, " ", noPrint, "\n" );
208 inline constexpr auto FormatList = makeJoinFormat( noPrint, noPrint, "\n", "\n", noPrint );
210 inline constexpr auto FormatTuple = makeJoinFormat( "(", noPrint, ", ", noPrint, ")" );
211
213 inline constexpr auto FormatDumpRangeDefault
214 = makeJoinFormat( "{", "\n ", "\n ", "\n", "}" );
215
216 namespace detail {
217
218 template <typename Ostream, typename Format>
219 void _joinSF( Ostream & str, const Format & fmt )
220 { ; }
221
222 template <typename Ostream, typename Format, typename First>
223 void _joinSF( Ostream & str, const Format & fmt, First && first )
224 { str << fmt._pel << std::forward<First>(first) << fmt._sel; }
225
226 template <typename Ostream, typename Format, typename First, typename... Args>
227 void _joinSF( Ostream & str, const Format & fmt, First && first, Args &&... args )
228 { _joinSF( str << fmt._pel << std::forward<First>(first) << fmt._sel << fmt._sep, fmt, std::forward<Args>(args)... ); }
229
233 template <typename Ostream, typename Format, typename... Args>
234 Ostream & joinSF( Ostream & str, Format && fmt, Args &&... args )
235 {
236 str << fmt._intro;
237 if ( sizeof...(Args) ) {
238 str << fmt._pfx;
239 detail::_joinSF( str, fmt, std::forward<Args>(args)... );
240 str << fmt._sfx;
241 }
242 str << fmt._extro;
243 return str;
244 }
245
246 } //namespace detail
247
249 template <typename Ostream, typename Format, typename... Args>
250 Ostream & printf( Ostream & str, Format && fmt, Args&&... args )
251 { return detail::joinSF( str, std::forward<Format>(fmt), std::forward<Args>(args)... ); }
252
254 template <typename Format, typename... Args>
255 std::string sprintf( Format && fmt, Args&&... args )
256 { str::Str str; return detail::joinSF( str, std::forward<Format>(fmt), std::forward<Args>(args)... ); }
257
258
260 template <typename Ostream, typename... Args>
261 Ostream & print( Ostream & str, Args&&... args )
262 { return detail::joinSF( str, FormatWords, std::forward<Args>(args)... ); }
263
265 template <typename... Args>
266 std::string sprint( Args&&... args )
267 { str::Str str; return detail::joinSF( str, FormatWords, std::forward<Args>(args)... ); }
268
270 template <typename Ostream, typename... Args>
271 Ostream & concat( Ostream & str, Args&&... args )
272 { return detail::joinSF( str, FormatConcat, std::forward<Args>(args)... ); }
273
275 template <typename... Args>
276 std::string sconcat( Args&&... args )
277 { str::Str str; return detail::joinSF( str, FormatConcat, std::forward<Args>(args)... ); }
278
279 namespace detail {
286 template <typename Ostream, typename Format>
287 struct PrintFmt {
288 PrintFmt( Ostream & str, const Format & fmt )
289 : _str { str }
290 , _fmt { fmt }
291 {}
292
293 template <typename... Args>
294 Ostream & operator()( Args&&... args )
295 { return str::printf( _str, _fmt, std::forward<Args>(args)... ); }
296
297 private:
298 Ostream & _str;
299 const Format & _fmt;
300 };
301 } //namespace detail
302
303 #define pXXX zypp::str::detail::PrintFmt(XXX,zypp::str::FormatLine)
304 #define pDBG zypp::str::detail::PrintFmt(DBG,zypp::str::FormatLine)
305 #define pMIL zypp::str::detail::PrintFmt(MIL,zypp::str::FormatLine)
306 #define pWAR zypp::str::detail::PrintFmt(WAR,zypp::str::FormatLine)
307 #define pERR zypp::str::detail::PrintFmt(ERR,zypp::str::FormatLine)
308 #define pSEC zypp::str::detail::PrintFmt(SEC,zypp::str::FormatLine)
309 #define pINT zypp::str::detail::PrintFmt(INT,zypp::str::FormatLine)
310 #define pUSR zypp::str::detail::PrintFmt(USR,zypp::str::FormatLine)
311
312 #define wXXX zypp::str::detail::PrintFmt(XXX,zypp::str::FormatWords)
313 #define wDBG zypp::str::detail::PrintFmt(DBG,zypp::str::FormatWords)
314 #define wMIL zypp::str::detail::PrintFmt(MIL,zypp::str::FormatWords)
315 #define wWAR zypp::str::detail::PrintFmt(WAR,zypp::str::FormatWords)
316 #define wERR zypp::str::detail::PrintFmt(ERR,zypp::str::FormatWords)
317 #define wSEC zypp::str::detail::PrintFmt(SEC,zypp::str::FormatWords)
318 #define wINT zypp::str::detail::PrintFmt(INT,zypp::str::FormatWords)
319 #define wUSR zypp::str::detail::PrintFmt(USR,zypp::str::FormatWords)
320 } // namespace str
322
323 using std::endl;
324
336 struct MLSep
337 {
338 MLSep() {}
339 MLSep( char sep_r ) : _sep { sep_r } {}
340 bool _first = true;
341 char _sep = '\n';
342 };
343 inline std::ostream & operator<<( std::ostream & str, MLSep & obj )
344 { if ( obj._first ) obj._first = false; else str << obj._sep; return str; }
345
403 template<class TIterator>
404 std::ostream & dumpRange( std::ostream & str,
405 TIterator begin, TIterator end,
406 const std::string & intro = "{",
407 const std::string & pfx = "\n ",
408 const std::string & sep = "\n ",
409 const std::string & sfx = "\n",
410 const std::string & extro = "}" )
411 {
412 str << intro;
413 if ( begin != end )
414 {
415 str << pfx << *begin;
416 for ( ++begin; begin != end; ++begin )
417 str << sep << *begin;
418 str << sfx;
419 }
420 return str << extro;
421 }
422
426 template<class TIterator>
427 std::ostream & dumpRangeLine( std::ostream & str,
428 TIterator begin, TIterator end )
429 { return dumpRange( str, begin, end, "(", "", ", ", "", ")" ); }
430
431 template<class TContainer>
432 std::ostream & dumpRangeLine( std::ostream & str, const TContainer & cont )
433 { return dumpRangeLine( str, cont.begin(), cont.end() ); }
434
435
437 namespace iomanip
438 {
443 template<class TIterator>
444 struct RangeLine
445 {
446 RangeLine( TIterator begin, TIterator end )
447 : _begin( begin )
448 , _end( end )
449 {}
450 TIterator _begin;
451 TIterator _end;
452 };
453
455 template<class TIterator>
456 std::ostream & operator<<( std::ostream & str, const RangeLine<TIterator> & obj )
457 { return dumpRangeLine( str, obj._begin, obj._end ); }
458
459 } // namespce iomanip
460
461
469 template<class TIterator>
470 iomanip::RangeLine<TIterator> rangeLine( TIterator begin, TIterator end )
471 { return iomanip::RangeLine<TIterator>( begin, end ); }
472
473 template<class TContainer>
474 auto rangeLine( const TContainer & cont ) -> decltype( rangeLine( cont.begin(), cont.end() ) )
475 { return rangeLine( cont.begin(), cont.end() ); }
476
477} // namespace zypp
479 namespace std {
480 template<class Tp>
481 std::ostream & operator<<( std::ostream & str, const std::vector<Tp> & obj )
482 { return zypp::dumpRange( str, obj.begin(), obj.end() ); }
483
484 template<class Tp, class TCmp, class TAlloc>
485 std::ostream & operator<<( std::ostream & str, const std::set<Tp,TCmp,TAlloc> & obj )
486 { return zypp::dumpRange( str, obj.begin(), obj.end() ); }
487
488 template<class Tp>
489 std::ostream & operator<<( std::ostream & str, const std::unordered_set<Tp> & obj )
490 { return zypp::dumpRange( str, obj.begin(), obj.end() ); }
491
492 template<class Tp>
493 std::ostream & operator<<( std::ostream & str, const std::multiset<Tp> & obj )
494 { return zypp::dumpRange( str, obj.begin(), obj.end() ); }
495
496 template<class Tp>
497 std::ostream & operator<<( std::ostream & str, const std::list<Tp> & obj )
498 { return zypp::dumpRange( str, obj.begin(), obj.end() ); }
499} // namespace std
501 namespace zypp {
502
503 template<class Tp>
504 std::ostream & operator<<( std::ostream & str, const Iterable<Tp> & obj )
505 { return dumpRange( str, obj.begin(), obj.end() ); }
506
508 namespace _logtoolsdetail
509 {
510
512 // mapEntry
514
520 template<class TPair>
521 class MapEntry
522 {
523 public:
524 MapEntry( const TPair & pair_r )
525 : _pair( &pair_r )
526 {}
527
528 const TPair & pair() const
529 { return *_pair; }
530
531 private:
532 const TPair *const _pair;
533 };
534
536 template<class TPair>
537 std::ostream & operator<<( std::ostream & str, const MapEntry<TPair> & obj )
538 {
539 return str << '[' << obj.pair().first << "] = " << obj.pair().second;
540 }
541
543 template<class TPair>
544 MapEntry<TPair> mapEntry( const TPair & pair_r )
545 { return MapEntry<TPair>( pair_r ); }
546
548 // dumpMap
550
555 template<class TMap>
556 class DumpMap
557 {
558 public:
559 using MapType = TMap;
560 using PairType = typename TMap::value_type;
561 using MapEntryType = MapEntry<PairType>;
562
563 struct Transformer
564 {
565 MapEntryType operator()( const PairType & pair_r ) const
566 { return mapEntry( pair_r ); }
567 };
568
569 using MapEntry_const_iterator = transform_iterator<Transformer, typename MapType::const_iterator>;
570
571 public:
572 DumpMap( const TMap & map_r )
573 : _map( &map_r )
574 {}
575
576 const TMap & map() const
577 { return *_map; }
578
579 MapEntry_const_iterator begin() const
580 { return make_transform_iterator( map().begin(), Transformer() ); }
581
582 MapEntry_const_iterator end() const
583 { return make_transform_iterator( map().end(), Transformer() );}
584
585 private:
586 const TMap *const _map;
587 };
588
590 template<class TMap>
591 std::ostream & operator<<( std::ostream & str, const DumpMap<TMap> & obj )
592 { return dumpRange( str, obj.begin(), obj.end() ); }
593
595 template<class TMap>
596 DumpMap<TMap> dumpMap( const TMap & map_r )
597 { return DumpMap<TMap>( map_r ); }
598
600 // dumpKeys
602
610 template<class TMap>
611 class DumpKeys
612 {
613 public:
614 using MapKey_const_iterator = typename MapKVIteratorTraits<TMap>::Key_const_iterator;
615
616 public:
617 DumpKeys( const TMap & map_r )
618 : _map( &map_r )
619 {}
620
621 const TMap & map() const
622 { return *_map; }
623
624 MapKey_const_iterator begin() const
625 { return make_map_key_begin( map() ); }
626
627 MapKey_const_iterator end() const
628 { return make_map_key_end( map() ); }
629
630 private:
631 const TMap *const _map;
632 };
633
635 template<class TMap>
636 std::ostream & operator<<( std::ostream & str, const DumpKeys<TMap> & obj )
637 { return dumpRange( str, obj.begin(), obj.end() ); }
638
640 template<class TMap>
641 DumpKeys<TMap> dumpKeys( const TMap & map_r )
642 { return DumpKeys<TMap>( map_r ); }
643
645 // dumpValues
647
655 template<class TMap>
656 class DumpValues
657 {
658 public:
659 using MapValue_const_iterator = typename MapKVIteratorTraits<TMap>::Value_const_iterator;
660
661 public:
662 DumpValues( const TMap & map_r )
663 : _map( &map_r )
664 {}
665
666 const TMap & map() const
667 { return *_map; }
668
669 MapValue_const_iterator begin() const
670 { return make_map_value_begin( map() ); }
671
672 MapValue_const_iterator end() const
673 { return make_map_value_end( map() ); }
674
675 private:
676 const TMap *const _map;
677 };
678
680 template<class TMap>
681 std::ostream & operator<<( std::ostream & str, const DumpValues<TMap> & obj )
682 { return dumpRange( str, obj.begin(), obj.end() ); }
683
685 template<class TMap>
686 DumpValues<TMap> dumpValues( const TMap & map_r )
687 { return DumpValues<TMap>( map_r ); }
688
690 } // namespace _logtoolsdetail
691
692
693 // iomanipulator
694 using _logtoolsdetail::mapEntry; // std::pair as '[key] = value'
695 using _logtoolsdetail::dumpMap; // dumpRange '[key] = value'
696 using _logtoolsdetail::dumpKeys; // dumpRange keys
697 using _logtoolsdetail::dumpValues; // dumpRange values
698
699} // namespace zypp
701 namespace std {
702 template<class TKey, class Tp>
703 std::ostream & operator<<( std::ostream & str, const std::map<TKey, Tp> & obj )
704 { return str << zypp::dumpMap( obj ); }
705
706 template<class TKey, class Tp>
707 std::ostream & operator<<( std::ostream & str, const std::unordered_map<TKey, Tp> & obj )
708 { return str << zypp::dumpMap( obj ); }
709
710 template<class TKey, class Tp>
711 std::ostream & operator<<( std::ostream & str, const std::multimap<TKey, Tp> & obj )
712 { return str << zypp::dumpMap( obj ); }
713
723 inline std::ostream & operator<<( std::ostream & str, const std::basic_ios<char> & obj )
724 {
725 std::string ret( "[" );
726 ret += ( obj.good() ? 'g' : '_' );
727 ret += ( obj.eof() ? 'e' : '_' );
728 ret += ( obj.fail() ? 'F' : '_' );
729 ret += ( obj.bad() ? 'B' : '_' );
730 ret += "]";
731 return str << ret;
732 }
733} // namespace std
735 namespace zypp {
736
738 // iomanipulator: str << dump(val) << ...
739 // calls: std::ostream & dumpOn( std::ostream & str, const Type & obj )
741
742 namespace detail
743 {
744 template<class Tp>
745 struct Dump
746 {
747 Dump( const Tp & obj_r ) : _obj( obj_r ) {}
748 const Tp & _obj;
749 };
750
751 template<class Tp>
752 std::ostream & operator<<( std::ostream & str, const Dump<Tp> & obj )
753 { return dumpOn( str, obj._obj ); }
754 }
755
756 template<class Tp>
757 detail::Dump<Tp> dump( const Tp & obj_r )
758 { return detail::Dump<Tp>(obj_r); }
759
768 inline std::ostream & hexdumpOn( std::ostream & outs, const unsigned char *ptr, size_t size )
769 {
770 size_t i = 0,c = 0;
771 unsigned width = 0x10;
772 outs << str::form( "hexdump %10.10ld bytes (0x%8.8lx):\n", (long)size, (long)size );
773
774 for ( i = 0; i < size; i += width ) {
775 outs << str::form( "%4.4lx: ", (long)i );
776 /* show hex to the left */
777 for ( c = 0; c < width; ++c ) {
778 if ( i+c < size )
779 outs << str::form( "%02x ", ptr[i+c] );
780 else
781 outs << (" ");
782 }
783 /* show data on the right */
784 for ( c = 0; (c < width) && (i+c < size); ++c ) {
785 char x = (ptr[i+c] >= 0x20 && ptr[i+c] < 0x7f) ? ptr[i+c] : '.';
786 outs << x;
787 }
788 outs << std::endl;
789 }
790 return outs;
791 }
792
793 inline std::ostream & hexdumpOn( std::ostream & outs, const char *ptr, size_t size )
794 { return hexdumpOn( outs, reinterpret_cast<const unsigned char*>(ptr), size ); }
795
796} // namespace zypp
798 namespace std {
800 template<class D>
801 inline std::ostream & operator<<( std::ostream & str, const std::shared_ptr<D> & obj )
802 {
803 if ( obj )
804 return str << *obj;
805 return str << std::string("NULL");
806 }
808 template<>
809 inline std::ostream & operator<<( std::ostream & str, const std::shared_ptr<void> & obj )
810 {
811 if ( obj )
812 return str << zypp::str::form( "%p", static_cast<void*>(obj.get()) );
813 return str << std::string("NULL");
814 }
815
820 inline std::ostream & operator<<( std::ostream & str, const std::type_info &info )
821 {
822#ifdef __GNUG__
823 int status = -4; // some arbitrary value to eliminate the compiler warning
824
825 // enable c++11 by passing the flag -std=c++11 to g++
826 std::unique_ptr<char, void(*)(void*)> res {
827 abi::__cxa_demangle(info.name(), NULL, NULL, &status),
828 std::free
829 };
830 return str << std::string((status==0) ? res.get() : info.name());
831#else
832 return str << info.name();
833#endif
834 }
835
836#ifdef __cpp_lib_optional // YAST/PK explicitly use c++11 until 15-SP3
837 template<class Tp>
838 inline std::ostream & operator<<( std::ostream & str, const std::optional<Tp> & obj )
839 {
840 if ( obj )
841 str << "opt(" << *obj << ")";
842 else
843 str << "nullopt";
844 return str;
845 }
846#endif
847} // namespace std
849#endif // ZYPP_BASE_LOGTOOLS_H
Globals.h
Provides API related macros.
Hash.h
Iterator.h
Logger.h
String.h
Extro
Intro
Pel
Pfx
Sel
Sep
Sfx
transform_iterator
An iterator over elements which are the result of applying some functional transformation to the elem...
zypp::Iterable
Definition Iterable.h:37
zypp::Iterable::begin
iterator_type begin() const
Definition Iterable.h:63
zypp::Iterable::end
iterator_type end() const
Definition Iterable.h:66
zypp::_logtoolsdetail::DumpKeys::map
const TMap & map() const
Definition LogTools.h:621
zypp::_logtoolsdetail::DumpKeys::end
MapKey_const_iterator end() const
Definition LogTools.h:627
zypp::_logtoolsdetail::DumpKeys::dumpKeys
DumpKeys< TMap > dumpKeys(const TMap &map_r)
Convenience function to create DumpKeys from std::map.
Definition LogTools.h:641
zypp::_logtoolsdetail::DumpKeys::MapKey_const_iterator
typename MapKVIteratorTraits< TMap >::Key_const_iterator MapKey_const_iterator
Definition LogTools.h:614
zypp::_logtoolsdetail::DumpKeys::DumpKeys
DumpKeys(const TMap &map_r)
Definition LogTools.h:617
zypp::_logtoolsdetail::DumpKeys::_map
const TMap *const _map
Definition LogTools.h:631
zypp::_logtoolsdetail::DumpKeys::begin
MapKey_const_iterator begin() const
Definition LogTools.h:624
zypp::_logtoolsdetail::DumpKeys::operator<<
std::ostream & operator<<(std::ostream &str, const DumpKeys< TMap > &obj)
Stream output.
Definition LogTools.h:636
zypp::_logtoolsdetail::DumpMap::MapEntry_const_iterator
transform_iterator< Transformer, typename MapType::const_iterator > MapEntry_const_iterator
Definition LogTools.h:569
zypp::_logtoolsdetail::DumpMap::operator<<
std::ostream & operator<<(std::ostream &str, const DumpMap< TMap > &obj)
Stream output.
Definition LogTools.h:591
zypp::_logtoolsdetail::DumpMap::begin
MapEntry_const_iterator begin() const
Definition LogTools.h:579
zypp::_logtoolsdetail::DumpMap::MapEntryType
MapEntry< PairType > MapEntryType
Definition LogTools.h:561
zypp::_logtoolsdetail::DumpMap::PairType
typename TMap::value_type PairType
Definition LogTools.h:560
zypp::_logtoolsdetail::DumpMap::end
MapEntry_const_iterator end() const
Definition LogTools.h:582
zypp::_logtoolsdetail::DumpMap::_map
const TMap *const _map
Definition LogTools.h:586
zypp::_logtoolsdetail::DumpMap::dumpMap
DumpMap< TMap > dumpMap(const TMap &map_r)
Convenience function to create DumpMap from std::map.
Definition LogTools.h:596
zypp::_logtoolsdetail::DumpMap::map
const TMap & map() const
Definition LogTools.h:576
zypp::_logtoolsdetail::DumpMap::DumpMap
DumpMap(const TMap &map_r)
Definition LogTools.h:572
zypp::_logtoolsdetail::DumpMap::MapType
TMap MapType
Definition LogTools.h:559
zypp::_logtoolsdetail::DumpValues::operator<<
std::ostream & operator<<(std::ostream &str, const DumpValues< TMap > &obj)
Stream output.
Definition LogTools.h:681
zypp::_logtoolsdetail::DumpValues::map
const TMap & map() const
Definition LogTools.h:666
zypp::_logtoolsdetail::DumpValues::dumpValues
DumpValues< TMap > dumpValues(const TMap &map_r)
Convenience function to create DumpValues from std::map.
Definition LogTools.h:686
zypp::_logtoolsdetail::DumpValues::_map
const TMap *const _map
Definition LogTools.h:676
zypp::_logtoolsdetail::DumpValues::DumpValues
DumpValues(const TMap &map_r)
Definition LogTools.h:662
zypp::_logtoolsdetail::DumpValues::MapValue_const_iterator
typename MapKVIteratorTraits< TMap >::Value_const_iterator MapValue_const_iterator
Definition LogTools.h:659
zypp::_logtoolsdetail::DumpValues::end
MapValue_const_iterator end() const
Definition LogTools.h:672
zypp::_logtoolsdetail::DumpValues::begin
MapValue_const_iterator begin() const
Definition LogTools.h:669
zypp::_logtoolsdetail::MapEntry
std::pair wrapper for std::map output.
Definition LogTools.h:522
zypp::_logtoolsdetail::MapEntry::MapEntry
MapEntry(const TPair &pair_r)
Definition LogTools.h:524
zypp::_logtoolsdetail::MapEntry::pair
const TPair & pair() const
Definition LogTools.h:528
zypp::_logtoolsdetail::MapEntry::operator<<
std::ostream & operator<<(std::ostream &str, const MapEntry< TPair > &obj)
Stream output.
Definition LogTools.h:537
zypp::_logtoolsdetail::MapEntry::mapEntry
MapEntry< TPair > mapEntry(const TPair &pair_r)
Convenience function to create MapEntry from std::pair.
Definition LogTools.h:544
zypp::_logtoolsdetail::MapEntry< PairType >::_pair
const PairType *const _pair
Definition LogTools.h:532
zypp::str::detail::RefStore
Helper to store a reference or move rvalues inside.
Definition LogTools.h:55
zypp::str::detail::RefStore::RefStore
constexpr RefStore(RefStore &&rhs)
Definition LogTools.h:62
zypp::str::detail::RefStore::get
const T & get() const
Definition LogTools.h:67
zypp::str::detail::RefStore::operator<<
std::ostream & operator<<(std::ostream &str, const RefStore< T > &obj)
<T> Stream output
Definition LogTools.h:101
zypp::str::detail::RefStore::RefStore
constexpr RefStore(T &&val_r)
Definition LogTools.h:56
zypp::str::detail::RefStore::makeRefStore
constexpr auto makeRefStore(T &&t) -> RefStore< T >
<T> Create a RefStore for the argument.
Definition LogTools.h:96
zypp::str::detail::RefStore::_val
T _val
Definition LogTools.h:70
zypp::str::detail::RefStore::RefStore
RefStore(const RefStore &)=delete
zypp::str::detail::RefStore::get
T & get()
Definition LogTools.h:66
std
Definition ansi.h:855
std::operator<<
std::ostream & operator<<(std::ostream &str, const std::vector< Tp > &obj)
Definition LogTools.h:481
str
String related utilities and Regular expression matching.
zypp::_logtoolsdetail
Definition LogTools.h:509
zypp::detail
Definition PoolQuery.cc:1509
zypp::iomanip
Definition LogTools.h:438
zypp::solver::detail
Definition PoolImpl.h:110
zypp::solver::detail::operator<<
std::ostream & operator<<(std::ostream &str, const SolutionActionList &actionlist)
Definition SolutionAction.cc:58
zypp::str::detail
Definition LogTools.h:47
zypp::str::detail::operator<<
std::ostream & operator<<(std::ostream &str, const NoPrint &obj)
Definition LogTools.h:108
zypp::str::detail::joinSF
Ostream & joinSF(Ostream &str, Format &&fmt, Args &&... args)
Print args on ostreamlike str using JoinFormat fmt.
Definition LogTools.h:234
zypp::str::detail::_joinSF
void _joinSF(Ostream &str, const Format &fmt)
Definition LogTools.h:219
zypp::str
Provide print[f] and sprint[f] functions based on JoinFormat.
Definition PurgeKernels.h:19
zypp::str::FormatLine
constexpr auto FormatLine
' '-separated and NL-terminated!
Definition LogTools.h:206
zypp::str::sprintf
std::string sprintf(Format &&fmt, Args &&... args)
Print Format fs string.
Definition LogTools.h:255
zypp::str::sprint
std::string sprint(Args &&... args)
Print words as string.
Definition LogTools.h:266
zypp::str::printf
Ostream & printf(Ostream &str, Format &&fmt, Args &&... args)
Print Format on stream.
Definition LogTools.h:250
zypp::str::FormatList
constexpr auto FormatList
One item per line NL-terminated!
Definition LogTools.h:208
zypp::str::FormatWords
constexpr auto FormatWords
' '-separated.
Definition LogTools.h:204
zypp::str::form
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition String.cc:39
zypp::str::FormatTuple
constexpr auto FormatTuple
Tuple: (el, .., el).
Definition LogTools.h:210
zypp::str::concat
Ostream & concat(Ostream &str, Args &&... args)
Concat words on stream.
Definition LogTools.h:271
zypp::str::print
Ostream & print(Ostream &str, Args &&... args)
Print words on stream.
Definition LogTools.h:261
zypp::str::sconcat
std::string sconcat(Args &&... args)
Concat words as string.
Definition LogTools.h:276
zypp::str::FormatDumpRangeDefault
constexpr auto FormatDumpRangeDefault
dumpRange default format: {}-enclosed and indented one item per line.
Definition LogTools.h:214
zypp::str::FormatConcat
constexpr auto FormatConcat
Concatenated.
Definition LogTools.h:202
zypp::str::NoPrint
detail::NoPrint NoPrint
Definition LogTools.h:164
zypp::str::noPrint
constexpr NoPrint noPrint
Definition LogTools.h:165
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::dumpRangeLine
std::ostream & dumpRangeLine(std::ostream &str, TIterator begin, TIterator end)
Print range defined by iterators (single line style).
Definition LogTools.h:427
zypp::make_map_key_begin
MapKVIteratorTraits< TMap >::Key_const_iterator make_map_key_begin(const TMap &map_r)
Convenience to create the key iterator from container::begin().
Definition Iterator.h:226
zypp::dumpRange
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).
Definition LogTools.h:404
zypp::rangeLine
iomanip::RangeLine< TIterator > rangeLine(TIterator begin, TIterator end)
Iomanip printing dumpRangeLine style.
Definition LogTools.h:470
zypp::make_map_value_begin
MapKVIteratorTraits< TMap >::Value_const_iterator make_map_value_begin(const TMap &map_r)
Convenience to create the value iterator from container::begin().
Definition Iterator.h:236
zypp::dumpOn
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition Capability.cc:588
zypp::make_map_key_end
MapKVIteratorTraits< TMap >::Key_const_iterator make_map_key_end(const TMap &map_r)
Convenience to create the key iterator from container::end().
Definition Iterator.h:231
zypp::make_map_value_end
MapKVIteratorTraits< TMap >::Value_const_iterator make_map_value_end(const TMap &map_r)
Convenience to create the value iterator from container::end().
Definition Iterator.h:241
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition SerialNumber.cc:52
zypp::hexdumpOn
std::ostream & hexdumpOn(std::ostream &outs, const unsigned char *ptr, size_t size)
hexdump data on stream
Definition LogTools.h:768
zypp::dump
detail::Dump< Tp > dump(const Tp &obj_r)
Definition LogTools.h:757
zypp::dumpMap
DumpMap< TMap > dumpMap(const TMap &map_r)
Convenience function to create DumpMap from std::map.
Definition LogTools.h:596
zypp::MLSep
Helper to produce not-NL-terminated multi line output.
Definition LogTools.h:337
zypp::MLSep::MLSep
MLSep(char sep_r)
Definition LogTools.h:339
zypp::MLSep::_first
bool _first
Definition LogTools.h:340
zypp::MLSep::_sep
char _sep
Definition LogTools.h:341
zypp::MLSep::MLSep
MLSep()
Definition LogTools.h:338
zypp::MapKVIteratorTraits::Key_const_iterator
transform_iterator< GetPairFirst< typename MapType::value_type >, typename MapType::const_iterator > Key_const_iterator
The key iterator type.
Definition Iterator.h:217
zypp::MapKVIteratorTraits::Value_const_iterator
transform_iterator< GetPairSecond< typename MapType::value_type >, typename MapType::const_iterator > Value_const_iterator
The value iterator type.
Definition Iterator.h:221
zypp::_logtoolsdetail::DumpMap::Transformer
Definition LogTools.h:564
zypp::_logtoolsdetail::DumpMap::Transformer::operator()
MapEntryType operator()(const PairType &pair_r) const
Definition LogTools.h:565
zypp::detail::Dump
Definition LogTools.h:746
zypp::detail::Dump::_obj
const Tp & _obj
Definition LogTools.h:748
zypp::detail::Dump::Dump
Dump(const Tp &obj_r)
Definition LogTools.h:747
zypp::iomanip::RangeLine
Definition LogTools.h:445
zypp::iomanip::RangeLine::operator<<
std::ostream & operator<<(std::ostream &str, const RangeLine< TIterator > &obj)
<TIterator>
Definition LogTools.h:456
zypp::iomanip::RangeLine::_end
TIterator _end
Definition LogTools.h:451
zypp::iomanip::RangeLine::RangeLine
RangeLine(TIterator begin, TIterator end)
Definition LogTools.h:446
zypp::iomanip::RangeLine::_begin
TIterator _begin
Definition LogTools.h:450
zypp::str::Format
Convenient building of std::string with boost::format.
Definition String.h:254
zypp::str::Str
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Definition String.h:213
zypp::str::detail::JoinFormat
A basic format description to print a collection.
Definition LogTools.h:141
zypp::str::detail::JoinFormat::_pfx
RefStore< Pfx > _pfx
Definition LogTools.h:153
zypp::str::detail::JoinFormat::_extro
RefStore< Extro > _extro
Definition LogTools.h:156
zypp::str::detail::JoinFormat::_sfx
RefStore< Sfx > _sfx
Definition LogTools.h:155
zypp::str::detail::JoinFormat::_pel
RefStore< Pel > _pel
Definition LogTools.h:157
zypp::str::detail::JoinFormat::_intro
RefStore< Intro > _intro
Definition LogTools.h:152
zypp::str::detail::JoinFormat::_sep
RefStore< Sep > _sep
Definition LogTools.h:154
zypp::str::detail::JoinFormat::_sel
RefStore< Sel > _sel
Definition LogTools.h:158
zypp::str::detail::JoinFormat::JoinFormat
constexpr JoinFormat(Intro &&intro, Pfx &&pfx, Sep &&sep, Sfx &&sfx, Extro &&extro, Pel &&pel, Sel &&sel)
Definition LogTools.h:142
zypp::str::detail::NoPrint
Store nothing print nothing.
Definition LogTools.h:106
zypp::str::detail::PrintFmt::_fmt
const Format & _fmt
Definition LogTools.h:299
zypp::str::detail::PrintFmt::_str
Ostream & _str
Definition LogTools.h:298
zypp::str::detail::PrintFmt::PrintFmt
PrintFmt(Ostream &str, const Format &fmt)
Definition LogTools.h:288
zypp::str::detail::PrintFmt::operator()
Ostream & operator()(Args &&... args)
Definition LogTools.h:294
zypp::str::detail::RefStore< NoPrint >::RefStore
constexpr RefStore()
Definition LogTools.h:113
zypp::str::detail::RefStore< NoPrint & >::RefStore
constexpr RefStore()
Definition LogTools.h:121
zypp::str::detail::RefStore< T & >::get
T & get()
Definition LogTools.h:87
zypp::str::detail::RefStore< T & >::_val
T & _val
Definition LogTools.h:91
zypp::str::detail::RefStore< T & >::RefStore
constexpr RefStore(T &t)
Definition LogTools.h:77
zypp::str::detail::RefStore< T & >::RefStore
RefStore(const RefStore &)=delete
zypp::str::detail::RefStore< T & >::RefStore
constexpr RefStore(RefStore &&rhs)
Definition LogTools.h:83
zypp::str::detail::RefStore< T & >::get
const T & get() const
Definition LogTools.h:88