GL Studio Safety Critical Embedded C++ Runtime Library
GlsTextGrid::CharAttributeGrid Class Reference

#include <gls_text_grid.h>

Public Member Functions

 CharAttributeGrid (const GlsUInt32 columns, const GlsUInt32 rows, const GlsText::CharAttribute &initialAttributes)
 
virtual ~CharAttributeGrid ()
 
const GlsText::CharAttributeGetCharAttribute (const GlsUInt32 column, const GlsUInt32 row) const
 
void SetCharAttribute (const GlsUInt32 column, const GlsUInt32 row, const GlsText::CharAttribute &charAttribute)
 

Protected Attributes

const GlsUInt32 _columns
 
const GlsUInt32 _rows
 
GlsText::CharAttribute *const _charAttributes
 

Detailed Description

Helper class encapsulates a grid of GlsText::CharAttribute 's

Invariant
_columns > 0, _rows > 0, GLS_NULL != _charAttributes, each element in the _charAttributes array is valid

Constructor & Destructor Documentation

GlsTextGrid::CharAttributeGrid::CharAttributeGrid ( const GlsUInt32  columns,
const GlsUInt32  rows,
const GlsText::CharAttribute initialAttributes 
)

Constructor - create an instance

Parameters
columnsnumber of columns in grid ( > 0 )
rowsnumber of rows in grid ( > 0 )
initialAttributesinitial value of each attribute in the grid
Precondition
columns > 0, rows > 0, initialAttributes.IsValid()
Postcondition
instance created
virtual GlsTextGrid::CharAttributeGrid::~CharAttributeGrid ( )
virtual

Destructor - shall never be called

Precondition
none
Postcondition
none

Member Function Documentation

const GlsText::CharAttribute& GlsTextGrid::CharAttributeGrid::GetCharAttribute ( const GlsUInt32  column,
const GlsUInt32  row 
) const

get a const ref to the attribute at the given column and row

Parameters
columncolumn in question ( column < _columns )
rowrow in question ( row < _rows )
Returns
ref to character attribute at given column and row
Precondition
column < _columns, row < _rows
Postcondition
none
void GlsTextGrid::CharAttributeGrid::SetCharAttribute ( const GlsUInt32  column,
const GlsUInt32  row,
const GlsText::CharAttribute charAttribute 
)

set the attribute at the given column and row

Parameters
columncolumn in question ( column < _columns )
rowrow in question ( row < _rows )
charAttributenew value for attribue
Precondition
column < _columns, row < _rows
Postcondition
attribute at column, row is set to new value

Member Data Documentation

GlsText::CharAttribute* const GlsTextGrid::CharAttributeGrid::_charAttributes
protected

grid array of attributes (_columns*_rows) in row major

const GlsUInt32 GlsTextGrid::CharAttributeGrid::_columns
protected

number of columns in grid ( > 0 )

const GlsUInt32 GlsTextGrid::CharAttributeGrid::_rows
protected

number of rows in grid ( > 0 )