Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXDictionary Class Reference

The dictionary class is a fast-access hash table, mapping strings to pointers. More...

#include <FXDictionary.h>

Inheritance diagram for FX::FXDictionary:
FX::FXDictionaryOf< TYPE >

List of all members.

Classes

struct  Entry

Public Member Functions

 FXDictionary ()
 Construct empty dictionary.
 FXDictionary (const FXDictionary &other)
 Construct from another dictionary.
FXival no () const
 Return the size of the table, including the empty slots.
FXival used () const
 Return number of used slots in the table.
FXival free () const
 Return number of free slots in the table.
FXbool empty () const
 See if map is empty.
FXDictionaryoperator= (const FXDictionary &other)
 Assignment operator.
FXDictionaryadopt (FXDictionary &other)
 Adopt dictionary from another.
FXival find (const FXchar *ky) const
 Find position of given key, returning -1 if not found.
FXival find (const FXString &ky) const
 Find position of given key, returning -1 if not found.
FXbool has (const FXchar *ky) const
 Check if key is mapped.
FXbool has (const FXString &ky) const
 Check if key is mapped.
FXptr & at (const FXchar *ky)
 Return reference to slot assocated with given key.
const FXptr & at (const FXchar *ky) const
 Return constant reference to slot assocated with given key.
FXptr & at (const FXString &ky)
 Return reference to slot assocated with given key.
const FXptr & at (const FXString &ky) const
 Return constant reference to slot assocated with given key.
FXptr & operator[] (const FXchar *ky)
 Return reference to slot assocated with given key.
const FXptr & operator[] (const FXchar *ky) const
 Return constant reference to slot assocated with given key.
FXptr & operator[] (const FXString &ky)
 Return reference to slot assocated with given key.
const FXptr & operator[] (const FXString &ky) const
 Return constant reference to slot assocated with given key.
FXptr insert (const FXchar *ky, FXptr ptr=NULL)
 Insert association with given key; return old value, if any.
FXptr insert (const FXString &ky, FXptr ptr=NULL)
 Insert association with given key; return old value, if any.
FXptr remove (const FXchar *ky)
 Remove association with given key; return old value, if any.
FXptr remove (const FXString &ky)
 Remove association with given key; return old value, if any.
FXptr erase (FXival pos)
 Erase data at pos in the table; return old value, if any.
FXbool empty (FXival pos) const
 Return true if slot is empty.
const FXStringkey (FXival pos) const
 Return key at position pos.
FXptr & data (FXival pos)
 Return reference to slot at position pos.
const FXptr & data (FXival pos) const
 Return constant reference to slot at position pos.
void clear ()
 Clear entire table.
 ~FXDictionary ()
 Destroy table.

Protected Member Functions

FXbool no (FXival n)
void used (FXival u)
void free (FXival f)
FXbool resize (FXival n)

Protected Attributes

Entrytable

Detailed Description

The dictionary class is a fast-access hash table, mapping strings to pointers.

Subclasses of dictionary can easily specialize the pointers to pointers to particular types; to this end subclasses must overload certain API's and perform the necessary type-casts for the proper interpretation of the stored pointer values. Note that many complex containers in FOX now fit inside a pointer, and thus these types can be used in dictionaries as well!


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

Copyright © 1997-2016 Jeroen van der Zijp