clutchlog 0.17
clutchlog::fmt::color_256 Struct Reference

Abstract base class for 256 colors objects (8-bits ANSI). More...

#include <clutchlog.h>

+ Inheritance diagram for clutchlog::fmt::color_256:
+ Collaboration diagram for clutchlog::fmt::color_256:

Detailed Description

Abstract base class for 256 colors objects (8-bits ANSI).

Definition at line 523 of file clutchlog.h.

Public Member Functions

 color_256 (ground t)
 Constructor. More...
 
 color_256 (ground t, const short i)
 Constructor. More...
 
bool is_set () const
 Returns true if the underying representation encodes an existing color. More...
 
std::ostream & print_on (std::ostream &os) const
 Print the color index on the given stream. More...
 
- Public Member Functions inherited from clutchlog::fmt::color
 color (ansi a, ground g)
 Constructor. More...
 
virtual bool is_set () const =0
 Should return true if the underying representation encodes an existing color. More...
 
virtual std::ostream & print_on (std::ostream &os) const =0
 Should print the underlying representation on the given stream. More...
 

Public Attributes

short index
 The encoded color index in 4-bits ANSI. More...
 
- Public Attributes inherited from clutchlog::fmt::color
ansi mode
 
enum clutchlog::fmt::color::ground type
 Type of color (foreground or background).
 

Additional Inherited Members

- Public Types inherited from clutchlog::fmt::color
enum class  ground { fore = 38 , back = 48 }
 Codes for representing foreground or background. More...
 

Constructor & Destructor Documentation

◆ color_256() [1/2]

clutchlog::fmt::color_256::color_256 ( ground  t)
inline

Constructor.

Parameters
tForeground or background tag.

Definition at line 532 of file clutchlog.h.

◆ color_256() [2/2]

clutchlog::fmt::color_256::color_256 ( ground  t,
const short  i 
)
inline

Constructor.

Parameters
tForeground or background tag.
iColor index (within [-1,255], -1 being "no color").

Definition at line 539 of file clutchlog.h.

Member Function Documentation

◆ is_set()

bool clutchlog::fmt::color_256::is_set ( ) const
inlinevirtual

Returns true if the underying representation encodes an existing color.

Implements clutchlog::fmt::color.

Definition at line 542 of file clutchlog.h.

References index.

◆ print_on()

std::ostream & clutchlog::fmt::color_256::print_on ( std::ostream &  os) const
inlinevirtual

Print the color index on the given stream.

Implements clutchlog::fmt::color.

Definition at line 545 of file clutchlog.h.

References index.

Member Data Documentation

◆ index

short clutchlog::fmt::color_256::index

The encoded color index in 4-bits ANSI.

"No color" is encoded as -1.

Definition at line 527 of file clutchlog.h.

Referenced by is_set(), and print_on().


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