Changes as per feedback comments.

test
cc9cii 10 years ago
parent 7990fab708
commit 1220369da3

@ -120,8 +120,6 @@ namespace CSMWorld
virtual const Record<ESXRecordT>& getRecord (int index) const; virtual const Record<ESXRecordT>& getRecord (int index) const;
virtual Record<ESXRecordT>& getRecord (int index);
virtual int getAppendIndex (const std::string& id, virtual int getAppendIndex (const std::string& id,
UniversalId::Type type = UniversalId::Type_None) const; UniversalId::Type type = UniversalId::Type_None) const;
///< \param type Will be ignored, unless the collection supports multiple record types ///< \param type Will be ignored, unless the collection supports multiple record types
@ -151,7 +149,7 @@ namespace CSMWorld
void setRecord (int index, const Record<ESXRecordT>& record); void setRecord (int index, const Record<ESXRecordT>& record);
///< \attention This function must not change the ID. ///< \attention This function must not change the ID.
NestableColumn *getNestableColumn (int column); NestableColumn *getNestableColumn (int column) const;
}; };
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
@ -294,7 +292,7 @@ namespace CSMWorld
} }
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
NestableColumn *Collection<ESXRecordT, IdAccessorT>::getNestableColumn (int column) NestableColumn *Collection<ESXRecordT, IdAccessorT>::getNestableColumn (int column) const
{ {
if (column < 0 || column >= static_cast<int>(mColumns.size())) if (column < 0 || column >= static_cast<int>(mColumns.size()))
throw std::runtime_error("column index out of range"); throw std::runtime_error("column index out of range");
@ -435,12 +433,6 @@ namespace CSMWorld
return mRecords.at (index); return mRecords.at (index);
} }
template<typename ESXRecordT, typename IdAccessorT>
Record<ESXRecordT>& Collection<ESXRecordT, IdAccessorT>::getRecord (int index)
{
return mRecords.at (index);
}
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
void Collection<ESXRecordT, IdAccessorT>::insertRecord (const RecordBase& record, int index, void Collection<ESXRecordT, IdAccessorT>::insertRecord (const RecordBase& record, int index,
UniversalId::Type type) UniversalId::Type type)

@ -26,12 +26,11 @@ int CSMWorld::ColumnBase::getId() const
void CSMWorld::NestableColumn::addColumn(CSMWorld::NestableColumn *column) void CSMWorld::NestableColumn::addColumn(CSMWorld::NestableColumn *column)
{ {
mNestedColumns.push_back(column); mNestedColumns.push_back(column);
mHasChildren = true;
} }
const CSMWorld::ColumnBase& CSMWorld::NestableColumn::nestedColumn(int subColumn) const const CSMWorld::ColumnBase& CSMWorld::NestableColumn::nestedColumn(int subColumn) const
{ {
if (!mHasChildren) if (mNestedColumns.empty())
throw std::logic_error("Tried to access nested column of the non-nest column"); throw std::logic_error("Tried to access nested column of the non-nest column");
return *mNestedColumns.at(subColumn); return *mNestedColumns.at(subColumn);
@ -39,7 +38,7 @@ const CSMWorld::ColumnBase& CSMWorld::NestableColumn::nestedColumn(int subColumn
CSMWorld::NestableColumn::NestableColumn(int columnId, CSMWorld::ColumnBase::Display displayType, CSMWorld::NestableColumn::NestableColumn(int columnId, CSMWorld::ColumnBase::Display displayType,
int flag) int flag)
: mHasChildren(false), CSMWorld::ColumnBase(columnId, displayType, flag) : CSMWorld::ColumnBase(columnId, displayType, flag)
{ {
} }
@ -53,5 +52,5 @@ CSMWorld::NestableColumn::~NestableColumn()
bool CSMWorld::NestableColumn::hasChildren() const bool CSMWorld::NestableColumn::hasChildren() const
{ {
return mHasChildren; return !mNestedColumns.empty();
} }

@ -137,7 +137,6 @@ namespace CSMWorld
class NestableColumn : public ColumnBase class NestableColumn : public ColumnBase
{ {
std::vector<NestableColumn *> mNestedColumns; std::vector<NestableColumn *> mNestedColumns;
bool mHasChildren;
public: public:

@ -2271,64 +2271,39 @@ namespace CSMWorld
PathgridPointListColumn () PathgridPointListColumn ()
: Column<ESXRecordT> (Columns::ColumnId_PathgridPoints, : Column<ESXRecordT> (Columns::ColumnId_PathgridPoints,
ColumnBase::Display_PathgridPointList, ColumnBase::Flag_Dialogue) ColumnBase::Display_PathgridPointList, ColumnBase::Flag_Dialogue)
{ {}
}
virtual QVariant get (const Record<ESXRecordT>& record) const virtual QVariant get (const Record<ESXRecordT>& record) const
{ {
return true; // required by IdTree::hasChildren() return true; // required by IdTree::hasChildren()
} }
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
}
virtual bool isEditable() const virtual bool isEditable() const
{ {
return true; return true;
} }
}; };
template<typename ESXRecordT> struct PathgridIndexColumn : public NestableColumn
struct PathgridIndexColumn : public Column<ESXRecordT>
{ {
PathgridIndexColumn() PathgridIndexColumn()
: Column<ESXRecordT> (Columns::ColumnId_PathgridIndex, ColumnBase::Display_Integer) : NestableColumn (Columns::ColumnId_PathgridIndex,
ColumnBase::Display_Integer, ColumnBase::Flag_Dialogue)
{} {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QVariant(); // FIXME
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
}
virtual bool isEditable() const virtual bool isEditable() const
{ {
return false; return false;
} }
}; };
template<typename ESXRecordT> struct PathgridPointColumn : public NestableColumn
struct PathgridPointColumn : public Column<ESXRecordT>
{ {
int mIndex; // 0=PosX, 1=PosY, 2=PosZ
PathgridPointColumn(int index) PathgridPointColumn(int index)
: Column<ESXRecordT> (Columns::ColumnId_PathgridPosX+index, ColumnBase::Display_Integer), mIndex(index) : NestableColumn (Columns::ColumnId_PathgridPosX+index,
ColumnBase::Display_Integer, ColumnBase::Flag_Dialogue)
{} {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QVariant(); // FIXME
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
}
virtual bool isEditable() const virtual bool isEditable() const
{ {
return true; return true;
@ -2341,18 +2316,13 @@ namespace CSMWorld
PathgridEdgeListColumn () PathgridEdgeListColumn ()
: Column<ESXRecordT> (Columns::ColumnId_PathgridEdges, : Column<ESXRecordT> (Columns::ColumnId_PathgridEdges,
ColumnBase::Display_PathgridEdgeList, ColumnBase::Flag_Dialogue) ColumnBase::Display_PathgridEdgeList, ColumnBase::Flag_Dialogue)
{ {}
}
virtual QVariant get (const Record<ESXRecordT>& record) const virtual QVariant get (const Record<ESXRecordT>& record) const
{ {
return true; // required by IdTree::hasChildren() return true; // required by IdTree::hasChildren()
} }
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
}
virtual bool isEditable() const virtual bool isEditable() const
{ {
return true; return true;
@ -2360,46 +2330,25 @@ namespace CSMWorld
}; };
template<typename ESXRecordT> struct PathgridEdgeIndexColumn : public NestableColumn
struct PathgridEdgeIndexColumn : public Column<ESXRecordT>
{ {
PathgridEdgeIndexColumn() PathgridEdgeIndexColumn()
: Column<ESXRecordT> (Columns::ColumnId_PathgridEdgeIndex, ColumnBase::Display_Integer) : NestableColumn (Columns::ColumnId_PathgridEdgeIndex,
ColumnBase::Display_Integer, ColumnBase::Flag_Dialogue)
{} {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QVariant(); // FIXME
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
}
virtual bool isEditable() const virtual bool isEditable() const
{ {
return false; return false;
} }
}; };
template<typename ESXRecordT> struct PathgridEdgeColumn : public NestableColumn
struct PathgridEdgeColumn : public Column<ESXRecordT>
{ {
int mIndex;
PathgridEdgeColumn (int index) PathgridEdgeColumn (int index)
: Column<ESXRecordT> (Columns::ColumnId_PathgridEdge0+index, ColumnBase::Display_Integer), mIndex(index) : NestableColumn (Columns::ColumnId_PathgridEdge0+index,
{ ColumnBase::Display_Integer, ColumnBase::Flag_Dialogue)
} {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QVariant(); // FIXME
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
}
virtual bool isEditable() const virtual bool isEditable() const
{ {

@ -287,11 +287,6 @@ int CSMWorld::Columns::getId (const std::string& name)
namespace namespace
{ {
static const char *sSkills[] =
{
"Long Blade"
};
static const char *sSpecialisations[] = static const char *sSpecialisations[] =
{ {
"Combat", "Magic", "Stealth", 0 "Combat", "Magic", "Stealth", 0
@ -394,7 +389,6 @@ namespace
switch (column) switch (column)
{ {
case CSMWorld::Columns::ColumnId_Specialisation: return sSpecialisations; case CSMWorld::Columns::ColumnId_Specialisation: return sSpecialisations;
case CSMWorld::Columns::ColumnId_Skill: return sSkills;
case CSMWorld::Columns::ColumnId_Attribute: return sAttributes; case CSMWorld::Columns::ColumnId_Attribute: return sAttributes;
case CSMWorld::Columns::ColumnId_SpellType: return sSpellTypes; case CSMWorld::Columns::ColumnId_SpellType: return sSpellTypes;
case CSMWorld::Columns::ColumnId_ApparatusType: return sApparatusTypes; case CSMWorld::Columns::ColumnId_ApparatusType: return sApparatusTypes;

@ -185,7 +185,9 @@ CSMWorld::DeleteNestedCommand::DeleteNestedCommand (IdTree& model,
mNestedRow(nestedRow), mNestedRow(nestedRow),
NestedTableStoring(model, id, parentColumn) NestedTableStoring(model, id, parentColumn)
{ {
setText (("Delete nested row in " + mId).c_str()); std::string title =
model.headerData(parentColumn, Qt::Horizontal, Qt::DisplayRole).toString().toUtf8().constData();
setText (("Delete row in " + title + " sub-table of " + mId).c_str());
} }
void CSMWorld::DeleteNestedCommand::redo() void CSMWorld::DeleteNestedCommand::redo()
@ -211,7 +213,9 @@ CSMWorld::AddNestedCommand::AddNestedCommand(IdTree& model, const std::string& i
QUndoCommand(parent), QUndoCommand(parent),
NestedTableStoring(model, id, parentColumn) NestedTableStoring(model, id, parentColumn)
{ {
setText (("Added nested row in " + mId).c_str()); std::string title =
model.headerData(parentColumn, Qt::Horizontal, Qt::DisplayRole).toString().toUtf8().constData();
setText (("Add row in " + title + " sub-table of " + mId).c_str());
} }
void CSMWorld::AddNestedCommand::redo() void CSMWorld::AddNestedCommand::redo()

@ -263,17 +263,17 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
mPathgrids.addAdapter (std::make_pair(pointList, new PathgridPointListAdapter<Pathgrid> ())); mPathgrids.addAdapter (std::make_pair(pointList, new PathgridPointListAdapter<Pathgrid> ()));
// new objects deleted in dtor of NestableColumn // new objects deleted in dtor of NestableColumn
// WARNING: The order of the columns below are assumed in PathgridPointListAdapter // WARNING: The order of the columns below are assumed in PathgridPointListAdapter
mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridIndexColumn<Pathgrid> ()); mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridIndexColumn ());
mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridPointColumn<Pathgrid> (0)); mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridPointColumn (0));
mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridPointColumn<Pathgrid> (1)); mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridPointColumn (1));
mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridPointColumn<Pathgrid> (2)); mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridPointColumn (2));
PathgridEdgeListColumn<Pathgrid> *edgeList = new PathgridEdgeListColumn<Pathgrid> (); PathgridEdgeListColumn<Pathgrid> *edgeList = new PathgridEdgeListColumn<Pathgrid> ();
mPathgrids.addColumn (edgeList); mPathgrids.addColumn (edgeList);
mPathgrids.addAdapter (std::make_pair(edgeList, new PathgridEdgeListAdapter<Pathgrid> ())); mPathgrids.addAdapter (std::make_pair(edgeList, new PathgridEdgeListAdapter<Pathgrid> ()));
mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridEdgeIndexColumn<Pathgrid> ()); mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridEdgeIndexColumn ());
mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridEdgeColumn<Pathgrid> (0)); mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridEdgeColumn (0));
mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridEdgeColumn<Pathgrid> (1)); mPathgrids.getNestableColumn(mPathgrids.getColumns()-1)->addColumn(new PathgridEdgeColumn (1));
mStartScripts.addColumn (new StringIdColumn<ESM::StartScript>); mStartScripts.addColumn (new StringIdColumn<ESM::StartScript>);
mStartScripts.addColumn (new RecordStateColumn<ESM::StartScript>); mStartScripts.addColumn (new RecordStateColumn<ESM::StartScript>);

@ -22,7 +22,7 @@ namespace CSMWorld
virtual void removeNestedRow(Record<ESXRecordT>& record, int rowToRemove) const = 0; virtual void removeNestedRow(Record<ESXRecordT>& record, int rowToRemove) const = 0;
virtual void setNestedTable(Record<ESXRecordT>& record, const NestedTableWrapperBase& nestedTable) = 0; virtual void setNestedTable(Record<ESXRecordT>& record, const NestedTableWrapperBase& nestedTable) const = 0;
virtual NestedTableWrapperBase* nestedTable(const Record<ESXRecordT>& record) const = 0; virtual NestedTableWrapperBase* nestedTable(const Record<ESXRecordT>& record) const = 0;

@ -102,7 +102,7 @@ namespace CSMWorld
} }
}; };
virtual void setNestedTable(Record<ESXRecordT>& record, const NestedTableWrapperBase& nestedTable) virtual void setNestedTable(Record<ESXRecordT>& record, const NestedTableWrapperBase& nestedTable) const
{ {
record.get().mPoints = record.get().mPoints =
static_cast<const PathgridPointsWrap &>(nestedTable).mRecord.mPoints; static_cast<const PathgridPointsWrap &>(nestedTable).mRecord.mPoints;
@ -204,7 +204,7 @@ namespace CSMWorld
record.setModified (pathgrid); record.setModified (pathgrid);
} }
virtual void setNestedTable(Record<ESXRecordT>& record, const NestedTableWrapperBase& nestedTable) virtual void setNestedTable(Record<ESXRecordT>& record, const NestedTableWrapperBase& nestedTable) const
{ {
record.get().mEdges = record.get().mEdges =
static_cast<const NestedTableWrapper<ESM::Pathgrid::EdgeList> &>(nestedTable).mNestedTable; static_cast<const NestedTableWrapper<ESM::Pathgrid::EdgeList> &>(nestedTable).mNestedTable;

@ -145,8 +145,8 @@ namespace CSMWorld
{ {
CastableHelper<ESXRecordT>::getRecord(data, index).get().mSpells.mList.at(subRowIndex) = std::string(value.toString().toUtf8()); CastableHelper<ESXRecordT>::getRecord(data, index).get().mSpells.mList.at(subRowIndex) = std::string(value.toString().toUtf8());
} }
else
throw std::logic_error("Trying to access non-existing column in the nested table!"); throw std::logic_error("Trying to access non-existing column in the nested table!");
} }
virtual void addNestedRow (RefIdData& data, int index, int position) const virtual void addNestedRow (RefIdData& data, int index, int position) const

@ -57,7 +57,7 @@ void CSMWorld::NestedRefIdAdapter::addNestedRow (const RefIdColumn *column, RefI
getHelper(column)->addNestedRow(data, index, position); //This code grows more boring and boring. I would love some macros. getHelper(column)->addNestedRow(data, index, position); //This code grows more boring and boring. I would love some macros.
} }
void CSMWorld::NestedRefIdAdapter::setNestedTable (const RefIdColumn* column, RefIdData& data, int index, const NestedTableWrapperBase& nestedTable) void CSMWorld::NestedRefIdAdapter::setNestedTable (const RefIdColumn* column, RefIdData& data, int index, const NestedTableWrapperBase& nestedTable) const
{ {
getHelper(column)->setNestedTable(data, index, nestedTable); getHelper(column)->setNestedTable(data, index, nestedTable);
} }

@ -69,7 +69,7 @@ namespace CSMWorld
virtual void addNestedRow (const RefIdColumn *column, RefIdData& data, int index, int position) const = 0; virtual void addNestedRow (const RefIdColumn *column, RefIdData& data, int index, int position) const = 0;
virtual void setNestedTable (const RefIdColumn* column, RefIdData& data, int index, const NestedTableWrapperBase& nestedTable) = 0; virtual void setNestedTable (const RefIdColumn* column, RefIdData& data, int index, const NestedTableWrapperBase& nestedTable) const = 0;
virtual NestedTableWrapperBase* nestedTable (const RefIdColumn* column, const RefIdData& data, int index) const = 0; virtual NestedTableWrapperBase* nestedTable (const RefIdColumn* column, const RefIdData& data, int index) const = 0;
}; };
@ -97,7 +97,7 @@ namespace CSMWorld
virtual void addNestedRow (const RefIdColumn *column, RefIdData& data, int index, int position) const; virtual void addNestedRow (const RefIdColumn *column, RefIdData& data, int index, int position) const;
virtual void setNestedTable (const RefIdColumn* column, RefIdData& data, int index, const NestedTableWrapperBase& nestedTable); virtual void setNestedTable (const RefIdColumn* column, RefIdData& data, int index, const NestedTableWrapperBase& nestedTable) const;
virtual NestedTableWrapperBase* nestedTable (const RefIdColumn* column, const RefIdData& data, int index) const; virtual NestedTableWrapperBase* nestedTable (const RefIdColumn* column, const RefIdData& data, int index) const;

@ -25,8 +25,7 @@ bool CSMWorld::RefIdColumn::isUserEditable() const
return mUserEditable; return mUserEditable;
} }
// FIXME: const problem const CSMWorld::RefIdAdapter& CSMWorld::RefIdCollection::findAdapter (UniversalId::Type type) const
/*const*/ CSMWorld::RefIdAdapter& CSMWorld::RefIdCollection::findAdapter (UniversalId::Type type) const
{ {
std::map<UniversalId::Type, RefIdAdapter *>::const_iterator iter = mAdapters.find (type); std::map<UniversalId::Type, RefIdAdapter *>::const_iterator iter = mAdapters.find (type);
@ -684,10 +683,8 @@ void CSMWorld::RefIdCollection::setNestedTable(int row, int column, const CSMWor
{ {
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (row); RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (row);
// FIXME: const problem const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdapter (localIndex.second));
CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<CSMWorld::NestedRefIdAdapter&>(findAdapter (localIndex.second));
// FIXME: const problem
adaptor.setNestedTable(&mColumns.at(column), mData, localIndex.first, nestedTable); adaptor.setNestedTable(&mColumns.at(column), mData, localIndex.first, nestedTable);
} }

@ -46,7 +46,7 @@ namespace CSMWorld
private: private:
/*const*/ RefIdAdapter& findAdapter (UniversalId::Type) const; const RefIdAdapter& findAdapter (UniversalId::Type) const;
///< Throws an exception if no adaptor for \a Type can be found. ///< Throws an exception if no adaptor for \a Type can be found.
public: public:

@ -32,7 +32,7 @@ namespace CSMWorld
virtual void loadRecord (ESXRecordT& record, ESM::ESMReader& reader); virtual void loadRecord (ESXRecordT& record, ESM::ESMReader& reader);
NestedIdAdapter<ESXRecordT>* getAdapter(const ColumnBase &column) const; const NestedIdAdapter<ESXRecordT>& getAdapter(const ColumnBase &column) const;
public: public:
@ -88,7 +88,7 @@ namespace CSMWorld
} }
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
NestedIdAdapter<ESXRecordT>* SubCellCollection<ESXRecordT, IdAccessorT>::getAdapter(const ColumnBase &column) const const NestedIdAdapter<ESXRecordT>& SubCellCollection<ESXRecordT, IdAccessorT>::getAdapter(const ColumnBase &column) const
{ {
typename std::map<const ColumnBase *, NestedIdAdapter<ESXRecordT>* >::const_iterator iter = typename std::map<const ColumnBase *, NestedIdAdapter<ESXRecordT>* >::const_iterator iter =
mAdapters.find (&column); mAdapters.find (&column);
@ -96,28 +96,36 @@ namespace CSMWorld
if (iter==mAdapters.end()) if (iter==mAdapters.end())
throw std::logic_error("No such column in the nestedidadapter"); throw std::logic_error("No such column in the nestedidadapter");
return iter->second; return *iter->second;
} }
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
void SubCellCollection<ESXRecordT, IdAccessorT>::addNestedRow(int row, int column, int position) void SubCellCollection<ESXRecordT, IdAccessorT>::addNestedRow(int row, int column, int position)
{ {
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column))->addNestedRow( Record<ESXRecordT> record;
Collection<ESXRecordT, IdAccessorT>::getRecord(row), position); record.assign(Collection<ESXRecordT, IdAccessorT>::getRecord(row));
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).addNestedRow(record, position);
Collection<ESXRecordT, IdAccessorT>::setRecord(row, record);
} }
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
void SubCellCollection<ESXRecordT, IdAccessorT>::removeNestedRows(int row, int column, int subRow) void SubCellCollection<ESXRecordT, IdAccessorT>::removeNestedRows(int row, int column, int subRow)
{ {
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column))->removeNestedRow( Record<ESXRecordT> record;
Collection<ESXRecordT, IdAccessorT>::getRecord(row), subRow); record.assign(Collection<ESXRecordT, IdAccessorT>::getRecord(row));
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).removeNestedRow(record, subRow);
Collection<ESXRecordT, IdAccessorT>::setRecord(row, record);
} }
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
QVariant SubCellCollection<ESXRecordT, IdAccessorT>::getNestedData (int row, QVariant SubCellCollection<ESXRecordT, IdAccessorT>::getNestedData (int row,
int column, int subRow, int subColumn) const int column, int subRow, int subColumn) const
{ {
return getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column))->getNestedData( return getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).getNestedData(
Collection<ESXRecordT, IdAccessorT>::getRecord(row), subRow, subColumn); Collection<ESXRecordT, IdAccessorT>::getRecord(row), subRow, subColumn);
} }
@ -125,15 +133,20 @@ namespace CSMWorld
void SubCellCollection<ESXRecordT, IdAccessorT>::setNestedData(int row, void SubCellCollection<ESXRecordT, IdAccessorT>::setNestedData(int row,
int column, const QVariant& data, int subRow, int subColumn) int column, const QVariant& data, int subRow, int subColumn)
{ {
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column))->setNestedData( Record<ESXRecordT> record;
Collection<ESXRecordT, IdAccessorT>::getRecord(row), data, subRow, subColumn); record.assign(Collection<ESXRecordT, IdAccessorT>::getRecord(row));
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).setNestedData(
record, data, subRow, subColumn);
Collection<ESXRecordT, IdAccessorT>::setRecord(row, record);
} }
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
CSMWorld::NestedTableWrapperBase* SubCellCollection<ESXRecordT, IdAccessorT>::nestedTable(int row, CSMWorld::NestedTableWrapperBase* SubCellCollection<ESXRecordT, IdAccessorT>::nestedTable(int row,
int column) const int column) const
{ {
return getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column))->nestedTable( return getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).nestedTable(
Collection<ESXRecordT, IdAccessorT>::getRecord(row)); Collection<ESXRecordT, IdAccessorT>::getRecord(row));
} }
@ -141,21 +154,26 @@ namespace CSMWorld
void SubCellCollection<ESXRecordT, IdAccessorT>::setNestedTable(int row, void SubCellCollection<ESXRecordT, IdAccessorT>::setNestedTable(int row,
int column, const CSMWorld::NestedTableWrapperBase& nestedTable) int column, const CSMWorld::NestedTableWrapperBase& nestedTable)
{ {
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column))->setNestedTable( Record<ESXRecordT> record;
Collection<ESXRecordT, IdAccessorT>::getRecord(row), nestedTable); record.assign(Collection<ESXRecordT, IdAccessorT>::getRecord(row));
getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).setNestedTable(
record, nestedTable);
Collection<ESXRecordT, IdAccessorT>::setRecord(row, record);
} }
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
int SubCellCollection<ESXRecordT, IdAccessorT>::getNestedRowsCount(int row, int column) const int SubCellCollection<ESXRecordT, IdAccessorT>::getNestedRowsCount(int row, int column) const
{ {
return getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column))->getNestedRowsCount( return getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).getNestedRowsCount(
Collection<ESXRecordT, IdAccessorT>::getRecord(row)); Collection<ESXRecordT, IdAccessorT>::getRecord(row));
} }
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
int SubCellCollection<ESXRecordT, IdAccessorT>::getNestedColumnsCount(int row, int column) const int SubCellCollection<ESXRecordT, IdAccessorT>::getNestedColumnsCount(int row, int column) const
{ {
return getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column))->getNestedColumnsCount( return getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).getNestedColumnsCount(
Collection<ESXRecordT, IdAccessorT>::getRecord(row)); Collection<ESXRecordT, IdAccessorT>::getRecord(row));
} }

Loading…
Cancel
Save