assert.hpp File Reference

Some assert macros to strengthen you code. More...

`#include <iostream>`
`#include <sstream>`
`#include <cstdlib>`

Go to the source code of this file.

## Namespaces

namespace | claw
| This is the main namespace.

## Macros

#define | CLAW_ASSERT(b, s)
| Print a message on std::cerr and stop the program if a condition is not true.
#define | CLAW_FAIL(s)
| Print a message on std::cerr and stop the program.
#define | CLAW_PRECOND(b)
| Abort the program if a precondition is not true.
#define | CLAW_POSTCOND(b)
| Abort the program if a postcondition is not true.

## Functions

void | claw::debug_assert (const char *file, const char *func, unsigned int line, bool b, const std::string &s)
| The method used by CLAW_ASSERT macro. Souldn't be used elsewhere.

## Detailed Description

Some assert macros to strengthen you code.

Author
  Julien Jorge

Definition in file assert.hpp.

## Macro Definition Documentation

## CLAW_ASSERT

#define CLAW_ASSERT | ( |  | b,
|  |  | s )

Value:
claw::debug_assert( __FILE__, __FUNCTION__, __LINE__, (b), (s) )
claw::debug_assert
void debug_assert(const char *file, const char *func, unsigned int line, bool b, const std::string &s)
The method used by CLAW_ASSERT macro. Souldn't be used elsewhere.
Definition assert.hpp:73

Print a message on std::cerr and stop the program if a condition is not true.

Parameters

  b | Condition to verify.
  s | An error message.

Definition at line 90 of file assert.hpp.

Referenced by claw::arguments::add_argument(), claw::arguments::get_integer(), claw::arguments::get_real(), and claw::arguments::get_string().

## CLAW_FAIL

#define CLAW_FAIL | ( |  | s | ) |

Value:
claw::debug_assert( __FILE__, __FUNCTION__, __LINE__, false, (s) )

Print a message on std::cerr and stop the program.

Parameters

  s | An error message.

Definition at line 94 of file assert.hpp.

## CLAW_POSTCOND

#define CLAW_POSTCOND | ( |  | b | ) |

Value:
CLAW_ASSERT( b, "postcondition failed: " #b )
CLAW_ASSERT
#define CLAW_ASSERT(b, s)
Print a message on std::cerr and stop the program if a condition is not true.
Definition assert.hpp:90

Abort the program if a postcondition is not true.

Parameters

  b | Condition to verify.

Definition at line 101 of file assert.hpp.

Referenced by claw::graphic::image::base_iterator< Image, Pixel >::base_iterator(), and claw::tween::base_tweener::update().

## CLAW_PRECOND

#define CLAW_PRECOND | ( |  | b | ) |

Value:
CLAW_ASSERT( b, "precondition failed: " #b )

Abort the program if a precondition is not true.

Parameters

  b | Condition to verify.

Definition at line 98 of file assert.hpp.

Referenced by claw__graphic__jpeg__destination_manager__empty_output_buffer(), claw__graphic__jpeg__destination_manager__term_destination(), claw__graphic__jpeg__source_manager__fill_input_buffer(), claw__graphic__jpeg__source_manager__skip_input_data(), claw::socket_traits_unix::connect(), claw::socket_traits_win32::connect(), claw::arguments_table::get_integer(), claw::arguments_table::get_real(), claw::arguments_table::get_string(), claw::socket_traits_unix::listen(), claw::socket_traits_win32::listen(), claw::graphic::bitmap::reader::load(), claw::graphic::jpeg::reader::load(), claw::graphic::pcx::reader::load(), claw::graphic::png::reader::load(), claw::graphic::targa::reader::load(), claw::graphic::xbm::reader::load(), claw::graphic::image::base_iterator< Image, Pixel >::operator*(), claw::graphic::image::base_iterator< Image, Pixel >::operator++(), claw::graphic::image::base_iterator< Image, Pixel >::operator+=(), claw::graphic::image::base_iterator< Image, Pixel >::operator-(), claw::graphic::image::base_iterator< Image, Pixel >::operator--(), claw::graphic::image::base_iterator< Image, Pixel >::operator-=(), claw::graphic::image::base_iterator< Image, Pixel >::operator->(), claw::graphic::jpeg::writer::save(), claw::graphic::png::writer::save(), claw::graphic::xbm::writer::save(), claw::socket_traits_unix::select_read(), claw::socket_traits_win32::select_read(), claw::graphic::jpeg::reader::source_manager::skip_input_data(), claw::graphic::png::reader::source_manager::source_manager(), claw::graphic::png::writer::target_manager::target_manager(), and claw::tween::base_tweener::update().