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