OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
collectionbase.hpp
Go to the documentation of this file.
1 #ifndef CSM_WOLRD_COLLECTIONBASE_H
2 #define CSM_WOLRD_COLLECTIONBASE_H
3 
4 #include <string>
5 #include <vector>
6 
7 #include "universalid.hpp"
8 #include "columns.hpp"
9 
10 class QVariant;
11 
12 namespace CSMWorld
13 {
14  struct ColumnBase;
15  struct RecordBase;
16 
24  {
25  // not implemented
28 
29  public:
30 
32 
33  virtual ~CollectionBase();
34 
35  virtual int getSize() const = 0;
36 
37  virtual std::string getId (int index) const = 0;
38 
39  virtual int getIndex (const std::string& id) const = 0;
40 
41  virtual int getColumns() const = 0;
42 
43  virtual const ColumnBase& getColumn (int column) const = 0;
44 
45  virtual QVariant getData (int index, int column) const = 0;
46 
47  virtual void setData (int index, int column, const QVariant& data) = 0;
48 
49 // Not in use. Temporarily removed so that the implementation of RefIdCollection can continue without
50 // these functions for now.
51 // virtual void merge() = 0;
53 
54 // virtual void purge() = 0;
56 
57  virtual void removeRows (int index, int count) = 0;
58 
59  virtual void appendBlankRecord (const std::string& id,
62 
63  virtual int searchId (const std::string& id) const = 0;
66 
67  virtual void replace (int index, const RecordBase& record) = 0;
72 
73  virtual void appendRecord (const RecordBase& record,
76 
77  virtual void cloneRecord(const std::string& origin,
78  const std::string& destination,
79  const UniversalId::Type type) = 0;
80 
81  virtual const RecordBase& getRecord (const std::string& id) const = 0;
82 
83  virtual const RecordBase& getRecord (int index) const = 0;
84 
85  virtual int getAppendIndex (const std::string& id,
86  UniversalId::Type type = UniversalId::Type_None) const = 0;
88 
89  virtual std::vector<std::string> getIds (bool listDeleted = true) const = 0;
93 
94  virtual bool reorderRows (int baseIndex, const std::vector<int>& newOrder) = 0;
99 
100  int searchColumnIndex (Columns::ColumnId id) const;
102 
103  int findColumnIndex (Columns::ColumnId id) const;
106  };
107 }
108 
109 #endif
virtual bool reorderRows(int baseIndex, const std::vector< int > &newOrder)=0
virtual std::string getId(int index) const =0
virtual int getColumns() const =0
virtual int searchId(const std::string &id) const =0
virtual void replace(int index, const RecordBase &record)=0
virtual std::vector< std::string > getIds(bool listDeleted=true) const =0
Type
Definition: universalid.hpp:40
CollectionBase()
Definition: collectionbase.cpp:7
virtual QVariant getData(int index, int column) const =0
virtual int getIndex(const std::string &id) const =0
virtual ~CollectionBase()
Definition: collectionbase.cpp:9
virtual void appendRecord(const RecordBase &record, UniversalId::Type type=UniversalId::Type_None)=0
If the record type does not match, an exception is thrown.
int findColumnIndex(Columns::ColumnId id) const
Definition: collectionbase.cpp:22
Definition: columnbase.hpp:15
Base class for record collections.
Definition: collectionbase.hpp:23
virtual int getAppendIndex(const std::string &id, UniversalId::Type type=UniversalId::Type_None) const =0
Definition: record.hpp:8
ColumnId
Definition: columns.hpp:13
virtual const RecordBase & getRecord(const std::string &id) const =0
CollectionBase & operator=(const CollectionBase &)
virtual int getSize() const =0
Definition: universalid.hpp:42
virtual void cloneRecord(const std::string &origin, const std::string &destination, const UniversalId::Type type)=0
virtual void appendBlankRecord(const std::string &id, UniversalId::Type type=UniversalId::Type_None)=0
int searchColumnIndex(Columns::ColumnId id) const
Return index of column with the given id. If no such column exists, -1 is returned.
Definition: collectionbase.cpp:11
virtual void removeRows(int index, int count)=0
< Merge modified into base.
virtual void setData(int index, int column, const QVariant &data)=0
virtual const ColumnBase & getColumn(int column) const =0