libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_option_group.h File Reference

Go to the source code of this file.

Data Structures

union  GblOptionPtr
 
struct  GblOption
 
struct  GblOptionGroupClass
 
struct  GblOptionGroup
 

Macros

Type System

Type UUID and cast operators

#define GBL_OPTION_GROUP_TYPE
 
#define GBL_OPTION_GROUP(self)
 
#define GBL_OPTION_GROUP_CLASS(klass)
 
#define GBL_OPTION_GROUP_GET_CLASS(self)
 

Typedefs

typedef GBL_RESULT(* GblOptionCallbackFn) (GblOptionGroup *pGroup, const GblOption *pOption, GblStringView value, GblBool *pConsumed)
 
typedef GblFlags GBL_OPTION_FLAGS
 
typedef GblEnum GBL_OPTION_TYPE
 

Enumerations

enum  GBL_OPTION_FLAGS
 
enum  GBL_OPTION_TYPE
 

Functions

GblType GblOptionGroup_type (void)
 
GblOptionGroupGblOptionGroup_create (const char *pName, const char *pPrefix, const GblOption *pOptions)
 
GblRefCount GblOptionGroup_unref (GblOptionGroup *pSelf)
 
GBL_RESULT GblOptionGroup_parse (GblOptionGroup *pSelf, GblStringList *pList, GblBool prefixOnly)
 

Detailed Description

Grouping of parsable command-line options.

This file contains the GblOptionGroup type and its associated API. It is used to create a standalone group of options that correspond to a single module or unit of code which can be added and parsed off of a larger, application-wide group of options.

Author
2023 Falco Girgis

Definition in file gimbal_option_group.h.

Macro Definition Documentation

◆ GBL_OPTION_GROUP_TYPE

#define GBL_OPTION_GROUP_TYPE

Type UUID for GblOptionGroup.

Definition at line 26 of file gimbal_option_group.h.

◆ GBL_OPTION_GROUP

#define GBL_OPTION_GROUP (   self)

Casts a GblInstance to GblOptionGroup.

Definition at line 27 of file gimbal_option_group.h.

◆ GBL_OPTION_GROUP_CLASS

#define GBL_OPTION_GROUP_CLASS (   klass)

Casts a GblClass to GblOptionGroupClass.

Definition at line 28 of file gimbal_option_group.h.

◆ GBL_OPTION_GROUP_GET_CLASS

#define GBL_OPTION_GROUP_GET_CLASS (   self)

Gets a GblOptionGroupClass from a GblInstance.

Definition at line 29 of file gimbal_option_group.h.

Typedef Documentation

◆ GblOptionCallbackFn

typedef GBL_RESULT(* GblOptionCallbackFn) (GblOptionGroup *pGroup, const GblOption *pOption, GblStringView value, GblBool *pConsumed)

Callback function signature to be used with a GBL_OPTION_TYPE_CALLBACK GblOption.

Definition at line 40 of file gimbal_option_group.h.

◆ GBL_OPTION_FLAGS

Definition at line 48 of file gimbal_option_group.h.

◆ GBL_OPTION_TYPE

Definition at line 58 of file gimbal_option_group.h.

Enumeration Type Documentation

◆ GBL_OPTION_FLAGS

GblOption flags for controlling special option behaviors.

Enumerator
GBL_OPTION_FLAG_NONE 

None.

GBL_OPTION_FLAG_HIDDEN 

Hidden (doesn't display in the –help text)

GBL_OPTION_FLAG_BOOL_INVERTED 

Underlying boolean value is swapped from user input.

GBL_OPTION_FLAG_BOOL_NO_VALUE 

Bool option is enabled just by being present, without value.

Definition at line 48 of file gimbal_option_group.h.

48 {
49 GBL_OPTION_FLAG_NONE = 0, //!< None
50 GBL_OPTION_FLAG_HIDDEN = 0x1, //!< Hidden (doesn't display in the --help text)
51 GBL_OPTION_FLAG_BOOL_INVERTED = 0x2, //!< Underlying boolean value is swapped from user input
52 GBL_OPTION_FLAG_BOOL_NO_VALUE = 0x4 //!< Bool option is enabled just by being present, without value
53};
@ GBL_OPTION_FLAG_NONE
None.
@ GBL_OPTION_FLAG_BOOL_INVERTED
Underlying boolean value is swapped from user input.
@ GBL_OPTION_FLAG_HIDDEN
Hidden (doesn't display in the –help text)
@ GBL_OPTION_FLAG_BOOL_NO_VALUE
Bool option is enabled just by being present, without value.

◆ GBL_OPTION_TYPE

Represents the list of every supported type of GblOption value.

Enumerator
GBL_OPTION_TYPE_STRING 

const char*

GBL_OPTION_TYPE_BOOL 

GblBool.

GBL_OPTION_TYPE_UINT8 

uint8_t

GBL_OPTION_TYPE_CHAR 

char

GBL_OPTION_TYPE_UINT16 

uint16_t

GBL_OPTION_TYPE_INT16 

int16_t

GBL_OPTION_TYPE_UINT32 

uint32_t

GBL_OPTION_TYPE_INT32 

int32_t

GBL_OPTION_TYPE_UINT64 

uint64_t

GBL_OPTION_TYPE_INT64 

int64_t

GBL_OPTION_TYPE_FLOAT 

float

GBL_OPTION_TYPE_DOUBLE 

double

GBL_OPTION_TYPE_CALLBACK 

GblOptionCallbackFn.

Definition at line 58 of file gimbal_option_group.h.

58 {
59 GBL_OPTION_TYPE_STRING, //!< const char*
60 GBL_OPTION_TYPE_BOOL, //!< GblBool
61 GBL_OPTION_TYPE_UINT8, //!< uint8_t
62 GBL_OPTION_TYPE_CHAR, //!< char
63 GBL_OPTION_TYPE_UINT16, //!< uint16_t
64 GBL_OPTION_TYPE_INT16, //!< int16_t
65 GBL_OPTION_TYPE_UINT32, //!< uint32_t
66 GBL_OPTION_TYPE_INT32, //!< int32_t
67 GBL_OPTION_TYPE_UINT64, //!< uint64_t
68 GBL_OPTION_TYPE_INT64, //!< int64_t
69 GBL_OPTION_TYPE_FLOAT, //!< float
70 GBL_OPTION_TYPE_DOUBLE, //!< double
71 GBL_OPTION_TYPE_CALLBACK //!< GblOptionCallbackFn
72};
@ GBL_OPTION_TYPE_UINT16
uint16_t
@ GBL_OPTION_TYPE_CALLBACK
GblOptionCallbackFn.
@ GBL_OPTION_TYPE_INT16
int16_t
@ GBL_OPTION_TYPE_UINT32
uint32_t
@ GBL_OPTION_TYPE_INT64
int64_t
@ GBL_OPTION_TYPE_BOOL
GblBool.
@ GBL_OPTION_TYPE_CHAR
char
@ GBL_OPTION_TYPE_UINT64
uint64_t
@ GBL_OPTION_TYPE_FLOAT
float
@ GBL_OPTION_TYPE_INT32
int32_t
@ GBL_OPTION_TYPE_DOUBLE
double
@ GBL_OPTION_TYPE_UINT8
uint8_t
@ GBL_OPTION_TYPE_STRING
const char*

Function Documentation

◆ GblOptionGroup_type()

GblType GblOptionGroup_type ( void  )

Returns the GblType UUID associated with GblOptionGroup.

◆ GblOptionGroup_create()

GblOptionGroup * GblOptionGroup_create ( const char *  pName,
const char *  pPrefix,
const GblOption pOptions 
)

Creates a GblOptionGroup with an option name, prefix, and NULL-terminated option list.

◆ GblOptionGroup_unref()

GblRefCount GblOptionGroup_unref ( GblOptionGroup pSelf)

Decrements the reference counter of the given GblOptionGroup by 1, destructing when it hits 0.

◆ GblOptionGroup_parse()

GBL_RESULT GblOptionGroup_parse ( GblOptionGroup pSelf,
GblStringList pList,
GblBool  prefixOnly 
)

Processes the given string list, optionally requiring prefixes on all options.