OpenMW
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
CSMWorld::Collection< ESXRecordT, IdAccessorT > Class Template Reference

Single-type record collection. More...

#include <collection.hpp>

List of all members.

Public Member Functions

 Collection ()
virtual ~Collection ()
void add (const ESXRecordT &record)
 Add a new record (modified)
virtual int getSize () const
virtual std::string getId (int index) const
virtual int getIndex (const std::string &id) const
virtual int getColumns () const
virtual QVariant getData (int index, int column) const
virtual void setData (int index, int column, const QVariant &data)
virtual const ColumnBasegetColumn (int column) const
virtual void merge ()
 Merge modified into base.
virtual void purge ()
 Remove records that are flagged as erased.
virtual void removeRows (int index, int count)
 < Merge modified into base.
virtual void appendBlankRecord (const std::string &id, UniversalId::Type type=UniversalId::Type_None)
virtual int searchId (const std::string &id) const
virtual void replace (int index, const RecordBase &record)
virtual void appendRecord (const RecordBase &record, UniversalId::Type type=UniversalId::Type_None)
virtual const Record
< ESXRecordT > & 
getRecord (const std::string &id) const
virtual const Record
< ESXRecordT > & 
getRecord (int index) const
virtual int getAppendIndex (const std::string &id, UniversalId::Type type=UniversalId::Type_None) const
virtual std::vector< std::string > getIds (bool listDeleted=true) const
virtual void insertRecord (const RecordBase &record, int index, UniversalId::Type type=UniversalId::Type_None)
virtual bool reorderRows (int baseIndex, const std::vector< int > &newOrder)
void addColumn (Column< ESXRecordT > *column)
void setRecord (int index, const Record< ESXRecordT > &record)

Protected Member Functions

const std::map< std::string,
int > & 
getIdMap () const
const std::vector< Record
< ESXRecordT > > & 
getRecords () const
bool reorderRowsImp (int baseIndex, const std::vector< int > &newOrder)

Private Member Functions

 Collection (const Collection &)
Collectionoperator= (const Collection &)

Private Attributes

std::vector< Record< ESXRecordT > > mRecords
std::map< std::string, int > mIndex
std::vector< Column
< ESXRecordT > * > 
mColumns

Detailed Description

template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT>>
class CSMWorld::Collection< ESXRecordT, IdAccessorT >

Single-type record collection.


Constructor & Destructor Documentation

template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT>>
CSMWorld::Collection< ESXRecordT, IdAccessorT >::Collection ( const Collection< ESXRecordT, IdAccessorT > &  ) [private]
template<typename ESXRecordT , typename IdAccessorT >
CSMWorld::Collection< ESXRecordT, IdAccessorT >::Collection ( )
template<typename ESXRecordT , typename IdAccessorT >
CSMWorld::Collection< ESXRecordT, IdAccessorT >::~Collection ( ) [virtual]

Member Function Documentation

template<typename ESXRecordT, typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::add ( const ESXRecordT &  record)

Add a new record (modified)

template<typename ESXRecordT, typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::addColumn ( Column< ESXRecordT > *  column)
template<typename ESXRecordT , typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::appendBlankRecord ( const std::string &  id,
UniversalId::Type  type = UniversalId::Type_None 
) [virtual]
Parameters:
typeWill be ignored, unless the collection supports multiple record types

Implements CSMWorld::CollectionBase.

template<typename ESXRecordT , typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::appendRecord ( const RecordBase record,
UniversalId::Type  type = UniversalId::Type_None 
) [virtual]

If the record type does not match, an exception is thrown.

Parameters:
typeWill be ignored, unless the collection supports multiple record types

Implements CSMWorld::CollectionBase.

template<typename ESXRecordT , typename IdAccessorT >
int CSMWorld::Collection< ESXRecordT, IdAccessorT >::getAppendIndex ( const std::string &  id,
UniversalId::Type  type = UniversalId::Type_None 
) const [virtual]
Parameters:
typeWill be ignored, unless the collection supports multiple record types

Implements CSMWorld::CollectionBase.

Reimplemented in CSMWorld::InfoCollection.

template<typename ESXRecordT , typename IdAccessorT >
const ColumnBase & CSMWorld::Collection< ESXRecordT, IdAccessorT >::getColumn ( int  column) const [virtual]
template<typename ESXRecordT , typename IdAccessorT >
int CSMWorld::Collection< ESXRecordT, IdAccessorT >::getColumns ( ) const [virtual]
template<typename ESXRecordT , typename IdAccessorT >
QVariant CSMWorld::Collection< ESXRecordT, IdAccessorT >::getData ( int  index,
int  column 
) const [virtual]
template<typename ESXRecordT , typename IdAccessorT >
std::string CSMWorld::Collection< ESXRecordT, IdAccessorT >::getId ( int  index) const [virtual]
template<typename ESXRecordT , typename IdAccessorT >
const std::map< std::string, int > & CSMWorld::Collection< ESXRecordT, IdAccessorT >::getIdMap ( ) const [protected]
template<typename ESXRecordT , typename IdAccessorT >
std::vector< std::string > CSMWorld::Collection< ESXRecordT, IdAccessorT >::getIds ( bool  listDeleted = true) const [virtual]

Return a sorted collection of all IDs

Parameters:
listDeletedinclude deleted record in the list

Implements CSMWorld::CollectionBase.

template<typename ESXRecordT , typename IdAccessorT >
int CSMWorld::Collection< ESXRecordT, IdAccessorT >::getIndex ( const std::string &  id) const [virtual]
template<typename ESXRecordT , typename IdAccessorT >
const Record< ESXRecordT > & CSMWorld::Collection< ESXRecordT, IdAccessorT >::getRecord ( const std::string &  id) const [virtual]
template<typename ESXRecordT , typename IdAccessorT >
const Record< ESXRecordT > & CSMWorld::Collection< ESXRecordT, IdAccessorT >::getRecord ( int  index) const [virtual]
template<typename ESXRecordT , typename IdAccessorT >
const std::vector< Record< ESXRecordT > > & CSMWorld::Collection< ESXRecordT, IdAccessorT >::getRecords ( ) const [protected]
template<typename ESXRecordT , typename IdAccessorT >
int CSMWorld::Collection< ESXRecordT, IdAccessorT >::getSize ( ) const [virtual]
template<typename ESXRecordT , typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::insertRecord ( const RecordBase record,
int  index,
UniversalId::Type  type = UniversalId::Type_None 
) [virtual]

Insert record before index.

If the record type does not match, an exception is thrown.

If the index is invalid either generally (by being out of range) or for the particular record, an exception is thrown.

template<typename ESXRecordT , typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::merge ( ) [virtual]

Merge modified into base.

template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT>>
Collection& CSMWorld::Collection< ESXRecordT, IdAccessorT >::operator= ( const Collection< ESXRecordT, IdAccessorT > &  ) [private]
template<typename ESXRecordT , typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::purge ( ) [virtual]

Remove records that are flagged as erased.

template<typename ESXRecordT , typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::removeRows ( int  index,
int  count 
) [virtual]

< Merge modified into base.

< Remove records that are flagged as erased.

Implements CSMWorld::CollectionBase.

template<typename ESXRecordT , typename IdAccessorT >
bool CSMWorld::Collection< ESXRecordT, IdAccessorT >::reorderRows ( int  baseIndex,
const std::vector< int > &  newOrder 
) [virtual]

Reorder the rows [baseIndex, baseIndex+newOrder.size()) according to the indices given in newOrder (baseIndex+newOrder[0] specifies the new index of row baseIndex).

Returns:
Success?

Implements CSMWorld::CollectionBase.

Reimplemented in CSMWorld::InfoCollection.

template<typename ESXRecordT , typename IdAccessorT >
bool CSMWorld::Collection< ESXRecordT, IdAccessorT >::reorderRowsImp ( int  baseIndex,
const std::vector< int > &  newOrder 
) [protected]

Reorder the rows [baseIndex, baseIndex+newOrder.size()) according to the indices given in newOrder (baseIndex+newOrder[0] specifies the new index of row baseIndex).

Returns:
Success?
template<typename ESXRecordT , typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::replace ( int  index,
const RecordBase record 
) [virtual]

If the record type does not match, an exception is thrown.

Attention:
record must not change the ID.

Implements CSMWorld::CollectionBase.

template<typename ESXRecordT , typename IdAccessorT >
int CSMWorld::Collection< ESXRecordT, IdAccessorT >::searchId ( const std::string &  id) const [virtual]

Search record with id.

Returns:
index of record (if found) or -1 (not found)

Implements CSMWorld::CollectionBase.

template<typename ESXRecordT , typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::setData ( int  index,
int  column,
const QVariant &  data 
) [virtual]
template<typename ESXRecordT, typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::setRecord ( int  index,
const Record< ESXRecordT > &  record 
)
Attention:
This function must not change the ID.

Member Data Documentation

template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT>>
std::vector<Column<ESXRecordT> *> CSMWorld::Collection< ESXRecordT, IdAccessorT >::mColumns [private]
template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT>>
std::map<std::string, int> CSMWorld::Collection< ESXRecordT, IdAccessorT >::mIndex [private]
template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT>>
std::vector<Record<ESXRecordT> > CSMWorld::Collection< ESXRecordT, IdAccessorT >::mRecords [private]

The documentation for this class was generated from the following file: