![]() |
![]() |
![]() |
Cutter Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
Assertion Utilities for GEnum and GFlagsAssertion Utilities for GEnum and GFlags — Utilities to write assertions related to GEnum or GFlags more easily. |
#define GCUT_ENUM_ERROR GQuark gcut_enum_error_quark (void); enum GCutEnumError; gchar * gcut_enum_inspect (GType enum_type, gint enum_value); gint gcut_enum_parse (GType enum_type, const gchar *enum_value, GError **error); gchar * gcut_flags_inspect (GType flags_type, guint flags_value); guint gcut_flags_parse (GType flags_type, const gchar *flags_value, GError **error); guint gcut_flags_get_all (GType flags_type, GError **error);
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.
#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
typedef enum { GCUT_ENUM_ERROR_INVALID_TYPE, GCUT_ENUM_ERROR_INVALID_VALUE } GCutEnumError;
Error codes returned by enum related operation.
Since 1.0.6
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.
|
a GEnum type. |
|
a GEnum value to be inspected. |
Returns : |
inspected enum_value as a string.
|
Since 1.0.5
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.
|
a GEnum type. |
|
a string to be parsed. |
|
return location for an error, or NULL
|
Returns : |
enum value of enum_type corresponded to enum_value .
|
Since 1.0.6
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.
|
a GFlags type. |
|
a GFlags value to be inspected. |
Returns : |
inspected flags_value as a string.
|
Since 1.0.5
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.
|
a GFlags type. |
|
a string to be parsed. |
|
return location for an error, or NULL
|
Returns : |
flags value of flags_type corresponded to flags_value .
|
Since 1.0.6