1 | /* gok-word-complete.h |
---|
2 | * |
---|
3 | * Copyright 2001,2002 Sun Microsystems, Inc., |
---|
4 | * Copyright 2001,2002 University Of Toronto |
---|
5 | * |
---|
6 | * This library is free software; you can redistribute it and/or |
---|
7 | * modify it under the terms of the GNU Library General Public |
---|
8 | * License as published by the Free Software Foundation; either |
---|
9 | * version 2 of the License, or (at your option) any later version. |
---|
10 | * |
---|
11 | * This library is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | * Library General Public License for more details. |
---|
15 | * |
---|
16 | * You should have received a copy of the GNU Library General Public |
---|
17 | * License along with this library; if not, write to the |
---|
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
19 | * Boston, MA 02111-1307, USA. |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef __GOKWORDCOMPLETE_H__ |
---|
23 | #define __GOKWORDCOMPLETE_H__ |
---|
24 | |
---|
25 | #include <glib-object.h> |
---|
26 | #include "gok-output.h" |
---|
27 | |
---|
28 | #ifdef __cplusplus |
---|
29 | extern "C" { |
---|
30 | #endif /* __cplusplus */ |
---|
31 | |
---|
32 | typedef enum { |
---|
33 | GOK_WORDCOMPLETE_CHAR_TYPE_NORMAL, |
---|
34 | GOK_WORDCOMPLETE_CHAR_TYPE_BACKSPACE, |
---|
35 | GOK_WORDCOMPLETE_CHAR_TYPE_COMPOSE, /* prefix composition */ |
---|
36 | GOK_WORDCOMPLETE_CHAR_TYPE_COMBINE, /* postfix composition */ |
---|
37 | GOK_WORDCOMPLETE_CHAR_TYPE_DELIMITER |
---|
38 | } GokWordCompletionCharacterCategory; |
---|
39 | |
---|
40 | #define GOK_TYPE_WORDCOMPLETE (gok_wordcomplete_get_type ()) |
---|
41 | #define GOK_WORDCOMPLETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOK_TYPE_WORDCOMPLETE, GokWordComplete)) |
---|
42 | #define GOK_WORDCOMPLETE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GOK_TYPE_WORDCOMPLETE, GokWordCompleteClass) |
---|
43 | #define GOK_IS_WORDCOMPLETE(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GOK_TYPE_WORDCOMPLETE) |
---|
44 | #define GOK_IS_WORDCOMPLETE_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE (klass, GOK_TYPE_WORDCOMPLETE) |
---|
45 | #define GOK_WORDCOMPLETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GOK_TYPE_WORDCOMPLETE, GokWordCompleteClass)) |
---|
46 | |
---|
47 | typedef struct _GokWordComplete GokWordComplete; |
---|
48 | typedef struct _GokWordCompleteClass GokWordCompleteClass; |
---|
49 | typedef struct _GokWordCompletePrivate GokWordCompletePrivate; |
---|
50 | |
---|
51 | struct _GokWordComplete |
---|
52 | { |
---|
53 | GObject parent; |
---|
54 | GokWordCompletePrivate *priv; |
---|
55 | }; |
---|
56 | |
---|
57 | struct _GokWordCompleteClass |
---|
58 | { |
---|
59 | GObjectClass parent_class; |
---|
60 | |
---|
61 | /* public */ |
---|
62 | gboolean (* open) (GokWordComplete *complete, |
---|
63 | const gchar *directory); |
---|
64 | void (* close) (GokWordComplete *complete); |
---|
65 | gchar* (* process_unichar) (GokWordComplete *complete, gunichar letter); |
---|
66 | void (* reset) (GokWordComplete *complete); |
---|
67 | gchar** (* predict) (GokWordComplete *complete, gint num_predictions); |
---|
68 | gchar** (* predict_string) (GokWordComplete *complete, const gchar *utf8_string, |
---|
69 | gint num_predictions); |
---|
70 | gboolean (* add_new_word) (GokWordComplete *complete, |
---|
71 | const gchar *utf8_word); |
---|
72 | gboolean (* increment_word_frequency) (GokWordComplete *complete, |
---|
73 | const gchar *word); |
---|
74 | gboolean (* validate_word) (GokWordComplete *complete, |
---|
75 | const gchar *utf8_word); |
---|
76 | |
---|
77 | /* private use */ |
---|
78 | gchar* (* unichar_pop) (GokWordComplete *complete); |
---|
79 | gchar* (* unichar_push) (GokWordComplete *complete, gunichar letter); |
---|
80 | GokWordCompletionCharacterCategory (* unichar_get_category) (GokWordComplete *complete, gunichar letter); |
---|
81 | gchar* (* get_word_part) (GokWordComplete *complete); |
---|
82 | const gchar* (* get_aux_dictionary) (GokWordComplete *complete); |
---|
83 | gboolean (* set_aux_dictionary) (GokWordComplete *complete, gchar *dict_path); |
---|
84 | const gchar* (* get_delimiter) (GokWordComplete *complete); |
---|
85 | }; |
---|
86 | |
---|
87 | GType gok_wordcomplete_get_type (void); |
---|
88 | gboolean gok_wordcomplete_open (GokWordComplete *complete, gchar *directory); |
---|
89 | void gok_wordcomplete_close (GokWordComplete *complete); |
---|
90 | void gok_wordcomplete_reset (GokWordComplete *complete); |
---|
91 | gchar** gok_wordcomplete_predict (GokWordComplete *complete, gint num_predictions); |
---|
92 | gchar* gok_wordcomplete_process_unichar(GokWordComplete *complete, const gunichar letter); |
---|
93 | gchar** gok_wordcomplete_predict_string (GokWordComplete *complete, const gchar *string, |
---|
94 | gint num_predictions); |
---|
95 | |
---|
96 | gboolean gok_wordcomplete_add_new_word (GokWordComplete *complete, const char* word); |
---|
97 | gboolean gok_wordcomplete_validate_word (GokWordComplete *complete, const char* word); |
---|
98 | |
---|
99 | GokWordComplete *gok_wordcomplete_get_default (void); |
---|
100 | gchar** gok_wordcomplete_process_and_predict (GokWordComplete *complete, const gunichar letter, |
---|
101 | gint num_predictions); |
---|
102 | |
---|
103 | gchar* gok_wordcomplete_get_word_part (GokWordComplete *complete); |
---|
104 | const gchar* gok_wordcomplete_get_aux_dictionaries (GokWordComplete *complete); |
---|
105 | const gchar* gok_wordcomplete_get_delimiter (GokWordComplete *complete); |
---|
106 | gboolean gok_wordcomplete_set_aux_dictionaries (GokWordComplete *complete, gchar *dictionary_path); |
---|
107 | gboolean gok_wordcomplete_increment_word_frequency (GokWordComplete *complete, const gchar* pWord); |
---|
108 | |
---|
109 | #ifdef __cplusplus |
---|
110 | } |
---|
111 | #endif /* __cplusplus */ |
---|
112 | |
---|
113 | #endif /* #ifndef __GOKWORDCOMPLETE_H__ */ |
---|