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

FX::FXDict Class Reference

The dictionary class maintains a fast-access hash table of entities indexed by a character string. More...

#include <FXDict.h>

Inheritance diagram for FX::FXDict:

FX::FXObject FX::FXFileDict FX::FXIconDict FX::FXSettings FX::FXStringDict FX::FXRegistry List of all members.

Public Member Functions

 FXDict ()
 FXDict (const FXDict &orig)
FXDictoperator= (const FXDict &orig)
void size (FXint m)
FXint size () const
FXint no () const
void * insert (const FXchar *ky, const void *ptr, bool mrk=false)
void * replace (const FXchar *ky, const void *ptr, bool mrk=false)
void * remove (const FXchar *ky)
void * find (const FXchar *ky) const
bool empty (FXint pos) const
const FXcharkey (FXuint pos) const
void * data (FXuint pos) const
bool mark (FXuint pos) const
FXint first () const
FXint last () const
FXint next (FXint pos) const
FXint prev (FXint pos) const
void clear ()
virtual ~FXDict ()

Detailed Description

The dictionary class maintains a fast-access hash table of entities indexed by a character string.

It is typically used to map strings to pointers; however, overloading the createData() and deleteData() members allows any type of data to be indexed by strings.


Constructor & Destructor Documentation

FX::FXDict::FXDict  ) 
 

Construct an empty dictionary.

FX::FXDict::FXDict const FXDict orig  ) 
 

Copy constructor; does bit-copy of void pointer data.

virtual FX::FXDict::~FXDict  )  [virtual]
 

Destructor.


Member Function Documentation

FXDict& FX::FXDict::operator= const FXDict orig  ) 
 

Assignment operator.

void FX::FXDict::size FXint  m  ) 
 

Resize the table to the given size.

FXint FX::FXDict::size  )  const [inline]
 

Return the size of the table, including the empty slots.

FXint FX::FXDict::no  )  const [inline]
 

Return the total number of entries in the table.

void* FX::FXDict::insert const FXchar ky,
const void *  ptr,
bool  mrk = false
 

Insert a new entry into the table given key and mark.

If there is already an entry with that key, leave it unchanged, otherwise insert the new entry.

void* FX::FXDict::replace const FXchar ky,
const void *  ptr,
bool  mrk = false
 

Replace data at key, if the entry's mark is less than or equal to the given mark.

If there was no existing entry, a new entry is inserted with the given mark.

void* FX::FXDict::remove const FXchar ky  ) 
 

Remove data given key.

Reimplemented in FX::FXFileDict, FX::FXIconDict, and FX::FXStringDict.

void* FX::FXDict::find const FXchar ky  )  const
 

Find data pointer given key.

Reimplemented in FX::FXSettings, and FX::FXStringDict.

bool FX::FXDict::empty FXint  pos  )  const [inline]
 

Return true if slot is empty.

const FXchar* FX::FXDict::key FXuint  pos  )  const [inline]
 

Return key at position pos.

void* FX::FXDict::data FXuint  pos  )  const [inline]
 

return data pointer at position pos.

Reimplemented in FX::FXSettings, and FX::FXStringDict.

bool FX::FXDict::mark FXuint  pos  )  const [inline]
 

Return mark flag of entry at position pos.

FXint FX::FXDict::first  )  const
 

Return position of first filled slot, or >= total.

FXint FX::FXDict::last  )  const
 

Return position of last filled slot or -1.

FXint FX::FXDict::next FXint  pos  )  const
 

Return position of next filled slot in hash table or a value greater than or equal to total if no filled slot was found.

FXint FX::FXDict::prev FXint  pos  )  const
 

Return position of previous filled slot in hash table or a -1 if no filled slot was found.

void FX::FXDict::clear  ) 
 

Clear all entries.

Reimplemented in FX::FXSettings.

Copyright © 1997-2005 Jeroen van der Zijp