gmime-filter-best

Name

gmime-filter-best -- 

Synopsis



struct      GMimeFilterBest;
enum        GMimeBestEncoding;
GMimeFilter* g_mime_filter_best_new         (unsigned int flags);
const char* g_mime_filter_best_charset      (GMimeFilterBest *best);
GMimePartEncodingType g_mime_filter_best_encoding
                                            (GMimeFilterBest *best,
                                             GMimeBestEncoding required);


Description

Details

struct GMimeFilterBest

struct GMimeFilterBest {

	GMimeFilter parent_object;
	
	unsigned int flags;
	
	/* for best charset detection */
	GMimeCharset charset;
	
	/* for best encoding detection */
	unsigned int count0;      /* count of null bytes */
	unsigned int count8;      /* count of 8bit bytes */
	unsigned int total;       /* total octets */
	
	unsigned int maxline;     /* longest line length */
	unsigned int linelen;     /* current line length */
	
	unsigned char frombuf[6];
	unsigned int fromlen : 4;
	unsigned int hadfrom : 1;
	
	unsigned int startline : 1;
	unsigned int midline : 1;
};


enum GMimeBestEncoding

typedef enum {
	GMIME_BEST_ENCODING_7BIT,
	GMIME_BEST_ENCODING_8BIT,
	GMIME_BEST_ENCODING_BINARY,
} GMimeBestEncoding;


g_mime_filter_best_new ()

GMimeFilter* g_mime_filter_best_new         (unsigned int flags);

Creates a new GMimeFilterBest filter. flags are used to determine which information to keep statistics of. If the GMIME_FILTER_BEST_CHARSET bit is set, the filter will be able to compute the best charset for encoding the stream of data filtered. If the GMIME_FILTER_BEST_ENCODING bit is set, the filter will be able to compute the best Content-Transfer-Encoding for use with the stream being filtered.

Note: In order for the #g_mime_filter_best_charset() function to work, the stream being filtered MUST already be encoded in UTF-8.

flags :

filter flags

Returns :

a new best filter with flags flags.


g_mime_filter_best_charset ()

const char* g_mime_filter_best_charset      (GMimeFilterBest *best);

Calculates the best charset for encoding the stream filtered through the best filter.

best :

best filter

Returns :

a pointer to a string containing the name of the charset best suited for the text filtered through best.


g_mime_filter_best_encoding ()

GMimePartEncodingType g_mime_filter_best_encoding
                                            (GMimeFilterBest *best,
                                             GMimeBestEncoding required);

Calculates the best Content-Transfer-Encoding for the stream filtered through best that fits within the required encoding.

best :

best filter

required :

encoding that all data must fit within

Returns :

the best encoding for the stream filtered by best.