Pretty Diagnostics
Create your own pretty diagnostics
Loading...
Searching...
No Matches
utils.hpp File Reference
#include <iomanip>
#include <string>
#include <string_view>
Include dependency graph for utils.hpp:

Go to the source code of this file.

Data Structures

struct  pretty_diagnostics::VisualChar
 A structure to contian the return values from get_visual_char More...
 

Namespaces

namespace  pretty_diagnostics
 

Functions

std::string pretty_diagnostics::escape_string (std::string_view input)
 Escapes control characters and quotes in a string for safe display. For example, converts newlines to "\\n" and tabs to "\\t". More...
 
template<typename T >
pretty_diagnostics::max (T first)
 Returns the maximum of a single value. More...
 
template<typename T , typename... Ts>
pretty_diagnostics::max (T first, Ts... rest)
 Returns the maximum of multiple values. More...
 
template<typename T >
pretty_diagnostics::min (T first)
 Returns the minimum of a single value. More...
 
template<typename T , typename... Ts>
pretty_diagnostics::min (T first, Ts... rest)
 Returns the minimum of multiple values. More...
 
size_t pretty_diagnostics::get_stream_width (const std::ostream &stream)
 
VisualChar pretty_diagnostics::get_visual_char (std::string_view input, size_t index)
 Returns the visual width and byte count of a given UTF8 character. More...
 
size_t pretty_diagnostics::visual_width (std::string_view input)
 Calculates the visual display width of a UTF-8 string (for terminal display) More...
 
size_t pretty_diagnostics::to_visual_column (std::string_view line, size_t byte_column)
 Returns the visual column of a specific byte column in a UTF-8 string. More...
 
size_t pretty_diagnostics::from_visual_column (std::string_view line, size_t visual_column)
 Maps a visual column to a UTF-8 byte index in a line. More...