LibCapy - strDecorator

Class to embellish strings with ANSI escape code.

Macros:

Enumerations:

Enumeration of available options to decorate a string

Typedefs:

None.

Struct CapyStrDecorator :

Struct CapyStrDecorator's properties:

Foreground and background color (default: white and black)

Flags to memorise the active options

Struct CapyStrDecorator's methods:

Destructor

Activate an option

Input argument(s):

option: the option to activate

Deactivate an option

Input argument(s):

option: the option to deactivate

Get the status of an option

Input argument(s):

option: the option to get the status of
Ouput: Returns true if the option is active, else false

Print a decorated string on a stream

Input argument(s):

stream: the stream on which to print
fmt: the format string to decorate and print
...: the arguments of the format string

Output and side effect(s):

Return the number of characters printed (excluding the terminating null byte). If an output error is encountered, return a negative value.

Set the foreground color used by the option capyStrDecoratorFgColor

Input argument(s):

color: the RGB color of the foreground

Set the background color used by the option capyStrDecoratorBgColor

Input argument(s):

color: the RGB color of the foreground

Functions:

Create a CapyStrDecorator

Output and side effect(s):

Return a CapyStrDecorator initialised with no active options

Allocate memory for a new CapyStrDecorator and create it

Output and side effect(s):

Return a CapyStrDecorator initialised with no active options

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a CapyStrDecorator* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyStrDecorator to free

2021-11-11
in LibCapy,
50 views
Copyright 2021-2023 Baillehache Pascal