Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_Assert

This is ClanLib's assertion class.
Contained in: global
Derived from: none
Derived by: none
Group: Core (System)

#include <ClanLib/core.h>

### public function member index:
### Operations:
``static` `void`` | `enable_channels` | `(`int` `channel_mask`)`;
``static` `void`` | `die` | `(`bool` `a`, `const` `char`* `file`, `int` `line`, `const` `char`* `func`, `const` `char`* `assert_str`)`;
``static` `void`` | `info` | `(`int` `channel`, `const` `char`* `text`, `const` `char`* `file`, `int` `line`)`;
``static` `void`` | `add_listener` | `(`CL_AssertListener`* `listener`)`;
``static` `void`` | `remove_listener` | `(`CL_AssertListener`* `listener`)`;

## Description:

It is needed because some implementations requires to be notified before ClanLib is exited. For instance the svgalib implementation need release the keyboard lock.

## Function Member Descriptions:

CL_Assert::add_listener - Adds an assertion listener which will be called in case of an assertion.
``static` `void`` `add_listener``(`CL_AssertListener`* `listener`)`;

> listener - The listener to be added.

CL_Assert::die - Produces an assert.
This function shouldn't be called directly - instead, use the cl_assert macro. For example: cl_assert(should_not_be_zero != 0)
``static` `void`` `die``(`bool` `a`, `const` `char`* `file`, `int` `line`, `const` `char`* `func`, `const` `char`* `assert_str`)`;

> a - Asserts if false.
> file - Name of the file where the assert occurred.
> line - Line in the file where the assert occurred.
> func - Function in which the assert occurred.
> assert_str - String that describe the assertion check.

CL_Assert::enable_channels - Enabled the error channels specified by the 'channel_mask'.
This can be used to get extra debugging information from limited parts of ClanLib.
``static` `void`` `enable_channels``(`int` `channel_mask`)`;

> channel_mask - Channels to be enabled.

CL_Assert::info - Writes an info statements on the specified channel.
Don't callthis one directly, instead use the cl_info macro. For example: cl_info(info_network, "MyClass::my_funx - Hello World.");
``static` `void`` `info``(`int` `channel`, `const` `char`* `text`, `const` `char`* `file`, `int` `line`)`;

> channel - Channel to use. (Use the ErrorChannels enum's)
> text - text to print.
> file - Name of the file where this was printed from.
> line - Line in the file where this was printed from.

CL_Assert::remove_listener - Removes an assertion listener.
``static` `void`` `remove_listener``(`CL_AssertListener`* `listener`)`;

> listener - The listener to be removed.

## Variable Member Descriptions: