source: trunk/Application/UDataModel.pas

Last change on this file was 56, checked in by chronos, 12 years ago
File size: 1.1 KB
Line 
1unit UDataModel;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, SpecializedList;
9
10type
11 TDataType = (dtInteger, dtString, dtText, dtFloat, dtBoolean, dtReference,
12 dtDate, dtTime, dtDateTime);
13
14 TDataModelItem = class
15 Name: string;
16 Caption: string;
17 DataType: TDataType;
18 end;
19
20 { TDateModelItems }
21
22 TDataModelItems = class(TListObject)
23 function AddItem(Caption, Name: string; DataType: TDataType): TDataModelItem;
24 end;
25
26 { TDataModel }
27
28 TDataModel = class
29 Name: string;
30 Caption: string;
31 Items: TDataModelItems;
32 constructor Create;
33 destructor Destroy; override;
34 end;
35
36implementation
37
38{ TDataModel }
39
40constructor TDataModel.Create;
41begin
42 Items := TDataModelItems.Create;
43end;
44
45destructor TDataModel.Destroy;
46begin
47 Items.Free;
48 inherited Destroy;
49end;
50
51{ TDateModelItems }
52
53function TDataModelItems.AddItem(Caption, Name: string; DataType: TDataType): TDataModelItem;
54begin
55 Result := TDataModelItem.Create;
56 Result.Name := Name;
57 Result.Caption := Caption;
58 Result.DataType := DataType;
59 Add(Result);
60end;
61
62end.
63
Note: See TracBrowser for help on using the repository browser.