]> git.llucax.com Git - software/bife/bife++.git/blob - libbife/widget.h
Added a typeid() demangle example.
[software/bife/bife++.git] / libbife / widget.h
1 // vim: set expandtab tabstop=4 shiftwidth=4:
2
3 #ifndef BIFE_WIDGET_H
4 #define BIFE_WIDGET_H
5
6 #include "hit.h"
7 #include "hash.h"
8 #include <string>
9
10 namespace bife {
11
12     using std::string;
13
14     /**
15      * Base Widget Class.
16      *
17      * @todo 
18      */
19     class Widget {
20         // Typedefs
21         public:
22             /// Widget constructor function prototype.
23             typedef Widget* Constructor(const string&, const Hash&);
24             /// Widget destructor function prototype.
25             typedef void Destructor(Widget*);
26
27         // Attributes.
28         public:
29             /// Widget attributes.
30             Hash attrs;
31
32         // Methods.
33         public:
34             /**
35              * Constructor.
36              */
37             Widget(void);
38
39             /**
40              * Constructor.
41              *
42              * @param attrs Widget attributes.
43              */
44             Widget(const Hash&);
45
46             /**
47              * Destructor.
48              */
49             virtual ~Widget(void);
50
51             /**
52              * Renders the widget using a HIT template.
53              *
54              * @param  hit HIT template to use to render de widget.
55              * @return Rendered widget.
56              */
57             virtual string render(HIT&) = 0;
58
59             /**
60              * Renders the widget using a HIT template.
61              *
62              * @param  hit HIT template to use to render de widget.
63              * @return Rendered widget.
64              */
65             virtual operator string(void) const;
66     };
67
68 }
69
70 #endif