Leosac  0.8.0
Open Source Access Control
enforce.hpp File Reference
#include "exception/InvalidArgument.hpp"
#include "exception/leosacexception.hpp"
#include <utility>
+ Include dependency graph for enforce.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 details
 

Macros

#define ENFORCE(cond, ex_type, ...)   ::details::enforce<ex_type>((cond), __VA_ARGS__)
 Enforce that a condition is true, otherwise throw an exception of type ex with parameters. More...
 
#define LEOSAC_ENFORCE(cond, ...)   ::details::enforce<LEOSACException>((cond), __VA_ARGS__)
 Similar to enforce, except that it will throw a LEOSACException. More...
 
#define LEOSAC_ENFORCE_ARGUMENT(cond, var, msg)   ::details::enforce<InvalidArgument>((cond), #var, var, msg, #cond)
 A macro to perform argument checking that results in an exception being thrown on failure. More...
 

Functions

template<typename E , typename Assessable , typename... Args>
auto details::enforce (Assessable &&value, Args &&... args)
 

Macro Definition Documentation

◆ ENFORCE

#define ENFORCE (   cond,
  ex_type,
  ... 
)    ::details::enforce<ex_type>((cond), __VA_ARGS__)

Enforce that a condition is true, otherwise throw an exception of type ex with parameters.

Definition at line 42 of file enforce.hpp.

◆ LEOSAC_ENFORCE

#define LEOSAC_ENFORCE (   cond,
  ... 
)    ::details::enforce<LEOSACException>((cond), __VA_ARGS__)

Similar to enforce, except that it will throw a LEOSACException.

Definition at line 47 of file enforce.hpp.

◆ LEOSAC_ENFORCE_ARGUMENT

#define LEOSAC_ENFORCE_ARGUMENT (   cond,
  var,
  msg 
)    ::details::enforce<InvalidArgument>((cond), #var, var, msg, #cond)

A macro to perform argument checking that results in an exception being thrown on failure.

Parameters
condThe condition to evaluates
varThe variable being checked.
msgAn optional message describing the expectation in a human friendly language.

Definition at line 59 of file enforce.hpp.