annotate src/doctree.hh @ 1049:a913df1621ac

comments
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Thu, 23 Apr 2009 11:49:25 +0200
parents df8153796f48
children e9729d5a1416
rev   line source
501
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
1 #ifndef __DOCTREE_HH__
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
2 #define __DOCTREE_HH__
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
3
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
4 class DoctreeNode {
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
5 public:
763
df8153796f48 initial implementation of a CSS selector matching optimization
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 562
diff changeset
6 int num; // unique ascending id
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
7 int depth;
562
145b8a4d65b3 tag -> element
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 558
diff changeset
8 int element;
501
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
9 const char *klass;
558
be6295157b10 adjust pseudo class handling
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 536
diff changeset
10 const char *pseudo;
501
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
11 const char *id;
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
12 };
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
13
1049
a913df1621ac comments
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 763
diff changeset
14 /**
a913df1621ac comments
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 763
diff changeset
15 * \brief HTML document tree interface.
a913df1621ac comments
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 763
diff changeset
16 *
a913df1621ac comments
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 763
diff changeset
17 * The Doctree class defines the interface to the parsed HTML document tree
a913df1621ac comments
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 763
diff changeset
18 * as it is used for CSS selector matching.
a913df1621ac comments
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 763
diff changeset
19 * Currently the Doctree can be represented as stack, however to support
a913df1621ac comments
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 763
diff changeset
20 * CSS adjacent siblings or for future JavaScript support it may have to
a913df1621ac comments
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 763
diff changeset
21 * be extended to a real tree.
a913df1621ac comments
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 763
diff changeset
22 */
501
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
23 class Doctree {
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
24 public:
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
25 virtual ~Doctree () {};
501
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
26 virtual const DoctreeNode *top () = 0;
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
27 virtual const DoctreeNode *parent (const DoctreeNode *node) = 0;
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
28 };
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
29
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
30 #endif