<refentry id="GMimeFilterBest">
<refmeta>
<refentrytitle role="top_of_page" id="GMimeFilterBest.top_of_page">GMimeFilterBest</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  GMIME Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GMimeFilterBest</refname>
<refpurpose>Determine the best charset/encoding to use for a stream</refpurpose>
</refnamediv>

<refsynopsisdiv id="GMimeFilterBest.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>                    <link linkend="GMimeFilterBest-struct">GMimeFilterBest</link>;
enum                <link linkend="GMimeFilterBestFlags">GMimeFilterBestFlags</link>;
<link linkend="GMimeFilter"><returnvalue>GMimeFilter</returnvalue></link> *       <link linkend="g-mime-filter-best-new">g_mime_filter_best_new</link>              (<parameter><link linkend="GMimeFilterBestFlags"><type>GMimeFilterBestFlags</type></link> flags</parameter>);
const <link linkend="char"><returnvalue>char</returnvalue></link> *        <link linkend="g-mime-filter-best-charset">g_mime_filter_best_charset</link>          (<parameter><link linkend="GMimeFilterBest"><type>GMimeFilterBest</type></link> *best</parameter>);
<link linkend="GMimeContentEncoding"><returnvalue>GMimeContentEncoding</returnvalue></link>  <link linkend="g-mime-filter-best-encoding">g_mime_filter_best_encoding</link>       (<parameter><link linkend="GMimeFilterBest"><type>GMimeFilterBest</type></link> *best</parameter>,
                                                         <parameter><link linkend="GMimeEncodingConstraint"><type>GMimeEncodingConstraint</type></link> constraint</parameter>);
</synopsis>
</refsynopsisdiv>
<refsect1 id="GMimeFilterBest.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----<link linkend="GMimeFilter">GMimeFilter</link>
         +----GMimeFilterBest
</synopsis>
</refsect1>

<refsect1 id="GMimeFilterBest.description" role="desc">
<title role="desc.title">Description</title>
<para>
A <link linkend="GMimeFilter"><type>GMimeFilter</type></link> which is meant to determine the best charset and/or
transfer encoding suitable for the stream which is filtered through
it.
</para>
</refsect1>
<refsect1 id="GMimeFilterBest.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GMimeFilterBest-struct" role="struct">
<title>GMimeFilterBest</title>
<indexterm zone="GMimeFilterBest-struct"><primary>GMimeFilterBest</primary></indexterm>
<programlisting>typedef struct _GMimeFilterBest GMimeFilterBest;</programlisting>
<para>
A filter for calculating the best encoding and/or charset to encode
the data passed through it.
</para><variablelist role="struct">
</variablelist></refsect2>
<refsect2 id="GMimeFilterBestFlags" role="enum">
<title>enum GMimeFilterBestFlags</title>
<indexterm zone="GMimeFilterBestFlags"><primary>GMimeFilterBestFlags</primary></indexterm>
<programlisting>typedef enum {
	GMIME_FILTER_BEST_CHARSET  = (1 &lt;&lt; 0),
	GMIME_FILTER_BEST_ENCODING = (1 &lt;&lt; 1)
} GMimeFilterBestFlags;
</programlisting>
<para>
Bit flags to enable charset and/or encoding scanning to make
educated guesses as to what the best charset and/or encodings to
use for the content passed through the filter.
</para><variablelist role="enum">
<varlistentry id="GMIME-FILTER-BEST-CHARSET:CAPS" role="constant">
<term><literal>GMIME_FILTER_BEST_CHARSET</literal></term>
<listitem><simpara>Enable best-charset detection.
</simpara></listitem>
</varlistentry>
<varlistentry id="GMIME-FILTER-BEST-ENCODING:CAPS" role="constant">
<term><literal>GMIME_FILTER_BEST_ENCODING</literal></term>
<listitem><simpara>Enable best-encoding detection.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-filter-best-new" role="function">
<title>g_mime_filter_best_new ()</title>
<indexterm zone="g-mime-filter-best-new"><primary>g_mime_filter_best_new</primary></indexterm>
<programlisting><link linkend="GMimeFilter"><returnvalue>GMimeFilter</returnvalue></link> *       g_mime_filter_best_new              (<parameter><link linkend="GMimeFilterBestFlags"><type>GMimeFilterBestFlags</type></link> flags</parameter>);</programlisting>
<para>
Creates a new GMimeFilterBest filter. <parameter>flags</parameter> are used to determine
which information to keep statistics of. If the
<link linkend="GMIME-FILTER-BEST-CHARSET:CAPS"><type>GMIME_FILTER_BEST_CHARSET</type></link> bit is set, the filter will be able to
compute the best charset for encoding the stream of data
filtered. If the <link linkend="GMIME-FILTER-BEST-ENCODING:CAPS"><type>GMIME_FILTER_BEST_ENCODING</type></link> bit is set, the filter
will be able to compute the best Content-Transfer-Encoding for use
with the stream being filtered.
</para>
<para>
Note: In order for the <link linkend="g-mime-filter-best-charset"><function>g_mime_filter_best_charset()</function></link> function to
work, the stream being filtered MUST already be encoded in UTF-8.
</para><variablelist role="params">
<varlistentry><term><parameter>flags</parameter>&#160;:</term>
<listitem><simpara>filter flags
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new best filter with flags <parameter>flags</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-filter-best-charset" role="function">
<title>g_mime_filter_best_charset ()</title>
<indexterm zone="g-mime-filter-best-charset"><primary>g_mime_filter_best_charset</primary></indexterm>
<programlisting>const <link linkend="char"><returnvalue>char</returnvalue></link> *        g_mime_filter_best_charset          (<parameter><link linkend="GMimeFilterBest"><type>GMimeFilterBest</type></link> *best</parameter>);</programlisting>
<para>
Calculates the best charset for encoding the stream filtered
through the <parameter>best</parameter> filter.
</para><variablelist role="params">
<varlistentry><term><parameter>best</parameter>&#160;:</term>
<listitem><simpara>best filter
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to a string containing the name of the charset
best suited for the text filtered through <parameter>best</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-mime-filter-best-encoding" role="function">
<title>g_mime_filter_best_encoding ()</title>
<indexterm zone="g-mime-filter-best-encoding"><primary>g_mime_filter_best_encoding</primary></indexterm>
<programlisting><link linkend="GMimeContentEncoding"><returnvalue>GMimeContentEncoding</returnvalue></link>  g_mime_filter_best_encoding       (<parameter><link linkend="GMimeFilterBest"><type>GMimeFilterBest</type></link> *best</parameter>,
                                                         <parameter><link linkend="GMimeEncodingConstraint"><type>GMimeEncodingConstraint</type></link> constraint</parameter>);</programlisting>
<para>
Calculates the most efficient Content-Transfer-Encoding for the
stream filtered through <parameter>best</parameter> that fits within the encoding
<parameter>constraint</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>best</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeFilterBest"><type>GMimeFilterBest</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>constraint</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMimeEncodingConstraint"><type>GMimeEncodingConstraint</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the best encoding for the stream filtered by <parameter>best</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1 id="GMimeFilterBest.see-also">
<title>See Also</title>
<link linkend="GMimeFilter"><type>GMimeFilter</type></link>
</refsect1>

</refentry>
