Statistics
| Branch: | Tag: | Revision:

root / libsylph / html.h @ aebfd4cc

History | View | Annotate | Download (1002 Bytes)

1
/*
2
 * LibSylph -- E-Mail client library
3
 * Copyright (C) 1999-2011 Hiroyuki Yamamoto
4
 */
5

    
6
#ifndef __HTML_H__
7
#define __HTML_H__
8

    
9
#include <glib.h>
10
#include <stdio.h>
11

    
12
#include "codeconv.h"
13

    
14
typedef enum
15
{
16
        HTML_NORMAL,
17
        HTML_PAR,
18
        HTML_BR,
19
        HTML_HR,
20
        HTML_HREF,
21
        HTML_IMG,
22
        HTML_FONT,
23
        HTML_PRE,
24
        HTML_UNKNOWN,
25
        HTML_CONV_FAILED,
26
        HTML_ERR,
27
        HTML_EOF
28
} HTMLState;
29

    
30
typedef struct _HTMLParser        HTMLParser;
31
typedef struct _HTMLAttr        HTMLAttr;
32
typedef struct _HTMLTag                HTMLTag;
33

    
34
struct _HTMLParser
35
{
36
        FILE *fp;
37
        CodeConverter *conv;
38

    
39
        GHashTable *symbol_table;
40

    
41
        GString *str;
42
        GString *buf;
43

    
44
        gchar *bufp;
45

    
46
        HTMLState state;
47

    
48
        gchar *href;
49

    
50
        gboolean newline;
51
        gboolean empty_line;
52
        gboolean space;
53
        gboolean pre;
54
};
55

    
56
struct _HTMLAttr
57
{
58
        gchar *name;
59
        gchar *value;
60
};
61

    
62
struct _HTMLTag
63
{
64
        gchar *name;
65
        GList *attr;
66
};
67

    
68
HTMLParser *html_parser_new        (FILE                *fp,
69
                                 CodeConverter        *conv);
70
void html_parser_destroy        (HTMLParser        *parser);
71
const gchar *html_parse                (HTMLParser        *parser);
72

    
73
#endif /* __HTML_H__ */