Main Page
Classes
Files
File List
include
dime
util
Dict.h
1
/**************************************************************************\
2
*
3
* FILE: Dict.h
4
*
5
* This source file is part of DIME.
6
* Copyright (C) 1998-1999 by Systems In Motion. All rights reserved.
7
*
8
* This library is free software; you can redistribute it and/or modify it
9
* under the terms of the GNU General Public License, version 2, as
10
* published by the Free Software Foundation.
11
*
12
* This library is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* General Public License (the accompanying file named COPYING) for more
16
* details.
17
*
18
**************************************************************************
19
*
20
* If you need DIME for a non-GPL project, contact Systems In Motion
21
* to acquire a Professional Edition License:
22
*
23
* Systems In Motion http://www.sim.no/
24
* Prof. Brochs gate 6 sales@sim.no
25
* N-7030 Trondheim Voice: +47 22114160
26
* NORWAY Fax: +47 67172912
27
*
28
\**************************************************************************/
29
30
#ifndef DIME_DICT_H
31
#define DIME_DICT_H
32
33
#include <dime/Basic.h>
34
#include <string.h>
35
36
class
DIME_DLL_API
dimeDictEntry
37
{
38
friend
class
dimeDict
;
39
40
private
:
41
dimeDictEntry
*next;
42
dimeDictEntry
(
const
char
*
const
k,
void
*v) {key = strdup(k); value = v; };
43
~
dimeDictEntry
() {free(key);}
44
char
*key;
45
void
*value;
46
47
};
// class dimeDictEntry
48
49
class
DIME_DLL_API
dimeDict
50
{
51
public
:
52
dimeDict
(
const
int
entries = 17989);
53
~
dimeDict
();
54
void
clear();
55
56
bool
enter(
const
char
*
const
key,
char
*&ptr,
void
*value);
57
const
char
*enter(
const
char
*
const
key,
void
*value);
58
const
char
*find(
const
char
*
const
key)
const
;
59
bool
find(
const
char
*
const
key,
void
*&value)
const
;
60
bool
remove
(
const
char
*
const
key);
61
void
dump(
void
);
62
63
private
:
64
int
tableSize;
65
dimeDictEntry
**buckets;
66
dimeDictEntry
*&findEntry(
const
char
*
const
key)
const
;
67
unsigned
int
bucketNr(
const
char
*key)
const
;
68
69
public
:
70
void
print_info();
71
72
};
// class dimeDict
73
74
#endif // ! DIME_DICT_H
75
Copyright © 1998-1999,
Systems In Motion
<
sales@sim.no
>. All rights reserved.
System documentation was generated using
doxygen
.