OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CSMWorld::Collection< ESXRecordT, IdAccessorT > Class Template Reference

Single-type record collection. More...

#include <collection.hpp>

Inheritance diagram for CSMWorld::Collection< ESXRecordT, IdAccessorT >:
Collaboration diagram for CSMWorld::Collection< ESXRecordT, IdAccessorT >:

Public Types

typedef ESXRecordT ESXRecord
 

Public Member Functions

 Collection ()
 
virtual ~Collection ()
 
void add (const ESXRecordT &record)
 Add a new record (modified) More...
 
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. More...
 
virtual void purge ()
 Remove records that are flagged as erased. More...
 
virtual void removeRows (int index, int count)
 < Merge modified into base. More...
 
virtual void appendBlankRecord (const std::string &id, UniversalId::Type type=UniversalId::Type_None)
 
virtual void cloneRecord (const std::string &origin, const std::string &destination, const UniversalId::Type type)
 
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)
 
NestableColumngetNestableColumn (int column) const
 
- Public Member Functions inherited from CSMWorld::CollectionBase
 CollectionBase ()
 
virtual ~CollectionBase ()
 
int searchColumnIndex (Columns::ColumnId id) const
 Return index of column with the given id. If no such column exists, -1 is returned. More...
 
int findColumnIndex (Columns::ColumnId id) const
 

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, intmIndex
 
std::vector< Column
< ESXRecordT > * > 
mColumns
 

Detailed Description

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

Single-type record collection.

Member Typedef Documentation

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

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)

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename ESXRecordT, typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::addColumn ( Column< ESXRecordT > *  column)

Here is the caller graph for this function:

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.

Here is the call graph for this function:

template<typename ESXRecordT , typename IdAccessorT >
void CSMWorld::Collection< ESXRecordT, IdAccessorT >::cloneRecord ( const std::string &  origin,
const std::string &  destination,
const UniversalId::Type  type 
)
virtual

Implements CSMWorld::CollectionBase.

Here is the call graph for this function:

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

Implements CSMWorld::CollectionBase.

Here is the caller graph for this function:

template<typename ESXRecordT , typename IdAccessorT >
int CSMWorld::Collection< ESXRecordT, IdAccessorT >::getColumns ( ) const
virtual

Implements CSMWorld::CollectionBase.

Here is the caller graph for this function:

template<typename ESXRecordT , typename IdAccessorT >
QVariant CSMWorld::Collection< ESXRecordT, IdAccessorT >::getData ( int  index,
int  column 
) const
virtual

Implements CSMWorld::CollectionBase.

Here is the caller graph for this function:

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.

Here is the call graph for this function:

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

Implements CSMWorld::CollectionBase.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename ESXRecordT , typename IdAccessorT >
NestableColumn * CSMWorld::Collection< ESXRecordT, IdAccessorT >::getNestableColumn ( int  column) const

Here is the caller graph for this function:

template<typename ESXRecordT , typename IdAccessorT >
const Record< ESXRecordT > & CSMWorld::Collection< ESXRecordT, IdAccessorT >::getRecord ( const std::string &  id) const
virtual

Implements CSMWorld::CollectionBase.

Here is the caller graph for this function:

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

Implements CSMWorld::CollectionBase.

Here is the caller graph for this function:

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.

Here is the call graph for this function:

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.

Here is the caller graph for this function:

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?

Here is the call graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

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: