Unicorn XML Toolkit
Version 1.00.00

Namespace Core
Class CHashTable

class CHashTable {
public:
    CHashTable();
    ~CHashTable();
public:
    void Create(int nSize);
    void Set(const CString &strKey, int nValue);
    bool Find(const CString &strKey, int &nValue);
    void Remove(const CString &strKey);
    int GetCount();
    };

The hash table which accepts strings as keys and integers as values.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
Constructor/Destructor Summary
CHashTable ();
����������Constructs the hash table.
~CHashTable ();
����������Destroys the hash table.

Function Summary
void Create (int nSize);
����������Creates the hash table with the specified size.
void Set (const CString &strKey, int nValue);
����������Sets the new key/value association.
bool Find (const CString &strKey, int &nValue);
����������Looks up the specified key in this hash table.
void Remove (const CString &strKey);
����������Removes the specified key from this hash table.
int GetCount ();
����������Returns a number of keys in this hash table.

Constructor/Destructor Detail

CHashTable

CHashTable();

Constructs the hash table.

~CHashTable

~CHashTable();

Destroys the hash table.

Function Detail

Create

void Create(int nSize);

Creates the hash table with the specified size.

Parameters:
nSize - the size of the hash table

Set

void Set(const CString &strKey, int nValue);

Sets the new key/value association.

If the specified key is already present in this hash table, its value is replaced by the specified value; otherwise the specified key/value pair is added to the hash table.

Parameters:
strKey - the key
nValue - the value

Find

bool Find(const CString &strKey, int &nValue);

Looks up the specified key in this hash table.

Parameters:
strKey - the key to look up
nValue - on return, the value corresponding to the specified key; undefined if the key is not found
Returns:
true if the specified key is found in this hash table; false otherwise

Remove

void Remove(const CString &strKey);

Removes the specified key from this hash table.

The function has no effect is the specified key is not found in this hash table.

Parameters:
strKey - the key to remove

GetCount

int GetCount();

Returns a number of keys in this hash table.

Returns:
the number of keys in this hash table

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

Copyright 1999-2001 Unicorn Enterprises SA.
All Rights Reserved.