From f7f56a1a1f965d071b00cb08cbb2d8abc3c6c20b Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 7 May 2013 11:23:18 +0200 Subject: [PATCH] added a RefIdCollection to Data --- apps/opencs/model/world/data.cpp | 12 ++++++++++++ apps/opencs/model/world/data.hpp | 6 ++++++ apps/opencs/model/world/idcollection.hpp | 6 ++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index dedbfc4e7d..9172959bba 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -140,6 +140,8 @@ CSMWorld::Data::Data() addModel (new IdTable (&mBirthsigns), UniversalId::Type_Birthsigns, UniversalId::Type_Birthsign); addModel (new IdTable (&mSpells), UniversalId::Type_Spells, UniversalId::Type_Spell); addModel (new IdTable (&mCells), UniversalId::Type_Cells, UniversalId::Type_Cell); + addModel (new IdTable (&mReferenceables), UniversalId::Type_Referenceables, + UniversalId::Type_Referenceable); } CSMWorld::Data::~Data() @@ -268,6 +270,16 @@ CSMWorld::IdCollection& CSMWorld::Data::getCells() return mCells; } +const CSMWorld::RefIdCollection& CSMWorld::Data::getReferenceables() const +{ + return mReferenceables; +} + +CSMWorld::RefIdCollection& CSMWorld::Data::getReferenceables() +{ + return mReferenceables; +} + QAbstractItemModel *CSMWorld::Data::getTableModel (const UniversalId& id) { std::map::iterator iter = mModelIndex.find (id.getType()); diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index 03a2448f11..ad6e4ba692 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -21,6 +21,7 @@ #include "idcollection.hpp" #include "universalid.hpp" #include "cell.hpp" +#include "refidcollection.hpp" class QAbstractItemModel; @@ -40,6 +41,7 @@ namespace CSMWorld IdCollection mBirthsigns; IdCollection mSpells; IdCollection mCells; + RefIdCollection mReferenceables; std::vector mModels; std::map mModelIndex; @@ -104,6 +106,10 @@ namespace CSMWorld IdCollection& getCells(); + const RefIdCollection& getReferenceables() const; + + RefIdCollection& getReferenceables(); + QAbstractItemModel *getTableModel (const UniversalId& id); ///< If no table model is available for \a id, an exception is thrown. /// diff --git a/apps/opencs/model/world/idcollection.hpp b/apps/opencs/model/world/idcollection.hpp index 93390c97b1..193e4f8e2e 100644 --- a/apps/opencs/model/world/idcollection.hpp +++ b/apps/opencs/model/world/idcollection.hpp @@ -46,10 +46,12 @@ namespace CSMWorld virtual void setData (int index, int column, const QVariant& data) = 0; - virtual void merge() = 0; +// Not in use. Temporarily removed so that the implementation of RefIdCollection can continue without +// these functions for now. +// virtual void merge() = 0; ///< Merge modified into base. - virtual void purge() = 0; +// virtual void purge() = 0; ///< Remove records that are flagged as erased. virtual void removeRows (int index, int count) = 0;