hash_table = (wxList**) NULL;
Create(the_key_type, size);
m_count = 0;
+ m_deleteContents = FALSE;
/*
n = size;
current_position = -1;
{
// Should NEVER be
long k = (long) key;
- if (k < 0)
- k = -k;
int position = (int) (k % n);
+ if (position < 0) position = -position;
+
if (!hash_table[position])
+ {
hash_table[position] = new wxList (wxKEY_INTEGER);
+ if (m_deleteContents) hash_table[position]->DeleteContents(TRUE);
+ }
hash_table[position]->Append (value, object);
m_count++;
void wxHashTable::Put (long key, const wxChar *value, wxObject * object)
{
// Should NEVER be
- long k = (long) key;
- if (k < 0)
- k = -k;
+ long k = (long) key;
int position = (int) (k % n);
+ if (position < 0) position = -position;
+
if (!hash_table[position])
+ {
hash_table[position] = new wxList (wxKEY_INTEGER);
+ if (m_deleteContents) hash_table[position]->DeleteContents(TRUE);
+ }
hash_table[position]->Append (value, object);
m_count++;
{
// Should NEVER be
long k = (long) key;
- if (k < 0)
- k = -k;
-
+
int position = (int) (k % n);
+ if (position < 0) position = -position;
+
if (!hash_table[position])
+ {
hash_table[position] = new wxList (wxKEY_INTEGER);
-
+ if (m_deleteContents) hash_table[position]->DeleteContents(TRUE);
+ }
+
hash_table[position]->Append (k, object);
m_count++;
}
void wxHashTable::Put (const wxChar *key, wxObject * object)
{
int position = (int) (MakeKey (key) % n);
+ if (position < 0) position = -position;
if (!hash_table[position])
+ {
hash_table[position] = new wxList (wxKEY_STRING);
+ if (m_deleteContents) hash_table[position]->DeleteContents(TRUE);
+ }
hash_table[position]->Append (key, object);
m_count++;
{
// Should NEVER be
long k = (long) key;
- if (k < 0)
- k = -k;
int position = (int) (k % n);
+ if (position < 0) position = -position;
+
if (!hash_table[position])
return (wxObject *) NULL;
else
{
// Should NEVER be
long k = (long) key;
- if (k < 0)
- k = -k;
-
+
int position = (int) (k % n);
+ if (position < 0) position = -position;
+
if (!hash_table[position])
return (wxObject *) NULL;
else
{
// Should NEVER be
long k = (long) key;
- if (k < 0)
- k = -k;
int position = (int) (k % n);
+ if (position < 0) position = -position;
+
if (!hash_table[position])
return (wxObject *) NULL;
else
wxObject *wxHashTable::Get (const wxChar *key) const
{
int position = (int) (MakeKey (key) % n);
+ if (position < 0) position = -position;
if (!hash_table[position])
return (wxObject *) NULL;
{
// Should NEVER be
long k = (long) key;
- if (k < 0)
- k = -k;
int position = (int) (k % n);
+ if (position < 0) position = -position;
+
if (!hash_table[position])
return (wxObject *) NULL;
else
wxObject *wxHashTable::Delete (const wxChar *key)
{
int position = (int) (MakeKey (key) % n);
+ if (position < 0) position = -position;
+
if (!hash_table[position])
return (wxObject *) NULL;
else
wxObject *wxHashTable::Delete (long key, int value)
{
// Should NEVER be
- long k = (long) key;
- if (k < 0)
- k = -k;
+ long k = (long) key;
int position = (int) (k % n);
+ if (position < 0) position = -position;
+
if (!hash_table[position])
return (wxObject *) NULL;
else
wxObject *wxHashTable::Delete (long key, const wxChar *value)
{
int position = (int) (key % n);
+ if (position < 0) position = -position;
+
if (!hash_table[position])
return (wxObject *) NULL;
else
void wxHashTable::DeleteContents (bool flag)
{
int i;
+ m_deleteContents = flag;
for (i = 0; i < n; i++)
{
if (hash_table[i])