source: trunk/Compiler/Target.pas

Last change on this file was 75, checked in by chronos, 6 months ago
  • Modified: Removed U prefix from unit names.
  • Modified: Updated Common package.
File size: 1.2 KB
Line 
1unit Target;
2
3interface
4
5uses
6 Classes, SysUtils, Producer, Executor, Generics.Collections;
7
8type
9 { TTarget }
10
11 TTarget = class
12 public
13 Name: string;
14 SysName: string;
15 Producer: TProducer;
16 Executor: TExecutor;
17 Compiler: TObject; // TCompiler
18 constructor Create; virtual;
19 destructor Destroy; override;
20 end;
21
22 TTargetClass = class of TTarget;
23
24 { TTargets }
25
26 TTargets = class(TObjectList<TTarget>)
27 function SearchBySysName(Name: string): TTarget;
28 procedure LoadToStrings(Strings: TStrings);
29 end;
30
31
32implementation
33
34{ TTarget }
35
36constructor TTarget.Create;
37begin
38 inherited;
39end;
40
41destructor TTarget.Destroy;
42begin
43 FreeAndNil(Producer);
44 FreeAndNil(Executor);
45 inherited;
46end;
47
48{ TTargets }
49
50function TTargets.SearchBySysName(Name: string): TTarget;
51var
52 I: Integer;
53begin
54 I := 0;
55 while (I < Count) and (TTarget(Items[I]).SysName <> Name) do Inc(I);
56 if I < Count then Result := TTarget(Items[I])
57 else Result := nil;
58end;
59
60procedure TTargets.LoadToStrings(Strings: TStrings);
61var
62 I: Integer;
63begin
64 try
65 Strings.BeginUpdate;
66 Strings.Clear;
67 for I := 0 to Count - 1 do
68 Strings.AddObject(TTarget(Items[I]).Name, Items[I]);
69 finally
70 Strings.EndUpdate;
71 end;
72end;
73
74end.
75
Note: See TracBrowser for help on using the repository browser.