forked from sisong/DGL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_DGLMap_String_Integer.pas
More file actions
75 lines (56 loc) · 1.96 KB
/
Copy path_DGLMap_String_Integer.pas
File metadata and controls
75 lines (56 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(*
* DGL(The Delphi Generic Library)
*
* Copyright (c) 2004
* HouSisong@gmail.com
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*)
//------------------------------------------------------------------------------
//TStrIntMap
//例子
//具现化String<->integer的map容器和其迭代器
// Create by HouSisong, 2004.09.13
//------------------------------------------------------------------------------
unit _DGLMap_String_Integer;
interface
uses
SysUtils;
{$I DGLCfg.inc_h}
type
_KeyType = string;
_ValueType = integer;
const
_NULL_Value:integer=0;
function _HashValue(const Key: _KeyType):Cardinal;{$ifdef _DGL_Inline} inline; {$endif}//Hash函数
{$I HashMap.inc_h} //"类"模版的声明文件
{$I Map.inc_h} //"类"模版的声明文件
{$I Algorithms.inc_h}
//out
type
IStrIntMapIterator = _IMapIterator;
IStrIntMap = _IMap;
IStrIntMultiMap = _IMultiMap;
TStrIntHashMap = _THashMap;
TStrIntHashMultiMap = _THashMultiMap;
TStrIntMap = _TMap;
TStrIntMultiMap = _TMultiMap;
implementation
uses
HashFunctions;
{$I HashMap.inc_pas} //"类"模版的实现文件
{$I Map.inc_pas} //"类"模版的实现文件
{$I Algorithms.inc_pas}
function _HashValue(const Key :_KeyType):Cardinal; overload;
begin
result:=HashValue_Str(Key);
end;
end.