mirror of
https://github.com/vtil-project/VTIL-Core
synced 2026-08-17 08:23:03 -04:00
Added formatted throw, and changed table overflow style.
This commit is contained in:
parent
d5fd957f87
commit
87a9a7529f
3 changed files with 22 additions and 3 deletions
|
|
@ -47,6 +47,19 @@ namespace vtil
|
|||
else logger::error( "Assertion failure, %s", string );
|
||||
}
|
||||
}
|
||||
|
||||
// A helper to throw formatted strings.
|
||||
//
|
||||
template<typename... params>
|
||||
__forceinline static void fthrow [[noreturn]] ( const char* fmt, params&&... ps )
|
||||
{
|
||||
// Format error message.
|
||||
//
|
||||
throw std::runtime_error( format::str(
|
||||
fmt,
|
||||
format::fix_parameter<params>( std::forward<params>( ps ) )...
|
||||
) );
|
||||
}
|
||||
};
|
||||
|
||||
// Declare assert macro.
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ namespace vtil::format
|
|||
|
||||
// Explicit percentage formatting.
|
||||
//
|
||||
template<FloatingPoint T = float>
|
||||
template<FloatingPoint T = double>
|
||||
struct percentage
|
||||
{
|
||||
T value = 0.0f;
|
||||
|
|
|
|||
|
|
@ -182,8 +182,14 @@ namespace vtil::format
|
|||
if ( table_overflow )
|
||||
{
|
||||
begl();
|
||||
write( config.vertical_delimiter, ' ', '.', '.', '.' );
|
||||
fill( ' ', line_length - 7 );
|
||||
write( config.vertical_delimiter, ' ' );
|
||||
|
||||
std::string indicator = format::str( "... (%d more)", entry_count - string_entries.size() );
|
||||
if ( indicator.size() > ( line_length - 4 ) )
|
||||
indicator.resize( line_length - 4 );
|
||||
write_n( indicator );
|
||||
fill( ' ', line_length - 4 - indicator.size() );
|
||||
|
||||
write( config.vertical_delimiter, ' ' );
|
||||
rendl();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue