BRL-CAD
Collaboration diagram for Pre-Defined Option Parsers:

Functions

int bu_opt_bool (struct bu_vls *msg, size_t argc, const char **argv, void *set_var)
 
int bu_opt_int (struct bu_vls *msg, size_t argc, const char **argv, void *set_var)
 
int bu_opt_long (struct bu_vls *msg, size_t argc, const char **argv, void *set_var)
 
int bu_opt_long_hex (struct bu_vls *msg, size_t argc, const char **argv, void *set_var)
 
int bu_opt_fastf_t (struct bu_vls *msg, size_t argc, const char **argv, void *set_var)
 
int bu_opt_str (struct bu_vls *msg, size_t argc, const char **argv, void *set_var)
 
int bu_opt_vls (struct bu_vls *msg, size_t argc, const char **argv, void *set_var)
 
int bu_opt_color (struct bu_vls *msg, size_t argc, const char **argv, void *set_var)
 
int bu_opt_vect_t (struct bu_vls *msg, size_t argc, const char **argv, void *set_var)
 

Detailed Description

Standard option validators. If a custom option argument validation isn't needed, the functions below can be used for most valid data types. When data conversion is successful, the user_data pointer in bu_opt_data will point to the results of the string->[type] translation in order to allow a calling program to use the int/long/etc. without having to repeat the conversion.

These functions should return -1 if there was a problem processing the value, and the number of argv entries processed otherwise. (Some validators such as bu_opt_color may read different numbers of args depending on what is found so calling code can't assume a successful validation will always return 1. Hence -1 is the error return - option validation will never "revert" previously processed argv entries.)

Function Documentation

◆ bu_opt_bool()

int bu_opt_bool ( struct bu_vls msg,
size_t  argc,
const char **  argv,
void *  set_var 
)

Process 1 argument to set a boolean type

◆ bu_opt_int()

int bu_opt_int ( struct bu_vls msg,
size_t  argc,
const char **  argv,
void *  set_var 
)

Process 1 argument to set an integer

◆ bu_opt_long()

int bu_opt_long ( struct bu_vls msg,
size_t  argc,
const char **  argv,
void *  set_var 
)

Process 1 argument to set a long

◆ bu_opt_long_hex()

int bu_opt_long_hex ( struct bu_vls msg,
size_t  argc,
const char **  argv,
void *  set_var 
)

Process 1 argument (hex style) to set a long

◆ bu_opt_fastf_t()

int bu_opt_fastf_t ( struct bu_vls msg,
size_t  argc,
const char **  argv,
void *  set_var 
)

Process 1 argument to set a fastf_t (either a float or a double, depending on how BRL-CAD was compiled)

◆ bu_opt_str()

int bu_opt_str ( struct bu_vls msg,
size_t  argc,
const char **  argv,
void *  set_var 
)

Process 1 argument to set a char pointer (uses the original argv string, does not make a copy)

◆ bu_opt_vls()

int bu_opt_vls ( struct bu_vls msg,
size_t  argc,
const char **  argv,
void *  set_var 
)

Process 1 argument to append to a vls (places a space before the new entry if the target vls is not empty)

◆ bu_opt_color()

int bu_opt_color ( struct bu_vls msg,
size_t  argc,
const char **  argv,
void *  set_var 
)

Process 1 or 3 arguments to set a bu_color

◆ bu_opt_vect_t()

int bu_opt_vect_t ( struct bu_vls msg,
size_t  argc,
const char **  argv,
void *  set_var 
)

Process 1 or 3 arguments to set a vect_t