Download Source Code

TStrList< T > Class Template Reference

Implements a hashed string linked list. More...

#include <THList.h>

Inheritance diagram for TStrList< T >:

Inheritance graph
[legend]
Collaboration diagram for TStrList< T >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TStrList::tagSTStrListInfo STStrListInfo
 Hash list element iterator structure.
typedef TStrList::tagSTStrListInfoLPSTStrListInfo
 Hash list element iterator structure.
typedef LPSTStrListInfo iterator
 Hash list element iterator.

Public Member Functions

virtual ~TStrList ()
 Destructor.
iterator begin ()
 Returns the iterator for the first element in the list.
iterator last ()
 Returns the iterator for the last element in the list.
iterator end ()
 Returns a NULL iterator.
iterator next (iterator it)
 Returns the next element in the list.
iterator prev (iterator it)
 Returns the previous element in the list.
T * push_back (LPCTSTR pKey, T *node=NULL)
 Adds an element to the end of the list.
T * push_back_memcpy (LPCTSTR pKey, T *node)
 Adds an element to the end of the list.
T * push_back_copy (LPCTSTR pKey, T *node)
 Adds an element to the end of the list.
T * operator[] (LPCTSTR pKey)
 Returns a pointer to the specified element.
T * get (LPCTSTR pKey, T *node=NULL)
 Returns a pointer to the specified element, adding if needed.
iterator erase (LPCTSTR pKey)
 Removes the specified element from the list.
iterator erase (const iterator it)
 Removes the specified element from the list.
BOOL verify (T *node)
 Verifies that the specified object pointer is actually in the list.
BOOL verify (iterator it)
 Verifies that the specified iterator is actually in the list.
void clear ()
 Removes all elements from the list.
virtual DWORD GetObjSize ()
 Returns the size of a hash list structure in bytes.
virtual void Destroy ()
 Removes all elements from the list.
virtual BOOL InitObject (void *node)
 Provides custom initialization of new hash list structures.
virtual void DeleteObject (void *node)
 Provides custom destruction of hash list structures.
iterator find_obj (T *pObj)
 Searchs the list to find the iterator for the specified object pointer.

Classes

struct  tagSTStrListInfo
 Hash list element iterator structure. More...

Detailed Description

template<class T>
class TStrList< T >

Implements a hashed string linked list.

Implements a hashed string linked list Obsolete, new code should use ATL7 classes or other standard implementation.


Member Typedef Documentation

template<class T>
typedef TStrList::tagSTStrListInfo * TStrList< T >::LPSTStrListInfo
 

Hash list element iterator structure.

See also:
THList, THList::iterator

template<class T>
typedef TStrList::tagSTStrListInfo TStrList< T >::STStrListInfo
 

Hash list element iterator structure.

See also:
THList, THList::iterator


Member Function Documentation

template<class T>
virtual void TStrList< T >::DeleteObject void *  node  )  [inline, virtual]
 

Provides custom destruction of hash list structures.

Parameters:
[in] node - Hash list structure pointer

Reimplemented from CHList.

template<class T>
iterator TStrList< T >::erase const iterator  it  )  [inline]
 

Removes the specified element from the list.

Parameters:
[in] it - Element iterator to remove
Returns:
Pointer to the previous element. Useful when iterating elements.
See also:

template<class T>
iterator TStrList< T >::erase LPCTSTR  pKey  )  [inline]
 

Removes the specified element from the list.

Parameters:
[in] pKey - Element key string
Returns:
Pointer to the previous element. Useful when iterating elements.
See also:

template<class T>
iterator TStrList< T >::find_obj T *  pObj  )  [inline]
 

Searchs the list to find the iterator for the specified object pointer.

Parameters:
[in] pObj - Element object pointer
Returns:
Iterator if found, otherwise NULL
See also:

template<class T>
T* TStrList< T >::get LPCTSTR  pKey,
T *  node = NULL
[inline]
 

Returns a pointer to the specified element, adding if needed.

Parameters:
[in] pKey - Element key
[in] node - Element to add if not found
Returns:
Pointer to specified element.
See also:

template<class T>
virtual BOOL TStrList< T >::InitObject void *  node  )  [inline, virtual]
 

Provides custom initialization of new hash list structures.

Parameters:
[in] node - Hash list structure pointer
Returns:
Non-zero if success
See also:

Reimplemented from CHList.

template<class T>
iterator TStrList< T >::next iterator  it  )  [inline]
 

Returns the next element in the list.

Parameters:
[in] it - Reference element
If it is NULL, the head element is returned.

Returns:
Pointer to the next element or NULL if none.
See also:

template<class T>
T* TStrList< T >::operator[] LPCTSTR  pKey  )  [inline]
 

Returns a pointer to the specified element.

Parameters:
[in] pKey - Element key
Returns:
Pointer to specified element.
See also:

template<class T>
iterator TStrList< T >::prev iterator  it  )  [inline]
 

Returns the previous element in the list.

Parameters:
[in] it - Reference element
If it is NULL, the last element is returned.

Returns:
Pointer to the previous element or NULL if none.
See also:

template<class T>
T* TStrList< T >::push_back LPCTSTR  pKey,
T *  node = NULL
[inline]
 

Adds an element to the end of the list.

Parameters:
[in] pKey - Element key
[in] node - Optional element pointer to add. If node is NULL, a new element is created.
Returns:
Pointer to newly added element
See also:

template<class T>
T* TStrList< T >::push_back_copy LPCTSTR  pKey,
T *  node
[inline]
 

Adds an element to the end of the list.

Parameters:
[in] pKey - Element key
[in] node - Optional element pointer that is copied to the new element.
Returns:
Pointer to newly added element
See also:

template<class T>
T* TStrList< T >::push_back_memcpy LPCTSTR  pKey,
T *  node
[inline]
 

Adds an element to the end of the list.

Parameters:
[in] pKey - Element key
[in] node - Optional element pointer that is copied byte-wise into the new element. Must be a POD pointer.
Warning:
POD only!
Returns:
Pointer to newly added element
See also:

template<class T>
BOOL TStrList< T >::verify iterator  it  )  [inline]
 

Verifies that the specified iterator is actually in the list.

Parameters:
[in] it - Iterator pointer to verify
Returns:
Non-zero if valid list iterator
See also:

template<class T>
BOOL TStrList< T >::verify T *  node  )  [inline]
 

Verifies that the specified object pointer is actually in the list.

Parameters:
[in] node - Object pointer to verify
Returns:
Non-zero if valid list object
See also:


The documentation for this class was generated from the following file:
  • inc/THList.h
Copyright Robert Umbehant
This documentation is covered by the LGPL