source: trunk/bin/SubOperation/templates/delegate_class.tab@ 351

Last change on this file since 351 was 342, checked in by dai, 17 years ago

静的メソッドのデリゲートに対応

File size: 1.2 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 Sub Add( dg As #name# )
27 _Add( dg )
28 End Sub
29
30 Function Operator+ ( dg As #name# ) As #name#
31 Dim result = New #name#( This )
32 result._Add( dg )
33 Return result
34 End Function
35
36 Static Function _CreateDynamicDelegate( object As Object, methodPtr As VoidPtr ) As #name#
37 Dim dg = New #name#
38 dg.simpleDelegates.Add( New System._SimpleDelegate( object, methodPtr ) )
39 Return dg
40 End Function
41
42 Static Function _CreateStaticDelegate( methodPtr As VoidPtr ) As #name#
43 Dim dg = New #name#
44 dg.simpleDelegates.Add( New System._SimpleDelegate( methodPtr ) )
45 Return dg
46 End Function
47 End Class
48#namespace_end#
Note: See TracBrowser for help on using the repository browser.