OSAPI  0.29
Open System API
status_macros.h File Reference

File providing public definitions for the status module. More...

#include <stdbool.h>
#include "error/error_types.h"
Include dependency graph for status_macros.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define status_reset(x)   ( (x)->code = 0 )
 Resets the status structure (to success)
 
#define status_set(m, t, f, e, r)   status_instance_set( m, t, f, e, r )
 See status_instance_set function.
 
#define status_setString(m, t, f, s, r)   status_instance_setString( m, t, f, s, r )
 See status_instance_setString function.
 
#define status_success(x)   ( x.code == 0 )
 Returns true if the operation that returned x was successful. More...
 
#define status_failure(x)   ( x.code != 0 )
 Returns true if the operation that returned x failed. More...
 
#define status_error(s, e)   ( s.code == e )
 Match a given error. More...
 
#define status_true( x)   ( status_failure( x ) ? 0 : 1 )
 Check if the status result of the operation is true. More...
 
#define status_false(x)   ( status_success( x ) ? 1 : 0 )
 Check if the status result of the operation is true. More...
 
#define status_result(x)   ( x.code == 0 ? true : false )
 Get the operation status result: success==true/failure==false.
 
#define status_unsupported(s)   ( s.code == OSAPI_ERROR_SUPPORT )
 Find if a module or facility is supported. More...
 

Detailed Description

File providing public definitions for the status module.

Macro Definition Documentation

◆ status_error

#define status_error (   s,
 
)    ( s.code == e )

Match a given error.

Returns
True if the error code in s is equal to the error e

◆ status_failure

#define status_failure (   x)    ( x.code != 0 )

Returns true if the operation that returned x failed.

Returns
True if failed, False otherwise

◆ status_false

#define status_false (   x)    ( status_success( x ) ? 1 : 0 )

Check if the status result of the operation is true.

Returns
True if status x failed. False otherwise

◆ status_success

#define status_success (   x)    ( x.code == 0 )

Returns true if the operation that returned x was successful.

Returns
True if success, False otherwise

◆ status_true

#define status_true (   x)    ( status_failure( x ) ? 0 : 1 )

Check if the status result of the operation is true.

Returns
True if the status x was successful. False otherwise

◆ status_unsupported

#define status_unsupported (   s)    ( s.code == OSAPI_ERROR_SUPPORT )

Find if a module or facility is supported.

Returns
True if the error code is equal to UNSUPPORTED. False otherwise