tb0300.pp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. {$Mode objfpc}
  2. {
  3. This unit introduces some basic classes as they are defined in Delphi.
  4. These classes should be source compatible to their Delphi counterparts:
  5. TPersistent
  6. TComponent
  7. }
  8. Unit tb0300;
  9. {$M+}
  10. Interface
  11. Type
  12. { ---------------------------------------------------------------------
  13. Forward Declarations.
  14. ---------------------------------------------------------------------}
  15. TComponent = Class;
  16. TFiler = Class;
  17. TPersistent = Class;
  18. { ---------------------------------------------------------------------
  19. TFiler
  20. ---------------------------------------------------------------------}
  21. TFiler = Class (TObject)
  22. Protected
  23. FAncestor : TComponent;
  24. FIgnoreChildren : Boolean;
  25. FRoot : TComponent;
  26. Private
  27. Public
  28. Published
  29. { Methods }
  30. Constructor Create {(Stream : TStream; BufSize : Longint) };
  31. Destructor Destroy; override;
  32. Procedure FlushBuffer; virtual; abstract;
  33. { Properties }
  34. Property Root : TComponent Read FRoot Write FRoot;
  35. Property Ancestor : TComponent Read FAncestor Write FAncestor;
  36. Property IgnoreChildren : Boolean Read FIgnoreChildren Write FIgnoreChildren;
  37. end;
  38. { ---------------------------------------------------------------------
  39. TPersistent
  40. ---------------------------------------------------------------------}
  41. TPersistent = Class (TObject)
  42. Private
  43. Procedure AssignError (Source : TPersistent);
  44. Protected
  45. Procedure AssignTo (Dest : TPersistent);
  46. Procedure DefineProperties (Filer : TFiler); Virtual;
  47. Public
  48. { Methods }
  49. Destructor Destroy; Override;
  50. Procedure Assign (Source : TPersistent); virtual;
  51. Published
  52. end;
  53. { ---------------------------------------------------------------------
  54. TComponent
  55. ---------------------------------------------------------------------}
  56. TComponentState = Set of ( csLoading, csReading, CsWriting, csDestroying,
  57. csDesigning, csAncestor, csUpdating, csFixups );
  58. TComponentStyle = set of ( csInheritable,csCheckPropAvail );
  59. TComponentName = String;
  60. TComponent = Class (TPersistent)
  61. Protected
  62. FComponentState : TComponentState;
  63. FComponentStyle : TComponentStyle;
  64. FName : TComponentName;
  65. FOwner : TComponent;
  66. Function GetComponent (Index : Longint) : TComponent;
  67. Function GetComponentCount : Longint;
  68. Function GetComponentIndex : Longint;
  69. Procedure SetComponentIndex (Value : Longint);
  70. Procedure Setname (Value : TComponentName);
  71. Private
  72. Public
  73. { Methods }
  74. { Properties }
  75. Property ComponentCount : Longint Read GetComponentCount; { RO }
  76. Property ComponentIndex : Longint Read GetComponentIndex write SetComponentIndex; { R/W }
  77. // Property Components [Index : LongInt] : TComponent Read GetComponent; { R0 }
  78. Property ComponentState : TComponentState Read FComponentState; { RO }
  79. Property ComponentStyle : TcomponentStyle Read FComponentStyle; { RO }
  80. Property Owner : TComponent Read Fowner; { RO }
  81. Published
  82. Property Name : TComponentName Read FName Write Setname;
  83. end;
  84. Implementation
  85. { ---------------------------------------------------------------------
  86. TComponent
  87. ---------------------------------------------------------------------}
  88. Function TComponent.GetComponent (Index : Longint) : TComponent;
  89. begin
  90. end;
  91. Function TComponent.GetComponentCount : Longint;
  92. begin
  93. end;
  94. Function TComponent.GetComponentIndex : Longint;
  95. begin
  96. end;
  97. Procedure TComponent.SetComponentIndex (Value : Longint);
  98. begin
  99. end;
  100. Procedure TComponent.Setname (Value : TComponentName);
  101. begin
  102. end;
  103. { ---------------------------------------------------------------------
  104. TFiler
  105. ---------------------------------------------------------------------}
  106. Constructor TFiler.Create {(Stream : TStream; BufSize : Longint) };
  107. begin
  108. end;
  109. Destructor TFiler.Destroy;
  110. begin
  111. end;
  112. { ---------------------------------------------------------------------
  113. TPersistent
  114. ---------------------------------------------------------------------}
  115. Procedure TPersistent.AssignError (Source : TPersistent);
  116. begin
  117. end;
  118. Procedure TPersistent.AssignTo (Dest : TPersistent);
  119. begin
  120. end;
  121. Procedure TPersistent.DefineProperties (Filer : TFiler);
  122. begin
  123. end;
  124. Destructor TPersistent.Destroy;
  125. begin
  126. end;
  127. Procedure TPersistent.Assign (Source : TPersistent);
  128. begin
  129. end;
  130. end.