atobase  3.2.0
ATOMAS atobase

API used by sample programs (and internally) to track arbitrary properties. More...

Functions

ATO_EXPORT void ato_arg_add (const char *name, bool required, const char *defvalue, const char *allowedvalues, const char *help)
 Add a new argument/property. More...
 
ATO_EXPORT bool ato_arg_process (int argc, const char *argv[])
 Add the standard C args as properties. More...
 
ATO_EXPORT void ato_arg_dump (void)
 Write all properties to the console.
 
ATO_EXPORT void ato_arg_usage (const char *appname)
 Print usage/help for known properties to the Console. More...
 
ATO_EXPORT bool ato_arg_check (void)
 Check that all args/properties are valid. More...
 
ATO_EXPORT const char * ato_arg_value_set (const char *name, const char *value)
 Reset the value of the property. More...
 
ATO_EXPORT const char * ato_arg_value (const char *name)
 Get the property value. More...
 
ATO_EXPORT bool ato_arg_value_bool (const char *name)
 Get the property value. More...
 
ATO_EXPORT int ato_arg_value_int (const char *name)
 Get the property value as an in. More...
 
ATO_EXPORT void ato_arg_free (void)
 Free all properties set using ato_arg_add()
 

Detailed Description

API used by sample programs (and internally) to track arbitrary properties.

Function Documentation

◆ ato_arg_add()

ATO_EXPORT void ato_arg_add ( const char *  name,
bool  required,
const char *  defvalue,
const char *  allowedvalues,
const char *  help 
)

Add a new argument/property.

Parameters
namethe name of the property
requiredwhen checking indicate if this property must have a value supplied.
defvaluevalue to use if not set.
allowedvaluescomma delimited list of predefined values
helphelp string to display if asked

◆ ato_arg_process()

ATO_EXPORT bool ato_arg_process ( int  argc,
const char *  argv[] 
)

Add the standard C args as properties.

Parameters
argcthe number of args
argvarray of args prefixed with - or @ (@ starts reading from argfile e.g. @argfile).
Returns
TRUE if no errors in loading args

◆ ato_arg_usage()

ATO_EXPORT void ato_arg_usage ( const char *  appname)

Print usage/help for known properties to the Console.

Parameters
appnamethe name of the calling program

◆ ato_arg_check()

ATO_EXPORT bool ato_arg_check ( void  )

Check that all args/properties are valid.

Returns
TRUE if all args have valid values

◆ ato_arg_value_set()

ATO_EXPORT const char* ato_arg_value_set ( const char *  name,
const char *  value 
)

Reset the value of the property.

Parameters
namethe name of property
valuethe va;ue of property
Returns
property value or NULL if not found

◆ ato_arg_value()

ATO_EXPORT const char* ato_arg_value ( const char *  name)

Get the property value.

Parameters
namethe name of property
Returns
The property value or NULL if not found

◆ ato_arg_value_bool()

ATO_EXPORT bool ato_arg_value_bool ( const char *  name)

Get the property value.

Parameters
namethe name of property
Returns
The property value as a bool or FALSE

◆ ato_arg_value_int()

ATO_EXPORT int ato_arg_value_int ( const char *  name)

Get the property value as an in.

Parameters
namethe name of property
Returns
The property value as an int or 0