1 // This is core/vgui/vgui_tableau_sptr.h 2 #ifndef vgui_tableau_sptr_h_ 3 #define vgui_tableau_sptr_h_ 4 //: 5 // \file 6 // \brief Smart-pointer to a vgui_tableau 7 8 class vgui_tableau; 9 #include <vbl/vbl_smart_ptr.h> 10 11 struct vgui_tableau_sptr : public vbl_smart_ptr<vgui_tableau> { 12 typedef vbl_smart_ptr<vgui_tableau> base; 13 vgui_tableau_sptrvgui_tableau_sptr14 vgui_tableau_sptr() {} vgui_tableau_sptrvgui_tableau_sptr15 vgui_tableau_sptr(vgui_tableau* p): base(p) {} vertical_castvgui_tableau_sptr16 void vertical_cast(vgui_tableau_sptr const& that) { *this = that; } vertical_castvgui_tableau_sptr17 void vertical_cast(vgui_tableau* t) { *this = t; } 18 }; 19 20 // Stop doxygen documenting the B class 21 #ifndef DOXYGEN_SHOULD_SKIP_THIS 22 template <class T, class B = vgui_tableau_sptr> 23 struct vgui_tableau_sptr_t : public B { vgui_tableau_sptr_tvgui_tableau_sptr_t24 vgui_tableau_sptr_t(): B() {} vgui_tableau_sptr_tvgui_tableau_sptr_t25 vgui_tableau_sptr_t(T* p): B(p) {} vgui_tableau_sptr_tvgui_tableau_sptr_t26 vgui_tableau_sptr_t(vgui_tableau_sptr_t<T> const& r): B(r) {} 27 vgui_tableau_sptr_t<T>& operator=(vgui_tableau_sptr_t<T> const& r) { B::operator=(r); return *this; } 28 T* operator->() const { return (T*)this->as_pointer(); } 29 T& operator*() const { return *((T*)this->as_pointer()); } 30 }; 31 #endif // DOXYGEN_SHOULD_SKIP_THIS 32 33 #endif // vgui_tableau_sptr_h_ 34