LFX Mentorship 2023
Classes | Typedefs | Functions
option.h File Reference

Basic functions for Option operation. More...

#include <stdbool.h>
Include dependency graph for option.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  opt
 Option Struct. More...
 

Typedefs

typedef struct opt Option
 Option Struct. More...
 

Functions

Optioncreate_Option (char *opt_name, int args_len, bool(*handle_func)(const Option *))
 Create a ParseData pointer, need to be deleted before exit execution. More...
 
void delete_Option (Option *opt)
 Delete a Option pointer from create_Option(). More...
 
void delete_Option_array (Option **opt, int opt_len)
 Delete a Option pointer array. More...
 
void show_opt (const Option *opt)
 Print Option. More...
 

Detailed Description

Basic functions for Option operation.

Typedef Documentation

◆ Option

typedef struct opt Option

Option Struct.

Parameters
opt_nameoption name.
args_lenargs length.
argschar pointer arrary. It contains arguments.
foundinitialize to false. Set to true if the option is found.
handle_funcpointer of option handler.

Function Documentation

◆ create_Option()

Option* create_Option ( char *  opt_name,
int  args_len,
bool(*)(const Option *)  handle_func 
)

Create a ParseData pointer, need to be deleted before exit execution.

Parameters
opt_nameis the name of option.
args_lenis the expected length of arguments. -1 means the option will accept
func_ptrpointer of option handler (option handler should be a function). all arguments after it.
Returns
return Option pointer.

◆ delete_Option()

void delete_Option ( Option opt)

Delete a Option pointer from create_Option().

Parameters
optis a Option pointer.

◆ delete_Option_array()

void delete_Option_array ( Option **  opt,
int  opt_len 
)

Delete a Option pointer array.

Parameters
optis a Option pointer array.
opt_lenis the length of Option pointer array.

◆ show_opt()

void show_opt ( const Option opt)

Print Option.

Parameters
optis a Option pointer