ClickHouse/src/Common/UnicodeBar.h

20 lines
554 B
C++
Raw Normal View History

#pragma once
#include <string>
2021-10-02 07:13:14 +00:00
#include <base/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
{
2021-01-02 20:40:15 +00:00
double getWidth(double x, double min, double max, double max_width);
2020-09-19 19:15:16 +00:00
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.
void render(double width, char * dst, const char * dst_end);
2020-09-19 19:15:16 +00:00
std::string render(double width);
}