ClickHouse/src/Common/UnicodeBar.h

20 lines
531 B
C++
Raw Normal View History

#pragma once
#include <string>
2020-09-15 09:55:57 +00:00
#include <common/types.h>
#define UNICODE_BAR_CHAR_SIZE (strlen("█"))
2017-05-07 20:25:26 +00:00
/** Allows you to draw a unicode-art bar whose width is displayed with a resolution of 1/8 character.
*/
namespace UnicodeBar
{
2020-09-19 19:15:16 +00:00
double getWidth(Int64 x, Int64 min, Int64 max, double max_width);
size_t getWidthInBytes(double width);
2017-05-07 20:25:26 +00:00
/// In `dst` there must be a space for barWidthInBytes(width) characters and a trailing zero.
2020-09-19 19:15:16 +00:00
void render(double width, char * dst);
std::string render(double width);
}