Ignore:
Timestamp:
Sep 28, 2007, 3:32:25 AM (17 years ago)
Author:
dai
Message:

デリゲートを試験実装
【現状のデリゲート制約】
・ダイナミックメソッド限定
・パラメータ相違チェックは行っていない

GCHandle.allocatedメンバをListクラスに変更。
List.Removeメソッドを追加

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/Delegate.ab

    r338 r340  
    11Namespace System
     2
    23
    34Class _SimpleDelegate
    45Public
     6    hasThisPtr As Boolean
    57    object As Object
    68    methodPtr As VoidPtr
    79
    810    Sub _SimpleDelegate( object As Object, methodPtr As VoidPtr )
     11        This.hasThisPtr = True
    912        This.object = object
     13        This.methodPtr = methodPtr
     14    End Sub
     15    Sub _SimpleDelegate( methodPtr As VoidPtr )
     16        This.hasThisPtr = False
     17        This.object = Nothing
    1018        This.methodPtr = methodPtr
    1119    End Sub
     
    1624    simpleDelegates As System.Collections.Generic.List<_SimpleDelegate>
    1725
     26    Sub _Add( dg As DelegateBase )
     27        Dim i As Long
     28        For i=0 To ELM(dg.simpleDelegates.Count)
     29            simpleDelegates.Add( dg.simpleDelegates[i] )
     30        Next
     31    End Sub
     32
    1833Public
    1934    Sub DelegateBase()
    2035        simpleDelegates = New System.Collections.Generic.List<_SimpleDelegate>()
    2136    End Sub
    22     Sub Add( sd As System._SimpleDelegate )
    23         simpleDelegates.Add( sd )
    24     End Sub
     37
     38/*
     39    Sub Operator + ( sd As System._SimpleDelegate )
     40        Add( sd )
     41    End Sub*/
    2542Public
    2643End Class
     
    2845
    2946End Namespace
     47
     48
     49Function _System_CreateSimpleDynamicDelegate( object As Object, methodPtr As VoidPtr ) As System._SimpleDelegate
     50    Return New System._SimpleDelegate( object, methodPtr )
     51End Function
     52Function _System_CreateSimpleStaticDelegate( methodPtr As VoidPtr ) As System._SimpleDelegate
     53    Return New System._SimpleDelegate( methodPtr )
     54End Function
Note: See TracChangeset for help on using the changeset viewer.