summaryrefslogtreecommitdiff
path: root/gir/anthygcontext.h
blob: ec8bf67d98a6c122a84730df002472750f989ac1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* ibus-anthy - The Anthy engine for IBus
 * Copyright (c) 2012-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
 * Copyright (c) 2012 Peng Huang <shawn.p.huang@gmail.com>
 * Copyright (c) 2012-2013 Red Hat, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef __ANTHY_GCONTEXT_H_
#define __ANTHY_GCONTEXT_H_

#include <glib-object.h>
#include <anthy/anthy.h>

/*
 * Type macros.
 */
#define ANTHY_TYPE_GCONTEXT             \
    (anthy_gcontext_get_type ())
#define ANTHY_GCONTEXT(obj)             \
    (G_TYPE_CHECK_INSTANCE_CAST ((obj), ANTHY_TYPE_GCONTEXT, AnthyGContext))
#define ANTHY_GCONTEXT_CLASS(class)     \
    (G_TYPE_CHECK_CLASS_CAST ((class), ANTHY_TYPE_GCONTEXT, AnthyGContextClass))
#define ANTHY_IS_GCONTEXT(obj)          \
    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ANTHY_TYPE_GCONTEXT))
#define ANTHY_IS_GCONTEXT_CLASS(class)  \
    (G_TYPE_CHECK_CLASS_TYPE ((class), ANTHY_TYPE_GCONTEXT))
#define ANTHY_GCONTEXT_GET_CLASS(obj)   \
    (G_TYPE_INSTANCE_GET_CLASS ((obj), ANTHY_TYPE_GCONTEXT, AnthyGContextClass))

typedef struct _AnthyGContext AnthyGContext;
typedef struct _AnthyGContextPrivate AnthyGContextPrivate;
typedef struct _AnthyGContextClass AnthyGContextClass;

G_BEGIN_DECLS

/**
 * AnthyGContext:
 *
 * An #AnthyGContext is an object that handles conversion strings.
 */
struct _AnthyGContext {
    GInitiallyUnowned parent;

    AnthyGContextPrivate *priv;

    /*< private >*/
    gpointer pdummy[8];
};

struct _AnthyGContextClass {
    GInitiallyUnownedClass parent;

    /*< private >*/
    gpointer pdummy[8];
};

GType           anthy_gcontext_get_type           (void);

/**
 * anthy_gcontext_new:
 * @returns: A newly allocated #AnthyGContext
 *
 * New an #AnthyGobject.
 */
AnthyGContext   *anthy_gcontext_new               (void);

/**
 * anthy_gcontext_set_encoding:
 * @encoding: An encoding
 *
 * Set an encoding.
 */
int             anthy_gcontext_set_encoding       (AnthyGContext *obj,
                                                   int encoding);

/**
 * anthy_gcontext_init_personality:
 *
 * Initialize the personal dictionaries.
 */
void            anthy_gcontext_init_personality   (AnthyGContext *obj);

/**
 * anthy_gcontext_do_set_personality:
 * @dict_name: a Dictionary name
 *
 * Set a personal dictionary.
 */
int             anthy_gcontext_do_set_personality (AnthyGContext *obj,
                                                   const gchar  *dict_name);

/**
 * anthy_gcontext_resize_segment:
 * @nth: nth segment
 * @resize: size
 *
 * Resize the nth segment.
 */
void            anthy_gcontext_resize_segment     (AnthyGContext *obj, 
                                                   int           nth,
                                                   int           resize);
/**
 * anthy_gcontext_set_string:
 * @string: A conversion string
 *
 * Set a conversion string.
 */
int             anthy_gcontext_set_string         (AnthyGContext *obj,
                                                   const gchar * string);
/**
 * anthy_gcontext_get_nr_segments:
 * @returns: The number of the converted segments
 *
 * The number of the converted segments
 */
int             anthy_gcontext_get_nr_segments    (AnthyGContext *obj);

/**
 * anthy_gcontext_get_segment:
 * @nth_seg: Nth segment
 * @nth_lookup: Nth lookup 
 * @returns: A newly assigned string.
 *
 * A newly assigned string with @ntg_seg and @nth_lookup .
 */
gchar *         anthy_gcontext_get_segment        (AnthyGContext *obj,
                                                   int           nth_seg,
                                                   int           nth_lookup);

/**
 * anthy_gcontext_commit_segment:
 * @nth_seg: Nth segment
 * @nth_lookup: Nth lookup
 *
 * Commit a string with @ntg_seg and @nth_lookup.
 */
int             anthy_gcontext_commit_segment     (AnthyGContext *obj,
                                                   int           nth_seg,
                                                   int           nth_lookup);

/**
 * anthy_gcontext_get_nr_candidates:
 * @returns: The number of the candidates
 *
 * The number of the candidates
 */
int             anthy_gcontext_get_nr_candidates  (AnthyGContext *obj,
                                                   int           nth_seg);

/**
 * anthy_gcontext_set_prediction_string:
 * @string: A prediction string
 *
 * Set a prediction string.
 */
int             anthy_gcontext_set_prediction_string
                                                  (AnthyGContext *obj,
                                                   const gchar * string);

/**
 * anthy_gcontext_get_nr_predictions:
 * @returns: The number of the converted segments in the current
 *        prediction string.
 *
 * The number of the converted segments in the current prediction string.
 */
int             anthy_gcontext_get_nr_predictions
                                                 (AnthyGContext *obj);

/**
 * anthy_gcontext_get_prediction:
 * @nth_seg: Nth segment
 * @returns: A newly assigned string.
 *
 * A newly assigned string with @ntg_seg .
 */
gchar *         anthy_gcontext_get_prediction    (AnthyGContext *obj,
                                                  int nth_seg);

/**
 * anthy_gcontext_commit_prediction:
 * @nth_seg: Nth segment
 *
 * Commit a prediction string with @ntg_seg .
 */
int             anthy_gcontext_commit_prediction (AnthyGContext *obj,
                                                  int nth_seg);

/**
 * anthy_gcontext_set_logger:
 * @level: Log level
 *
 * Set Anthy log level.
 */
void            anthy_gcontext_set_logger        (int level);
G_END_DECLS
#endif