1 | Class EnumBase<T As EnumBase>
|
---|
2 | Protected
|
---|
3 | value As Long
|
---|
4 | lpszName As LPTSTR
|
---|
5 | Public
|
---|
6 | Sub EnumBase(value As Long,lpszName As LPTSTR)
|
---|
7 | This.value = value
|
---|
8 | This.lpszName = lpszName
|
---|
9 | End Sub
|
---|
10 |
|
---|
11 | Sub EnumBase( enumBase As EnumBase )
|
---|
12 | This.value = enumBase.value
|
---|
13 | This.lpszName = enumBase.lpszName
|
---|
14 | End Sub
|
---|
15 |
|
---|
16 | Sub ~EnumBase()
|
---|
17 | End Sub
|
---|
18 |
|
---|
19 | Override Function ToString() As String
|
---|
20 | Return New String( lpszName )
|
---|
21 | End Function
|
---|
22 |
|
---|
23 | Sub Copy(obj As EnumBase)
|
---|
24 | This.value = obj.value
|
---|
25 | This.lpszName = obj.lpszName
|
---|
26 | End Sub
|
---|
27 |
|
---|
28 | Function Operator() As Int64
|
---|
29 | Return This.value
|
---|
30 | End Function
|
---|
31 | Function Operator() As Long
|
---|
32 | Return This.value
|
---|
33 | End Function
|
---|
34 | Function Operator() As DWord
|
---|
35 | Return This.value
|
---|
36 | End Function
|
---|
37 | Function Operator() As Boolean
|
---|
38 | Return ( This.value <> 0 )
|
---|
39 | End Function
|
---|
40 |
|
---|
41 | Function Operator == (value As Long) As Boolean
|
---|
42 | Return ( This.value = value )
|
---|
43 | End Function
|
---|
44 |
|
---|
45 | Function Operator == (enumObj As T) As Boolean
|
---|
46 | Return ( This.value = enumObj.value )
|
---|
47 | End Function
|
---|
48 |
|
---|
49 | Function Operator <> (value As Long) As Boolean
|
---|
50 | Return Not( This = value)
|
---|
51 | End Function
|
---|
52 |
|
---|
53 | Function Operator <> (enumObj As T) As Boolean
|
---|
54 | Return Not( This = enumObj)
|
---|
55 | End Function
|
---|
56 |
|
---|
57 | Function Operator or (enumObj As T) As Boolean
|
---|
58 | Return ( This.value or enumObj.value ) <> 0
|
---|
59 | End Function
|
---|
60 |
|
---|
61 | Function Operator and (enumObj As T) As Boolean
|
---|
62 | Return ( This.value and enumObj.value ) <> 0
|
---|
63 | End Function
|
---|
64 |
|
---|
65 | Function Operator or (enumObj As T) As T
|
---|
66 | Return New EnumBase( This.value or enumObj.value, This.lpszName )
|
---|
67 | End Function
|
---|
68 |
|
---|
69 | Function Operator and (enumObj As T) As T
|
---|
70 | Return New EnumBase( This.value and enumObj.value, This.lpszName )
|
---|
71 | End Function
|
---|
72 | /*
|
---|
73 | Function Operator xor (enumBase As EnumBase) As EnumBase
|
---|
74 | Return New EnumBase(This.value Xor enumBase.value)
|
---|
75 | End Function
|
---|
76 | */
|
---|
77 | End Class
|
---|