Assertion Utilities for GEnum and GFlags: Cutter Reference Manual

## Assertion Utilities for GEnum and GFlags Assertion Utilities for GEnum and GFlags — Utilities to write assertions related to GEnum or GFlags more easily. |

## Functions

GQuark | gcut_enum_error_quark ()
gchar * | gcut_enum_inspect ()
gint | gcut_enum_parse ()
gchar * | gcut_flags_inspect ()
guint | gcut_flags_parse ()
guint | gcut_flags_get_all ()

## Types and Values

#define | GCUT_ENUM_ERROR
enum | GCutEnumError

## Description

To write assertions, you need to check equality and show expected and actual values.

The utilities help you to write assertions that are related to GEnum or GFlags.

## Functions

### gcut_enum_error_quark ()

    GQuark
    gcut_enum_error_quark (void);

### gcut_enum_inspect ()

    gchar *
    gcut_enum_inspect (GType enum_type,
                       gint enum_value);

Inspects `enum_type` value, `enum_value` . The returned string should be freed when no longer needed.

#### Parameters

enum_type | a GEnum type. |
enum_value | a GEnum value to be inspected. |

#### Returns

inspected `enum_value` as a string.

Since: 1.0.5

### gcut_enum_parse ()

    gint
    gcut_enum_parse (GType enum_type,
                     const gchar *enum_value,
                     GError **error);

Parses `enum_value` and returns a enum value of `enum_type` . `enum_value` should be enum name or nick name. If `enum_value` isn't match then `error` is set to a GCutEnumError.

#### Parameters

enum_type | a GEnum type. |
enum_value | a string to be parsed. |
error | return location for an error, or `NULL` |

#### Returns

enum value of `enum_type` corresponded to `enum_value` .

Since: 1.0.6

### gcut_flags_inspect ()

    gchar *
    gcut_flags_inspect (GType flags_type,
                        guint flags_value);

Inspects `flags_type` value, `flags_value` . The returned string should be freed when no longer needed.

#### Parameters

flags_type | a GFlags type. |
flags_value | a GFlags value to be inspected. |

#### Returns

inspected `flags_value` as a string.

Since: 1.0.5

### gcut_flags_parse ()

    guint
    gcut_flags_parse (GType flags_type,
                      const gchar *flags_value,
                      GError **error);

Parses `flags_value` and returns a flags value of `flags_type` . `flags_value` should be formated as "nick-or-name1|nick-or-name2|...|nick-or-nameN". If `flags_value` includes unknown flag then `error` is set to a GCutEnumError.

#### Parameters

flags_type | a GFlags type. |
flags_value | a string to be parsed. |
error | return location for an error, or `NULL` |

#### Returns

flags value of `flags_type` corresponded to `flags_value` .

Since: 1.0.6

### gcut_flags_get_all ()

    guint
    gcut_flags_get_all (GType flags_type,
                        GError **error);

Gets a flags value that includes all available flag values.

#### Parameters

flags_type | a GFlags type. |
error | return location for an error, or `NULL` |

#### Returns

a flags value that includes all available flag values.

Since: 1.0.6

## Types and Values

### GCUT_ENUM_ERROR

    #define GCUT_ENUM_ERROR (gcut_enum_error_quark())

Error domain for enum related operations. Errors in this domain will be from the GCutEnumError enumeration.

Since: 1.0.6

### enum GCutEnumError

Error codes returned by enum related operation.

#### Members

GCUT_ENUM_ERROR_INVALID_TYPE | Invalid type. |
GCUT_ENUM_ERROR_INVALID_VALUE | Invalid value. |

Since: 1.0.6