GCC Middle and Back End API Reference
text_art::style Struct Reference

#include <types.h>

Collaboration diagram for text_art::style:

Data Structures

struct  color

Public Types

enum class  named_color {
  DEFAULT , BLACK , RED , GREEN ,
  YELLOW , BLUE , MAGENTA , CYAN ,
  WHITE
}
typedef unsigned char id_t

Public Member Functions

 style ()
bool operator== (const style &other) const
styleset_style_url (const char *url)

Static Public Member Functions

static void print_changes (pretty_printer *pp, const style &old_style, const style &new_style)

Data Fields

bool m_bold
bool m_underscore
bool m_blink
bool m_reverse
color m_fg_color
color m_bg_color
std::vector< cppchar_t > m_url

Static Public Attributes

static const id_t id_plain = 0

Detailed Description

A combination of attributes describing how to style a text cell.
We only support those attributes mentioned in invoke.texi:
- bold,
- underscore,
- blink,
- inverse,
- colors for foreground and background:
  - default color
  - named colors
  - 16-color mode colors (the "bright" variants)
  - 88-color mode
  - 256-color mode
plus URLs.  

Member Typedef Documentation

◆ id_t

typedef unsigned char text_art::style::id_t

Member Enumeration Documentation

◆ named_color

enum class text_art::style::named_color
strong
Enumerator
DEFAULT 
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
WHITE 

Constructor & Destructor Documentation

◆ style()

text_art::style::style ( )
inline

Member Function Documentation

◆ operator==()

bool text_art::style::operator== ( const style & other) const
inline

◆ print_changes()

void style::print_changes ( pretty_printer * pp,
const style & old_style,
const style & new_style )
static
class text_art::style.   
See https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf
GRCM - GRAPHIC RENDITION COMBINATION MODE can be "REPLACING" or
"CUMULATIVE", which affects whether we need to respecify all attributes
at each SGR, or can accumulate them.  Looks like we can't rely on the value
of this, so we have to emit a single SGR for all changes, with a "0" reset
at the front, forcing it to be effectively replacing.   

References COLOR_BLINK, COLOR_BOLD, COLOR_NONE, COLOR_UNDERSCORE, ensure_separator(), gcc_assert, gcc_unreachable, pretty_printer::get_url_format(), m_bg_color, m_blink, m_bold, m_fg_color, m_underscore, m_url, pp_end_url(), pp_show_color(), pp_string(), pp_unicode_character(), text_art::style::color::print_sgr(), SGR_END, SGR_START, style(), pretty_printer::supports_urls_p(), URL_FORMAT_BEL, URL_FORMAT_NONE, and URL_FORMAT_ST.

Referenced by text_art::style_manager::print_any_style_changes().

◆ set_style_url()

style & style::set_style_url ( const char * url)
class text_art::style.   

References m_url.

Referenced by text_art::styled_string::set_url().

Field Documentation

◆ id_plain

const id_t text_art::style::id_plain = 0
static

◆ m_bg_color

color text_art::style::m_bg_color

Referenced by operator==(), print_changes(), and style().

◆ m_blink

bool text_art::style::m_blink

Referenced by operator==(), print_changes(), and style().

◆ m_bold

bool text_art::style::m_bold

Referenced by operator==(), print_changes(), and style().

◆ m_fg_color

color text_art::style::m_fg_color

Referenced by operator==(), print_changes(), and style().

◆ m_reverse

bool text_art::style::m_reverse

Referenced by operator==(), and style().

◆ m_underscore

bool text_art::style::m_underscore

Referenced by operator==(), print_changes(), and style().

◆ m_url

std::vector<cppchar_t> text_art::style::m_url

The documentation for this struct was generated from the following files: