12#ifndef ZYPP_BASE_LOGTOOLS_H
13#define ZYPP_BASE_LOGTOOLS_H
60 {
if (
obj._first )
obj._first =
false;
else str <<
obj._sep;
return str; }
119 template<
class TIterator>
121 TIterator begin, TIterator end,
122 const std::string &
intro =
"{",
123 const std::string &
pfx =
"\n ",
124 const std::string &
sep =
"\n ",
125 const std::string &
sfx =
"\n",
126 const std::string &
extro =
"}" )
132 for ( ++begin; begin != end; ++begin )
142 template<
class TIterator>
144 TIterator begin, TIterator end )
145 {
return dumpRange(
str, begin, end,
"(",
"",
", ",
"",
")" ); }
147 template<
class TContainer>
159 template<
class TIterator>
171 template<
class TIterator>
185 template<
class TIterator>
189 template<
class TContainer>
197 template<
class Tp,
class TCmp,
class TAlloc>
218 namespace _logtoolsdetail
230 template<
class TPair>
246 template<
class TPair>
249 return str <<
'[' <<
obj.pair().first <<
"] = " <<
obj.pair().second;
253 template<
class TPair>
276 {
return mapEntry(
pair_r ); }
404 using _logtoolsdetail::mapEntry;
405 using _logtoolsdetail::dumpMap;
406 using _logtoolsdetail::dumpKeys;
407 using _logtoolsdetail::dumpValues;
409 template<
class TKey,
class Tp>
411 {
return str << dumpMap(
obj ); }
413 template<
class TKey,
class Tp>
415 {
return str << dumpMap(
obj ); }
417 template<
class TKey,
class Tp>
419 {
return str << dumpMap(
obj ); }
432 std::string
ret(
"[" );
433 ret += (
obj.good() ?
'g' :
'_' );
434 ret += (
obj.eof() ?
'e' :
'_' );
435 ret += (
obj.fail() ?
'F' :
'_' );
436 ret += (
obj.bad() ?
'B' :
'_' );
472 inline std::ostream &
hexdumpOn( std::ostream &
outs,
const unsigned char *
ptr,
size_t size )
475 unsigned width = 0x10;
476 outs <<
str::form(
"hexdump %10.10ld bytes (0x%8.8lx):\n", (
long)size, (
long)size );
478 for (
i = 0;
i < size;
i +=
width ) {
488 for (
c = 0; (
c <
width) && (
i+
c < size); ++
c ) {
504 inline std::ostream &
operator<<( std::ostream &
str,
const std::type_info &info )
510 std::unique_ptr<char,
void(*)(
void*)>
res {
511 abi::__cxa_demangle(info.name(),
NULL,
NULL, &status),
514 return str << std::string((status==0) ?
res.get() : info.name());
516 return str << info.name();
520#ifdef __cpp_lib_optional
522 inline std::ostream &
operator<<( std::ostream &
str,
const std::optional<Tp> & obj )
525 str <<
"opt(" << *obj <<
")";
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
std::pair wrapper for std::map output.
MapEntry(const TPair &pair_r)
const TPair & pair() const
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 & operator<<(std::ostream &str, const SolutionActionList &actionlist)
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & dumpRangeLine(std::ostream &str, TIterator begin, TIterator end)
Print range defined by iterators (single line style).
MapKVIteratorTraits< TMap >::Key_const_iterator make_map_key_begin(const TMap &map_r)
Convenience to create the key iterator from container::begin()
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).
iomanip::RangeLine< TIterator > rangeLine(TIterator begin, TIterator end)
Iomanip printing dumpRangeLine style.
MapKVIteratorTraits< TMap >::Value_const_iterator make_map_value_begin(const TMap &map_r)
Convenience to create the value iterator from container::begin()
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
MapKVIteratorTraits< TMap >::Key_const_iterator make_map_key_end(const TMap &map_r)
Convenience to create the key iterator from container::end()
MapKVIteratorTraits< TMap >::Value_const_iterator make_map_value_end(const TMap &map_r)
Convenience to create the value iterator from container::end()
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
std::ostream & hexdumpOn(std::ostream &outs, const unsigned char *ptr, size_t size)
hexdump data on stream
detail::Dump< Tp > dump(const Tp &obj_r)
Helper to produce not-NL-terminated multi line output.
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)