ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
enums.c File Reference

Option enum value implementation - single source of truth. More...

Go to the source code of this file.

Functions

const char ** options_get_enum_values (const char *option_name, size_t *value_count)
 
bool options_is_enum_option (const char *option_name)
 

Detailed Description

Option enum value implementation - single source of truth.

Definition in file enums.c.

Function Documentation

◆ options_get_enum_values()

const char ** options_get_enum_values ( const char *  option_name,
size_t *  value_count 
)

Definition at line 49 of file enums.c.

49 {
50 if (!option_name || !value_count) {
51 return NULL;
52 }
53
54 for (size_t i = 0; enum_registry[i].option_name != NULL; i++) {
55 if (strcmp(enum_registry[i].option_name, option_name) == 0) {
56 *value_count = enum_registry[i].value_count;
57 return enum_registry[i].values;
58 }
59 }
60
61 *value_count = 0;
62 return NULL;
63}

Referenced by asciichat_suggest_enum_value().

◆ options_is_enum_option()

bool options_is_enum_option ( const char *  option_name)

Definition at line 65 of file enums.c.

65 {
66 if (!option_name) {
67 return false;
68 }
69
70 for (size_t i = 0; enum_registry[i].option_name != NULL; i++) {
71 if (strcmp(enum_registry[i].option_name, option_name) == 0) {
72 return true;
73 }
74 }
75
76 return false;
77}