Changeset 497 for trunk/Include/Classes
- Timestamp:
- Mar 28, 2008, 5:43:34 PM (17 years ago)
- Location:
- trunk/Include/Classes
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/ActiveBasic/Strings/Strings.ab
r478 r497 191 191 192 192 Namespace Detail 193 Function Split(s As String, c As StrChar) As System.Collections.Generic.List<String>193 Function Split(s As String, c As Char) As System.Collections.Generic.List<String> 194 194 Split = New System.Collections.Generic.List<String> 195 195 -
trunk/Include/Classes/System/Data/Odbc/Odbc.ab
r1 r497 1 1 ' odbc.sbp 2 2 3 #ifndef _INC_SQLEXT 4 #include <api_sqlext.sbp> 5 #endif 6 7 3 #require <api_sqlext.sbp> 8 4 9 5 '=========================================================== … … 143 139 144 140 'ステートメントハンドルを取得する 145 SQLAllocHandle( SQL_HANDLE_STMT, hDbc, hStmt ) 141 SQLAllocHandle( SQL_HANDLE_STMT, hDbc, hStmt ) 146 142 147 143 'SQL文を発行 … … 154 150 155 151 'ステートメントハンドルを取得する 156 SQLAllocHandle( SQL_HANDLE_STMT, hDbc, hStmt ) 152 SQLAllocHandle( SQL_HANDLE_STMT, hDbc, hStmt ) 157 153 158 154 Prepare = SQLPrepare( hStmt, lpszSQL, SQL_NTS ) 'SQL文を設定する … … 244 240 SQLAllocHandle( SQL_HANDLE_STMT, 245 241 pobj_Command->pobj_Connection->GetDbcHandle(), 246 hStmt ) 242 hStmt ) 247 243 248 244 'SQL文を発行 -
trunk/Include/Classes/System/Drawing/CharacterRange.ab
r473 r497 1 1 ' Classes/System/Drawing/CharacterRange.ab 2 3 #ifndef __SYSTEM_DRAWING_CHARACTERRANGE_AB__4 #define __SYSTEM_DRAWING_CHARACTERRANGE_AB__5 2 6 3 Class CharacterRange … … 52 49 length As Long 53 50 End Class 54 55 #endif '__SYSTEM_DRAWING_CHARACTERRANGE_AB__ -
trunk/Include/Classes/System/Drawing/Color.ab
r473 r497 1 1 ' Classes/System/Drawing/Color.ab 2 2 3 #ifndef __SYSTEM_DRAWING_COLOR_AB__ 4 #define __SYSTEM_DRAWING_COLOR_AB__ 5 6 #include <Classes/System/Drawing/Imaging/misc.ab> 3 #require <Classes/System/Drawing/Imaging/misc.ab> 7 4 8 5 Class Color … … 309 306 argb As ARGB 310 307 End Class 311 312 #endif '__SYSTEM_DRAWING_COLOR_AB__ -
trunk/Include/Classes/System/Drawing/Drawing2D/Matrix.ab
r77 r497 1 1 ' Classes/System/Drawing/Drawing2D/Matrix.ab 2 3 #ifndef __SYSTEM_DRAWING_DRAWING2D_MATRIX_AB__4 #define __SYSTEM_DRAWING_DRAWING2D_MATRIX_AB__5 2 6 3 Class Matrix 7 4 End Class 8 9 #endif '__SYSTEM_DRAWING_DRAWING2D_MATRIX_AB__ -
trunk/Include/Classes/System/Drawing/Drawing2D/misc.ab
r77 r497 1 1 ' Classes/System/Drawing/Drawing2D/misc.ab 2 3 #ifndef __SYSTEM_DRAWING_DRAWING2D_MISC_AB__4 #define __SYSTEM_DRAWING_DRAWING2D_MISC_AB__5 2 6 3 Enum CombineMode … … 84 81 Device 85 82 End Enum 86 87 #endif '__SYSTEM_DRAWING_DRAWING2D_MISC_AB__ -
trunk/Include/Classes/System/Drawing/Font.ab
r473 r497 250 250 251 251 Const Function Name() As String 252 #ifdef __STRING_IS_NOT_UNICODE 252 #ifdef UNICODE 253 Dim lf As LOGFONTW 254 GetLogFontW(0, lf) 255 #else 253 256 Dim lf As LOGFONTA 254 257 GetLogFontA(0, lf) 255 #else256 Dim lf As LOGFONTW257 GetLogFontW(0, lf)258 258 #endif 259 259 Return lf.lfFaceName -
trunk/Include/Classes/System/Drawing/Graphics.ab
r473 r497 1 1 ' Classes/System/Drawing/Graphics.ab 2 3 #ifndef __SYSTEM_DRAWING_GRAPHICS_AB__4 #define __SYSTEM_DRAWING_GRAPHICS_AB__5 2 6 3 Class Brush : End Class … … 2011 2008 End Class 2012 2009 2013 #endif -
trunk/Include/Classes/System/Drawing/Imaging/MetafileHeader.ab
r12 r497 1 1 ' Classes/System/Drawing/Imaging/MetafileHeader.ab 2 3 #ifndef __SYSTEM_DRAWING_IMAGING_METAFILEHEADER_AB__4 #define __SYSTEM_DRAWING_IMAGING_METAFILEHEADER_AB__5 2 6 3 Type Align(8) ENHMETAHEADER3 … … 154 151 End Function 155 152 End Class 156 157 #endif '__SYSTEM_DRAWING_IMAGING_METAFILEHEADER_AB__ -
trunk/Include/Classes/System/Drawing/Imaging/misc.ab
r447 r497 1 1 ' Classes/System/Drawing/Imaging/misc.ab 2 2 3 #ifndef __SYSTEM_DRAWING_IMAGING_MISC_AB__ 4 #define __SYSTEM_DRAWING_IMAGING_MISC_AB__ 5 6 #include <Classes/System/Drawing/Color.ab> 3 #require <Classes/System/Drawing/Color.ab> 7 4 8 5 TypeDef ARGB = DWord … … 436 433 ColorChannelLast 437 434 End Enum 438 439 #endif '__SYSTEM_DRAWING_IMAGING_MISC_AB__ -
trunk/Include/Classes/System/Drawing/Text/misc.ab
r77 r497 1 1 ' Classes/System/Drawing/Text/misc.ab 2 3 #ifndef __SYSTEM_DRAWING_TEXT_MISC_AB__4 #define __SYSTEM_DRAWING_TEXT_MISC_AB__5 2 6 3 Enum TextRenderingHint … … 12 9 ClearTypeGridFit 13 10 End Enum 14 15 #endif '__SYSTEM_DRAWING_TEXT_MISC_AB__ -
trunk/Include/Classes/System/Environment.ab
r427 r497 20 20 Static Function CommandLine() As String 21 21 If Object.ReferenceEquals(cmdLine, Nothing) Then 22 #ifdef __STRING_IS_NOT_UNICODE 22 #ifdef UNICODE 23 cmdLine = New String(GetCommandLineW()) 24 #else 23 25 cmdLine = New String(GetCommandLineA()) 24 #else25 cmdLine = New String(GetCommandLineW())26 26 #endif 27 27 End If … … 120 120 Public 121 121 'NTでしか使用できない仕様 122 Static Function WorkingSet() As Int64122 Static Function WorkingSet() As SIZE_T 123 123 Dim hmodPSAPI = LoadLibrary("PSAPI.DLL") 124 124 If hmodPSAPI = 0 Then Return 0 … … 141 141 142 142 Static Function ExpandEnvironmentVariables(s As String) As String 143 If ActiveBasic.IsNothing(s) Then 144 Throw New ArgumentNullException("s") 145 End If 143 146 Dim src = ToTCStr(s) 144 147 Dim size = ExpandEnvironmentStrings(src, 0, 0) 145 Dim dst = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR 146 ExpandEnvironmentStrings(src, dst, size) 147 ExpandEnvironmentVariables = New String(dst, size - 1) 148 Dim dst = New Text.StringBuilder 149 dst.Length = size As Long 150 ExpandEnvironmentStrings(src, StrPtr(dst), size) 151 dst.Length = (size - 1) As Long 152 ExpandEnvironmentVariables = dst.ToString 148 153 End Function 149 154 … … 155 160 156 161 Static Function GetEnvironmentVariable(variable As String) As String 162 If ActiveBasic.IsNothing(variable) Then 163 Throw New ArgumentNullException("variable") 164 End If 157 165 Dim tcsVariable = ToTCStr(variable) 158 166 Dim size = _System_GetEnvironmentVariable(tcsVariable, 0, 0) 159 Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR 160 Dim len = _System_GetEnvironmentVariable(tcsVariable, p, size) 161 GetEnvironmentVariable = New String(p, len As Long) 167 Dim buf = New Text.StringBuilder 168 buf.Length = size As Long 169 buf.Length = _System_GetEnvironmentVariable(tcsVariable, StrPtr(buf), size) 170 GetEnvironmentVariable = buf.ToString 162 171 End Function 163 172 … … 176 185 177 186 Static Sub SetEnvironmentVariable(variable As String, value As String) 187 If ActiveBasic.IsNothing(variable) Then 188 Throw New ArgumentNullException("variable") 189 End If 178 190 _System_SetEnvironmentVariable(ToTCStr(variable), ToTCStr(value)) 179 191 End Sub -
trunk/Include/Classes/System/IO/Path.ab
r469 r497 10 10 Class Path 11 11 Public 12 Static Const AltDirectorySeparatorChar = &H2F As StrChar '/13 Static Const DirectorySeparatorChar = &H5C As StrChar '\14 Static Const PathSeparator = &H3B As StrChar ';15 Static Const VolumeSeparatorChar = &H3A As StrChar ':12 Static Const AltDirectorySeparatorChar = &H2F As Char '/ 13 Static Const DirectorySeparatorChar = &H5C As Char '\ 14 Static Const PathSeparator = &H3B As Char '; 15 Static Const VolumeSeparatorChar = &H3A As Char ': 16 16 17 17 '---------------------------------------------------------------- … … 135 135 If IsPathRooted(path) Then 136 136 If path.Contains(UniformNamingConventionString) Then 137 Return path.Remove(path.IndexOf(DirectorySeparatorChar, 137 Return path.Remove(path.IndexOf(DirectorySeparatorChar, 138 138 UniformNamingConventionString.Length) + 1) 139 139 Else … … 214 214 215 215 Private 216 Static Const ExtensionSeparatorChar = &H2E As StrChar216 Static Const ExtensionSeparatorChar = &H2E As Char 217 217 Static Const InvalidPathChars = Ex"\q<>|\0\t" As String 218 218 Static Const UniformNamingConventionString = "\\" As String … … 258 258 */ 259 259 Static Function GetLastSeparatorIndex(path As String) As Long 260 Return System.Math.Max(path.LastIndexOf(DirectorySeparatorChar), 260 Return System.Math.Max(path.LastIndexOf(DirectorySeparatorChar), 261 261 path.LastIndexOf(AltDirectorySeparatorChar)) As Long 262 262 End Function -
trunk/Include/Classes/System/IO/StreamReader.ab
r435 r497 93 93 @auther Egtra 94 94 */ 95 Override Function ReadImpl(buffer As * StrChar, index As Long, count As Long) As Long95 Override Function ReadImpl(buffer As *Char, index As Long, count As Long) As Long 96 96 Dim n = last - cur 97 97 If count <= n Then … … 143 143 文字数が足りなくても、元のストリームまで読みには行かない。 144 144 */ 145 Function ReadFromBuffer(p As * StrChar, index As Long, count As Long) As Long146 memcpy(VarPtr(p[index]), VarPtr(buf[cur]), count * SizeOf ( StrChar))145 Function ReadFromBuffer(p As *Char, index As Long, count As Long) As Long 146 memcpy(VarPtr(p[index]), VarPtr(buf[cur]), count * SizeOf (Char)) 147 147 cur += count 148 148 ReadFromBuffer = count -
trunk/Include/Classes/System/IO/StringReader.ab
r432 r497 75 75 @auther Egtra 76 76 */ 77 Override Function ReadImpl(buffer As * StrChar, index As Long, count As Long) As Long77 Override Function ReadImpl(buffer As *Char, index As Long, count As Long) As Long 78 78 ReadImpl = Math.Min(count, s.Length - i) 79 ActiveBasic.Strings.ChrCopy(VarPtr(buffer[index]) As * StrChar, (StrPtr(s) + i * SizeOf (StrChar)) As *StrChar, ReadImpl As SIZE_T) 'ToDo: ポインタに対する+演算79 ActiveBasic.Strings.ChrCopy(VarPtr(buffer[index]) As *Char, (StrPtr(s) + i * SizeOf (Char)) As *Char, ReadImpl As SIZE_T) 'ToDo: ポインタに対する+演算 80 80 End Function 81 81 -
trunk/Include/Classes/System/IO/TextReader.ab
r473 r497 31 31 @auther Egtra 32 32 */ 33 Function Read(buffer As * StrChar, index As Long, count As Long) As Long33 Function Read(buffer As *Char, index As Long, count As Long) As Long 34 34 If buffer = 0 Then 35 35 ElseIf index < 0 Then … … 76 76 ' Exit Do 77 77 End Select 78 sb.Append(ch As StrChar) 'ToDo キャスト不要にすべきというチケットを書くこと78 sb.Append(ch As Char) 'ToDo キャスト不要にすべきというチケットを書くこと 79 79 Loop 80 80 ReadLine = sb.ToString … … 93 93 Exit Function 94 94 End If 95 sb.Append(ch As StrChar)95 sb.Append(ch As Char) 96 96 Loop 97 97 End Function … … 109 109 @auther Egtra 110 110 */ 111 Virtual Function ReadImpl(buffer As * StrChar, index As Long, count As Long) As Long111 Virtual Function ReadImpl(buffer As *Char, index As Long, count As Long) As Long 112 112 Dim i As Long 113 113 Dim p = VarPtr(buffer[index]) … … 118 118 Exit Function 119 119 Else 120 p[i] = c As StrChar120 p[i] = c As Char 121 121 End If 122 122 Next … … 171 171 End Sub 172 172 173 Override Function ReadImpl(buffer As * StrChar, index As Long, count As Long) As Long173 Override Function ReadImpl(buffer As *Char, index As Long, count As Long) As Long 174 174 ' Using lock = cs.Lock 175 175 ReadImpl = base.ReadImpl(buffer, index, count) -
trunk/Include/Classes/System/Math.ab
r457 r497 2 2 3 3 #require <Classes/ActiveBasic/Math/Math.ab> 4 5 #ifndef __SYSTEM_MATH_AB__6 #define __SYSTEM_MATH_AB__7 4 8 5 Namespace System … … 600 597 Const _System_InverseLn10 = 0.43429448190325182765112891891661 '1 / (ln 10) 601 598 Const _System_InverseSqrt2 = 0.70710678118654752440084436210485 '1 / (√2) 602 603 #endif '__SYSTEM_MATH_AB__ -
trunk/Include/Classes/System/OperatingSystem.ab
r258 r497 1 1 ' Classes/System/OperatingSystem.ab 2 3 #ifndef __SYSYTEM_OPERATINGSYSTEM_AB__4 #define __SYSYTEM_OPERATINGSYSTEM_AB__5 2 6 3 #require <Classes/System/Version.ab> … … 86 83 87 84 End Namespace 88 89 #endif '__SYSYTEM_OPERATINGSYSTEM_AB__ -
trunk/Include/Classes/System/String.ab
r478 r497 1 1 ' Classes/System/String.ab 2 3 #require <basic/function.sbp>4 #require <Classes/System/Text/StringBuilder.ab>5 #require <Classes/ActiveBasic/Strings/Strings.ab>6 7 TypeDef StrChar = Char8 9 #ifdef UNICODE10 #define __STRING_IS_UNICODE11 #else12 #define __STRING_IS_NOT_UNICODE13 #endif14 2 15 3 Namespace System … … 270 258 271 259 Sub Assign(text As PCSTR, textLengthA As Long) 272 #ifdef __STRING_IS_NOT_UNICODE 273 AssignFromCharPtr(text, textLengthA) 274 #else 260 #ifdef UNICODE 275 261 Dim textLengthW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, 0, 0) 276 262 If AllocStringBuffer(textLengthW) <> 0 Then … … 278 264 Chars[textLengthW] = 0 279 265 End If 266 #else 267 AssignFromCharPtr(text, textLengthA) 280 268 #endif 281 269 End Sub 282 270 283 271 Sub Assign(text As PCWSTR, textLengthW As Long) 284 #ifdef __STRING_IS_NOT_UNICODE 272 #ifdef UNICODE 273 AssignFromCharPtr(text, textLengthW) 274 #else 285 275 Dim textLengthA = WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, 0, 0, 0, 0) 286 276 If AllocStringBuffer(textLengthA) <> 0 Then … … 288 278 Chars[textLengthA] = 0 289 279 End If 290 #else291 AssignFromCharPtr(text, textLengthW)292 280 #endif 293 281 End Sub … … 305 293 Public 306 294 Const Function Concat(text As PCSTR, len As Long) As String 307 #ifdef __STRING_IS_NOT_UNICODE 308 Return ConcatChar(This.Chars, m_Length, text, len) 309 #else 295 #ifdef UNICODE 310 296 With Concat 311 297 Dim lenW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, len, 0, 0) … … 316 302 .Chars[m_Length + lenW] = 0 317 303 End With 304 #else 305 Return ConcatChar(This.Chars, m_Length, text, len) 318 306 #endif 319 307 End Function 320 308 321 309 Const Function Concat(text As PCWSTR, len As Long) As String 322 #ifdef __STRING_IS_NOT_UNICODE 310 #ifdef UNICODE 311 Return ConcatChar(This.Chars, m_Length, text, len) 312 #else 323 313 With Concat 324 314 Concat = New String … … 329 319 .Chars[m_Length + lenA] = 0 330 320 End With 331 #else332 Return ConcatChar(This.Chars, m_Length, text, len)333 321 #endif 334 322 End Function … … 600 588 601 589 Override Function GetHashCode() As Long 602 #ifdef __STRING_IS_NOT_UNICODE 590 #ifdef UNICODE 591 Dim size = m_Length 592 #else 603 593 Dim size = (m_Length + 1) >> 1 604 #else605 Dim size = m_Length606 594 #endif 607 595 Return _System_GetHashFromWordArray(Chars As *Word, size) Xor m_Length -
trunk/Include/Classes/System/Text/DecoderFallback.ab
r411 r497 77 77 len = length 78 78 End Sub 79 #if ndef __STRING_IS_NOT_UNICODE79 #ifdef UNICODE 80 80 /*! 81 81 @brief 指定された文字列でDecoderReplacementFallbackを構築する。 … … 124 124 End Function 125 125 126 #if ndef __STRING_IS_NOT_UNICODE126 #ifdef UNICODE 127 127 /*! 128 128 @brief 代替文字列を返す … … 167 167 End If 168 168 End Sub 169 #if ndef __STRING_IS_NOT_UNICODE169 #ifdef UNICODE 170 170 /*! 171 171 @brief 指定された文字列でDecoderReplacementFallbackを構築する。 -
trunk/Include/Classes/System/Text/Encoding.ab
r411 r497 1 #define __STRING_IS_NOT_UNICODE 'なぜか認識されないので2 3 1 /*! 4 2 @file Classes/System/Text/Encoding.ab … … 52 50 Return GetBytesCountCore(s, n) 53 51 End Function 54 #if ndef __STRING_IS_NOT_UNICODE52 #ifdef UNICODE 55 53 /*! 56 54 @brief 符号化して得られる文字列の長さを計算する。 … … 141 139 Return GetBytesCore(VarPtr(chars[index]), count, bytes, byteCount) 142 140 End Function 143 #if ndef __STRING_IS_NOT_UNICODE141 #ifdef UNICODE 144 142 /*! 145 143 @brief 符号化する。 … … 289 287 Abstract Function GetCharsCore(bytes As *Byte, byteCount As Long, chars As *WCHAR, charCount As Long) As Long 290 288 Public 291 #if ndef __STRING_IS_NOT_UNICODE289 #ifdef UNICODE 292 290 /*! 293 291 @brief 復号し、Stringで結果を返す。 -
trunk/Include/Classes/System/Text/StringBuilder.ab
r468 r497 1 1 'Classes/System/Text/StringBuilder.ab 2 3 #require <Classes/ActiveBasic/Strings/Strings.ab>4 2 5 3 Namespace System … … 7 5 8 6 Class StringBuilder 9 'Inherits ISerializable10 7 Public 11 8 Sub StringBuilder() … … 196 193 197 194 Override Function GetHashCode() As Long 198 #ifdef __STRING_IS_NOT_UNICODE 195 #ifdef UNICODE 196 Dim n = size 197 #else 199 198 Dim n = (size + 1) >> 1 200 #else201 Dim n = size202 199 #endif 203 200 Return _System_GetHashFromWordArray(chars As *Word, n As SIZE_T) Xor capacity Xor maxCapacity … … 214 211 Return This 215 212 End Function 216 #ifdef __STRING_IS_NOT_UNICODE 213 #ifdef UNICODE 214 Function Insert(i As Long, x As SByte) As StringBuilder 215 rangeCheck(i) 216 insertCore(i, Str$(x As Long)) 217 Return This 218 End Function 219 #else 217 220 Function Insert(i As Long, x As Word) As StringBuilder 218 221 rangeCheck(i) 219 222 insertCore(i, Str$(x As DWord)) 220 Return This221 End Function222 #else223 Function Insert(i As Long, x As SByte) As StringBuilder224 rangeCheck(i)225 insertCore(i, Str$(x As Long))226 223 Return This 227 224 End Function -
trunk/Include/Classes/System/Threading/Timeout.ab
r419 r497 1 1 ' Classes/System/Threading/Timeout.ab 2 3 #ifndef __SYSTEM_THREADING_TIMEOUT_AB__4 #define __SYSTEM_THREADING_TIMEOUT_AB__5 2 6 3 Namespace System … … 14 11 End Namespace 'Threading 15 12 End Namespace 'System 16 17 #endif -
trunk/Include/Classes/System/Version.ab
r257 r497 1 ' System/Version.ab 2 3 #ifndef __SYSTEM_VERSION_AB__ 4 #define __SYSTEM_VERSION_AB__ 5 6 #require <api_winsock2.sbp> 1 ' Classes/System/Version.ab 7 2 8 3 Namespace System … … 121 116 Function ToString(fieldCount As Long) As String 122 117 If fieldCount < 0 Or fieldCount > 4 Then 123 ' Throw ArgumentException 124 Debug 118 Throw New ArgumentOutOfRangeException("fieldCount") 125 119 End If 126 120 ToString = "" … … 132 126 133 127 If build < 0 Then 134 ' Throw ArgumentException 135 Debug 128 Throw New ArgumentException 136 129 End If 137 130 ToString = ToString + "." + Str$(build) … … 139 132 140 133 If revision < 0 Then 141 ' Throw ArgumentException 142 Debug 134 Throw New ArgumentException 143 135 End If 144 136 ToString = ToString + "." + Str$(revision) … … 152 144 153 145 End Namespace 'System 154 155 #endif '__SYSTEM_VERSION_AB__ -
trunk/Include/Classes/System/Xml/XmlDocument.ab
r468 r497 99 99 Virtual Sub Load( inStream As System.IO.Stream ) 100 100 Dim length = inStream.Length As DWord 101 Dim xmlBuffer = calloc( length + 1 ) As * StrChar101 Dim xmlBuffer = calloc( length + 1 ) As *Char 102 102 inStream.Read( xmlBuffer As *Byte, 0, length ) 103 103 inStream.Close() … … 124 124 Virtual Sub Save( outStream As System.IO.Stream ) 125 125 Dim xmlStr = InnerXmlSupportedIndent( True ) 126 outStream.Write( xmlStr.StrPtr As *Byte, 0, xmlStr.Length * SizeOf( StrChar ) )126 outStream.Write( xmlStr.StrPtr As *Byte, 0, xmlStr.Length * SizeOf( Char ) ) 127 127 outStream.Close() 128 128 End Sub
Note:
See TracChangeset
for help on using the changeset viewer.