1 |
torben |
2671 |
// Upgraded to Delphi 2009: Sebastian Zierer
|
2 |
|
|
|
3 |
|
|
(* ***** BEGIN LICENSE BLOCK *****
|
4 |
|
|
* Version: MPL 1.1
|
5 |
|
|
*
|
6 |
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
7 |
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
8 |
|
|
* the License. You may obtain a copy of the License at
|
9 |
|
|
* http://www.mozilla.org/MPL/
|
10 |
|
|
*
|
11 |
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
12 |
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
13 |
|
|
* for the specific language governing rights and limitations under the
|
14 |
|
|
* License.
|
15 |
|
|
*
|
16 |
|
|
* The Original Code is TurboPower SysTools
|
17 |
|
|
*
|
18 |
|
|
* The Initial Developer of the Original Code is
|
19 |
|
|
* TurboPower Software
|
20 |
|
|
*
|
21 |
|
|
* Portions created by the Initial Developer are Copyright (C) 1996-2002
|
22 |
|
|
* the Initial Developer. All Rights Reserved.
|
23 |
|
|
*
|
24 |
|
|
* Contributor(s):
|
25 |
|
|
*
|
26 |
|
|
* ***** END LICENSE BLOCK ***** *)
|
27 |
|
|
|
28 |
|
|
{*********************************************************}
|
29 |
|
|
{* SysTools: StNVDict.pas 4.04 *}
|
30 |
|
|
{*********************************************************}
|
31 |
|
|
{* SysTools: non visual component for TStDictionary *}
|
32 |
|
|
{*********************************************************}
|
33 |
|
|
|
34 |
|
|
{$I StDefine.inc}
|
35 |
|
|
|
36 |
|
|
unit StNVDict;
|
37 |
|
|
|
38 |
|
|
interface
|
39 |
|
|
|
40 |
|
|
uses
|
41 |
|
|
Windows, Classes,
|
42 |
|
|
StBase, StDict, StNVCont;
|
43 |
|
|
|
44 |
|
|
type
|
45 |
|
|
TStNVDictionary = class(TStNVContainerBase)
|
46 |
|
|
{.Z+}
|
47 |
|
|
protected {private}
|
48 |
|
|
{property variables}
|
49 |
|
|
FContainer : TStDictionary; {instance of the container}
|
50 |
|
|
FHashSize : Integer;
|
51 |
|
|
|
52 |
|
|
{property methods}
|
53 |
|
|
function GetHashSize : Integer;
|
54 |
|
|
function GetOnEqual : TStStringCompareEvent;
|
55 |
|
|
procedure SetHashSize(Value : Integer);
|
56 |
|
|
procedure SetOnEqual(Value : TStStringCompareEvent);
|
57 |
|
|
|
58 |
|
|
protected
|
59 |
|
|
function GetOnDisposeData : TStDisposeDataEvent;
|
60 |
|
|
override;
|
61 |
|
|
function GetOnLoadData : TStLoadDataEvent;
|
62 |
|
|
override;
|
63 |
|
|
function GetOnStoreData : TStStoreDataEvent;
|
64 |
|
|
override;
|
65 |
|
|
procedure SetOnDisposeData(Value : TStDisposeDataEvent);
|
66 |
|
|
override;
|
67 |
|
|
procedure SetOnLoadData(Value : TStLoadDataEvent);
|
68 |
|
|
override;
|
69 |
|
|
procedure SetOnStoreData(Value : TStStoreDataEvent);
|
70 |
|
|
override;
|
71 |
|
|
|
72 |
|
|
public
|
73 |
|
|
constructor Create(AOwner : TComponent);
|
74 |
|
|
override;
|
75 |
|
|
destructor Destroy;
|
76 |
|
|
override;
|
77 |
|
|
{.Z-}
|
78 |
|
|
|
79 |
|
|
property Container : TStDictionary
|
80 |
|
|
read FContainer;
|
81 |
|
|
|
82 |
|
|
published
|
83 |
|
|
property HashSize : Integer
|
84 |
|
|
read GetHashSize
|
85 |
|
|
write SetHashSize default 509;
|
86 |
|
|
|
87 |
|
|
property OnEqual : TStStringCompareEvent
|
88 |
|
|
read GetOnEqual
|
89 |
|
|
write SetOnEqual;
|
90 |
|
|
|
91 |
|
|
property OnDisposeData;
|
92 |
|
|
property OnLoadData;
|
93 |
|
|
property OnStoreData;
|
94 |
|
|
end;
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
implementation
|
98 |
|
|
|
99 |
|
|
{*** TStNVDictionary ***}
|
100 |
|
|
|
101 |
|
|
constructor TStNVDictionary.Create(AOwner : TComponent);
|
102 |
|
|
begin
|
103 |
|
|
inherited Create(AOwner);
|
104 |
|
|
|
105 |
|
|
{defaults}
|
106 |
|
|
FHashSize := 509;
|
107 |
|
|
|
108 |
|
|
if Classes.GetClass(TStDictionary.ClassName) = nil then
|
109 |
|
|
RegisterClass(TStDictionary);
|
110 |
|
|
if Classes.GetClass(TStDictNode.ClassName) = nil then
|
111 |
|
|
RegisterClass(TStDictNode);
|
112 |
|
|
|
113 |
|
|
FContainer := TStDictionary.Create(FHashSize);
|
114 |
|
|
end;
|
115 |
|
|
|
116 |
|
|
destructor TStNVDictionary.Destroy;
|
117 |
|
|
begin
|
118 |
|
|
FContainer.Free;
|
119 |
|
|
FContainer := nil;
|
120 |
|
|
|
121 |
|
|
inherited Destroy;
|
122 |
|
|
end;
|
123 |
|
|
|
124 |
|
|
function TStNVDictionary.GetHashSize : Integer;
|
125 |
|
|
begin
|
126 |
|
|
Result := FContainer.HashSize;
|
127 |
|
|
end;
|
128 |
|
|
|
129 |
|
|
function TStNVDictionary.GetOnDisposeData : TStDisposeDataEvent;
|
130 |
|
|
begin
|
131 |
|
|
Result := FContainer.OnDisposeData;
|
132 |
|
|
end;
|
133 |
|
|
|
134 |
|
|
function TStNVDictionary.GetOnEqual : TStStringCompareEvent;
|
135 |
|
|
begin
|
136 |
|
|
Result := FContainer.OnEqual;
|
137 |
|
|
end;
|
138 |
|
|
|
139 |
|
|
function TStNVDictionary.GetOnLoadData : TStLoadDataEvent;
|
140 |
|
|
begin
|
141 |
|
|
Result := FContainer.OnLoadData;
|
142 |
|
|
end;
|
143 |
|
|
|
144 |
|
|
function TStNVDictionary.GetOnStoreData : TStStoreDataEvent;
|
145 |
|
|
begin
|
146 |
|
|
Result := FContainer.OnStoreData;
|
147 |
|
|
end;
|
148 |
|
|
|
149 |
|
|
procedure TStNVDictionary.SetHashSize(Value : Integer);
|
150 |
|
|
begin
|
151 |
|
|
FContainer.HashSize := Value;
|
152 |
|
|
end;
|
153 |
|
|
|
154 |
|
|
procedure TStNVDictionary.SetOnDisposeData(Value : TStDisposeDataEvent);
|
155 |
|
|
begin
|
156 |
|
|
FContainer.OnDisposeData := Value;
|
157 |
|
|
end;
|
158 |
|
|
|
159 |
|
|
procedure TStNVDictionary.SetOnEqual(Value : TStStringCompareEvent);
|
160 |
|
|
begin
|
161 |
|
|
FContainer.OnEqual := Value;
|
162 |
|
|
end;
|
163 |
|
|
|
164 |
|
|
procedure TStNVDictionary.SetOnLoadData(Value : TStLoadDataEvent);
|
165 |
|
|
begin
|
166 |
|
|
FContainer.OnLoadData := Value;
|
167 |
|
|
end;
|
168 |
|
|
|
169 |
|
|
procedure TStNVDictionary.SetOnStoreData(Value : TStStoreDataEvent);
|
170 |
|
|
begin
|
171 |
|
|
FContainer.OnStoreData := Value;
|
172 |
|
|
end;
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
end.
|