⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testtypedefs.out

📁 格式化源码的最新板
💻 OUT
字号:
unit TestTypeDefs;

{ AFS 16 Jan 2000

 This unit compiles but is not semantically meaningfull
 it is test cases for the code formatting utility

 This unit test type declarations, including record, class and interface declarations.
 also fowards declarations are tested
}

interface

uses Classes;

type
  TFred = integer;

  TJim1 = record
    i1: integer;
    s1: string;
  end;

  { forward declarations }
  TBob     = interface;
  TBobDisp = dispinterface;
  TMark    = class;

  //TJim = Record;

  ptGarf = ^TGarf;

  TGarf = record
    iFoo: integer;
    bBar: boolean;
    sBaz: string;
  end;

  TMyEnum    = (Foo, Bar, Baz, Spon, Wibble, Fish);
  TMyEnumSet = set of TMyEnum;

  { some fairly simple real-world code (modified slightly) }

  IMyIterator = interface(IUnknown)
    procedure First;
    procedure Next;
  end;

  IEntryJournalLookupDisp = dispinterface
    ['{D34D4103-FBC4-11D2-94F3-00A0CC39B56F}']
    property StartDate: TDateTime dispid 1;
    property EndDate: TDateTime dispid 2;
    property MaxRows: integer dispid 2000;
    property Iterator: IMyIterator ReadOnly dispid 2001;
    function Execute: IMyIterator; dispid 2002;
    function GetNewOjectKey: IUnknown; dispid 2003;
  end;

  IEntryJournalIterator = interface(IMyIterator)
    ['{D34D4105-FBC4-11D2-94F3-00A0CC39B56F}']
    function Get_Note: WideString; safecall;
    function Get_Status: WideString; safecall;
    function Get_CreatedDate: TDateTime; safecall;
    function Get_LoginName: WideString; safecall;
    function Get_Id: integer; safecall;
    procedure Set_Id(Id: integer); safecall;
    property Note: WideString Read Get_Note;
    property Status: WideString Read Get_Status;
    property CreatedDate: TDateTime Read Get_CreatedDate;
    property LoginName: WideString Read Get_LoginName;
    property Id: integer Read Get_Id Write Set_Id;
  end;

  // class with class functions 
  FredCoClass = class
    function Dink: boolean;
    class function Create: IDispatch;
    class function CreateRemote(const MachineName: string): IDispatch;
  end;

  // eesh! this class function stuff can get confusing
  OtherFredCoClass = class
    class function Dink: boolean;
  end;


  TMark = class(TObject)
  private
    fiMark: integer;
  protected
    psStuff: string;
  public
    procedure Fred; safecall;
    property Mark: integer Read fiMark Write fiMark;
  end;


 { the forwards are just there to test,
 but I have to fulfill them or it won't compile
 So I will do so as minimaly as possible }
  TBob = interface(IUnknown)
  end;

  TBobDisp = dispinterface
    ['{BAADBEEF-CADA-11D2-94F3-00A0CC39B56F}']
  end;

  TDink = class(TStrings)
  end;

implementation

function FredCoClass.Dink: boolean;
begin
  Result := True;
end;

class function FredCoClass.Create: IDispatch;
begin
  Result := nil;
end;

class function FredCoClass.CreateRemote(const MachineName: string): IDispatch;
begin
  Result := nil;
end;

{ TMark }

procedure TMark.Fred;
begin
  //do nothing
end;

{ OtherFredCoClass }

class function OtherFredCoClass.Dink: boolean;
begin
  Result := False;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -