2013-05-11 17:01:16 +02:00
|
|
|
#ifndef CSM_WOLRD_REFIDADAPTER_H
|
2013-05-06 14:11:55 +02:00
|
|
|
#define CSM_WOLRD_REFIDADAPTER_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class QVariant;
|
|
|
|
|
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class RefIdColumn;
|
|
|
|
class RefIdData;
|
|
|
|
class RecordBase;
|
|
|
|
|
|
|
|
class RefIdAdapter
|
|
|
|
{
|
|
|
|
// not implemented
|
|
|
|
RefIdAdapter (const RefIdAdapter&);
|
|
|
|
RefIdAdapter& operator= (const RefIdAdapter&);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
RefIdAdapter();
|
|
|
|
|
|
|
|
virtual ~RefIdAdapter();
|
|
|
|
|
2013-05-07 14:19:02 +02:00
|
|
|
virtual QVariant getData (const RefIdColumn *column, const RefIdData& data, int idnex)
|
2013-05-06 14:11:55 +02:00
|
|
|
const = 0;
|
2013-05-07 14:19:02 +02:00
|
|
|
|
|
|
|
virtual void setData (const RefIdColumn *column, RefIdData& data, int index,
|
|
|
|
const QVariant& value) const = 0;
|
2013-05-06 14:11:55 +02:00
|
|
|
///< If the data type does not match an exception is thrown.
|
|
|
|
|
|
|
|
virtual std::string getId (const RecordBase& record) const = 0;
|
2014-06-09 10:35:39 +02:00
|
|
|
|
2014-01-20 14:29:47 +01:00
|
|
|
virtual void setId(RecordBase& record, const std::string& id) = 0;
|
2013-05-06 14:11:55 +02:00
|
|
|
};
|
2014-06-09 10:35:39 +02:00
|
|
|
|
|
|
|
class NestedRefIdAdapter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NestedRefIdAdapter();
|
|
|
|
|
|
|
|
virtual ~NestedRefIdAdapter();
|
|
|
|
|
|
|
|
virtual void setNestedData (const RefIdColumn *column, RefIdData& data, int row,
|
2014-06-17 11:49:35 +02:00
|
|
|
const QVariant& value, int subRowIndex, int subColIndex) const = 0;
|
2014-06-09 10:35:39 +02:00
|
|
|
|
2014-06-02 20:41:37 +02:00
|
|
|
virtual QVariant getNestedData (const RefIdColumn *column, const RefIdData& data,
|
2014-06-17 14:21:50 +02:00
|
|
|
int index, int subRowIndex, int subColIndex) const = 0;
|
2014-06-09 10:35:39 +02:00
|
|
|
|
2014-06-17 11:49:35 +02:00
|
|
|
virtual int getNestedColumnsCount(const RefIdColumn *column, const RefIdData& data) const = 0;
|
2014-05-27 14:01:15 +02:00
|
|
|
|
2014-06-17 11:49:35 +02:00
|
|
|
virtual int getNestedRowsCount(const RefIdColumn *column, const RefIdData& data, int index) const = 0;
|
2014-06-24 10:22:42 +02:00
|
|
|
|
2014-06-24 12:21:40 +02:00
|
|
|
virtual void removeNestedRow (const RefIdColumn *column, RefIdData& data, int index, int rowToRemove) const = 0;
|
2014-06-24 19:03:29 +02:00
|
|
|
|
|
|
|
virtual void addNestedRow (const RefIdColumn *column, RefIdData& data, int index, int position) const = 0;
|
2014-06-09 10:35:39 +02:00
|
|
|
};
|
2013-05-06 14:11:55 +02:00
|
|
|
}
|
|
|
|
|
2014-06-09 10:35:39 +02:00
|
|
|
#endif
|