StuBS
TextMode::Attribute Union Reference

Structure of a character attribute consists of 4 bit fore- and 3 bit background color, and a single blink bit. More...

#include <machine/textmode.h>

Classes

struct  [struct].__unnamed0__

Public Member Functions

 Attribute (Color foreground=LIGHT_GREY, Color background=BLACK, bool blink=false)
 Attribute constructor (with default values).

Public Attributes

struct  
uint8_t value
 combined value

Detailed Description

Structure of a character attribute consists of 4 bit fore- and 3 bit background color, and a single blink bit.

Bit fields can notably simplify the access and code readability.

Note
Type punning is indeed undefined behavior in C++. However, gcc explicitly allows this construct as a language extension. Some compilers (other than gcc might allow this feature only by disabling strict aliasing (-fno-strict-aliasing). In StuBS we use this feature extensively due to the improved code readability.

Constructor & Destructor Documentation

◆ Attribute()

TextMode::Attribute::Attribute ( Color foreground = LIGHT_GREY,
Color background = BLACK,
bool blink = false )
inlineexplicit

Attribute constructor (with default values).

Todo
Complete constructor
Parameters
foregroundForeground color (Default: LIGHT_GREY)
backgroundBackground color (Default: BLACK)
blinkBlink if true (default: no blinking)

Member Data Documentation

◆ @176371033372260241142110053060245046103047131106

◆ value

uint8_t TextMode::Attribute::value

combined value


The documentation for this union was generated from the following file: