html/style.hh

00001 /* -*- mode: c++; c-basic-offset: 4; -*- */
00002 #ifndef HTML_STYLE_HH
00003 #define HTML_STYLE_HH
00004 
00005 #include <string>
00006 #include "html/Attrib.hh"
00007 
00008 namespace html {
00009     class color;
00010     class font;
00011     class size;
00012     class writer;
00013 
00020     class StyleClass : public attList {
00021     public:
00025         StyleClass(void);
00026 
00030         ~StyleClass(void);
00031         
00036         void putAttr(writer& w) const;
00037 
00043         StyleClass& setColor(const color& c);
00044 
00050         StyleClass& setFace(const font& c);
00051 
00057         StyleClass& setSize(const size& c);
00058 
00064         StyleClass& setWeight(const std::string& c);
00065     };
00066 
00073     class style {
00074     public:
00078         style(void);
00079 
00083         ~style(void);
00084 
00090         void addClass(const std::string& name, const StyleClass& c);
00091 
00096         void write(writer& w) const;
00097 
00102         bool empty(void) const;
00103 
00104     private:
00105         typedef std::map<std::string, StyleClass> StyleDict;
00106         typedef StyleDict::iterator style_iterator;
00107         typedef StyleDict::const_iterator const_style_iterator;
00108 
00109         StyleDict mDict;
00110     };
00111 
00112 }
00113 
00114 inline bool
00115 html::style::empty(void) const {
00116     return mDict.empty();
00117 }
00118 
00119 #endif //  HTML_STYLE_HH

Generated on Sun Mar 8 19:20:48 2009 for dmt by  doxygen 1.5.4