#ifndef GAME_MWWORLD_PTR_H #define GAME_MWWORLD_PTR_H #include #include #include #include "cellreflist.hpp" namespace MWWorld { class ContainerStore; class CellStore; class LiveCellRefBase; /// \brief Pointer to a LiveCellRef class Ptr { public: MWWorld::LiveCellRefBase *mRef; CellStore *mCell; ContainerStore *mContainerStore; public: Ptr(MWWorld::LiveCellRefBase *liveCellRef=0, CellStore *cell=0) : mRef(liveCellRef), mCell(cell), mContainerStore(0) { } bool isEmpty() const { return mRef == 0; } const std::string& getTypeName() const; const Class& getClass() const { if(mRef != 0) return *(mRef->mClass); throw std::runtime_error("Cannot get class of an empty object"); } template MWWorld::LiveCellRef *get() const { MWWorld::LiveCellRef *ref = dynamic_cast*>(mRef); if(ref) return ref; std::stringstream str; str<< "Bad LiveCellRef cast to "<= (const Ptr& left, const Ptr& right) { return !(left (const Ptr& left, const Ptr& right) { return rightright); } } #endif