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.3 KB
|
Line | |
---|
1 | unit SourceConvertor;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, Generics.Collections;
|
---|
7 |
|
---|
8 | type
|
---|
9 | TSource = class
|
---|
10 | Name: string;
|
---|
11 | end;
|
---|
12 |
|
---|
13 | TSourceClass = class of TSource;
|
---|
14 |
|
---|
15 | TSourceFileLink = class(TSource)
|
---|
16 | FileName: string;
|
---|
17 | end;
|
---|
18 |
|
---|
19 | { TSourceText }
|
---|
20 |
|
---|
21 | TSourceText = class(TSource)
|
---|
22 | Code: TStringList;
|
---|
23 | constructor Create;
|
---|
24 | destructor Destroy; override;
|
---|
25 | end;
|
---|
26 |
|
---|
27 | TSourceList = class
|
---|
28 | Items: TObjectList<TSource>;
|
---|
29 | end;
|
---|
30 |
|
---|
31 | TDebugLogEvent = procedure(Text: string) of object;
|
---|
32 |
|
---|
33 | { TConvertor }
|
---|
34 |
|
---|
35 | TConvertor = class
|
---|
36 | private
|
---|
37 | FOnDebugLog: TDebugLogEvent;
|
---|
38 | public
|
---|
39 | Name: string;
|
---|
40 | InputType: TSourceClass;
|
---|
41 | OutputType: TSourceClass;
|
---|
42 | procedure Convert(Input, Output: TSourceList); virtual;
|
---|
43 | constructor Create; virtual;
|
---|
44 | procedure Log(Text: string);
|
---|
45 | property OnDebugLog: TDebugLogEvent read FOnDebugLog write FOnDebugLog;
|
---|
46 | end;
|
---|
47 |
|
---|
48 | TConvertorClass = class of TConvertor;
|
---|
49 |
|
---|
50 |
|
---|
51 | implementation
|
---|
52 |
|
---|
53 | { TConvertor }
|
---|
54 |
|
---|
55 | procedure TConvertor.Convert(Input, Output: TSourceList);
|
---|
56 | begin
|
---|
57 | end;
|
---|
58 |
|
---|
59 | constructor TConvertor.Create;
|
---|
60 | begin
|
---|
61 | end;
|
---|
62 |
|
---|
63 | procedure TConvertor.Log(Text: string);
|
---|
64 | begin
|
---|
65 | if Assigned(FOnDebugLog) then
|
---|
66 | FOnDebugLog(Text);
|
---|
67 | end;
|
---|
68 |
|
---|
69 | { TSourceText }
|
---|
70 |
|
---|
71 | constructor TSourceText.Create;
|
---|
72 | begin
|
---|
73 | Code := TStringList.Create;
|
---|
74 | end;
|
---|
75 |
|
---|
76 | destructor TSourceText.Destroy;
|
---|
77 | begin
|
---|
78 | FreeAndNil(Code);
|
---|
79 | inherited;
|
---|
80 | end;
|
---|
81 |
|
---|
82 | end.
|
---|
83 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.