-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathBreakpointList.pas
More file actions
93 lines (72 loc) · 2.73 KB
/
Copy pathBreakpointList.pas
File metadata and controls
93 lines (72 loc) · 2.73 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
(***********************************************************************)
(* Delphi Code Coverage *)
(* *)
(* A quick hack of a Code Coverage Tool for Delphi *)
(* by Christer Fahlgren and Nick Ring *)
(* *)
(* This Source Code Form is subject to the terms of the Mozilla Public *)
(* License, v. 2.0. If a copy of the MPL was not distributed with this *)
(* file, You can obtain one at http://mozilla.org/MPL/2.0/. *)
unit BreakPointList;
interface
uses
JclStringLists,
I_BreakPoint,
I_BreakPointList;
type
TBreakPointList = class(TInterfacedObject, IBreakPointList)
strict private
FBreakPointLst: IJclStringList;
public
function GetBreakPoint(const AIndex: Integer): IBreakPoint;
property BreakPoint[const AIndex: Integer]: IBreakPoint read GetBreakPoint; default;
function GetBreakPointByAddress(const AAddress: Pointer): IBreakPoint;
property BreakPointByAddress[const AAddress: Pointer]: IBreakPoint read GetBreakPointByAddress;
function HasBreakPointUnitModuleName(const AUnitModuleName: String): Boolean;
constructor Create;
destructor Destroy; override;
procedure Add(const ABreakPoint: IBreakPoint);
function Count: Integer;
procedure SetCapacity(const AValue: Integer);
end;
implementation
uses
System.Classes,
System.SysUtils;
constructor TBreakPointList.Create;
begin
inherited;
FBreakPointLst := TJclStringList.Create;
FBreakPointLst.Sorted := True;
FBreakPointLst.Duplicates := dupError;
end;
destructor TBreakPointList.Destroy;
begin
FBreakPointLst := nil;
inherited;
end;
function TBreakPointList.GetBreakPoint(const AIndex: Integer): IBreakPoint;
begin
Result := IBreakPoint(FBreakPointLst.Interfaces[AIndex]);
end;
function TBreakPointList.Count: Integer;
begin
Result := FBreakPointLst.Count;
end;
procedure TBreakPointList.Add(const ABreakPoint: IBreakPoint);
begin
FBreakPointLst.KeyInterface[IntToHex(Integer(ABreakPoint.Address), 8)] := ABreakPoint;
end;
function TBreakPointList.GetBreakPointByAddress(const AAddress: Pointer): IBreakPoint;
begin
Result := IBreakPoint(FBreakPointLst.KeyInterface[IntToHex(Integer(AAddress), 8)]);
end;
function TBreakPointList.HasBreakPointUnitModuleName(const AUnitModuleName: String): Boolean;
begin
Result := FBreakPointLst.IndexOf(AUnitModuleName) > 0;
end;
procedure TBreakPointList.SetCapacity(const AValue: Integer);
begin
FBreakPointLst.Capacity := AValue;
end;
end.