Spelling and other consistencies nit pick.

test
cc9cii 10 years ago
parent 3d280a6ba5
commit 29ef08bb75

@ -26,7 +26,7 @@ opencs_units (model/world
opencs_units_noqt (model/world
universalid record commands columnbase scriptcontext cell refidcollection
refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata cellcoordinates cellselection resources resourcesmanager scope
pathgrid landtexture land nestedtablewrapper nestedadaptors
pathgrid landtexture land nestedtablewrapper nestedadapters
)
opencs_hdrs_noqt (model/world

@ -13,7 +13,6 @@ namespace CSMWorld
{
struct ColumnBase;
struct RecordBase;
class NestedTableWrapperBase;
/// \brief Base class for record collections
///
@ -105,28 +104,6 @@ namespace CSMWorld
///< Return index of column with the given \a id. If no such column exists, an exception is
/// thrown.
};
class NestedCollection : public CollectionBase
{
public:
virtual void addNestedRow(int row, int col, int position) = 0;
virtual QVariant getNestedData(int row, int column, int subRow, int subColumn) const = 0;
virtual NestedTableWrapperBase* nestedTable(int row, int column) const = 0;
virtual void setNestedTable(int row, int column, const NestedTableWrapperBase& nestedTable) = 0;
virtual void setNestedData(int row, int column, const QVariant& data, int subRow, int subColumn) = 0;
virtual int getNestedRowsCount(int row, int column) const = 0;
virtual int getNestedColumnsCount(int row, int column) const = 0;
virtual void removeNestedRows(int row, int column, int subRow) = 0;
};
}
#endif

@ -6,6 +6,7 @@
#include "nestedtablewrapper.hpp"
#include "collectionbase.hpp"
#include "nestedcollection.hpp"
#include "columnbase.hpp"
CSMWorld::IdTable::IdTable (CollectionBase *idCollection, unsigned int features)

@ -1,4 +1,4 @@
#include "nestedadaptors.hpp"
#include "nestedadapters.hpp"
CSMWorld::HelperBase::HelperBase(CSMWorld::UniversalId::Type type)
: mType(type)

@ -1,5 +1,5 @@
#ifndef CSM_WORLD_NESTEDADAPTORS_H
#define CSM_WORLD_NESTEDADAPTORS_H
#ifndef CSM_WORLD_NESTEDADAPTERS_H
#define CSM_WORLD_NESTEDADAPTERS_H
#include <vector>
#include <string>

@ -0,0 +1,35 @@
#ifndef CSM_WOLRD_NESTEDCOLLECTION_H
#define CSM_WOLRD_NESTEDCOLLECTION_H
#include "collectionbase.hpp"
class QVariant;
namespace CSMWorld
{
class NestedTableWrapperBase;
class NestedCollection : public CollectionBase
{
public:
virtual void addNestedRow(int row, int col, int position) = 0;
virtual QVariant getNestedData(int row, int column, int subRow, int subColumn) const = 0;
virtual NestedTableWrapperBase* nestedTable(int row, int column) const = 0;
virtual void setNestedTable(int row, int column, const NestedTableWrapperBase& nestedTable) = 0;
virtual void setNestedData(int row, int column, const QVariant& data, int subRow, int subColumn) = 0;
virtual int getNestedRowsCount(int row, int column) const = 0;
virtual int getNestedColumnsCount(int row, int column) const = 0;
virtual void removeNestedRows(int row, int column, int subRow) = 0;
};
}
#endif

@ -4,10 +4,10 @@
#include <string>
#include <vector>
#include "nestedadaptors.hpp"
#include "nestedadapters.hpp"
/*! \brief
* Adaptors acts as indirection layer, abstracting details of the record types (in the wrappers) from the higher levels of model.
* Adapters acts as indirection layer, abstracting details of the record types (in the wrappers) from the higher levels of model.
* Please notice that nested adaptor uses helper classes for actually performing any actions. Different record types require different helpers (needs to be created in the subclass and then fetched via member function).
* Important point: don't forget to make sure that getData on the nestedColumn returns true (otherwise code will not treat the index pointing to the column as having childs!
*/
@ -79,25 +79,25 @@ namespace CSMWorld
public:
NestedRefIdAdapter();
virtual ~NestedRefIdAdapter();
virtual void setNestedData (const RefIdColumn *column, RefIdData& data, int row,
const QVariant& value, int subRowIndex, int subColIndex) const;
virtual QVariant getNestedData (const RefIdColumn *column, const RefIdData& data,
int index, int subRowIndex, int subColIndex) const;
virtual int getNestedColumnsCount(const RefIdColumn *column, const RefIdData& data) const;
virtual int getNestedRowsCount(const RefIdColumn *column, const RefIdData& data, int index) const;
virtual void removeNestedRow (const RefIdColumn *column, RefIdData& data, int index, int rowToRemove) 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 NestedTableWrapperBase* nestedTable (const RefIdColumn* column, const RefIdData& data, int index) const;
protected:
@ -105,12 +105,12 @@ namespace CSMWorld
///The ownership of the Helper pointers is transfered.
///The ownership of the column pointers it not transfered (it is not surprising, since columns are created by collection).
///You MUST call this method to setup the nested adaptor!
void addAssocColumn(const std::pair <const RefIdColumn*, HelperBase*>& assocColumn);
void addAssocColumn(const std::pair <const RefIdColumn*, HelperBase*>& assocColumn);
///Like setAssocColumn, when it is impossible to set all columns at once
private:
HelperBase* getHelper(const RefIdColumn *column) const;
};
}

@ -12,7 +12,7 @@
#include "refiddata.hpp"
#include "universalid.hpp"
#include "refidadapter.hpp"
#include "nestedadaptors.hpp"
#include "nestedadapters.hpp"
namespace CSMWorld
{
@ -509,7 +509,7 @@ namespace CSMWorld
assoCol.push_back(std::make_pair(mActors.mInventory, new InventoryHelper<RecordT>(type)));
assoCol.push_back(std::make_pair(mActors.mSpells, new SpellsHelper<RecordT>(type)));
setAssocColumns(assoCol);
}
@ -540,7 +540,7 @@ namespace CSMWorld
if (column==mActors.mSpells)
return true;
std::map<const RefIdColumn *, unsigned int>::const_iterator iter =
mActors.mServices.find (column);
@ -666,7 +666,7 @@ namespace CSMWorld
const RefIdColumn *mOrganic;
const RefIdColumn *mRespawn;
const RefIdColumn *mContent;
public:
ContainerRefIdAdapter (const NameColumns& columns, const RefIdColumn *weight,

@ -27,7 +27,7 @@ bool CSMWorld::RefIdColumn::isUserEditable() const
}
CSMWorld::RefIdAdapter& CSMWorld::RefIdCollection::findAdaptor (UniversalId::Type type) const
CSMWorld::RefIdAdapter& CSMWorld::RefIdCollection::findAdapter (UniversalId::Type type) const
{
std::map<UniversalId::Type, RefIdAdapter *>::const_iterator iter = mAdapters.find (type);
@ -452,7 +452,7 @@ QVariant CSMWorld::RefIdCollection::getData (int index, int column) const
{
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (index);
const RefIdAdapter& adaptor = findAdaptor (localIndex.second);
const RefIdAdapter& adaptor = findAdapter (localIndex.second);
return adaptor.getData (&mColumns.at (column), mData, localIndex.first);
}
@ -461,7 +461,7 @@ QVariant CSMWorld::RefIdCollection::getNestedData (int row, int column, int subR
{
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex(row);
const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdaptor (localIndex.second));
const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdapter (localIndex.second));
return adaptor.getNestedData (&mColumns.at (column), mData, localIndex.first, subRow, subColumn);
}
@ -470,7 +470,7 @@ void CSMWorld::RefIdCollection::setData (int index, int column, const QVariant&
{
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (index);
const RefIdAdapter& adaptor = findAdaptor (localIndex.second);
const RefIdAdapter& adaptor = findAdapter (localIndex.second);
adaptor.setData (&mColumns.at (column), mData, localIndex.first, data);
}
@ -479,7 +479,7 @@ void CSMWorld::RefIdCollection::setNestedData(int row, int column, const QVarian
{
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (row);
const RefIdAdapter& adaptor = findAdaptor (localIndex.second);
const RefIdAdapter& adaptor = findAdapter (localIndex.second);
dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(adaptor).setNestedData (&mColumns.at (column), mData, localIndex.first, data, subRow, subColumn);
}
@ -493,7 +493,7 @@ void CSMWorld::RefIdCollection::removeNestedRows(int row, int column, int subRow
{
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (row);
const RefIdAdapter& adaptor = findAdaptor (localIndex.second);
const RefIdAdapter& adaptor = findAdapter (localIndex.second);
dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(adaptor).removeNestedRow(&mColumns.at (column), mData, localIndex.first, subRow);
}
@ -530,7 +530,7 @@ void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin,
void CSMWorld::RefIdCollection::appendRecord (const RecordBase& record,
UniversalId::Type type)
{
std::string id = findAdaptor (type).getId (record);
std::string id = findAdapter (type).getId (record);
int index = mData.getAppendIndex (type);
@ -637,7 +637,7 @@ int CSMWorld::RefIdCollection::getNestedRowsCount(int row, int column) const
{
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (row);
const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdaptor (localIndex.second));
const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdapter (localIndex.second));
return adaptor.getNestedRowsCount(&mColumns.at(column), mData, localIndex.first);
}
@ -646,7 +646,7 @@ int CSMWorld::RefIdCollection::getNestedColumnsCount(int row, int column) const
{
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (row);
const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdaptor (localIndex.second));
const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdapter (localIndex.second));
return adaptor.getNestedColumnsCount(&mColumns.at(column), mData);
}
@ -655,7 +655,7 @@ void CSMWorld::RefIdCollection::addNestedRow(int row, int col, int position)
{
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (row);
const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdaptor (localIndex.second));
const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdapter (localIndex.second));
adaptor.addNestedRow(&mColumns.at(col), mData, localIndex.first, position);
}
@ -664,7 +664,7 @@ void CSMWorld::RefIdCollection::setNestedTable(int row, int column, const CSMWor
{
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (row);
CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<CSMWorld::NestedRefIdAdapter&>(findAdaptor (localIndex.second));
CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<CSMWorld::NestedRefIdAdapter&>(findAdapter (localIndex.second));
adaptor.setNestedTable(&mColumns.at(column), mData, localIndex.first, nestedTable);
}
@ -673,7 +673,7 @@ CSMWorld::NestedTableWrapperBase* CSMWorld::RefIdCollection::nestedTable(int row
{
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (row);
const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdaptor (localIndex.second));
const CSMWorld::NestedRefIdAdapter& adaptor = dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(findAdapter (localIndex.second));
return adaptor.nestedTable(&mColumns.at(column), mData, localIndex.first);
}

@ -7,6 +7,7 @@
#include "columnbase.hpp"
#include "collectionbase.hpp"
#include "nestedcollection.hpp"
#include "refiddata.hpp"
namespace ESM
@ -45,7 +46,7 @@ namespace CSMWorld
private:
RefIdAdapter& findAdaptor (UniversalId::Type) const;
RefIdAdapter& findAdapter (UniversalId::Type) const;
///< Throws an exception if no adaptor for \a Type can be found.
public:
@ -71,7 +72,7 @@ namespace CSMWorld
virtual QVariant getData (int index, int column) const;
virtual QVariant getNestedData(int row, int column, int subRow, int subColumn) const;
virtual NestedTableWrapperBase* nestedTable(int row, int column) const;
virtual void setNestedTable(int row, int column, const NestedTableWrapperBase& nestedTable);

Loading…
Cancel
Save