1 #include "../include/style.hpp"
32 throw exception(
"invalid argument: nm (=%p)", nm);
48 m_fgcolor(src.m_fgcolor),
49 m_bgcolor(src.m_bgcolor),
50 m_attributes(src.m_attributes)
76 return new style(*
this);
137 throw exception(
"invalid argument: nm (=%p)", nm);
139 u32 len = strlen(nm);
140 if (len > strlen(
m_name)) {
290 return const_cast<style&
> (*this);
309 return const_cast<style&
> (*this);
virtual style & set_attr_enabled(attrset_t, bool)
Enable/disable a set of text formatting attributes.
virtual string & append(const string &)
Append a string.
virtual style * clone() const
Object virtual copy constructor.
virtual style & set_fgcolor(color_t)
Set the foreground color.
virtual style & to_string(string &) const
Set a string with all the style escape sequences.
char i8
8-bit signed integer
virtual style & apply(string &) const
Apply the style to some text.
A set of formatting attributes for VT100 (and compatible) terminals.
virtual const i8 * name() const
Get the style name.
virtual string & insert(u32, const string &)
Insert a string at a specified position.
u8 color_t
VT100 terminal color.
virtual style & set_name(const i8 *)
Set the style name.
virtual style & operator=(const style &)
Assignment operator.
virtual string & clear()
Clear contents.
virtual attrset_t attributes() const
Get the text formatting attributes.
virtual color_t fgcolor() const
Get the foreground color.
virtual color_t bgcolor() const
Get the background color.
attrset_t m_attributes
Text formatting attribute bitmask.
color_t m_bgcolor
Background color.
virtual style & set_bgcolor(color_t)
Set the background color.
unsigned int u32
32-bit unsigned integer
u16 attrset_t
VT100 attribute bitmask.
virtual bool is_attr_enabled(attrset_t) const
Check if a set of text formatting attributes is enabled.
This class is a throwable with a textual description of an error.
style(const i8 *, color_t=WHITE, color_t=CLEAR, attrset_t=0)
Object constructor.
color_t m_fgcolor
Foreground (text) color.
virtual style & set_attributes(attrset_t)
Set the text formatting attributes.
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
virtual ~style()
Object destructor.