comparison src/styleengine.hh @ 503:00b31843839b

implement various apply() methods
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Wed, 29 Oct 2008 16:44:28 +0100
parents 424e4f409636
children 03de2284bfa6
comparison
equal deleted inserted replaced
502:e1ff5d59c338 503:00b31843839b
2 #define __STYLEENGINE_HH__ 2 #define __STYLEENGINE_HH__
3 3
4 #include "dw/core.hh" 4 #include "dw/core.hh"
5 #include "doctree.hh" 5 #include "doctree.hh"
6 6
7 class StyleEngine { 7 class StyleEngine : public Doctree {
8 private: 8 private:
9 dw::core::style::Style *currentStyle; 9 class Node : public DoctreeNode {
10 public:
11 dw::core::style::Style *style;
12
13
14 };
15
16 lout::misc::SimpleVector <Node> *stack;
10 17
11 public: 18 public:
12 StyleEngine (); 19 StyleEngine ();
13 ~StyleEngine (); 20 ~StyleEngine ();
21
22 /* Doctree interface */
23 const DoctreeNode *top () {
24 return stack->getRef (stack->size () - 1);
25 };
26 const DoctreeNode *parent (const DoctreeNode *n) {
27 if (n->depth > 0)
28 return stack->getRef (n->depth - 1);
29 else
30 return NULL;
31 };
14 32
15 void startElement (int tag, const char *id, const char *klass, const char *style); 33 void startElement (int tag, const char *id, const char *klass, const char *style);
16 void endElement (int tag); 34 void endElement (int tag);
17 inline dw::core::style::Style *style () { return currentStyle; }; 35
36 inline dw::core::style::Style *style () {
37 return stack->getRef (stack->size () - 1)->style;
38 };
18 }; 39 };
19 40
20 #endif 41 #endif