亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? xpevent.pas

?? 類似于Java JUnit的單元測試
?? PAS
字號:
unit XPEvent;

{
 $Source: /cvsroot/dunit/dunit/Contrib/DUnitWizard/Source/Common/XPEvent.pas,v $
 $Revision: 1.2 $
 $Date: 2004/05/03 15:07:15 $
 Last amended by $Author: pvspain $
 $State: Exp $

 XPEvent:  Base interfaces and classes for management of events with
              multiple listeners (event handlers)

 Events covered: TXPEvent (no arguments)

Unit entry points:

  function CreateIXPEventMulticaster: IXPEventMulticaster;

 Copyright (c) 2001 by The Excellent Programming Company Pty Ltd
 (Australia) (ABN 27 005 394 918).

 Contact Paul Spain via email: paul@xpro.com.au

 This unit is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This unit is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this unit; if not, the license can be viewed at:
 http://www.gnu.org/copyleft/lesser.html
 or write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 Boston, MA  02111-1307  USA
}

interface

type

  // Base interface
  IXPCount = interface(IUnknown)
    ['{50D5B041-28A7-11D5-A292-00608CF441D9}']
    function Count: integer;
    end;

/////////////////////////////////////////////////////////////////////////////
///   Base classes TXPEventMulticaster, TXPRefEventMulticaster declaration
/////////////////////////////////////////////////////////////////////////////

type

  TXPEvent = procedure of object;
  TXPEvents = array of TXPEvent;

  IXPEventMulticaster = interface(IXPCount)
    ['{ADE449D1-294B-11D5-8CAD-0080ADB62643}']
    procedure Add(const Handler: TXPEvent);
    function Insert(const Handler: TXPEvent;
      const idx: integer): integer;
    procedure Delete(const Handler: TXPEvent);
    function Handler: TXPEvent;
    end;

function CreateIXPEventMulticaster: IXPEventMulticaster;

type

  // Class to manage multiple event handlers for a single event
  // <TXPEvent> is a necessarily generic method pointer
  //
  // Users should subclass from TXPEventMulticaster for each event type to
  // be handled:
  // * Overwrite Add(), Insert() and Delete() with wrappers taking
  //   arguments of the correct event type for the subclass and invoking
  //   the inherited namesake method with a TXPEvent-cast
  //   argument.
  // * Overwrite Notify() with a method of the same signature
  //   as the subclass event type. This method must iterate over the content
  //   of Events, casting each item to the subclass event type and
  //   executing with the arguments passed in to subclassed Notify().
  //   Typically, the base class Notify is never called. It is provided
  //   as a minimal template, and the off-chance someone needs a Multicaster
  //   with an event signature of TXPEvent.
  // * Implement Handler(), which returns the address of subclassed Notify()
  //
  // Users of the subclass must:
  // * Call the subclasses' Notify() with appropriate arguments to trigger
  //   the event. When plugging into a standard component event, this can
  //   be done indirectly by assigning Handler to the event,
  //   eg Button1.OnClick := FNotifyMulticaster.Handler
  //
  // Clients of a subclass object must:
  // * Register/deregister interest in the event by calling Add() or Insert()
  //   and Delete() respectively with an appropriately typed event handler
  //   argument.

  TXPEventMulticaster = class(TInterfacedObject, IXPCount, IXPEventMulticaster)
    private

    FEvents: TXPEvents;
    FCount: integer;
    FIncSize: integer;

    procedure DeleteIdx(const idx: integer);
    function Find(const Handler: TXPEvent; out idx: integer): boolean;

    protected

    function Count: integer;
    // Returns 0-based resultant index of inserted <Handler>;
    // -1 for nil <Handler>
    function Insert(const Handler: TXPEvent; const idx: integer): integer;
    // Append <Handler> to array elements
    procedure Add(const Handler: TXPEvent);
    procedure Delete(const Handler: TXPEvent);
    // Fire all event handlers in array
    procedure Notify;
    function Handler: TXPEvent;
    procedure Clear;

    property Events: TXPEvents read FEvents;

    public

    constructor Create(const InitSize: integer = 4;
      const IncSize: integer = 4);
    destructor Destroy; override;
    end;

  // Behaviour for events with arguments passed by reference
  // raShortCircuit:
  //   Event propagation stops with first handler to modify argument(s).
  // raIsolationFirstChanged:
  //   Every handler gets the original arguments. The values from
  //   the first handler to *modify* the arguments (else original
  //   arguments) are returned to the event origin.
  // raIsolationFirst:
  //   Every handler gets the original arguments. The values from
  //   the first handler are returned to the event origin.
  // raPropagation:
  //   The (modified) arguments are propagated from handler to
  //   handler. The resultant values are returned to the event
  //   origin.
  TXPRefArgs = (raShortCircuit, raIsolationFirstChanged, raIsolationFirst,
    raPropagation);

  TXPRefEventMulticaster = class(TXPEventMulticaster)
    protected

    FBehaviour: TXPRefArgs;

    public

    constructor Create(const Behaviour: TXPRefArgs = raShortCircuit;
      InitSize: integer = 4; const IncSize: integer = 4);
    end;

implementation

uses
  SysUtils;
  
const
  CVSID = '$Header: /cvsroot/dunit/dunit/Contrib/DUnitWizard/Source/Common/XPEvent.pas,v 1.2 2004/05/03 15:07:15 pvspain Exp $';

/////////////////////////////////////////////////////////////////////////////
///           TXPEventMulticaster implementation
/////////////////////////////////////////////////////////////////////////////

constructor TXPEventMulticaster.Create(const InitSize, IncSize: integer);
  begin
  inherited Create;
  FIncSize := IncSize;
  System.SetLength(FEvents, InitSize);
  end;

destructor TXPEventMulticaster.Destroy;
  begin
  FEvents := nil; // dealloc array
  inherited;
  end;

procedure TXPEventMulticaster.Add(const Handler: TXPEvent);
  begin
  Insert(Handler, FCount);
  end;

procedure TXPEventMulticaster.Delete(const Handler: TXPEvent);
  var
  idx: integer;

  begin

  if Find(Handler, idx) then
    DeleteIdx(idx);

  end;

procedure TXPEventMulticaster.Notify;
  var
  idx: integer;

  begin

  // Iterate over all handlers and execute
  // Subclass versions of Notify() must type-cast the handler (Events[idx])
  // and supply arguments as necessary.
    for idx := 0 to FCount - 1 do
      Events[idx];

  end;

procedure TXPEventMulticaster.DeleteIdx(const idx: integer);
  begin

  if idx < FCount - 1 then
    begin
    // Move remainder of array down to cover 'empty' slot
    System.Move(FEvents[idx + 1], FEvents[idx],
      (FCount - idx - 1) * System.SizeOf(TXPEvent));
    end;

  System.Dec(FCount);
  end;

function TXPEventMulticaster.Find(const Handler: TXPEvent;
  out idx: integer): boolean;
  begin
  idx := 0;

  // Comparing by @Method only compares first pointer <Code> of a
  // method procedural type. Need to compare both <Code> and <Data>
  while (idx < FCount)
    and ((TMethod(Handler).Code <> TMethod(FEvents[idx]).Code)
      or (TMethod(Handler).Data <> TMethod(FEvents[idx]).Data)) do
    System.Inc(idx);

  Result := (idx < FCount);
  end;

function TXPEventMulticaster.Insert(const Handler: TXPEvent;
  const idx: integer): integer;
  begin

  // This check will bail and return the index of the handler
  // if present
  if (not Find(Handler, Result)) and Assigned(Handler) then
    begin

    // Check if we've hit the ceiling, and increment array size if
    // necessary.
    if FCount > High(FEvents) then
      SetLength(FEvents, Length(FEvents) + FIncSize);

    // Check for insertion point outside range
    // and clip if necessary.

    if idx < 0 then
      Result := 0
    else if idx < FCount then
      Result := idx
    else
      Result := FCount;

    if Result < FCount then
      begin
      // Move remainder of array up to make an  empty slot at <Result>.
      System.Move(FEvents[Result], FEvents[Result + 1],
        (FCount - Result) * SizeOf(TXPEvent));
      end;

    // Insert handler and increase array entries count.
    FEvents[Result] := Handler;
    System.Inc(FCount);
    end;

  end;

function TXPEventMulticaster.Count: integer;
  begin
  Result := FCount;
  end;

function TXPEventMulticaster.Handler: TXPEvent;
  begin
  Result := Notify;
  end;

procedure TXPEventMulticaster.Clear;
  begin
  FCount := 0;
  end;

function CreateIXPEventMulticaster: IXPEventMulticaster;
  begin
  Result := TXPEventMulticaster.Create;
  end;

/////////////////////////////////////////////////////////////////////////////
///           TXPRefEventMulticaster implementation
/////////////////////////////////////////////////////////////////////////////

constructor TXPRefEventMulticaster.Create(const Behaviour: TXPRefArgs;
  InitSize: integer; const IncSize: integer);
  begin
  inherited Create(InitSize, IncSize);
  FBehaviour := Behaviour;
  end;

end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费观看高清完整版在线观看| 日本三级韩国三级欧美三级| 香蕉久久一区二区不卡无毒影院| 久草精品在线观看| 色噜噜狠狠色综合中国| 精品久久五月天| 夜夜精品浪潮av一区二区三区| 国产麻豆成人精品| 在线播放日韩导航| 一卡二卡三卡日韩欧美| 99精品在线免费| 久久久噜噜噜久久人人看| 日日摸夜夜添夜夜添亚洲女人| 色综合av在线| 亚洲三级小视频| 99久久精品一区| 国产精品高潮呻吟| 成人av综合在线| 国产亚洲欧美色| 国产乱妇无码大片在线观看| 欧美一区三区二区| 婷婷久久综合九色综合绿巨人| 欧美综合久久久| 一区二区三区精品视频| 91视频精品在这里| 中文字幕一区二区三区视频| 国产 欧美在线| 久久精品一区二区三区av| 麻豆国产精品官网| 日韩午夜激情免费电影| 日韩精品每日更新| 日韩一区二区三区免费观看| 日本视频中文字幕一区二区三区| 91麻豆精品久久久久蜜臀| 亚洲午夜电影在线观看| 欧美日韩www| 午夜精品久久久| 4hu四虎永久在线影院成人| 亚洲国产aⅴ天堂久久| 欧美日韩一区二区三区不卡| 亚洲福利电影网| 日韩欧美色综合| 国内精品久久久久影院一蜜桃| 久久久精品日韩欧美| 国产91在线|亚洲| 亚洲婷婷综合色高清在线| 99精品视频一区二区| 一区二区三区国产| 欧美一卡二卡在线观看| 国产福利一区二区三区视频| 中文字幕不卡的av| 一本色道久久加勒比精品 | 国产98色在线|日韩| 国产精品拍天天在线| 色综合天天综合网天天看片| 亚洲一区二区综合| 精品久久人人做人人爰| 国产91在线看| 久久国产精品色婷婷| 久久精品一区二区三区av| 91小视频免费观看| 免费日本视频一区| 国产精品久久久久国产精品日日| 在线一区二区三区四区五区 | 国产不卡在线播放| 亚洲制服欧美中文字幕中文字幕| 欧美zozozo| 色哟哟国产精品| 久久机这里只有精品| 日本一区二区高清| 欧美精品v国产精品v日韩精品 | 亚洲日本乱码在线观看| 欧美色手机在线观看| 国产在线精品免费av| 伊人夜夜躁av伊人久久| 精品国产一区二区三区忘忧草| 成人黄色小视频| 日本不卡一二三区黄网| 亚洲女爱视频在线| 久久久久高清精品| 欧美一区二区视频在线观看| 成人免费电影视频| 久久黄色级2电影| 一区二区三区四区av| 久久久国际精品| 日韩一级成人av| 91国产免费观看| 成人黄色国产精品网站大全在线免费观看| 亚洲国产日韩一级| 中文字幕中文乱码欧美一区二区| 日韩精品专区在线| 欧美裸体bbwbbwbbw| 日本精品视频一区二区| 成+人+亚洲+综合天堂| 精品综合久久久久久8888| 亚洲国产精品久久艾草纯爱| 亚洲色图在线视频| 国产欧美日韩亚州综合| 精品蜜桃在线看| 91精品国产综合久久久久| 欧美三级韩国三级日本三斤| 99国产精品久久| 成人丝袜高跟foot| 国产成人免费视频一区| 国产一区二区三区在线观看精品 | 亚洲欧美成人一区二区三区| 久久精品人人爽人人爽| 久久九九影视网| 久久综合色鬼综合色| 日韩一二三四区| 日韩三级视频在线观看| 欧美一区永久视频免费观看| 88在线观看91蜜桃国自产| 精品视频1区2区3区| 欧美美女bb生活片| 91麻豆精品国产91久久久更新时间| 欧美日韩在线播| 91精品午夜视频| 日韩精品一区二| 久久美女艺术照精彩视频福利播放| 久久在线观看免费| 国产视频在线观看一区二区三区 | 日韩欧美视频一区| 久久免费电影网| 国产精品色哟哟| 亚洲黄色av一区| 天堂蜜桃91精品| 国产在线一区二区综合免费视频| 国产揄拍国内精品对白| 国产精品自拍在线| 91丨九色丨蝌蚪富婆spa| 欧美又粗又大又爽| 日韩欧美在线观看一区二区三区| 日韩欧美国产一二三区| 亚洲国产高清在线| 一区二区三区视频在线观看| 亚洲h精品动漫在线观看| 激情成人午夜视频| 99久久久国产精品| 欧美一级午夜免费电影| 久久九九全国免费| 亚洲一区成人在线| 久久国产成人午夜av影院| 国产精一品亚洲二区在线视频| proumb性欧美在线观看| 欧美亚洲国产bt| 亚洲精品一区二区在线观看| 国产精品家庭影院| 视频一区二区三区在线| 国产精品小仙女| 欧美午夜精品电影| 久久久精品免费观看| 亚洲一区二区三区小说| 毛片av一区二区三区| 91在线免费看| 日韩欧美精品三级| 亚洲欧美另类综合偷拍| 美女一区二区在线观看| 91啦中文在线观看| 久久综合九色欧美综合狠狠| 亚洲免费观看高清| 国精产品一区一区三区mba桃花| 成人开心网精品视频| 日韩午夜精品视频| 亚洲综合丝袜美腿| 成人免费毛片片v| 日韩精品中午字幕| 亚洲国产精品影院| av电影在线不卡| 久久久精品蜜桃| 久久国产精品99久久人人澡| 91精品1区2区| 中文字幕字幕中文在线中不卡视频| 日本亚洲天堂网| 欧美日韩mp4| 亚洲永久精品国产| 91在线你懂得| 中文字幕一区三区| 国产成人午夜精品影院观看视频 | 风流少妇一区二区| 欧美一区日韩一区| 亚洲在线一区二区三区| 91麻豆精品一区二区三区| 久久综合999| 老司机午夜精品99久久| 欧美日韩国产一区| 亚洲香肠在线观看| 一道本成人在线| 亚洲精选视频在线| 91一区二区在线观看| 中文字幕一区二区三区不卡在线 | 国产伦精品一区二区三区免费迷| 欧美疯狂做受xxxx富婆| 亚洲免费在线电影| 色婷婷精品大在线视频| 亚洲人成7777| 在线观看日韩一区| 亚洲chinese男男1069| 欧美日韩一级黄| 日本亚洲三级在线|