wxHashTable Class Reference
[Containers]

#include <wx/hash.h>

Inheritance diagram for wxHashTable:

wxObject

List of all members.


Detailed Description

Please note that this class is retained for backward compatibility reasons; you should use wxHashMap.

This class provides hash table functionality for wxWidgets, and for an application if it wishes. Data can be hashed on an integer or string key.

Library:  wxBase

Category:  Containers

See also:
wxList

Public Member Functions

 wxHashTable (unsigned int key_type, int size=1000)
virtual ~wxHashTable ()
void BeginFind ()
void Clear ()
void DeleteContents (bool flag)
size_t GetCount () const
wxHashTable::Node * Next ()
wxObjectDelete (long key)
wxObjectDelete (const wxString &key)
wxObjectGet (long key)
wxObjectGet (const char *key)
void Put (long key, wxObject *object)
void Put (const char *key, wxObject *object)

Static Public Member Functions

static long MakeKey (const wxString &string)

Constructor & Destructor Documentation

wxHashTable::wxHashTable ( unsigned int  key_type,
int  size = 1000 
)

Constructor. key_type is one of wxKEY_INTEGER, or wxKEY_STRING, and indicates what sort of keying is required. size is optional.

virtual wxHashTable::~wxHashTable (  )  [virtual]

Destroys the hash table.


Member Function Documentation

void wxHashTable::BeginFind (  ) 

The counterpart of Next. If the application wishes to iterate through all the data in the hash table, it can call BeginFind and then loop on Next.

void wxHashTable::Clear (  ) 

Clears the hash table of all nodes (but as usual, doesn't delete user data).

wxObject* wxHashTable::Delete ( long  key  ) 

Deletes entry in hash table and returns the user's data (if found).

wxObject* wxHashTable::Delete ( const wxString key  ) 

Deletes entry in hash table and returns the user's data (if found).

void wxHashTable::DeleteContents ( bool  flag  ) 

If set to true data stored in hash table will be deleted when hash table object is destroyed.

wxObject* wxHashTable::Get ( long  key  ) 

Gets data from the hash table, using an integer or string key (depending on which has table constructor was used).

wxObject* wxHashTable::Get ( const char *  key  ) 

Gets data from the hash table, using an integer or string key (depending on which has table constructor was used).

size_t wxHashTable::GetCount (  )  const

Returns the number of elements in the hash table.

static long wxHashTable::MakeKey ( const wxString string  )  [static]

Makes an integer key out of a string. An application may wish to make a key explicitly (for instance when combining two data values to form a key).

wxHashTable::Node* wxHashTable::Next (  ) 

If the application wishes to iterate through all the data in the hash table, it can call BeginFind and then loop on Next. This function returns a Node() pointer (or NULL if there are no more nodes). The return value is functionally equivalent to wxNode but might not be implemented as a wxNode. The user will probably only wish to use the GetData method to retrieve the data; the node may also be deleted.

void wxHashTable::Put ( long  key,
wxObject object 
)

Inserts data into the hash table, using an integer or string key (depending on which has table constructor was used). The key string is copied and stored by the hash table implementation.

void wxHashTable::Put ( const char *  key,
wxObject object 
)

Inserts data into the hash table, using an integer or string key (depending on which has table constructor was used). The key string is copied and stored by the hash table implementation.



wxWidgets logo

[ top ]