oscap_string_map Struct Reference

Define mapping between symbolic constant and its string representation. More...

`#include <util.h>`

## Public Member Functions

int | oscap_string_to_enum (const struct oscap_string_map *map, const char *str)
| Convert a string to an enumeration constant. More...
const char * | oscap_enum_to_string (const struct oscap_string_map *map, int val)
| Convert an enumeration constant to its corresponding string representation. More...

## Data Fields

int | value
const char * | string

## Detailed Description

Define mapping between symbolic constant and its string representation.

It is supposed to define array of these structures, ending with element with the string member set to NULL. Value of such member also defines the default value for strings not defined elsewhere.

## Member Function Documentation

const char * oscap_enum_to_string | ( | const struct oscap_string_map * | map,
|  | int | val
| ) |  |

Convert an enumeration constant to its corresponding string representation.

Parameters

  map | An array of oscap_string_map structures that defines mapping between constants and strings.
  val | value to be converted

int oscap_string_to_enum | ( | const struct oscap_string_map * | map,
|  | const char * | str
| ) |  |

Convert a string to an enumeration constant.

Parameters

  map | An array of oscap_string_map structures that defines mapping between constants and strings.
  str | string to be converted

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

- util.h