source: trunk/ab5.0/system/templates/delegate_class.tab@ 618

Last change on this file since 618 was 352, checked in by dai, 17 years ago

System.Collections.Generic.List.RemoveAtメソッドを追加
デリゲート型に対する"-"演算子を追加

File size: 1.3 KB
Line 
1#namespace_begin#
2 Class Delegate #name#
3 Inherits System.DelegateBase
4
5 Public
6 Sub #name#()
7 End Sub
8 Sub #name#( dg As #name# )
9 _Add( dg )
10 End Sub
11
12 #call_method_begin#
13 'Sub Call(...)
14 Dim i As Long
15 For i = 0 To ELM(simpleDelegates.Count)
16 Dim sd = simpleDelegates[i]
17 If sd.hasThisPtr Then
18 #result# __delegate_dynamicmethod_call(sd.methodPtr, sd.object, #params#)
19 Else
20 #result# __delegate_staticmethod_call(sd.methodPtr, #params#)
21 End If
22 Next
23 'End Sub
24 #call_method_end#
25
26 Function Operator+ ( dg As #name# ) As #name#
27 Dim result = New #name#( This )
28 result._Add( dg )
29 Return result
30 End Function
31
32 Function Operator- ( dg As #name# ) As #name#
33 Dim result = New #name#( This )
34 result._Delete( dg )
35 Return result
36 End Function
37
38 Static Function _CreateDynamicDelegate( object As Object, methodPtr As VoidPtr ) As #name#
39 Dim dg = New #name#
40 dg.simpleDelegates.Add( New System._SimpleDelegate( object, methodPtr ) )
41 Return dg
42 End Function
43
44 Static Function _CreateStaticDelegate( methodPtr As VoidPtr ) As #name#
45 Dim dg = New #name#
46 dg.simpleDelegates.Add( New System._SimpleDelegate( methodPtr ) )
47 Return dg
48 End Function
49 End Class
50#namespace_end#
Note: See TracBrowser for help on using the repository browser.