#include "data.hpp" #include #include #include #include "idtable.hpp" #include "columns.hpp" CSMWorld::Data::Data() { mGlobals.addColumn (new StringIdColumn); mGlobals.addColumn (new RecordStateColumn); mGlobals.addColumn (new FloatValueColumn); mModels.insert (std::make_pair ( UniversalId (UniversalId::Type_Globals), new IdTable (&mGlobals) )); } CSMWorld::Data::~Data() { for (std::map::iterator iter (mModels.begin()); iter!=mModels.end(); ++iter) delete iter->second; } const CSMWorld::IdCollection& CSMWorld::Data::getGlobals() const { return mGlobals; } CSMWorld::IdCollection& CSMWorld::Data::getGlobals() { return mGlobals; } QAbstractTableModel *CSMWorld::Data::getTableModel (const UniversalId& id) { std::map::iterator iter = mModels.find (id); if (iter==mModels.end()) throw std::logic_error ("No table model available for " + id.toString()); return iter->second; } void CSMWorld::Data::merge() { mGlobals.merge(); }