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 | |
---|
1 | unit Target;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, Producer, Executor, Generics.Collections;
|
---|
7 |
|
---|
8 | type
|
---|
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 |
|
---|
32 | implementation
|
---|
33 |
|
---|
34 | { TTarget }
|
---|
35 |
|
---|
36 | constructor TTarget.Create;
|
---|
37 | begin
|
---|
38 | inherited;
|
---|
39 | end;
|
---|
40 |
|
---|
41 | destructor TTarget.Destroy;
|
---|
42 | begin
|
---|
43 | FreeAndNil(Producer);
|
---|
44 | FreeAndNil(Executor);
|
---|
45 | inherited;
|
---|
46 | end;
|
---|
47 |
|
---|
48 | { TTargets }
|
---|
49 |
|
---|
50 | function TTargets.SearchBySysName(Name: string): TTarget;
|
---|
51 | var
|
---|
52 | I: Integer;
|
---|
53 | begin
|
---|
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;
|
---|
58 | end;
|
---|
59 |
|
---|
60 | procedure TTargets.LoadToStrings(Strings: TStrings);
|
---|
61 | var
|
---|
62 | I: Integer;
|
---|
63 | begin
|
---|
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;
|
---|
72 | end;
|
---|
73 |
|
---|
74 | end.
|
---|
75 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.