TContainer< T > Class Template Reference
[Template Containers]

Template container base class (abstract). More...

#include <tcontainer.h>

Inheritance diagram for TContainer< T >:
Inheritance graph
[legend]

Public Member Functions

 TContainer ()
 TContainer (const TContainer< T > &)
virtual ~TContainer ()
bool operator== (const TContainer< T > &) const
bool operator!= (const TContainer< T > &) const
virtual TContainer< T > * newInstance () const =0
 Create a copy of this container.
T & operator[] (int32) const
 "[]" indexing operator returns the item at the specified index.
virtual int32 total () const
 Return number of items.
virtual bool isEmpty () const
 Is container empty?
virtual int32 size () const
 Returns the container size.
virtual bool add (const T &item)=0
 Add item to container.
virtual bool remove (const T &item)=0
 Remove equal item.
virtual bool remove (const TIterator< T > &)=0
 Remove item at current iterator position.
virtual bool removeAt (int32 index)=0
 Remove item at given index.
virtual void removeAll ()=0
 Remove all items from list.
virtual T & at (int32 index) const
 Get item at index.
virtual T & lookup (const T &item) const
 Searches for the item equal to the specified item in the list and returns the first occurrence.
virtual bool contains (const T &item) const
 See if container has equal item.
virtual int32 occurrences (const T &item) const
 Count occurrences of equal items.
virtual TIterator< T > * newIterator () const =0
 Create container iterator instance.
TContainer< T > * lookupAll (const T &item) const
 Allocate and returns a container with all items in this container equal to the specified item.
bool addAllFrom (const TContainer< T > &container)
 Adds all the items from the specified container to this container.
bool addNewFrom (const TContainer< T > &container)
 Adds the items from the specified container to this container that are not in this container already.
T & error () const
 Access error object.

Protected Member Functions

void copy (const TContainer< T > &container)
 Internal copy method. Copies the contents of the specified container into this container.

Protected Attributes

errorObject
 Object used as return value when methods returning a T& fail.
int32 _size
 Container size.

Detailed Description

template<class T>
class Steinberg::TContainer< T >

Template container base class (abstract).

This class defines the basic interface for any container implementation in this module.
Please note that:

See also:
TIterator, TArray, TLinkedList, TDLinkedList

Constructor & Destructor Documentation

TContainer (  )  [inline]
TContainer ( const TContainer< T > &   )  [inline]
~TContainer (  )  [inline, virtual]

Member Function Documentation

bool operator== ( const TContainer< T > &  other  )  const [inline]
bool operator!= ( const TContainer< T > &  other  )  const [inline]
virtual TContainer<T>* newInstance (  )  const [pure virtual]
T & operator[] ( int32  idx  )  const [inline]

"[]" indexing operator returns the item at the specified index.

int32 total (  )  const [inline, virtual]
bool isEmpty (  )  const [inline, virtual]
int32 size (  )  const [inline, virtual]

Returns the container size.

The size of a container can be larger than the number of items it contains. For example the TArray implementation returns the number of items that fit into the allocated memory and not the number of actually inserted items

virtual bool add ( const T &  item  )  [pure virtual]
virtual bool remove ( const T &  item  )  [pure virtual]
virtual bool remove ( const TIterator< T > &   )  [pure virtual]
virtual bool removeAt ( int32  index  )  [pure virtual]
virtual void removeAll (  )  [pure virtual]
T & at ( int32  index  )  const [inline, virtual]
T & lookup ( const T &  item  )  const [inline, virtual]
bool contains ( const T &  item  )  const [inline, virtual]
int32 occurrences ( const T &  item  )  const [inline, virtual]
virtual TIterator<T>* newIterator (  )  const [pure virtual]
TContainer< T > * lookupAll ( const T &  item  )  const [inline]

Allocate and returns a container with all items in this container equal to the specified item.

bool addAllFrom ( const TContainer< T > &  container  )  [inline]

Adds all the items from the specified container to this container.

bool addNewFrom ( const TContainer< T > &  container  )  [inline]

Adds the items from the specified container to this container that are not in this container already.

T& error (  )  const [inline]

Access error object.

void copy ( const TContainer< T > &  container  )  [inline, protected]

Internal copy method. Copies the contents of the specified container into this container.


Field Documentation

T errorObject [protected]

Object used as return value when methods returning a T& fail.

int32 _size [protected]

Container size.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Empty

Copyright ©2013 Steinberg Media Technologies GmbH. All Rights Reserved.