1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  *  Copyright (C) 2000 - 2004 Hiroyuki Komatsu <komatsu@taiyaki.org>
4  *  Copyright (C) 2004 Hiroaki Nakamura <hnakamur@good-day.co.jp>
5  *  Copyright (C) 2005 Hiroyuki Ikezoe <poincare@ikezoe.net>
6  *  Copyright (C) 2005 Takuro Ashie <ashie@homa.ne.jp>
7  *  Copyright (C) 2006 Juernjakob Harder <juernjakob.harder@gmail.com>
8  *
9  *  This library is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU Lesser General Public
11  *  License as published by the Free Software Foundation; either
12  *  version 2 of the License, or (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public
20  *  License along with this program; if not, write to the
21  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22  *  Boston, MA  02111-1307  USA
23  *
24  *  $Id: tomoe-dict.h 1475 2007-06-15 06:17:55Z ikezoe $
25  */
26 
27 #ifndef __TOMOE_DICT_H__
28 #define __TOMOE_DICT_H__
29 
30 #include <glib-object.h>
31 
32 G_BEGIN_DECLS
33 
34 #include "tomoe-module.h"
35 #include "tomoe-char.h"
36 #include "tomoe-query.h"
37 
38 #define TOMOE_TYPE_DICT            (tomoe_dict_get_type ())
39 #define TOMOE_DICT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOMOE_TYPE_DICT, TomoeDict))
40 #define TOMOE_DICT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), TOMOE_TYPE_DICT, TomoeDictClass))
41 #define TOMOE_IS_DICT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOMOE_TYPE_DICT))
42 #define TOMOE_IS_DICT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOMOE_TYPE_DICT))
43 #define TOMOE_DICT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), TOMOE_TYPE_DICT, TomoeDictClass))
44 
45 typedef struct _TomoeDict TomoeDict;
46 typedef struct _TomoeDictClass TomoeDictClass;
47 
48 struct _TomoeDict
49 {
50     GObject object;
51 };
52 
53 struct _TomoeDictClass
54 {
55     GObjectClass parent_class;
56 
57     const gchar    *(*get_name)            (TomoeDict     *dict);
58     gboolean        (*register_char)       (TomoeDict     *dict,
59                                             TomoeChar     *chr);
60     gboolean        (*unregister_char)     (TomoeDict     *dict,
61                                             const gchar   *utf8);
62     TomoeChar      *(*get_char)            (TomoeDict     *dict,
63                                             const gchar   *utf8);
64     GList          *(*search)              (TomoeDict     *dict,
65                                             TomoeQuery    *query);
66     gboolean        (*flush)               (TomoeDict     *dict);
67     gboolean        (*copy)                (TomoeDict     *src_dict,
68                                             TomoeDict     *dest_dict);
69     gboolean        (*is_editable)         (TomoeDict     *dict);
70     gboolean        (*is_available)        (TomoeDict     *dict);
71     gchar          *(*get_available_private_utf8) (TomoeDict *dict);
72 };
73 
74 GType           tomoe_dict_get_type (void) G_GNUC_CONST;
75 
76 void            tomoe_dict_init        (void);
77 void            tomoe_dict_quit        (void);
78 
79 const gchar    *tomoe_dict_get_default_module_dir   (void);
80 void            tomoe_dict_set_default_module_dir   (const gchar *dir);
81 
82 void            tomoe_dict_load        (const gchar *base_dir);
83 TomoeModule    *tomoe_dict_load_module (const gchar *name);
84 void            tomoe_dict_unload      (void);
85 GList          *tomoe_dict_get_registered_types (void);
86 GList          *tomoe_dict_get_log_domains      (void);
87 
88 TomoeDict      *tomoe_dict_new         (const gchar *name,
89                                         const gchar *first_property,
90                                         ...);
91 
92 const gchar    *tomoe_dict_get_name             (TomoeDict     *dict);
93 
94 /* Editable methods */
95 gboolean        tomoe_dict_register_char        (TomoeDict     *dict,
96                                                  TomoeChar     *chr);
97 
98 gboolean        tomoe_dict_unregister_char      (TomoeDict     *dict,
99                                                  const gchar   *utf8);
100 
101 TomoeChar      *tomoe_dict_get_char             (TomoeDict     *dict,
102                                                  const gchar   *utf8);
103 
104 /* search method */
105 GList          *tomoe_dict_search               (TomoeDict     *dict,
106                                                  TomoeQuery    *query);
107 
108 gboolean        tomoe_dict_flush                (TomoeDict     *dict);
109 
110 gboolean        tomoe_dict_copy                 (TomoeDict     *src_dict,
111                                                  TomoeDict     *dest_dict);
112 
113 gboolean        tomoe_dict_plain_copy           (TomoeDict     *src_dict,
114                                                  TomoeDict     *dest_dict);
115 
116 gboolean        tomoe_dict_is_editable          (TomoeDict *dict);
117 gboolean        tomoe_dict_is_available         (TomoeDict *dict);
118 
119 gchar          *tomoe_dict_get_available_private_utf8 (TomoeDict *dict);
120 
121 G_END_DECLS
122 
123 #endif /* __TOMOE_DICT_H__ */
124 
125 /*
126 vi:ts=4:nowrap:ai:expandtab
127 */
128