1
/*
2
 * gchardet.h
3
 * Copyright (C) 2009 Adrian Perez <aperez@igalia.com>
4
 */
5
6
#ifndef __gchardet_h__
7
#define __gchardet_h__
8
9
#include <glib.h>
10
11
/*
12
 * Copied from nsUniversalDetector.h
13
 */
14
#define G_CHARDET_CHINESE_SIMPLIFIED  0x01
15
#define G_CHARDET_CHINESE_TRADITIONAL 0x02
16
#define G_CHARDET_JAPANESE            0x04
17
#define G_CHARDET_KOREAN              0x08
18
#define G_CHARDET_NON_CJK             0x10
19
#define G_CHARDET_ALL                 0x1F
20
21
#define G_CHARDET_CHINESE (G_CHARDET_CHINESE_SIMPLIFIED | \
22
                           G_CHARDET_CHINESE_TRADITIONAL)
23
24
#define G_CHARDET_CJK (G_CHARDET_CHINESE_SIMPLIFIED | \
25
                       G_CHARDET_CHINESE_TRADITIONAL | \
26
                       G_CHARDET_JAPANESE | \
27
                       G_CHARDET_KOREAN)
28
29
G_BEGIN_DECLS
30
31
typedef void  g_chardet_t;
32
33
g_chardet_t*  g_chardet_new     (guint32 lang_filter);
34
gboolean      g_chardet_handle  (g_chardet_t* cd, const gchar *buf, guint32 len);
35
const gchar*  g_chardet_charset (g_chardet_t* cd);
36
gboolean      g_chardet_found   (g_chardet_t* cd);
37
void          g_chardet_finish  (g_chardet_t* cd);
38
void          g_chardet_free    (g_chardet_t* cd);
39
gchar*        g_chardet_detect  (const gchar *string, guint32 lang_filter);
40
41
G_END_DECLS
42
43
#endif /* !__gchardet_h__ */