<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cutter-Assertion-Utilities-for-GEnum-and-GFlags">
<refmeta>
<refentrytitle role="top_of_page" id="cutter-Assertion-Utilities-for-GEnum-and-GFlags.top_of_page">Assertion Utilities for GEnum and GFlags</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CUTTER Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Assertion Utilities for GEnum and GFlags</refname>
<refpurpose>Utilities to write assertions related
to <link linkend="GEnum"><type>GEnum</type></link> or <link linkend="GFlags"><type>GFlags</type></link> more easily.</refpurpose>
</refnamediv>

<refsect1 id="cutter-Assertion-Utilities-for-GEnum-and-GFlags.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_return" colwidth="150px"/>
<colspec colname="functions_name"/>
<tbody>
<row><entry role="function_type"><link linkend="GQuark"><returnvalue>GQuark</returnvalue></link>
</entry><entry role="function_name"><link linkend="gcut-enum-error-quark">gcut_enum_error_quark</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gcut-enum-inspect">gcut_enum_inspect</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gcut-enum-parse">gcut_enum_parse</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gcut-flags-inspect">gcut_flags_inspect</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gcut-flags-parse">gcut_flags_parse</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gcut-flags-get-all">gcut_flags_get_all</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="cutter-Assertion-Utilities-for-GEnum-and-GFlags.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="name" colwidth="150px"/>
<colspec colname="description"/>
<tbody>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="GCUT-ENUM-ERROR:CAPS">GCUT_ENUM_ERROR</link></entry></row>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GCutEnumError">GCutEnumError</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>


<refsect1 id="cutter-Assertion-Utilities-for-GEnum-and-GFlags.description" role="desc">
<title role="desc.title">Description</title>
<para>To write assertions, you need to check equality and show
expected and actual values.</para>
<para>The utilities help you to write assertions that are
related to <link linkend="GEnum"><type>GEnum</type></link> or <link linkend="GFlags"><type>GFlags</type></link>.</para>

</refsect1>
<refsect1 id="cutter-Assertion-Utilities-for-GEnum-and-GFlags.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gcut-enum-error-quark" role="function">
<title>gcut_enum_error_quark&#160;()</title>
<indexterm zone="gcut-enum-error-quark"><primary>gcut_enum_error_quark</primary></indexterm>
<programlisting language="C"><link linkend="GQuark"><returnvalue>GQuark</returnvalue></link>
gcut_enum_error_quark (<parameter><type>void</type></parameter>);</programlisting>
<para>
</para>
</refsect2>
<refsect2 id="gcut-enum-inspect" role="function" condition="since:1.0.5">
<title>gcut_enum_inspect&#160;()</title>
<indexterm zone="gcut-enum-inspect" role="1.0.5"><primary>gcut_enum_inspect</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
gcut_enum_inspect (<parameter><link linkend="GType"><type>GType</type></link> enum_type</parameter>,
                   <parameter><link linkend="gint"><type>gint</type></link> enum_value</parameter>);</programlisting>
<para>Inspects <parameter>enum_type</parameter>
 value, <parameter>enum_value</parameter>
. The returned
string should be freed when no longer needed.</para>
<refsect3 id="gcut-enum-inspect.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>enum_type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GEnum"><type>GEnum</type></link> type.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>enum_value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GEnum"><type>GEnum</type></link> value to be inspected.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gcut-enum-inspect.returns" role="returns">
<title>Returns</title>
<para> inspected <parameter>enum_value</parameter>
as a string.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.5">1.0.5</link></para></refsect2>
<refsect2 id="gcut-enum-parse" role="function" condition="since:1.0.6">
<title>gcut_enum_parse&#160;()</title>
<indexterm zone="gcut-enum-parse" role="1.0.6"><primary>gcut_enum_parse</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
gcut_enum_parse (<parameter><link linkend="GType"><type>GType</type></link> enum_type</parameter>,
                 <parameter>const <link linkend="gchar"><type>gchar</type></link> *enum_value</parameter>,
                 <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Parses <parameter>enum_value</parameter>
 and returns a enum value of
<parameter>enum_type</parameter>
. <parameter>enum_value</parameter>
 should be enum name or nick
name. If <parameter>enum_value</parameter>
 isn't match then <parameter>error</parameter>
 is set to a
<link linkend="GCutEnumError"><type>GCutEnumError</type></link>.</para>
<refsect3 id="gcut-enum-parse.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>enum_type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GEnum"><type>GEnum</type></link> type.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>enum_value</para></entry>
<entry role="parameter_description"><para>a string to be parsed.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for an error, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gcut-enum-parse.returns" role="returns">
<title>Returns</title>
<para> enum value of <parameter>enum_type</parameter>
corresponded to <parameter>enum_value</parameter>
.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.6">1.0.6</link></para></refsect2>
<refsect2 id="gcut-flags-inspect" role="function" condition="since:1.0.5">
<title>gcut_flags_inspect&#160;()</title>
<indexterm zone="gcut-flags-inspect" role="1.0.5"><primary>gcut_flags_inspect</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
gcut_flags_inspect (<parameter><link linkend="GType"><type>GType</type></link> flags_type</parameter>,
                    <parameter><link linkend="guint"><type>guint</type></link> flags_value</parameter>);</programlisting>
<para>Inspects <parameter>flags_type</parameter>
 value, <parameter>flags_value</parameter>
. The returned
string should be freed when no longer needed.</para>
<refsect3 id="gcut-flags-inspect.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>flags_type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GFlags"><type>GFlags</type></link> type.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>flags_value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GFlags"><type>GFlags</type></link> value to be inspected.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gcut-flags-inspect.returns" role="returns">
<title>Returns</title>
<para> inspected <parameter>flags_value</parameter>
as a string.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.5">1.0.5</link></para></refsect2>
<refsect2 id="gcut-flags-parse" role="function" condition="since:1.0.6">
<title>gcut_flags_parse&#160;()</title>
<indexterm zone="gcut-flags-parse" role="1.0.6"><primary>gcut_flags_parse</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gcut_flags_parse (<parameter><link linkend="GType"><type>GType</type></link> flags_type</parameter>,
                  <parameter>const <link linkend="gchar"><type>gchar</type></link> *flags_value</parameter>,
                  <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Parses <parameter>flags_value</parameter>
 and returns a flags value of
<parameter>flags_type</parameter>
. <parameter>flags_value</parameter>
 should be formated as
"nick-or-name1|nick-or-name2|...|nick-or-nameN". If
<parameter>flags_value</parameter>
 includes unknown flag then <parameter>error</parameter>
 is set to
a <link linkend="GCutEnumError"><type>GCutEnumError</type></link>.</para>
<refsect3 id="gcut-flags-parse.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>flags_type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GFlags"><type>GFlags</type></link> type.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>flags_value</para></entry>
<entry role="parameter_description"><para>a string to be parsed.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for an error, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gcut-flags-parse.returns" role="returns">
<title>Returns</title>
<para> flags value of <parameter>flags_type</parameter>
corresponded to <parameter>flags_value</parameter>
.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.6">1.0.6</link></para></refsect2>
<refsect2 id="gcut-flags-get-all" role="function" condition="since:1.0.6">
<title>gcut_flags_get_all&#160;()</title>
<indexterm zone="gcut-flags-get-all" role="1.0.6"><primary>gcut_flags_get_all</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gcut_flags_get_all (<parameter><link linkend="GType"><type>GType</type></link> flags_type</parameter>,
                    <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Gets a flags value that includes all available flag
values.</para>
<refsect3 id="gcut-flags-get-all.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>flags_type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GFlags"><type>GFlags</type></link> type.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for an error, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gcut-flags-get-all.returns" role="returns">
<title>Returns</title>
<para> a flags value that includes all available flag
values.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.6">1.0.6</link></para></refsect2>

</refsect1>
<refsect1 id="cutter-Assertion-Utilities-for-GEnum-and-GFlags.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GCUT-ENUM-ERROR:CAPS" role="macro" condition="since:1.0.6">
<title>GCUT_ENUM_ERROR</title>
<indexterm zone="GCUT-ENUM-ERROR:CAPS" role="1.0.6"><primary>GCUT_ENUM_ERROR</primary></indexterm>
<programlisting language="C">#define GCUT_ENUM_ERROR (gcut_enum_error_quark())
</programlisting>
<para>Error domain for enum related operations. Errors in this domain
will be from the <link linkend="GCutEnumError"><type>GCutEnumError</type></link> enumeration.</para>
<para role="since">Since: <link linkend="api-index-1.0.6">1.0.6</link></para></refsect2>
<refsect2 id="GCutEnumError" role="enum" condition="since:1.0.6">
<title>enum GCutEnumError</title>
<indexterm zone="GCutEnumError" role="1.0.6"><primary>GCutEnumError</primary></indexterm>
<para>Error codes returned by enum related operation.</para>
<refsect3 id="GCutEnumError.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="GCUT-ENUM-ERROR-INVALID-TYPE:CAPS">GCUT_ENUM_ERROR_INVALID_TYPE</para></entry>
<entry role="enum_member_description"><para>Invalid type.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GCUT-ENUM-ERROR-INVALID-VALUE:CAPS">GCUT_ENUM_ERROR_INVALID_VALUE</para></entry>
<entry role="enum_member_description"><para>Invalid value.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.6">1.0.6</link></para></refsect2>

</refsect1>

</refentry>
