@ -39,11 +39,12 @@ public:
, size_per_line_ ( size_per_line )
, size_per_line_ ( size_per_line )
{ }
{ }
It begin ( ) const
// do not use begin() and end() to avoid collision with fmt/ranges
It getBegin ( ) const
{
{
return begin_ ;
return begin_ ;
}
}
It end( ) const
It g etE nd( ) const
{
{
return end_ ;
return end_ ;
}
}
@ -144,14 +145,14 @@ struct formatter<spdlog::details::dump_info<T>, char>
# endif
# endif
int size_per_line = static_cast < int > ( the_range . size_per_line ( ) ) ;
int size_per_line = static_cast < int > ( the_range . size_per_line ( ) ) ;
auto start_of_line = the_range . b egin( ) ;
auto start_of_line = the_range . getB egin( ) ;
for ( auto i = the_range . b egin( ) ; i ! = the_range . end( ) ; i + + )
for ( auto i = the_range . getB egin( ) ; i ! = the_range . g etE nd( ) ; i + + )
{
{
auto ch = static_cast < unsigned char > ( * i ) ;
auto ch = static_cast < unsigned char > ( * i ) ;
if ( put_newlines & & ( i = = the_range . b egin( ) | | i - start_of_line > = size_per_line ) )
if ( put_newlines & & ( i = = the_range . getB egin( ) | | i - start_of_line > = size_per_line ) )
{
{
if ( show_ascii & & i ! = the_range . b egin( ) )
if ( show_ascii & & i ! = the_range . getB egin( ) )
{
{
* inserter + + = delimiter ;
* inserter + + = delimiter ;
* inserter + + = delimiter ;
* inserter + + = delimiter ;
@ -162,7 +163,7 @@ struct formatter<spdlog::details::dump_info<T>, char>
}
}
}
}
put_newline ( inserter , static_cast < size_t > ( i - the_range . b egin( ) ) ) ;
put_newline ( inserter , static_cast < size_t > ( i - the_range . getB egin( ) ) ) ;
// put first byte without delimiter in front of it
// put first byte without delimiter in front of it
* inserter + + = hex_chars [ ( ch > > 4 ) & 0x0f ] ;
* inserter + + = hex_chars [ ( ch > > 4 ) & 0x0f ] ;
@ -181,9 +182,9 @@ struct formatter<spdlog::details::dump_info<T>, char>
}
}
if ( show_ascii ) // add ascii to last line
if ( show_ascii ) // add ascii to last line
{
{
if ( the_range . end( ) - the_range . b egin( ) > size_per_line )
if ( the_range . g etE nd( ) - the_range . getB egin( ) > size_per_line )
{
{
auto blank_num = size_per_line - ( the_range . end( ) - start_of_line ) ;
auto blank_num = size_per_line - ( the_range . g etE nd( ) - start_of_line ) ;
while ( blank_num - - > 0 )
while ( blank_num - - > 0 )
{
{
* inserter + + = delimiter ;
* inserter + + = delimiter ;
@ -196,7 +197,7 @@ struct formatter<spdlog::details::dump_info<T>, char>
}
}
* inserter + + = delimiter ;
* inserter + + = delimiter ;
* inserter + + = delimiter ;
* inserter + + = delimiter ;
for ( auto j = start_of_line ; j ! = the_range . end( ) ; j + + )
for ( auto j = start_of_line ; j ! = the_range . g etE nd( ) ; j + + )
{
{
auto pc = static_cast < unsigned char > ( * j ) ;
auto pc = static_cast < unsigned char > ( * j ) ;
* inserter + + = std : : isprint ( pc ) ? static_cast < char > ( * j ) : ' . ' ;
* inserter + + = std : : isprint ( pc ) ? static_cast < char > ( * j ) : ' . ' ;