source: gaycko/trunk/src/dom/dom.h @ 4750

Last change on this file since 4750 was 4750, checked in by Jean-Yves Lamoureux, 9 years ago
  • Initial general node and table width computation
File size: 1.7 KB
Line 
1/*
2 *  Gaycko        Text mode web browser
3 *  Copyright (c) 2011 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  This library is free software. It comes without any warranty, to
7 *  the extent permitted by applicable law. You can redistribute it
8 *  and/or modify it under the terms of the Do What The Fuck You Want
9 *  To Public License, Version 2, as published by Sam Hocevar. See
10 *  http://sam.zoy.org/wtfpl/COPYING for more details.
11 */
12#ifndef _DOM_H
13#define _DOM_H
14
15#include <libxml/parser.h>
16#include <libxml/xinclude.h>
17#include <libxml/tree.h>
18#include <libxml/xmlIO.h>
19#include <libxml/HTMLparser.h>
20
21
22typedef enum  {
23    ELEM_UNKNOW = 0,
24    ELEM_TEXT,
25    ELEM_HTML,
26    ELEM_HEAD,
27    ELEM_TITLE,
28    ELEM_META,
29    ELEM_BODY,
30    ELEM_H1,
31    ELEM_BR,
32    ELEM_P,
33    ELEM_IMG,
34    ELEM_TABLE,
35    ELEM_TR,
36    ELEM_TD
37}nodeType;
38
39
40struct gProperty_ {
41    unsigned int x, y;
42    unsigned int width, height;
43};
44typedef struct gProperty_ gProperty;
45
46
47
48struct gAttribute_ {
49    char *name;
50    char *value;
51};
52typedef struct gAttribute_ gAttribute;
53
54
55
56typedef struct gNode_ gNode;
57struct gNode_ {
58    nodeType  type;
59        char        *name;
60    unsigned int level;
61   
62    unsigned int attribute_count;
63    gAttribute  *attributes;
64    char        *text;
65   
66    unsigned int children_count;
67    gNode   **children;
68   
69    gProperty *properties;
70   
71    gNode     *parent;
72};
73
74
75struct gDOM_ {
76        gNode *root;
77};
78
79typedef struct gDOM_ gDOM;
80
81
82gDOM *gaycko_convert_dom(htmlDocPtr doc);
83gNode* explore(gNode **elem, htmlNodePtr element, unsigned int level , gNode *parent);
84gNode *add_node(htmlNodePtr node);
85void destroy_node(gNode *elem);
86void pretty_print(gNode *elem);
87
88#endif
Note: See TracBrowser for help on using the repository browser.