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

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

?? xpinterfacedobject.pas

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

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

 TXPInterfacedObject is a utility base class which implements the base
 interface, ie IUnknown for D5, or IInterface for D6+ and K1+

 What is missing from D5 documentation and barely mentioned in D6 is the need
 to deflect all reference counting to the container (owner) class, when
 delegating to an interface-type property or to a class-type property which
 implements (directly or in an ancestor) IInterface/IUnknown.

 TXPInterfacedObject subclasses TInterfacedObject and correctly handles
 reference counting when it provides its interface directly to clients, or
 indirectly, when a container interfaced object is using interface delegation.
 To indicate a delegated context, pass a non-nil ADelegator parameter to the
 TXPInterfacedObject constructor

 Delphi 6 introduced the TAggregatedObject class to handle the delegated
 context, but it does so unconditionally, ie you must know a-priori if your
 class will be exclusively in either a primary implementor context (use
 TInterfacedObject) or a delegated implementor context (use TAggregatedObject).

 To my thinking this design decision is too inflexible, and this is the reason
 for writing our own solution to the reference counting deflection problem.

 Delphi 6 also saw the introduction of TContainedObject, which is a subclass of
 TAggregatedObject that doesn't deflect QueryInterface() calls to its
 Delegator/Container object. I have added the Introspective property to
 TXPInterfacedObject to support this behaviour. Introspective is false by
 default, and QueryInterface() calls will deflect to the Delegator object, if
 defined. When Introspective is true, QueryInterface calls will be resolved by
 this object.

 When ref count redirection is active, there is no longer a mechanism for the
 Delegated object's destructor to be called automatically - _Release calls are
 handled by the Delegator. Therefore, to avoid memory leakage, the Delegator
 must explicitly destroy the Delegated object. It follows that the Delegator
 must always delegate to a class-type property, not an interface-type property,
 to be able to call the Delegated destructor. The Delegator should call the
 Delegated destructor in the context of its own destructor.

 Copyright (c) 2001,2003 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

{$I JEDI.inc}

///////////////////////////////////////////////////////////////////////////////
///     TXPInterfacedObject declaration
///////////////////////////////////////////////////////////////////////////////

type

// Conditional types for Delphi 4 & 5
{$IFNDEF DELPHI6_UP}
  IInterface = IUnknown;
{$ENDIF}

  TXPInterfacedObject = class(TInterfacedObject, IInterface)
  private

    FDelegator: Pointer;  // weak reference to delegator/container for delegated
                          // interface implementation ( = nil for direct
                          // implementation )

    FIntrospective: boolean;

    function GetDelegator: IInterface;
    procedure SetIntrospective(const Value: boolean);

  protected

    //
    // IInterface re-implementation
    //

    function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
    function _AddRef: integer; stdcall;
    function _Release: Integer; stdcall;

  public

    constructor Create(const ADelegator: IInterface = nil);
    property Delegator: IInterface read GetDelegator;
    // Defaults to false. When true, QueryInterface() will only return
    // interfaces implemented by this object, not by the delegating host 
    property Introspective: boolean read FIntrospective write SetIntrospective;
  end;


implementation

uses
  Windows;

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

///////////////////////////////////////////////////////////////////////////////
///     TXPInterfacedObject implementation
///////////////////////////////////////////////////////////////////////////////

constructor TXPInterfacedObject.Create(const ADelegator: IInterface);
begin
  inherited Create;
  // weak reference to delegator/container - don't keep it alive
  FDelegator := Pointer(ADelegator);
end;

function TXPInterfacedObject.GetDelegator: IInterface;
begin
  Result := IInterface(FDelegator);
end;

function TXPInterfacedObject.QueryInterface(const IID: TGUID; out Obj): HResult;
begin

  if (FDelegator = nil) or FIntrospective then
    Result := inherited QueryInterface(IID, Obj)
  else
    Result := IInterface(FDelegator).QueryInterface(IID, Obj);

end;

procedure TXPInterfacedObject.SetIntrospective(const Value: boolean);
begin
  
  if Value or (FDelegator <> nil) then 
    FIntrospective := Value;
  
end;

function TXPInterfacedObject._AddRef: Integer;
begin

  if FDelegator = nil then
    Result := inherited _AddRef
  else
  begin
    // Separate _AddRef and Result for thread-safety
    IInterface(FDelegator)._AddRef;
    // Although unnecessary in delegated case, maintain FRefCount for use by
    // subclasses (such as XPObserver.TXPSubject)
    Result := Windows.InterlockedIncrement(FRefCount);
  end;

end;

function TXPInterfacedObject._Release: Integer;
begin

  if FDelegator = nil then
    Result := inherited _Release
  else
  begin
    // Although unnecessary in delegated case, maintain FRefCount for use by
    // subclasses (such as XPObserver.TXPTarget)
    Result := Windows.InterlockedDecrement(FRefCount);
    // Separate Result and _Release for thread-safety. Do _Release last to
    // ensure we aren't referencing member data after destruction
    IInterface(FDelegator)._Release;
  end;

end;

end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美美女一区二区三区| 91九色最新地址| 蜜桃久久久久久| 亚洲国产另类av| 亚洲成av人片一区二区三区| 亚洲bt欧美bt精品| 亚洲国产一二三| 舔着乳尖日韩一区| 七七婷婷婷婷精品国产| 老司机精品视频一区二区三区| 日本aⅴ免费视频一区二区三区| 日本欧美在线观看| 国产乱人伦精品一区二区在线观看| 国产一区二区三区| av午夜一区麻豆| 色综合天天综合网天天看片| 欧美日韩久久久一区| 日韩午夜精品视频| 久久婷婷国产综合精品青草| 国产精品蜜臀av| 亚洲永久免费视频| 麻豆国产精品777777在线| 国产福利一区二区三区视频| thepron国产精品| 欧美色综合久久| 精品国产乱码久久久久久久久| 2014亚洲片线观看视频免费| 日韩一区欧美一区| 青娱乐精品视频在线| 成人激情开心网| 欧美日高清视频| 国产欧美综合在线观看第十页| 亚洲美女一区二区三区| 精品在线播放午夜| 色婷婷av一区二区三区大白胸| 欧美一区二区三区视频在线观看| 国产欧美日韩视频一区二区| 亚洲国产精品视频| 丁香一区二区三区| 制服丝袜亚洲网站| 亚洲乱码中文字幕| 久久99精品久久久久久久久久久久| av中文字幕不卡| 日韩视频在线一区二区| 亚洲人成在线观看一区二区| 久久超碰97中文字幕| 在线精品视频一区二区三四| 久久女同互慰一区二区三区| 五月激情综合网| 色婷婷av一区二区三区大白胸| 2023国产精品自拍| 免费成人av资源网| 欧美日韩精品一区二区三区 | 日韩av中文字幕一区二区三区| 国产精品影音先锋| 日韩欧美国产三级| 日韩黄色片在线观看| 99国产欧美另类久久久精品 | 专区另类欧美日韩| 国产不卡在线播放| 精品美女被调教视频大全网站| 亚洲综合男人的天堂| 91蜜桃在线观看| 综合网在线视频| thepron国产精品| 国产精品女主播av| 成人app软件下载大全免费| 久久久激情视频| 国产传媒欧美日韩成人| 精品理论电影在线观看| 日韩不卡手机在线v区| 3d成人动漫网站| 青青草国产成人99久久| 欧美一区二区成人| 日韩国产精品久久久久久亚洲| 欧洲国产伦久久久久久久| 亚洲激情图片qvod| 欧美日韩激情在线| 日日夜夜免费精品| 日韩一区二区免费视频| 麻豆视频一区二区| 久久久青草青青国产亚洲免观| 精品一区二区在线看| 欧美精品一区二区三区视频| 国产精一品亚洲二区在线视频| 久久久天堂av| 成人天堂资源www在线| 亚洲欧美一区二区三区孕妇| 欧美三级午夜理伦三级中视频| 亚洲综合在线观看视频| 欧美精品精品一区| 蜜桃91丨九色丨蝌蚪91桃色| 精品理论电影在线观看 | 欧美在线视频不卡| 日韩中文字幕1| 国产精品成人午夜| 色综合久久久久综合体桃花网| 亚洲欧美日韩一区二区| 欧美电影影音先锋| 国产一区视频网站| 亚洲综合网站在线观看| 日韩欧美电影一区| 成人自拍视频在线| 亚洲成人免费在线| 国产视频911| 欧美无乱码久久久免费午夜一区| 欧美aaaaa成人免费观看视频| 欧美激情中文字幕| 欧美久久久一区| 成人自拍视频在线| 老司机午夜精品| 一区二区在线免费观看| 久久久亚洲国产美女国产盗摄| 99久精品国产| 国产麻豆午夜三级精品| 亚洲成人在线免费| 国产精品麻豆视频| 精品日韩在线观看| 欧美日韩一区二区三区视频 | 最新热久久免费视频| 欧美一区国产二区| 91色视频在线| 国产一区高清在线| 婷婷中文字幕综合| 一区二区三区欧美日韩| 国产免费观看久久| 精品福利一二区| 欧美一级黄色大片| 欧美日韩一区中文字幕| 99久久国产综合色|国产精品| 精品夜夜嗨av一区二区三区| 亚洲不卡一区二区三区| 日韩理论电影院| 国产精品全国免费观看高清| 精品欧美一区二区在线观看| 欧美一区中文字幕| 欧美三级日韩三级国产三级| 日本久久一区二区| 成人激情免费视频| 成人激情小说网站| 成人激情免费电影网址| 国产精品亚洲а∨天堂免在线| 久久精品久久精品| 久久国产日韩欧美精品| 日本大胆欧美人术艺术动态| 亚洲国产色一区| 亚洲成人动漫av| 石原莉奈在线亚洲三区| 三级亚洲高清视频| 日韩成人午夜电影| 久久国产麻豆精品| 久久99精品久久久| 精品一区二区在线观看| 国内精品久久久久影院色| 久久99精品国产麻豆婷婷| 久久成人羞羞网站| 国产精品456露脸| 大胆亚洲人体视频| www.亚洲免费av| 色综合久久综合中文综合网| 日本道色综合久久| 欧美影视一区在线| 欧美精品在线一区二区| 欧美一级艳片视频免费观看| 欧美成人福利视频| 日本一区二区三区在线观看| 国产精品久久久久久亚洲毛片| 亚洲丝袜另类动漫二区| 亚洲国产精品一区二区www| 免费久久99精品国产| 国产精品1区二区.| 99国产欧美久久久精品| 欧美日韩国产免费一区二区| 日韩一二三区视频| 国产精品美女久久久久久| 亚洲综合一区二区三区| 老司机免费视频一区二区| 成人看片黄a免费看在线| 欧美午夜精品免费| 久久久噜噜噜久噜久久综合| 亚洲摸摸操操av| 免费不卡在线观看| 成人网页在线观看| 337p亚洲精品色噜噜噜| 国产精品午夜电影| 天天av天天翘天天综合网色鬼国产| 久久精品国产免费| 99麻豆久久久国产精品免费| 7777精品伊人久久久大香线蕉 | 国产精品久久久久影院| 亚洲制服欧美中文字幕中文字幕| 美女网站色91| 99久久99久久综合| 日韩欧美激情四射| 亚洲最大的成人av| 岛国精品在线观看| 日韩欧美国产综合一区| 亚洲一本大道在线| a亚洲天堂av| 国产欧美精品区一区二区三区|