Open SCAP Library
Public Member Functions | Data Fields
oscap_string_map Struct Reference

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

#include <util.h>

Public Member Functions

OSCAP_API int oscap_string_to_enum (const struct oscap_string_map *map, const char *str)
 Convert a string to an enumeration constant. More...
 
OSCAP_API 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

const 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

◆ oscap_enum_to_string()

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

Convert an enumeration constant to its corresponding string representation.

Parameters
mapAn array of oscap_string_map structures that defines mapping between constants and strings.
valvalue to be converted

◆ oscap_string_to_enum()

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

Convert a string to an enumeration constant.

Parameters
mapAn array of oscap_string_map structures that defines mapping between constants and strings.
strstring to be converted

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