summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/tbs/tb0300.pp
blob: b5ece15c3bd71dccb54b69042fe54a60879c3c44 (plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
{$Mode objfpc}

{
  This unit introduces some basic classes as they are defined in Delphi.
  These classes should be source compatible to their Delphi counterparts:
    TPersistent
    TComponent
}

Unit tb0300;

{$M+}

Interface

Type

{ ---------------------------------------------------------------------
    Forward Declarations.
  ---------------------------------------------------------------------}

  TComponent = Class;
  TFiler = Class;
  TPersistent = Class;

{ ---------------------------------------------------------------------
    TFiler
  ---------------------------------------------------------------------}

  TFiler = Class (TObject)
    Protected
      FAncestor : TComponent;
      FIgnoreChildren : Boolean;
      FRoot : TComponent;
    Private
    Public
    Published
      { Methods }
      Constructor Create {(Stream : TStream; BufSize : Longint) };
      Destructor Destroy; override;
      Procedure FlushBuffer; virtual; abstract;
      { Properties }
      Property Root : TComponent Read FRoot Write FRoot;
      Property Ancestor : TComponent Read FAncestor Write FAncestor;
      Property IgnoreChildren : Boolean Read FIgnoreChildren Write FIgnoreChildren;
    end;

{ ---------------------------------------------------------------------
    TPersistent
  ---------------------------------------------------------------------}

  TPersistent = Class (TObject)
    Private
      Procedure AssignError (Source : TPersistent);
    Protected
      Procedure AssignTo (Dest : TPersistent);
      Procedure DefineProperties (Filer : TFiler); Virtual;
    Public
      { Methods }
      Destructor Destroy; Override;
      Procedure Assign (Source : TPersistent); virtual;
    Published
    end;

{ ---------------------------------------------------------------------
    TComponent
  ---------------------------------------------------------------------}

  TComponentState = Set of ( csLoading, csReading, CsWriting, csDestroying,
                             csDesigning, csAncestor, csUpdating, csFixups );
  TComponentStyle = set of ( csInheritable,csCheckPropAvail );
  TComponentName = String;

  TComponent = Class (TPersistent)
    Protected
      FComponentState : TComponentState;
      FComponentStyle : TComponentStyle;
      FName : TComponentName;

      FOwner : TComponent;
      Function GetComponent (Index : Longint) : TComponent;
      Function GetComponentCount : Longint;
      Function GetComponentIndex : Longint;
      Procedure SetComponentIndex (Value : Longint);
      Procedure Setname (Value : TComponentName);
    Private
    Public
      { Methods }
      { Properties }
      Property ComponentCount : Longint Read GetComponentCount; { RO  }
      Property ComponentIndex : Longint Read GetComponentIndex write SetComponentIndex; { R/W }
      // Property Components [Index : LongInt] : TComponent Read GetComponent; { R0 }
      Property ComponentState : TComponentState Read FComponentState; { RO }
      Property ComponentStyle : TcomponentStyle Read FComponentStyle; { RO }
      Property Owner : TComponent Read Fowner; { RO }
    Published
      Property Name : TComponentName Read FName Write Setname;
    end;




Implementation

{ ---------------------------------------------------------------------
    TComponent
  ---------------------------------------------------------------------}

Function TComponent.GetComponent (Index : Longint) : TComponent;

begin
end;



Function TComponent.GetComponentCount : Longint;

begin
end;



Function TComponent.GetComponentIndex : Longint;

begin
end;



Procedure TComponent.SetComponentIndex (Value : Longint);

begin
end;




Procedure TComponent.Setname (Value : TComponentName);

begin
end;



{ ---------------------------------------------------------------------
    TFiler
  ---------------------------------------------------------------------}

Constructor TFiler.Create {(Stream : TStream; BufSize : Longint) };

begin
end;




Destructor TFiler.Destroy;

begin
end;




{ ---------------------------------------------------------------------
    TPersistent
  ---------------------------------------------------------------------}

Procedure TPersistent.AssignError (Source : TPersistent);

begin
end;



Procedure TPersistent.AssignTo (Dest : TPersistent);

begin
end;



Procedure TPersistent.DefineProperties (Filer : TFiler);

begin
end;



Destructor TPersistent.Destroy;

begin
end;



Procedure TPersistent.Assign (Source : TPersistent);

begin
end;



end.