GCC Middle and Back End API Reference
text_art::canvas Class Reference

#include <canvas.h>

Collaboration diagram for text_art::canvas:

Public Types

typedef styled_unichar cell_t
typedef size< class canvassize_t
typedef coord< class canvascoord_t
typedef range< class canvasrange_t
typedef rect< class canvasrect_t

Public Member Functions

 canvas (size_t size, const style_manager &style_mgr)
size_t get_size () const
void paint (coord_t coord, cell_t c)
void paint_text (coord_t coord, const styled_string &text)
void fill (rect_t rect, cell_t c)
void debug_fill ()
void print_to_pp (pretty_printer *pp, const char *per_line_prefix=NULL) const
void debug (bool styled) const
const cell_tget (coord_t coord) const

Private Member Functions

int get_final_x_in_row (int y) const

Private Attributes

array2< cell_t, size_t, coord_tm_cells
const style_managerm_style_mgr

Detailed Description

A 2 dimensional grid of text cells (a "canvas"), which
can be written to ("painted") via random access, and then
written out to a pretty_printer once the picture is complete.

Each text cell can be styled independently (colorization,
URLs, etc).   

Member Typedef Documentation

◆ cell_t

◆ coord_t

◆ range_t

◆ rect_t

◆ size_t

Constructor & Destructor Documentation

◆ canvas()

canvas::canvas ( size_t size,
const style_manager & style_mgr )

References m_cells, and m_style_mgr.

Member Function Documentation

◆ debug()

◆ debug_fill()

void canvas::debug_fill ( )

References fill(), and get_size().

◆ fill()

◆ get()

const cell_t & text_art::canvas::get ( coord_t coord) const
inline

References m_cells.

◆ get_final_x_in_row()

int canvas::get_final_x_in_row ( int y) const
private
Find right-most non-default cell in this row,
or -1 if all are default.   

References text_art::styled_unichar::get_code(), text_art::styled_unichar::get_style_id(), text_art::style::id_plain, m_cells, and y.

Referenced by print_to_pp().

◆ get_size()

size_t text_art::canvas::get_size ( ) const
inline

References m_cells.

Referenced by debug_fill().

◆ paint()

◆ paint_text()

◆ print_to_pp()

Field Documentation

◆ m_cells

array2<cell_t, size_t, coord_t> text_art::canvas::m_cells
private

◆ m_style_mgr

const style_manager& text_art::canvas::m_style_mgr
private

Referenced by canvas(), and print_to_pp().


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