Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / camel-html-parser.h
1 /*
2  *  Copyright (C) 2001 Ximian Inc.
3  *
4  *  Authors: Michael Zucchi <notzed@ximian.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of version 2 of the GNU Lesser General Public
8  * License as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 /* WARNING
22  *
23  * DO NOT USE THIS CODE OUTSIDE OF CAMEL
24  *
25  * IT IS SUBJECT TO CHANGE OR MAY VANISH AT ANY TIME
26  */
27
28 #ifndef _CAMEL_HTML_PARSER_H
29 #define _CAMEL_HTML_PARSER_H
30
31 #include <camel/camel-object.h>
32
33 #define CAMEL_HTML_PARSER(obj)         CAMEL_CHECK_CAST (obj, camel_html_parser_get_type (), CamelHTMLParser)
34 #define CAMEL_HTML_PARSER_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_html_parser_get_type (), CamelHTMLParserClass)
35 #define CAMEL_IS_HTML_PARSER(obj)      CAMEL_CHECK_TYPE (obj, camel_html_parser_get_type ())
36
37 G_BEGIN_DECLS
38
39 typedef struct _CamelHTMLParserClass CamelHTMLParserClass;
40 typedef struct _CamelHTMLParser CamelHTMLParser;
41
42 /* Parser/tokeniser states */
43 typedef enum _camel_html_parser_t {
44         CAMEL_HTML_PARSER_DATA,                 /* raw data */
45         CAMEL_HTML_PARSER_ENT,                  /* entity in data */
46         CAMEL_HTML_PARSER_ELEMENT,              /* element (tag + attributes scanned) */
47         CAMEL_HTML_PARSER_TAG,                  /* tag */
48         CAMEL_HTML_PARSER_DTDENT,               /* dtd entity? <! blah blah > */
49         CAMEL_HTML_PARSER_COMMENT0,             /* start of comment */
50         CAMEL_HTML_PARSER_COMMENT,              /* body of comment */
51         CAMEL_HTML_PARSER_ATTR0,                /* start of attribute */
52         CAMEL_HTML_PARSER_ATTR,                 /* attribute */
53         CAMEL_HTML_PARSER_VAL0,                 /* start of value */
54         CAMEL_HTML_PARSER_VAL,                  /* value */
55         CAMEL_HTML_PARSER_VAL_ENT,              /* entity in value */
56         CAMEL_HTML_PARSER_EOD,                  /* end of current data */
57         CAMEL_HTML_PARSER_EOF,                  /* end of file */
58 } camel_html_parser_t;
59
60 struct _CamelHTMLParser {
61         CamelObject parent;
62
63         struct _CamelHTMLParserPrivate *priv;
64 };
65
66 struct _CamelHTMLParserClass {
67         CamelObjectClass parent_class;
68 };
69
70 CamelType               camel_html_parser_get_type      (void);
71 CamelHTMLParser      *camel_html_parser_new     (void);
72
73 void camel_html_parser_set_data(CamelHTMLParser *hp, const char *start, int len, int last);
74 camel_html_parser_t camel_html_parser_step(CamelHTMLParser *hp, const char **datap, int *lenp);
75 const char *camel_html_parser_left(CamelHTMLParser *hp, int *lenp);
76 const char *camel_html_parser_tag(CamelHTMLParser *hp);
77 const char *camel_html_parser_attr(CamelHTMLParser *hp, const char *name);
78 const GPtrArray *camel_html_parser_attr_list(CamelHTMLParser *hp, const GPtrArray **values);
79
80 G_END_DECLS
81
82 #endif /* ! _CAMEL_HTML_PARSER_H */