YAC 3.15.0
Yet Another Coupler
Loading...
Searching...
No Matches
yac_name_type_pair Struct Reference

#include <utils_common.h>

Collaboration diagram for yac_name_type_pair:
Collaboration graph

Data Fields

const char * name
 String name (e.g., "true")
 
int type
 Integer type value (e.g., 1)
 

Detailed Description

Pair of string name and integer type, for mapping between names and type values.

Example usage:

static const struct yac_name_type_pair bool_table[] = {
{"false", 0}, {"true", 1}, {"no", 0}, {"yes", 1}
};
enum {BOOL_TABLE_SIZE = sizeof(bool_table) / sizeof(bool_table[0])};
int t =
bool_table, BOOL_TABLE_SIZE, "yes"); // t == 1
const char *n =
bool_table, BOOL_TABLE_SIZE, 0); // n == "false"
int yac_name_type_pair_get_type(struct yac_name_type_pair const *pairs, size_t count, char const *name)
Definition utils_core.c:26
char const * yac_name_type_pair_get_name(struct yac_name_type_pair const *pairs, size_t count, int type)
Definition utils_core.c:17

Definition at line 65 of file utils_common.h.

Field Documentation

◆ name

const char* yac_name_type_pair::name

String name (e.g., "true")

Definition at line 66 of file utils_common.h.

◆ type

int yac_name_type_pair::type

Integer type value (e.g., 1)

Definition at line 67 of file utils_common.h.


The documentation for this struct was generated from the following file: