source: trunk/Include/Classes/System/Blittable.ab@ 356

Last change on this file since 356 was 332, checked in by dai, 17 years ago

下記のBlittable型を実装。
System.Byte
System.SByte
System.Int16
System.UInt16
System.Int32
System.UInt32
System.Int64
System.UInt64
System.IntPtr
System.UIntPtr
System.Single
System.Double

File size: 5.4 KB
Line 
1Namespace System
2
3 Class Blittable(SByte) SByte
4 value As SByte
5 Public
6 Static Function MaxValue() As SByte
7 Return 127
8 End Function
9 Static Function MinValue() As SByte
10 Return -128
11 End Function
12
13 Sub SByte( value As SByte )
14 This.value = value
15 End Sub
16
17 Override Function ToString() As String
18 Return Str$(value)
19 End Function
20
21 Function Operator() As SByte
22 Return value
23 End Function
24
25 Static Function _Create( value As SByte ) As System.SByte
26 Return New System.SByte( value )
27 End Function
28 End Class
29
30 Class Blittable(Byte) Byte
31 value As Byte
32 Public
33 Static Function MaxValue() As Byte
34 Return 255
35 End Function
36 Static Function MinValue() As Byte
37 Return 0
38 End Function
39
40 Sub Byte( value As Byte )
41 This.value = value
42 End Sub
43
44 Override Function ToString() As String
45 Return Str$(value)
46 End Function
47
48 Function Operator() As Byte
49 Return value
50 End Function
51
52 Static Function _Create( value As Byte ) As System.Byte
53 Return New System.Byte( value )
54 End Function
55 End Class
56
57 Class Blittable(Integer) Int16
58 value As Integer
59 Public
60 Static Function MaxValue() As Integer
61 Return 32767
62 End Function
63 Static Function MinValue() As Integer
64 Return -32768
65 End Function
66
67 Sub Int16( value As Integer )
68 This.value = value
69 End Sub
70
71 Override Function ToString() As String
72 Return Str$(value)
73 End Function
74
75 Function Operator() As Integer
76 Return value
77 End Function
78
79 Static Function _Create( value As Integer ) As System.Int16
80 Return New System.Int16( value )
81 End Function
82 End Class
83
84 Class Blittable(Word) UInt16
85 value As Word
86 Public
87 Static Function MaxValue() As Word
88 Return 65535
89 End Function
90 Static Function MinValue() As Word
91 Return 0
92 End Function
93
94 Sub UInt16( value As Word )
95 This.value = value
96 End Sub
97
98 Override Function ToString() As String
99 Return Str$(value)
100 End Function
101
102 Function Operator() As Word
103 Return value
104 End Function
105
106 Static Function _Create( value As Word ) As UInt16
107 Return New UInt16( value )
108 End Function
109 End Class
110
111 Class Blittable(Long) Int32
112 value As Long
113 Public
114 Static Function MaxValue() As Long
115 Return 2147483647
116 End Function
117 Static Function MinValue() As Long
118 Return -2147483648
119 End Function
120
121 Sub Int32( value As Long )
122 This.value = value
123 End Sub
124
125 Override Function ToString() As String
126 Return Str$(value)
127 End Function
128
129 Function Operator() As Long
130 Return value
131 End Function
132
133 Static Function _Create( value As Long ) As Int32
134 Return New Int32( value )
135 End Function
136 End Class
137
138 Class Blittable(DWord) UInt32
139 value As DWord
140 Public
141 Static Function MaxValue() As DWord
142 Return 4294967295
143 End Function
144 Static Function MinValue() As DWord
145 Return 0
146 End Function
147
148 Sub UInt32( value As DWord )
149 This.value = value
150 End Sub
151
152 Override Function ToString() As String
153 Return Str$(value)
154 End Function
155
156 Function Operator() As DWord
157 Return value
158 End Function
159
160 Static Function _Create( value As DWord ) As UInt32
161 Return New UInt32( value )
162 End Function
163 End Class
164
165 Class Blittable(Int64) Int64
166 value As Int64
167 Public
168 Static Function MaxValue() As Int64
169 Return &H7FFFFFFFFFFFFFFF As Int64
170 End Function
171 Static Function MinValue() As Int64
172 Return &H8000000000000000 As Int64
173 End Function
174
175 Sub Int64( value As Int64 )
176 This.value = value
177 End Sub
178
179 Override Function ToString() As String
180 Return Str$(value)
181 End Function
182
183 Function Operator() As Int64
184 Return value
185 End Function
186
187 Static Function _Create( value As Int64 ) As System.Int64
188 Return New System.Int64( value )
189 End Function
190 End Class
191
192 Class Blittable(QWord) UInt64
193 value As QWord
194 Public
195 Static Function MaxValue() As QWord
196 Return &HFFFFFFFFFFFFFFFF
197 End Function
198 Static Function MinValue() As QWord
199 Return 0
200 End Function
201
202 Sub UInt64( value As QWord )
203 This.value = value
204 End Sub
205
206 Override Function ToString() As String
207 Return Str$(value)
208 End Function
209
210 Function Operator() As QWord
211 Return value
212 End Function
213
214 Static Function _Create( value As QWord ) As System.UInt64
215 Return New System.UInt64( value )
216 End Function
217 End Class
218
219 Class Blittable(Single) Single
220 value As Single
221 Public
222 Static Function MaxValue() As Single
223 Return 3.4e+38
224 End Function
225 Static Function MinValue() As Single
226 Return 3.4e-38
227 End Function
228
229 Sub Single( value As Single )
230 This.value = value
231 End Sub
232
233 Override Function ToString() As String
234 Return Str$(value)
235 End Function
236
237 Function Operator() As Single
238 Return value
239 End Function
240
241 Static Function _Create( value As Single ) As System.Single
242 Return New System.Single( value )
243 End Function
244 End Class
245
246 Class Blittable(Double) Double
247 value As Double
248 Public
249 Static Function MaxValue() As Double
250 Return 1.7e+308
251 End Function
252 Static Function MinValue() As Double
253 Return 1.7e-308
254 End Function
255
256 Sub Double( value As Double )
257 This.value = value
258 End Sub
259
260 Override Function ToString() As String
261 Return Str$(value)
262 End Function
263
264 Function Operator() As Double
265 Return value
266 End Function
267
268 Static Function _Create( value As Double ) As System.Double
269 Return New System.Double( value )
270 End Function
271 End Class
272
273End Namespace
Note: See TracBrowser for help on using the repository browser.