home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / dialgmgr.sit / Object.p < prev    next >
Text File  |  1989-11-29  |  1KB  |  61 lines

  1. {}
  2. {    File: ObjIntf.p}
  3. {        }
  4. {    Copyright Symantec Corporation 1988}
  5. {    Copyright Apple Computer, Inc. 1986-1987}
  6. {    All rights reserved.}
  7. {}
  8.  
  9. unit TObject;
  10.  
  11. interface
  12.  
  13.     type
  14.         TObject = object
  15.                 function ShallowClone: TObject;
  16.             {Lowest level method for copying an object; should not be overridden}
  17. {                except in very unusual cases.  Simply calls HandToHand to copy}
  18. {                the object data.}
  19.                 function Clone: TObject;
  20.             {Defaults to calling ShallowClone; can be overridden to copy objects}
  21. {                refered to by fields.}
  22.                 procedure ShallowFree;
  23.             {Lowest level method for freeing an object; should not be overridden}
  24. {                except in very unusual cases.  Simply calls DisposHandle to}
  25. {                free the object data.}
  26.                 procedure Free;
  27.             {Defaults to calling ShallowFree; can be overridden to free objects }
  28. {                refered to by fields.}
  29.             end;
  30.  
  31. implementation
  32.  
  33.     function TObject.ShallowClone;
  34.         var
  35.             result: Handle;
  36.     begin
  37.         result := Handle(SELF);
  38.         if HandToHand(result) <> noErr then
  39.             begin
  40.                   { report some sort of error? }
  41.                 result := nil
  42.             end;
  43.         ShallowClone := TObject(result);
  44.     end;
  45.  
  46.     function TObject.Clone;
  47.     begin
  48.         Clone := SELF.ShallowClone;
  49.     end;
  50.  
  51.     procedure TObject.ShallowFree;
  52.     begin
  53.         DisposHandle(Handle(SELF));
  54.     end;
  55.  
  56.     procedure TObject.Free;
  57.     begin
  58.         SELF.ShallowFree;
  59.     end;
  60.  
  61. end.