annotate src/doctree.hh @ 1214:e9729d5a1416

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