1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-20 15:53:54 +00:00
openmw/apps/opencs/model/world/idtablebase.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

69 lines
1.9 KiB
C++
Raw Normal View History

#ifndef CSM_WOLRD_IDTABLEBASE_H
#define CSM_WOLRD_IDTABLEBASE_H
#include <QAbstractItemModel>
#include "columns.hpp"
namespace CSMWorld
{
class UniversalId;
class IdTableBase : public QAbstractItemModel
{
2022-09-22 18:26:05 +00:00
Q_OBJECT
2022-09-22 18:26:05 +00:00
public:
enum Features
{
Feature_ReorderWithinTopic = 1,
2022-09-22 18:26:05 +00:00
/// Use ID column to generate view request (ID is transformed into
/// worldspace and original ID is passed as hint with c: prefix).
Feature_ViewId = 2,
2022-09-22 18:26:05 +00:00
/// Use cell column to generate view request (cell ID is transformed
/// into worldspace and record ID is passed as hint with r: prefix).
Feature_ViewCell = 4,
2022-09-22 18:26:05 +00:00
Feature_View = Feature_ViewId | Feature_ViewCell,
2022-09-22 18:26:05 +00:00
Feature_Preview = 8,
2022-09-22 18:26:05 +00:00
/// Table can not be modified through ordinary means.
Feature_Constant = 16,
2014-07-05 10:44:11 +00:00
2022-09-22 18:26:05 +00:00
Feature_AllowTouch = 32
};
2022-09-22 18:26:05 +00:00
private:
unsigned int mFeatures;
2022-09-22 18:26:05 +00:00
public:
IdTableBase(unsigned int features);
2022-09-22 18:26:05 +00:00
virtual QModelIndex getModelIndex(const std::string& id, int column) const = 0;
2022-09-22 18:26:05 +00:00
/// Return index of column with the given \a id. If no such column exists, -1 is
/// returned.
virtual int searchColumnIndex(Columns::ColumnId id) const = 0;
2022-09-22 18:26:05 +00:00
/// Return index of column with the given \a id. If no such column exists, an
/// exception is thrown.
virtual int findColumnIndex(Columns::ColumnId id) const = 0;
2022-09-22 18:26:05 +00:00
/// Return the UniversalId and the hint for viewing \a row. If viewing is not
/// supported by this table, return (UniversalId::Type_None, "").
virtual std::pair<UniversalId, std::string> view(int row) const = 0;
2022-09-22 18:26:05 +00:00
/// Is \a id flagged as deleted?
virtual bool isDeleted(const std::string& id) const = 0;
2022-09-22 18:26:05 +00:00
virtual int getColumnId(int column) const = 0;
2022-09-22 18:26:05 +00:00
unsigned int getFeatures() const;
};
}
#endif