#ifndef LAYOUT_REFERENCE_H #define LAYOUT_REFERENCE_H #include "tree_reference.h" //#include "layout_cursor.h" #include "layout_node.h" template class LayoutReference : public TreeReference { friend class LayoutCursor; public: using TreeReference::TreeReference; /* Allow every LayoutReference to be transformed into a * LayoutReference, i.e. Layout */ operator LayoutReference() const { // TODO: make sure this is kosher return *(reinterpret_cast *>(this)); } LayoutReference * pointer() { return (reinterpret_cast *>(this)); } // LayoutReference cursorReference() const; void addChild(LayoutReference l) { TreeReference::addChild(l); } LayoutReference childAtIndex(int i) { return TreeReference::childAtIndex(i); } void replaceChildAtIndex(int oldChildIndex, LayoutReference newChild) { TreeReference::replaceChildAtIndex(oldChildIndex, newChild); } int layoutOrigin() { return this->node()->layoutOrigin(); } int absoluteOrigin() { return this->node()->absoluteOrigin(); } }; typedef LayoutReference Layout; #endif