1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
---|
2 | /* This file is part of the GtkHTML library. |
---|
3 | |
---|
4 | Copyright (C) 1997 Martin Jones (mjones@kde.org) |
---|
5 | Copyright (C) 1997 Torben Weis (weis@kde.org) |
---|
6 | Copyright (C) 2000 Helix Code, Inc. |
---|
7 | Copyright (C) 2001 Ximian, Inc. |
---|
8 | |
---|
9 | This library is free software; you can redistribute it and/or |
---|
10 | modify it under the terms of the GNU Library 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 GNU |
---|
17 | Library General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Library General Public License |
---|
20 | along with this library; see the file COPYING.LIB. If not, write to |
---|
21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
22 | Boston, MA 02111-1307, USA. |
---|
23 | */ |
---|
24 | |
---|
25 | #ifndef _HTMLTOKENIZER_H_ |
---|
26 | #define _HTMLTOKENIZER_H_ |
---|
27 | |
---|
28 | #include <glib-object.h> |
---|
29 | #include "htmltypes.h" |
---|
30 | |
---|
31 | #define TAG_ESCAPE 13 |
---|
32 | #define TAB_SIZE 8 |
---|
33 | |
---|
34 | #define HTML_TYPE_TOKENIZER (html_tokenizer_get_type ()) |
---|
35 | #define HTML_TOKENIZER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), HTML_TYPE_TOKENIZER, HTMLTokenizer)) |
---|
36 | #define HTML_TOKENIZER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), HTML_TYPE_TOKENIZER, HTMLTokenizerClass)) |
---|
37 | #define HTML_IS_TOKENIZER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), HTML_TYPE_TOKENIZER)) |
---|
38 | #define HTML_IS_TOKENIZER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), HTML_TYPE_TOKENIZER)) |
---|
39 | |
---|
40 | struct _HTMLTokenizerPrivate; |
---|
41 | |
---|
42 | struct _HTMLTokenizer { |
---|
43 | GObject parent; |
---|
44 | struct _HTMLTokenizerPrivate *priv; |
---|
45 | }; |
---|
46 | |
---|
47 | struct _HTMLTokenizerClass { |
---|
48 | GObjectClass parent_class; |
---|
49 | |
---|
50 | /* signals */ |
---|
51 | void (*begin) (HTMLTokenizer *, gchar *content_type); |
---|
52 | void (*end) (HTMLTokenizer *); |
---|
53 | |
---|
54 | /* virtual functions */ |
---|
55 | void (*write) (HTMLTokenizer *, const gchar *string, size_t size); |
---|
56 | gchar *(*peek_token) (HTMLTokenizer *); |
---|
57 | gchar *(*next_token) (HTMLTokenizer *); |
---|
58 | gboolean (*has_more) (HTMLTokenizer *); |
---|
59 | |
---|
60 | HTMLTokenizer *(*clone) (HTMLTokenizer *); |
---|
61 | }; |
---|
62 | |
---|
63 | GType html_tokenizer_get_type (void); |
---|
64 | |
---|
65 | HTMLTokenizer *html_tokenizer_new (void); |
---|
66 | void html_tokenizer_destroy (HTMLTokenizer *tokenizer); |
---|
67 | |
---|
68 | void html_tokenizer_begin (HTMLTokenizer *t, |
---|
69 | gchar *content_type); |
---|
70 | void html_tokenizer_write (HTMLTokenizer *t, |
---|
71 | const gchar *string, |
---|
72 | size_t size); |
---|
73 | void html_tokenizer_end (HTMLTokenizer *t); |
---|
74 | gchar * html_tokenizer_peek_token (HTMLTokenizer *t); |
---|
75 | gchar * html_tokenizer_next_token (HTMLTokenizer *t); |
---|
76 | gboolean html_tokenizer_has_more_tokens (HTMLTokenizer *t); |
---|
77 | |
---|
78 | HTMLTokenizer *html_tokenizer_clone (HTMLTokenizer *t); |
---|
79 | |
---|
80 | #endif /* _HTMLTOKENIZER_H_ */ |
---|