<refentry id="camel-CamelMimeFilterBestenc">
<refmeta>
<refentrytitle role="top_of_page" id="camel-CamelMimeFilterBestenc.top_of_page">CamelMimeFilterBestenc</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAMEL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>CamelMimeFilterBestenc</refname>
<refpurpose></refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="camel-CamelMimeFilterBestenc.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
enum                <link linkend="CamelBestencRequired">CamelBestencRequired</link>;
enum                <link linkend="CamelBestencEncoding">CamelBestencEncoding</link>;
struct              <link linkend="CamelMimeFilterBestenc">CamelMimeFilterBestenc</link>;
<link linkend="CamelMimeFilterBestenc">CamelMimeFilterBestenc</link>* <link linkend="camel-mime-filter-bestenc-new">camel_mime_filter_bestenc_new</link>   (unsigned <link linkend="int">int</link> flags);
<link linkend="CamelTransferEncoding">CamelTransferEncoding</link> <link linkend="camel-mime-filter-bestenc-get-best-encoding">camel_mime_filter_bestenc_get_best_encoding</link>
                                                        (<link linkend="CamelMimeFilterBestenc">CamelMimeFilterBestenc</link> *filter,
                                                         <link linkend="CamelBestencEncoding">CamelBestencEncoding</link> required);
const <link linkend="char">char</link>*         <link linkend="camel-mime-filter-bestenc-get-best-charset">camel_mime_filter_bestenc_get_best_charset</link>
                                                        (<link linkend="CamelMimeFilterBestenc">CamelMimeFilterBestenc</link> *filter);
<link linkend="void">void</link>                <link linkend="camel-mime-filter-bestenc-set-flags">camel_mime_filter_bestenc_set_flags</link> (<link linkend="CamelMimeFilterBestenc">CamelMimeFilterBestenc</link> *filter,
                                                         unsigned <link linkend="int">int</link> flags);
</synopsis>
</refsynopsisdiv>









<refsect1 id="camel-CamelMimeFilterBestenc.description" role="desc">
<title role="desc.title">Description</title>
<para>

</para>
</refsect1>

<refsect1 id="camel-CamelMimeFilterBestenc.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CamelBestencRequired" role="enum">
<title>enum CamelBestencRequired</title>
<indexterm zone="CamelBestencRequired"><primary>CamelBestencRequired</primary></indexterm><programlisting>typedef enum _CamelBestencRequired {
	CAMEL_BESTENC_GET_ENCODING = 1&lt;&lt;0,
	CAMEL_BESTENC_GET_CHARSET = 1&lt;&lt;1,

	/* do we treat 'lf' as if it were crlf? */
	CAMEL_BESTENC_LF_IS_CRLF = 1&lt;&lt;8,
	/* do we not allow "From " to appear at the start of a line in any part? */
	CAMEL_BESTENC_NO_FROM = 1&lt;&lt;9
} CamelBestencRequired;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelBestencEncoding" role="enum">
<title>enum CamelBestencEncoding</title>
<indexterm zone="CamelBestencEncoding"><primary>CamelBestencEncoding</primary></indexterm><programlisting>typedef enum _CamelBestencEncoding {
	CAMEL_BESTENC_7BIT,
	CAMEL_BESTENC_8BIT,
	CAMEL_BESTENC_BINARY,
	
	/* is the content stream to be treated as text? */
	CAMEL_BESTENC_TEXT = 1&lt;&lt;8
} CamelBestencEncoding;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelMimeFilterBestenc" role="struct">
<title>struct CamelMimeFilterBestenc</title>
<indexterm zone="CamelMimeFilterBestenc"><primary>CamelMimeFilterBestenc</primary></indexterm><programlisting>struct CamelMimeFilterBestenc {
	CamelMimeFilter parent;

	unsigned int flags;	/* our creation flags, see above */

	unsigned int count0;	/* count of NUL characters */
	unsigned int count8;	/* count of 8 bit characters */
	unsigned int total;	/* total characters read */

	unsigned int lastc;	/* the last character read */
	int crlfnoorder;	/* if crlf's occured where they shouldn't have */

	int startofline;	/* are we at the start of a new line? */

	int fromcount;
	char fromsave[6];	/* save a few characters if we found an \n near the end of the buffer */
	int hadfrom;		/* did we encounter a "\nFrom " in the data? */

	unsigned int countline;	/* current count of characters on a given line */
	unsigned int maxline;	/* max length of any line */

	CamelCharset charset;	/* used to determine the best charset to use */
};
</programlisting>
<para>

</para></refsect2>
<refsect2 id="camel-mime-filter-bestenc-new" role="function">
<title>camel_mime_filter_bestenc_new ()</title>
<indexterm zone="camel-mime-filter-bestenc-new"><primary>camel_mime_filter_bestenc_new</primary></indexterm><programlisting><link linkend="CamelMimeFilterBestenc">CamelMimeFilterBestenc</link>* camel_mime_filter_bestenc_new   (unsigned <link linkend="int">int</link> flags);</programlisting>
<para>
Create a new <link linkend="CamelMimeFilterBestenc"><type>CamelMimeFilterBestenc</type></link> object.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>flags</parameter>&nbsp;:</term>
<listitem><simpara> a bitmask of data required.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>a new <link linkend="CamelMimeFilterBestenc"><type>CamelMimeFilterBestenc</type></link> object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-mime-filter-bestenc-get-best-encoding" role="function">
<title>camel_mime_filter_bestenc_get_best_encoding ()</title>
<indexterm zone="camel-mime-filter-bestenc-get-best-encoding"><primary>camel_mime_filter_bestenc_get_best_encoding</primary></indexterm><programlisting><link linkend="CamelTransferEncoding">CamelTransferEncoding</link> camel_mime_filter_bestenc_get_best_encoding
                                                        (<link linkend="CamelMimeFilterBestenc">CamelMimeFilterBestenc</link> *filter,
                                                         <link linkend="CamelBestencEncoding">CamelBestencEncoding</link> required);</programlisting>
<para>
Get the best encoding, given specific constraints, that can be used to
encode a stream of bytes.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>filter</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelMimeFilterBestenc"><type>CamelMimeFilterBestenc</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>required</parameter>&nbsp;:</term>
<listitem><simpara> maximum level of output encoding allowed.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>the best encoding to use
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-mime-filter-bestenc-get-best-charset" role="function">
<title>camel_mime_filter_bestenc_get_best_charset ()</title>
<indexterm zone="camel-mime-filter-bestenc-get-best-charset"><primary>camel_mime_filter_bestenc_get_best_charset</primary></indexterm><programlisting>const <link linkend="char">char</link>*         camel_mime_filter_bestenc_get_best_charset
                                                        (<link linkend="CamelMimeFilterBestenc">CamelMimeFilterBestenc</link> *filter);</programlisting>
<para>
Gets the best charset that can be used to contain this content.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>filter</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelMimeFilterBestenc"><type>CamelMimeFilterBestenc</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>the name of the best charset to use to encode the input
text filtered by <parameter>filter</parameter>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-mime-filter-bestenc-set-flags" role="function">
<title>camel_mime_filter_bestenc_set_flags ()</title>
<indexterm zone="camel-mime-filter-bestenc-set-flags"><primary>camel_mime_filter_bestenc_set_flags</primary></indexterm><programlisting><link linkend="void">void</link>                camel_mime_filter_bestenc_set_flags (<link linkend="CamelMimeFilterBestenc">CamelMimeFilterBestenc</link> *filter,
                                                         unsigned <link linkend="int">int</link> flags);</programlisting>
<para>
Set the flags for subsequent operations.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>filter</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="CamelMimeFilterBestenc"><type>CamelMimeFilterBestenc</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&nbsp;:</term>
<listitem><simpara> bestenc filter flags
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
