Function

Pangoparse_enum

Declaration [src]

gboolean
pango_parse_enum (
  GType type,
  const char* str,
  int* value,
  gboolean warn,
  char** possible_values
)

Description [src]

Parses an enum type and stores the result in value.

If str does not match the nick name of any of the possible values for the enum and is not an integer, FALSE is returned, a warning is issued if warn is TRUE, and a string representing the list of possible values is stored in possible_values. The list is slash-separated, eg. “none/start/middle/end”.

If failed and possible_values is not NULL, returned string should be freed using g_free().

Available since:1.16
Deprecated since:1.38

Please do not use it in newly written code.

Parameters

type

Type: GType

Enum type to parse, eg. PANGO_TYPE_ELLIPSIZE_MODE.

str

Type: const char*

String to parse.

The argument can be NULL.
The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
value

Type: int*

Integer to store the result in.

The argument will be set by the function.
The argument can be NULL.
warn

Type: gboolean

If TRUE, issue a g_warning() on bad input.

possible_values

Type: char**

Place to store list of possible values on failure.

The argument will be set by the function.
The argument can be NULL.
The called function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.

Return value

Type: gboolean

TRUE if str was successfully parsed.