mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 10:31:34 +08:00
Small refactor
This commit is contained in:
parent
f31a834613
commit
643426e2b2
@ -80,9 +80,7 @@ namespace fmt {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct formatter<spdlog::details::dump_info<T>>
|
struct formatter<spdlog::details::dump_info<T>>
|
||||||
{
|
{
|
||||||
const std::size_t line_size = 100;
|
|
||||||
const char delimiter = ' ';
|
const char delimiter = ' ';
|
||||||
|
|
||||||
bool put_newlines = true;
|
bool put_newlines = true;
|
||||||
bool put_delimiters = true;
|
bool put_delimiters = true;
|
||||||
bool use_uppercase = false;
|
bool use_uppercase = false;
|
||||||
@ -148,8 +146,8 @@ struct formatter<spdlog::details::dump_info<T>>
|
|||||||
{
|
{
|
||||||
if (show_ascii && i != the_range.begin())
|
if (show_ascii && i != the_range.begin())
|
||||||
{
|
{
|
||||||
*inserter++ = ' ';
|
*inserter++ = delimiter;
|
||||||
*inserter++ = ' ';
|
*inserter++ = delimiter;
|
||||||
for (auto j = start_of_line; j < i; j++)
|
for (auto j = start_of_line; j < i; j++)
|
||||||
{
|
{
|
||||||
auto pc = static_cast<unsigned char>(*j);
|
auto pc = static_cast<unsigned char>(*j);
|
||||||
@ -174,23 +172,23 @@ struct formatter<spdlog::details::dump_info<T>>
|
|||||||
*inserter++ = hex_chars[(ch >> 4) & 0x0f];
|
*inserter++ = hex_chars[(ch >> 4) & 0x0f];
|
||||||
*inserter++ = hex_chars[ch & 0x0f];
|
*inserter++ = hex_chars[ch & 0x0f];
|
||||||
}
|
}
|
||||||
if (show_ascii)
|
if (show_ascii) // add ascii to last line
|
||||||
{
|
{
|
||||||
if (the_range.end() - the_range.begin() > size_per_line)
|
if (the_range.end() - the_range.begin() > size_per_line)
|
||||||
{
|
{
|
||||||
auto blank_num = size_per_line - (the_range.end() - start_of_line);
|
auto blank_num = size_per_line - (the_range.end() - start_of_line);
|
||||||
while (blank_num-- > 0)
|
while (blank_num-- > 0)
|
||||||
{
|
{
|
||||||
*inserter++ = ' ';
|
*inserter++ = delimiter;
|
||||||
*inserter++ = ' ';
|
*inserter++ = delimiter;
|
||||||
if (put_delimiters)
|
if (put_delimiters)
|
||||||
{
|
{
|
||||||
*inserter++ = ' ';
|
*inserter++ = delimiter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*inserter++ = ' ';
|
*inserter++ = delimiter;
|
||||||
*inserter++ = ' ';
|
*inserter++ = delimiter;
|
||||||
for (auto j = start_of_line; j != the_range.end(); j++)
|
for (auto j = start_of_line; j != the_range.end(); j++)
|
||||||
{
|
{
|
||||||
auto pc = static_cast<unsigned char>(*j);
|
auto pc = static_cast<unsigned char>(*j);
|
||||||
|
Loading…
Reference in New Issue
Block a user