~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to docs/objectex/myobject.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Unit MyObject;
2
 
 
3
 
 
4
 
Interface
5
 
 
6
 
Uses Objects;
7
 
 
8
 
Type
9
 
     PMyObject = ^TMyObject;
10
 
     TMyObject = Object(TObject)
11
 
       Field : Longint;
12
 
       Constructor Init;
13
 
       Constructor Load (Var Stream : TStream);
14
 
       Destructor Done;
15
 
       Procedure Store (Var Stream : TStream);
16
 
       Function  GetField : Longint;
17
 
       Procedure SetField (Value : Longint);
18
 
       end;
19
 
 
20
 
Implementation
21
 
 
22
 
Constructor TMyobject.Init;
23
 
 
24
 
begin
25
 
  Inherited Init;
26
 
  Field:=-1;
27
 
end;
28
 
 
29
 
Constructor TMyobject.Load (Var Stream : TStream);
30
 
 
31
 
begin
32
 
  Stream.Read(Field,Sizeof(Field));
33
 
end;
34
 
 
35
 
Destructor TMyObject.Done;
36
 
 
37
 
begin
38
 
end;
39
 
 
40
 
Function TMyObject.GetField : Longint;
41
 
 
42
 
begin
43
 
  GetField:=Field;
44
 
end;
45
 
 
46
 
Procedure TMyObject.SetField (Value : Longint);
47
 
 
48
 
begin
49
 
  Field:=Value;
50
 
end;
51
 
 
52
 
Procedure TMyObject.Store (Var Stream : TStream);
53
 
 
54
 
begin
55
 
  Stream.Write(Field,SizeOf(Field));
56
 
end;
57
 
 
58
 
Const MyObjectRec : TStreamRec = (
59
 
        Objtype : 666;
60
 
        vmtlink : Ofs(TypeOf(TMyObject)^);
61
 
        Load : @TMyObject.Load;
62
 
        Store : @TMyObject.Store;
63
 
        );
64
 
 
65
 
begin
66
 
  RegisterObjects;
67
 
  RegisterType (MyObjectRec);
68
 
end.
 
 
b'\\ No newline at end of file'