<refentry id="gobject-Enumeration-and-Flag-Types">
<refmeta>
<refentrytitle>Enums and Flags</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GOBJECT Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Enums and Flags</refname><refpurpose>Enumeration and flags types.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>

#include &lt;gobject.h&gt;


struct      <link linkend="GEnumClass">GEnumClass</link>;
struct      <link linkend="GFlagsClass">GFlagsClass</link>;
#define     <link linkend="G-ENUM-CLASS-TYPE-CAPS">G_ENUM_CLASS_TYPE</link>               (class)
#define     <link linkend="G-ENUM-CLASS-TYPE-NAME-CAPS">G_ENUM_CLASS_TYPE_NAME</link>          (class)
#define     <link linkend="G-TYPE-IS-ENUM-CAPS">G_TYPE_IS_ENUM</link>                  (type)
#define     <link linkend="G-ENUM-CLASS-CAPS">G_ENUM_CLASS</link>                    (class)
#define     <link linkend="G-IS-ENUM-CLASS-CAPS">G_IS_ENUM_CLASS</link>                 (class)
#define     <link linkend="G-TYPE-IS-FLAGS-CAPS">G_TYPE_IS_FLAGS</link>                 (type)
#define     <link linkend="G-FLAGS-CLASS-CAPS">G_FLAGS_CLASS</link>                   (class)
#define     <link linkend="G-IS-FLAGS-CLASS-CAPS">G_IS_FLAGS_CLASS</link>                (class)
#define     <link linkend="G-FLAGS-CLASS-TYPE-CAPS">G_FLAGS_CLASS_TYPE</link>              (class)
#define     <link linkend="G-FLAGS-CLASS-TYPE-NAME-CAPS">G_FLAGS_CLASS_TYPE_NAME</link>         (class)
struct      <link linkend="GEnumValue">GEnumValue</link>;
struct      <link linkend="GFlagsValue">GFlagsValue</link>;
<link linkend="GEnumValue">GEnumValue</link>* <link linkend="g-enum-get-value">g_enum_get_value</link>                (<link linkend="GEnumClass">GEnumClass</link> *enum_class,
                                             <link linkend="gint">gint</link> value);
<link linkend="GEnumValue">GEnumValue</link>* <link linkend="g-enum-get-value-by-name">g_enum_get_value_by_name</link>        (<link linkend="GEnumClass">GEnumClass</link> *enum_class,
                                             const <link linkend="gchar">gchar</link> *name);
<link linkend="GEnumValue">GEnumValue</link>* <link linkend="g-enum-get-value-by-nick">g_enum_get_value_by_nick</link>        (<link linkend="GEnumClass">GEnumClass</link> *enum_class,
                                             const <link linkend="gchar">gchar</link> *nick);
<link linkend="GFlagsValue">GFlagsValue</link>* <link linkend="g-flags-get-first-value">g_flags_get_first_value</link>        (<link linkend="GFlagsClass">GFlagsClass</link> *flags_class,
                                             <link linkend="guint">guint</link> value);
<link linkend="GFlagsValue">GFlagsValue</link>* <link linkend="g-flags-get-value-by-name">g_flags_get_value_by_name</link>      (<link linkend="GFlagsClass">GFlagsClass</link> *flags_class,
                                             const <link linkend="gchar">gchar</link> *name);
<link linkend="GFlagsValue">GFlagsValue</link>* <link linkend="g-flags-get-value-by-nick">g_flags_get_value_by_nick</link>      (<link linkend="GFlagsClass">GFlagsClass</link> *flags_class,
                                             const <link linkend="gchar">gchar</link> *nick);
<link linkend="GType">GType</link>       <link linkend="g-enum-register-static">g_enum_register_static</link>          (const <link linkend="gchar">gchar</link> *name,
                                             const <link linkend="GEnumValue">GEnumValue</link> *const_static_values);
<link linkend="GType">GType</link>       <link linkend="g-flags-register-static">g_flags_register_static</link>         (const <link linkend="gchar">gchar</link> *name,
                                             const <link linkend="GFlagsValue">GFlagsValue</link> *const_static_values);
void        <link linkend="g-enum-complete-type-info">g_enum_complete_type_info</link>       (<link linkend="GType">GType</link> g_enum_type,
                                             <link linkend="GTypeInfo">GTypeInfo</link> *info,
                                             const <link linkend="GEnumValue">GEnumValue</link> *const_values);
void        <link linkend="g-flags-complete-type-info">g_flags_complete_type_info</link>      (<link linkend="GType">GType</link> g_flags_type,
                                             <link linkend="GTypeInfo">GTypeInfo</link> *info,
                                             const <link linkend="GFlagsValue">GFlagsValue</link> *const_values);
</synopsis>
</refsynopsisdiv>





<refsect1>
<title>Description</title>
<para>
</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GEnumClass">struct GEnumClass</title>
<programlisting>struct GEnumClass;</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GFlagsClass">struct GFlagsClass</title>
<programlisting>struct GFlagsClass;</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="G-ENUM-CLASS-TYPE-CAPS">G_ENUM_CLASS_TYPE()</title>
<programlisting>#define G_ENUM_CLASS_TYPE(class)       (G_TYPE_FROM_CLASS (class))
</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>class</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="G-ENUM-CLASS-TYPE-NAME-CAPS">G_ENUM_CLASS_TYPE_NAME()</title>
<programlisting>#define G_ENUM_CLASS_TYPE_NAME(class)  (g_type_name (G_ENUM_CLASS_TYPE (class)))
</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>class</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="G-TYPE-IS-ENUM-CAPS">G_TYPE_IS_ENUM()</title>
<programlisting>#define G_TYPE_IS_ENUM(type)	       (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM)
</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>type</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="G-ENUM-CLASS-CAPS">G_ENUM_CLASS()</title>
<programlisting>#define G_ENUM_CLASS(class)	       (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_ENUM, GEnumClass))
</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>class</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="G-IS-ENUM-CLASS-CAPS">G_IS_ENUM_CLASS()</title>
<programlisting>#define G_IS_ENUM_CLASS(class)	       (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_ENUM))
</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>class</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="G-TYPE-IS-FLAGS-CAPS">G_TYPE_IS_FLAGS()</title>
<programlisting>#define G_TYPE_IS_FLAGS(type)	       (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS)
</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>type</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="G-FLAGS-CLASS-CAPS">G_FLAGS_CLASS()</title>
<programlisting>#define G_FLAGS_CLASS(class)	       (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_FLAGS, GFlagsClass))
</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>class</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="G-IS-FLAGS-CLASS-CAPS">G_IS_FLAGS_CLASS()</title>
<programlisting>#define G_IS_FLAGS_CLASS(class)        (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_FLAGS))
</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>class</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="G-FLAGS-CLASS-TYPE-CAPS">G_FLAGS_CLASS_TYPE()</title>
<programlisting>#define G_FLAGS_CLASS_TYPE(class)      (G_TYPE_FROM_CLASS (class))
</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>class</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="G-FLAGS-CLASS-TYPE-NAME-CAPS">G_FLAGS_CLASS_TYPE_NAME()</title>
<programlisting>#define G_FLAGS_CLASS_TYPE_NAME(class) (g_type_name (G_FLAGS_TYPE (class)))
</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>class</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GEnumValue">struct GEnumValue</title>
<programlisting>struct GEnumValue
{
  gint	 value;
  gchar *value_name;
  gchar *value_nick;
};
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GFlagsValue">struct GFlagsValue</title>
<programlisting>struct GFlagsValue
{
  guint	 value;
  gchar *value_name;
  gchar *value_nick;
};
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="g-enum-get-value">g_enum_get_value ()</title>
<programlisting><link linkend="GEnumValue">GEnumValue</link>* g_enum_get_value                (<link linkend="GEnumClass">GEnumClass</link> *enum_class,
                                             <link linkend="gint">gint</link> value);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>enum_class</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>value</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-enum-get-value-by-name">g_enum_get_value_by_name ()</title>
<programlisting><link linkend="GEnumValue">GEnumValue</link>* g_enum_get_value_by_name        (<link linkend="GEnumClass">GEnumClass</link> *enum_class,
                                             const <link linkend="gchar">gchar</link> *name);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>enum_class</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>name</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-enum-get-value-by-nick">g_enum_get_value_by_nick ()</title>
<programlisting><link linkend="GEnumValue">GEnumValue</link>* g_enum_get_value_by_nick        (<link linkend="GEnumClass">GEnumClass</link> *enum_class,
                                             const <link linkend="gchar">gchar</link> *nick);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>enum_class</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>nick</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-flags-get-first-value">g_flags_get_first_value ()</title>
<programlisting><link linkend="GFlagsValue">GFlagsValue</link>* g_flags_get_first_value        (<link linkend="GFlagsClass">GFlagsClass</link> *flags_class,
                                             <link linkend="guint">guint</link> value);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>flags_class</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>value</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-flags-get-value-by-name">g_flags_get_value_by_name ()</title>
<programlisting><link linkend="GFlagsValue">GFlagsValue</link>* g_flags_get_value_by_name      (<link linkend="GFlagsClass">GFlagsClass</link> *flags_class,
                                             const <link linkend="gchar">gchar</link> *name);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>flags_class</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>name</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-flags-get-value-by-nick">g_flags_get_value_by_nick ()</title>
<programlisting><link linkend="GFlagsValue">GFlagsValue</link>* g_flags_get_value_by_nick      (<link linkend="GFlagsClass">GFlagsClass</link> *flags_class,
                                             const <link linkend="gchar">gchar</link> *nick);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>flags_class</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>nick</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-enum-register-static">g_enum_register_static ()</title>
<programlisting><link linkend="GType">GType</link>       g_enum_register_static          (const <link linkend="gchar">gchar</link> *name,
                                             const <link linkend="GEnumValue">GEnumValue</link> *const_static_values);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>name</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>const_static_values</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-flags-register-static">g_flags_register_static ()</title>
<programlisting><link linkend="GType">GType</link>       g_flags_register_static         (const <link linkend="gchar">gchar</link> *name,
                                             const <link linkend="GFlagsValue">GFlagsValue</link> *const_static_values);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>name</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>const_static_values</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-enum-complete-type-info">g_enum_complete_type_info ()</title>
<programlisting>void        g_enum_complete_type_info       (<link linkend="GType">GType</link> g_enum_type,
                                             <link linkend="GTypeInfo">GTypeInfo</link> *info,
                                             const <link linkend="GEnumValue">GEnumValue</link> *const_values);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>g_enum_type</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>info</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>const_values</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-flags-complete-type-info">g_flags_complete_type_info ()</title>
<programlisting>void        g_flags_complete_type_info      (<link linkend="GType">GType</link> g_flags_type,
                                             <link linkend="GTypeInfo">GTypeInfo</link> *info,
                                             const <link linkend="GFlagsValue">GFlagsValue</link> *const_values);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>g_flags_type</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>info</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>const_values</parameter>&nbsp;:</entry>
<entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>




</refentry>
