source: trunk/Compiler/SourceConvertor.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.3 KB
Line 
1unit SourceConvertor;
2
3interface
4
5uses
6 Classes, SysUtils, Generics.Collections;
7
8type
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
51implementation
52
53{ TConvertor }
54
55procedure TConvertor.Convert(Input, Output: TSourceList);
56begin
57end;
58
59constructor TConvertor.Create;
60begin
61end;
62
63procedure TConvertor.Log(Text: string);
64begin
65 if Assigned(FOnDebugLog) then
66 FOnDebugLog(Text);
67end;
68
69{ TSourceText }
70
71constructor TSourceText.Create;
72begin
73 Code := TStringList.Create;
74end;
75
76destructor TSourceText.Destroy;
77begin
78 FreeAndNil(Code);
79 inherited;
80end;
81
82end.
83
Note: See TracBrowser for help on using the repository browser.