Desarrollar y descargar software de código abierto

Browse Subversion Repository

Contents of /kazehakase/trunk/module/search/kz-search-rast.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3676 - (show annotations) (download) (as text)
Sat Feb 14 02:03:29 2009 UTC (15 years, 3 months ago) by ikezoe
File MIME type: text/x-csrc
File size: 6372 byte(s)
Use macro.

1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 /*
4 * Copyright (C) 2004 Hiroyuki Ikezoe
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program 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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 #include <ctype.h>
22 #include <glib/gi18n.h>
23 #include <glib.h>
24 #include <glib/gstdio.h>
25
26 #include "kazehakase.h"
27 #include "utils/utils.h"
28 #include "glib-utils.h"
29 #include "kz-search-common.h"
30 #include "kz-search-rast.h"
31 #include "egg-pixbuf-thumbnail.h"
32 #include <rast/rast.h>
33
34
35 #define HISTORY_INDEX "history_index.rast"
36
37 typedef struct _KzSearchRastPrivate KzSearchRastPrivate;
38 struct _KzSearchRastPrivate
39 {
40 };
41
42 typedef struct _KzSearchRastClass KzSearchRastClass;
43 struct _KzSearchRastClass
44 {
45 KzSearchClass parent_class;
46 };
47
48 #define KZ_SEARCH_RAST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), KZ_TYPE_SEARCH_RAST, KzSearchRastPrivate))
49
50 #define KZ_SEARCH_RAST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KZ_TYPE_SEARCH_RAST, KzSearchRastClass))
51 #define KZ_IS_SEARCH_RAST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KZ_TYPE_SEARCH_RAST))
52 #define KZ_SEARCH_RAST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KZ_TYPE_SEARCH_RAST, KzSearchRastClass))
53
54 /* for module */
55 void kz_search_module_init (GTypeModule *module);
56 void kz_search_module_exit (void);
57 KzSearch *kz_search_module_create (void);
58
59 /* KzSearchRast Class */
60 static void kz_search_rast_class_init (KzSearchRastClass *klass);
61 static void kz_search_rast_init (KzSearchRast *search);
62
63 /* GObject Class */
64 static GObject *constructor (GType type,
65 guint n_props,
66 GObjectConstructParam *props);
67 static void dispose (GObject *object);
68
69 /* KzSearch Class */
70 static gchar *get_search_result_html (KzSearch *search, const gchar *text);
71 static KzBookmark *get_search_result_bookmark (KzSearch *search, const gchar *text);
72 static gboolean register_document (KzSearch *search,
73 const gchar *uri,
74 const gchar *title,
75 const gchar *contents,
76 GTime mtime);
77 static gboolean unregister_document (KzSearch *search, const gchar *uri);
78 static GPid optimize_index (KzSearch *search);
79 static void make_index (KzSearch *search);
80 static gboolean exist_index_dir (KzSearch *search);
81
82 static KzSearchRast *the_kz_search_rast = NULL;
83
84 static GObjectClass *parent_class;
85 static GType kz_search_rast_type = 0;
86
87 static void
88 kz_search_rast_register_type (GTypeModule *module)
89 {
90 static const GTypeInfo kz_search_rast_info =
91 {
92 sizeof (KzSearchRastClass),
93 NULL, /* base_init */
94 NULL, /* base_finalize */
95 (GClassInitFunc) kz_search_rast_class_init,
96 NULL, /* class_finalize */
97 NULL, /* class_data */
98 sizeof (KzSearchRast),
99 0, /* n_preallocs */
100 (GInstanceInitFunc) kz_search_rast_init,
101 };
102
103 kz_search_rast_type = g_type_module_register_type (module,
104 KZ_TYPE_SEARCH,
105 "KzSearchRast",
106 &kz_search_rast_info, 0);
107 }
108
109 G_MODULE_EXPORT void
110 kz_search_module_init (GTypeModule *module)
111 {
112 kz_search_rast_register_type(module);
113 }
114
115 G_MODULE_EXPORT void
116 kz_search_module_exit (void)
117 {
118 }
119
120 G_MODULE_EXPORT KzSearch *
121 kz_search_module_create (void)
122 {
123 return kz_search_rast_new();
124 }
125
126 GType
127 kz_search_rast_get_type (void)
128 {
129 return kz_search_rast_type;
130 }
131
132 static void
133 kz_search_rast_class_init (KzSearchRastClass *klass)
134 {
135 GObjectClass *object_class;
136 KzSearchClass *search_class;
137
138 parent_class = g_type_class_peek_parent (klass);
139 object_class = G_OBJECT_CLASS(klass);
140 search_class = KZ_SEARCH_CLASS(klass);
141
142 object_class->constructor = constructor;
143 object_class->dispose = dispose;
144
145 search_class->get_search_result_html = get_search_result_html;
146 search_class->get_search_result_bookmark = get_search_result_bookmark;
147 search_class->register_document = register_document;
148 search_class->unregister_document = unregister_document;
149 search_class->optimize_index = optimize_index;
150 search_class->make_index = make_index;
151 search_class->exist_index_dir = exist_index_dir;
152
153 g_type_class_add_private (object_class, sizeof(KzSearchRastPrivate));
154 }
155
156
157 static void
158 kz_search_rast_init (KzSearchRast *search)
159 {
160 rast_error_t *error;
161
162 apr_initialize();
163
164 error = rast_initialize();
165 }
166
167 static GObject *
168 constructor (GType type,
169 guint n_props,
170 GObjectConstructParam *props)
171 {
172 GObject *object;
173
174 if (!the_kz_search_rast)
175 {
176 GObjectClass *klass = G_OBJECT_CLASS(parent_class);
177 object = klass->constructor(type, n_props, props);
178 the_kz_search_rast = KZ_SEARCH_RAST(object);
179 }
180 else
181 {
182 object = g_object_ref(G_OBJECT(the_kz_search_rast));
183 }
184 return object;
185 }
186
187 static void
188 dispose (GObject *object)
189 {
190 rast_finalize();
191 apr_terminate();
192
193 if (G_OBJECT_CLASS(parent_class)->dispose)
194 G_OBJECT_CLASS(parent_class)->dispose(object);
195 }
196
197
198 KzSearch *
199 kz_search_rast_new (void)
200 {
201 return KZ_SEARCH(g_object_new(KZ_TYPE_SEARCH_RAST, NULL));
202 }
203
204 gchar *
205 get_search_result_html (KzSearch *search, const gchar *text)
206 {
207 if (!text) return NULL;
208
209 return NULL;
210 }
211
212 gboolean
213 register_document (KzSearch *search, const gchar *uri, const gchar *title, const gchar *contents, GTime mtime)
214 {
215 return FALSE;
216 }
217
218 gboolean
219 unregister_document (KzSearch *search, const gchar *uri)
220 {
221 return FALSE;
222 }
223
224 static GPid
225 optimize_index (KzSearch *search)
226 {
227 return 0;
228 }
229
230 static KzBookmark *
231 get_search_result_bookmark (KzSearch *search, const gchar *text)
232 {
233 /* not implemented yet */
234 return NULL;
235 }
236
237 static void
238 make_index (KzSearch *search)
239 {
240 }
241
242 static gboolean
243 exist_index_dir(KzSearch *search)
244 {
245 gboolean exist = FALSE;
246
247 return exist;
248 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26