Permalink
Browse files

Fiz a implementação com a sugestão do @fabriciocolombo, apenas nas cl…

…asses que geram o problema de compilação.
  • Loading branch information...
henriquewerlang committed Nov 26, 2015
1 parent a92beb8 commit d8afc7ec5ccdb4ec8490ed5241faa83f20d0439e
Showing with 21 additions and 0 deletions.
  1. +7 −0 Delphi.Mocks.Proxy.pas
  2. +7 −0 Delphi.Mocks.WeakReference.pas
  3. +7 −0 Delphi.Mocks.pas
View
@@ -42,12 +42,19 @@ interface
TSetupMode = (None, Behavior, Expectation);
{$IFOPT M+}
{$M-}
{$DEFINE ENABLED_M+}
{$ENDIF}
IProxyVirtualInterface = interface
['{A0394EB0-245E-4AE6-AD71-3BC9815CD173}']
function QueryProxy(const IID: TGUID; out Obj : IProxy) : HRESULT;
function QueryInterfaceWithOwner(const IID: TGUID; out Obj; const ACheckOwner : Boolean): HRESULT; overload;
function QueryInterfaceWithOwner(const IID: TGUID; const ACheckOwner : Boolean): HRESULT; overload;
end;
{$IFDEF ENABLED_M+}
{$M+}
{$ENDIF}
TProxy<T> = class(TWeakReferencedObject, IWeakReferenceableObject, IInterface, IProxy, IProxy<T>, IStubProxy<T>, IMockSetup<T>, IStubSetup<T>, IExpect<T>, IVerify)
private
@@ -47,12 +47,19 @@ interface
type
/// Implemented by our weak referenced object base class
{$IFOPT M+}
{$M-}
{$DEFINE ENABLED_M+}
{$ENDIF}
IWeakReferenceableObject = interface
['{3D7F9CB5-27F2-41BF-8C5F-F6195C578755}']
procedure AddWeakRef(value : Pointer);
procedure RemoveWeakRef(value : Pointer);
function GetRefCount : integer;
end;
{$IFDEF ENABLED_M+}
{$M+}
{$ENDIF}
/// This is our base class for any object that can have a weak reference to
/// it. It implements IInterface so the object can also be used just like
View
@@ -139,6 +139,10 @@ interface
function Proxy : T;
end;
{$IFOPT M+}
{$M-}
{$DEFINE ENABLED_M+}
{$ENDIF}
IProxy = interface(IWeakReferenceableObject)
['{C97DC7E8-BE99-46FE-8488-4B356DD4AE29}']
function ProxyInterface : IInterface;
@@ -147,6 +151,9 @@ interface
function QueryImplementedInterface(const IID: TGUID; out Obj): HRESULT; stdcall;
procedure SetParentProxy(const AProxy : IProxy);
end;
{$IFDEF ENABLED_M+}
{$M+}
{$ENDIF}
//used by the mock - need to find another place to put this.. circular references
//problem means we need it here for now.

0 comments on commit d8afc7e

Please sign in to comment.