Remove IBUS_IS_ENGINE_DESC for freed pointer in ibus-bus.c
[platform/upstream/ibus.git] / src / ibusenginesimple.h
1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
2 /* vim:set et sts=4: */
3 /* ibus - The Input Bus
4  * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
5  * Copyright (C) 2008-2010 Red Hat, Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
24 #error "Only <ibus.h> can be included directly"
25 #endif
26
27 /**
28  * SECTION: ibussimpleengine
29  * @short_description: Input method engine supporting table-based input method
30  * @title: IBusEngineSimple
31  * @stability: Stable
32  *
33  * An IBusEngineSimple provides table-based input method logic.
34  *
35  * see_also: #IBusEngine
36  */
37 #ifndef __IBUS_ENGINE_SIMPLE_H__
38 #define __IBUS_ENGINE_SIMPLE_H__
39
40 #include "ibusengine.h"
41
42 G_BEGIN_DECLS
43
44 #define IBUS_MAX_COMPOSE_LEN 7
45
46 /*
47  * Type macros.
48  */
49
50 /* define GOBJECT macros */
51 #define IBUS_TYPE_ENGINE_SIMPLE             \
52     (ibus_engine_simple_get_type ())
53 #define IBUS_ENGINE_SIMPLE(obj)             \
54     (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_ENGINE_SIMPLE, IBusEngineSimple))
55 #define IBUS_ENGINE_SIMPLE_CLASS(klass)     \
56     (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_ENGINE_SIMPLE, IBusEngineSimpleClass))
57 #define IBUS_IS_ENGINE_SIMPLE(obj)          \
58     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_ENGINE_SIMPLE))
59 #define IBUS_IS_ENGINE_SIMPLE_CLASS(klass)  \
60     (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_ENGINE_SIMPLE))
61 #define IBUS_ENGINE_SIMPLE_GET_CLASS(obj)   \
62     (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_ENGINE_SIMPLE, IBusEngineSimpleClass))
63
64 typedef struct _IBusEngineSimple IBusEngineSimple;
65 typedef struct _IBusEngineSimpleClass IBusEngineSimpleClass;
66 typedef struct _IBusEngineSimplePrivate IBusEngineSimplePrivate;
67
68 /**
69  * IBusEngineSimple:
70  *
71  * IBusEngineSimple properties.
72  */
73 struct _IBusEngineSimple {
74     /*< private >*/
75     IBusEngine parent;
76     IBusEngineSimplePrivate *priv;
77
78     /* instance members */
79     /*< public >*/
80 };
81
82 struct _IBusEngineSimpleClass {
83     /*< private >*/
84     IBusEngineClass parent;
85
86     /* class members */
87     /*< public >*/
88     /* signals */
89     
90     /*< private >*/
91     /* padding */
92     gpointer pdummy[8];
93 };
94
95 GType   ibus_engine_simple_get_type       (void);
96
97 /**
98  * ibus_engine_simple_add_table:
99  * @simple: An IBusEngineSimple.
100  * @data: (element-type guint16) (array): The table which must be available
101  *      during the whole life of the simple engine.
102  * @max_seq_len: Maximum length of a swquence in the table (cannot be greater
103  *      than %IBUS_MAX_COMPOSE_LEN)
104  *
105  * Adds an additional table to search to the engine. Each row of the table
106  * consists of max_seq_len key symbols followed by two guint16 interpreted as
107  * the high and low words of a gunicode value. Tables are searched starting from
108  * the last added.
109  *
110  * The table must be sorted in dictionary order on the numeric value of the key
111  * symbol fields. (Values beyond the length of the sequence should be zero.)
112  */
113 void    ibus_engine_simple_add_table      (IBusEngineSimple     *simple,
114                                            const guint16        *data,
115                                            gint                  max_seq_len,
116                                            gint                  n_seqs);
117
118 G_END_DECLS
119
120 #endif // __IBUS_ENGINE_SIMPLE_H__