Public Member Functions | Protected Attributes | Friends

nsDeque Class Reference

#include <nsDeque.h>

Collaboration diagram for nsDeque:

List of all members.

Public Member Functions

 nsDeque (nsDequeFunctor *aDeallocator=0)
 ~nsDeque ()
PRInt32 GetSize () const
 Returns the number of elements currently stored in this deque.
nsDequePush (void *aItem)
 Appends new member at the end of the deque.
nsDequePushFront (void *aItem)
 Inserts new member at the front of the deque.
void * Pop ()
 Remove and return the last item in the container.
void * PopFront ()
 Remove and return the first item in the container.
void * Peek ()
 Retrieve the bottom item without removing it.
void * PeekFront ()
 Return topmost item without removing it.
void * ObjectAt (int aIndex) const
 Retrieve the i'th member from the deque without removing it.
nsDequeEmpty ()
 Remove all items from container without destroying them.
nsDequeErase ()
 Remove and delete all items from container.
nsDequeIterator Begin () const
 Creates a new iterator, pointing to the first item in the deque.
nsDequeIterator End () const
 Creates a new iterator, pointing to the last item in the deque.
void * Last () const
void ForEach (nsDequeFunctor &aFunctor) const
 Call this method when you want to iterate all the members of the container, passing a functor along to call your code.
const void * FirstThat (nsDequeFunctor &aFunctor) const
 Call this method when you want to iterate all the members of the container, calling the functor you passed with each member.
void SetDeallocator (nsDequeFunctor *aDeallocator)

Protected Attributes

PRInt32 mSize
PRInt32 mCapacity
PRInt32 mOrigin
nsDequeFunctormDeallocator
void * mBuffer [8]
void ** mData

Friends

class nsDequeIterator

Constructor & Destructor Documentation

nsDeque::nsDeque ( nsDequeFunctor aDeallocator = 0  ) 
nsDeque::~nsDeque (  ) 

Member Function Documentation

nsDequeIterator nsDeque::Begin (  )  const

Creates a new iterator, pointing to the first item in the deque.

Returns:
new dequeIterator
nsDeque& nsDeque::Empty (  ) 

Remove all items from container without destroying them.

Returns:
*this
nsDequeIterator nsDeque::End (  )  const

Creates a new iterator, pointing to the last item in the deque.

Returns:
new dequeIterator
nsDeque& nsDeque::Erase (  ) 

Remove and delete all items from container.

Deletes are handled by the deallocator nsDequeFunctor which is specified at deque construction.

Returns:
*this
const void* nsDeque::FirstThat ( nsDequeFunctor aFunctor  )  const

Call this method when you want to iterate all the members of the container, calling the functor you passed with each member.

This process will interrupt if your function returns non 0 to this method.

Parameters:
aFunctor object to call for each member
Returns:
first nonzero result of aFunctor or 0.
void nsDeque::ForEach ( nsDequeFunctor aFunctor  )  const

Call this method when you want to iterate all the members of the container, passing a functor along to call your code.

Parameters:
aFunctor object to call for each member
Returns:
*this
PRInt32 nsDeque::GetSize (  )  const [inline]

Returns the number of elements currently stored in this deque.

Returns:
number of elements currently in the deque
void* nsDeque::Last (  )  const
void* nsDeque::ObjectAt ( int  aIndex  )  const

Retrieve the i'th member from the deque without removing it.

Parameters:
index of desired item
Returns:
i'th element in list
void* nsDeque::Peek (  ) 

Retrieve the bottom item without removing it.

Returns:
the first item in container
void* nsDeque::PeekFront (  ) 

Return topmost item without removing it.

Returns:
the first item in container
void* nsDeque::Pop (  ) 

Remove and return the last item in the container.

Returns:
the item that was the last item in container
void* nsDeque::PopFront (  ) 

Remove and return the first item in the container.

Returns:
the item that was first item in container
nsDeque& nsDeque::Push ( void *  aItem  ) 

Appends new member at the end of the deque.

Parameters:
item to store in deque
Returns:
*this
nsDeque& nsDeque::PushFront ( void *  aItem  ) 

Inserts new member at the front of the deque.

Parameters:
item to store in deque
Returns:
*this
void nsDeque::SetDeallocator ( nsDequeFunctor aDeallocator  ) 

Friends And Related Function Documentation

friend class nsDequeIterator [friend]

Member Data Documentation

void* nsDeque::mBuffer[8] [protected]
PRInt32 nsDeque::mCapacity [protected]
void** nsDeque::mData [protected]
PRInt32 nsDeque::mOrigin [protected]
PRInt32 nsDeque::mSize [protected]

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