00001 #ifndef hpp_CPP_BoxHierarchy_CPP_hpp
00002 #define hpp_CPP_BoxHierarchy_CPP_hpp
00003
00004
00005 #include "../HTMLParser/DOM.hpp"
00006
00007 #include "../Containers/Container.hpp"
00008
00009 #include "../CSS/CSSUnit.hpp"
00010
00011 namespace Tests
00012 {
00013 struct RendererTest;
00014 }
00015
00016 namespace HTML
00017 {
00019 namespace Renderer
00020 {
00021
00022 class Mapper;
00023
00034 class BoxHierarchy
00035 {
00036 public:
00038 typedef DOM::DOMString String;
00039
00040
00041 private:
00043 const BoxHierarchy * parent;
00045 const BoxHierarchy * previous;
00046
00048 HTML::GenericElement::ElementID tagType;
00050 String IDAttribute;
00052 String ClassAttribute;
00053
00055 mutable const BoxHierarchy * child;
00057 mutable const BoxHierarchy * next;
00058
00060 const DOM::Element * element;
00061
00062
00063 public:
00070 BoxHierarchy * enterChild(Mapper & mapper, const HTML::GenericElement::ElementID tagID, const String & ID = String(), const String & Class = String()) const;
00071
00078 BoxHierarchy * nextChild(Mapper & mapper, const HTML::GenericElement::ElementID tagID, const String & ID = String(), const String & Class = String()) const;
00079
00082 inline const DOM::Element * getElement() const { return element; }
00083
00087 inline bool isTaggedAs(const HTML::GenericElement::ElementID tagID) const { return tagType == tagID; }
00088
00089
00090 public:
00092 friend class Mapper;
00094 friend struct ::Tests::RendererTest;
00095
00096
00097 public:
00099 BoxHierarchy(const HTML::GenericElement::ElementID tagID, const String & ID = String(), const String & Class = String()) : tagType(tagID), IDAttribute(ID), ClassAttribute(Class), parent(0), previous(0), child(0), next(0), element(0) {}
00100 };
00101 }
00102 }
00103
00104 #endif