-
Notifications
You must be signed in to change notification settings - Fork 10
/
DWMarkupLinguageTag.pas
91 lines (74 loc) · 2.51 KB
/
DWMarkupLinguageTag.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
unit DWMarkupLinguageTag;
interface
uses Classes, System.SysUtils, DWRenderStream;
type
TDWClosingTag = (ctdwAuto, ctdwFalse, ctdwTrue, ctdwSimpleClose);
TDWCustomElement = class(TPersistent)
private
FParentElement: TDWCustomElement;
FDestroying: System.Boolean;
FChanged: Boolean;
protected
FClosingTag: TDWClosingTag;
procedure SetParentElement(const Value: TDWCustomElement); virtual;
procedure RenderElement(ABuffer: TDWStream; AIndent: Integer = 0); virtual;
procedure InitializeElement(AParentElement: TDWCustomElement); virtual;
public
constructor Create(AParentElement: TDWCustomElement); virtual;
destructor Destroy; override;
procedure Assign(ASource: Classes.TPersistent); override;
procedure Render(ABuffer: TDWStream); overload; virtual;
function Render: String; overload; virtual;
procedure Changed(aValue: Boolean = True); virtual;
property Destroying: System.Boolean read FDestroying;
property ParentElement: TDWCustomElement read FParentElement write SetParentElement;
end;
implementation
{ TDWMarkupLanguageElement }
procedure TDWCustomElement.Assign(ASource: Classes.TPersistent);
begin
if ASource <> Self then
begin
inherited Assign(ASource);
Changed;
end;
end;
procedure TDWCustomElement.Changed(aValue: Boolean = True);
begin
FChanged := aValue;
end;
constructor TDWCustomElement.Create(AParentElement: TDWCustomElement);
begin
FChanged := True;
FParentElement := AParentElement;
end;
destructor TDWCustomElement.Destroy;
begin
inherited;
end;
procedure TDWCustomElement.InitializeElement(AParentElement: TDWCustomElement);
begin
raise Exception.Create('Render not Implemented for TDWCustomElement, use descendant class');
end;
procedure TDWCustomElement.Render(ABuffer: TDWStream);
begin
raise Exception.Create('Render not Implemented for TDWCustomElement, use descendant class');
end;
function TDWCustomElement.Render: String;
begin
raise Exception.Create('Render not Implemented for TDWCustomElement, use descendant class');
end;
procedure TDWCustomElement.RenderElement(ABuffer: TDWStream; AIndent: Integer = 0);
begin
raise Exception.Create
('RenderElement not Implemented for TDWCustomElement, use descendant class');
end;
procedure TDWCustomElement.SetParentElement(const Value: TDWCustomElement);
begin
if FParentElement <> Value then
begin
FParentElement := Value;
Changed;
end;
end;
end.