OpenMW
|
00001 #ifndef CSM_WOLRD_COLLECTIONBASE_H 00002 #define CSM_WOLRD_COLLECTIONBASE_H 00003 00004 #include <string> 00005 #include <vector> 00006 00007 #include "universalid.hpp" 00008 #include "columns.hpp" 00009 00010 class QVariant; 00011 00012 namespace CSMWorld 00013 { 00014 struct ColumnBase; 00015 struct RecordBase; 00016 00023 class CollectionBase 00024 { 00025 // not implemented 00026 CollectionBase (const CollectionBase&); 00027 CollectionBase& operator= (const CollectionBase&); 00028 00029 public: 00030 00031 CollectionBase(); 00032 00033 virtual ~CollectionBase(); 00034 00035 virtual int getSize() const = 0; 00036 00037 virtual std::string getId (int index) const = 0; 00038 00039 virtual int getIndex (const std::string& id) const = 0; 00040 00041 virtual int getColumns() const = 0; 00042 00043 virtual const ColumnBase& getColumn (int column) const = 0; 00044 00045 virtual QVariant getData (int index, int column) const = 0; 00046 00047 virtual void setData (int index, int column, const QVariant& data) = 0; 00048 00049 // Not in use. Temporarily removed so that the implementation of RefIdCollection can continue without 00050 // these functions for now. 00051 // virtual void merge() = 0; 00053 00054 // virtual void purge() = 0; 00056 00057 virtual void removeRows (int index, int count) = 0; 00058 00059 virtual void appendBlankRecord (const std::string& id, 00060 UniversalId::Type type = UniversalId::Type_None) = 0; 00062 00063 virtual int searchId (const std::string& id) const = 0; 00066 00067 virtual void replace (int index, const RecordBase& record) = 0; 00072 00073 virtual void appendRecord (const RecordBase& record, 00074 UniversalId::Type type = UniversalId::Type_None) = 0; 00076 00077 virtual const RecordBase& getRecord (const std::string& id) const = 0; 00078 00079 virtual const RecordBase& getRecord (int index) const = 0; 00080 00081 virtual int getAppendIndex (const std::string& id, 00082 UniversalId::Type type = UniversalId::Type_None) const = 0; 00084 00085 virtual std::vector<std::string> getIds (bool listDeleted = true) const = 0; 00089 00090 virtual bool reorderRows (int baseIndex, const std::vector<int>& newOrder) = 0; 00095 00096 int searchColumnIndex (Columns::ColumnId id) const; 00098 00099 int findColumnIndex (Columns::ColumnId id) const; 00102 }; 00103 } 00104 00105 #endif