Ignore:
Timestamp:
Nov 25, 2007, 4:31:35 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

Stringなどで例外を投げるようにした。
#147の解決。
CType ASCII文字判定関数群の追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/Text/StringBuilder.ab

    r385 r388  
    128128                Return This
    129129            Else
    130                 Throw New ArgumentNullException("StringBuilder.Append: An argument was null", "s")
     130                Throw New ArgumentNullException("StringBuilder.Append: An argument is null", "s")
    131131            End If
    132132        ElseIf startIndex < 0 Or count < 0 Then
    133             Throw New ArgumentOutOfRangeException("StringBuilder.Append: One or more arguments have out of range value.", "startIndex or count or both")
     133            Throw New ArgumentOutOfRangeException("StringBuilder.Append: One or more arguments are out of range value.", "startIndex or count or both")
    134134        End If
    135135        appendCore(s, startIndex, count)
     
    169169    Const Sub CopyTo(sourceIndex As Long, ByRef dest[] As StrChar, destIndex As Long, count As Long)
    170170        If dest = 0 Then
    171             Throw New ArgumentNullException("StringBuilder.CopyTo: An argument was null", "sourceIndex")
     171            Throw New ArgumentNullException("StringBuilder.CopyTo: An argument is null", "sourceIndex")
    172172        ElseIf size < sourceIndex + count Or sourceIndex < 0 Or destIndex < 0 Or count < 0 Then
    173             Throw New ArgumentOutOfRangeException("StringBuilder.CopyTo: One or more arguments have out of range value.", "startIndex or count or both")
     173            Throw New ArgumentOutOfRangeException("StringBuilder.CopyTo: One or more arguments are out of range value.", "startIndex or count or both")
    174174        End If
    175175
     
    179179    Function EnsureCapacity(c As Long) As Long
    180180        If c < 0 Or c > MaxCapacity Then
    181             Throw New ArgumentOutOfRangeException("StringBuilder.Append: An argument was out of range value.", "c")
     181            Throw New ArgumentOutOfRangeException("StringBuilder.Append: An argument is out of range value.", "c")
    182182        ElseIf c > Capacity Then
    183183            Dim p = GC_malloc_atomic((c + 1) * SizeOf (StrChar)) As *StrChar
     
    291291        rangeCheck(index)
    292292        If n < 0 Then
    293             Throw New ArgumentOutOfRangeException("StringBuilder.Insert: An argument was out of range value.", "n")
     293            Throw New ArgumentOutOfRangeException("StringBuilder.Insert: An argument is out of range value.", "n")
    294294        End If
    295295        Dim len = x.Length
     
    310310        rangeCheck(i)
    311311        If x = 0 Then
    312             Throw New ArgumentNullException("StringBuilder.Insert: An argument was null", "x")
     312            Throw New ArgumentNullException("StringBuilder.Insert: An argument is null", "x")
    313313        ElseIf index < 0 Or count < 0 Then
    314             Throw New ArgumentOutOfRangeException("StringBuilder.Append: One or more arguments have out of range value.", "index or count or both")
     314            Throw New ArgumentOutOfRangeException("StringBuilder.Append: One or more arguments are out of range value.", "index or count or both")
    315315        End If
    316316
     
    381381    Sub replaceCore(oldStr As String, newStr As String, start As Long, count As Long)
    382382        If ActiveBasic.IsNothing(oldStr) Then
    383             Throw New ArgumentNullException("StringBuilder.Replace: An argument was null", "oldStr")
     383            Throw New ArgumentNullException("StringBuilder.Replace: An argument is null", "oldStr")
    384384        ElseIf oldStr.Length = 0 Then
    385385            Throw New ArgumentException("StringBuilder.Replace: The argument 'oldStr' is empty string. ", "oldStr")
     
    428428    Sub Capacity(c As Long)
    429429        If c < size Or c > MaxCapacity Then 'sizeとの比較でcが負の場合も対応
    430             Throw New ArgumentOutOfRangeException("StringBuilder.Append: An argument have out of range value.", "c")
     430            Throw New ArgumentOutOfRangeException("StringBuilder.Capacity: An argument is out of range value.", "c")
    431431        End If
    432432        EnsureCapacity(c)
     
    435435    Const Function Chars(i As Long) As StrChar
    436436        If i >= Length Or i < 0 Then
    437             Throw New IndexOutOfRangeException("StringBuilder.Chars: The index argument 'i' have out of range value.")
     437            Throw New IndexOutOfRangeException("StringBuilder.Chars: The index argument 'i' is out of range value.")
    438438        End If
    439439        Return chars[i]
     
    442442    Sub Chars(i As Long, c As StrChar)
    443443        If i >= Length Or i < 0 Then
    444             Throw New ArgumentOutOfRangeException("StringBuilder.Chars: An argument have out of range value.", "i")
     444            Throw New ArgumentOutOfRangeException("StringBuilder.Chars: An argument is out of range value.", "i")
    445445        End If
    446446        chars[i] = c
     
    474474    Sub initialize(capacity As Long, maxCapacity = LONG_MAX As Long)
    475475        If capacity < 0 Or maxCapacity < 1 Or maxCapacity < capacity Then
    476             Throw New ArgumentOutOfRangeException("StringBuilder constructor: One or more arguments have out of range value.", "capacity or maxCapacity or both")
     476            Throw New ArgumentOutOfRangeException("StringBuilder constructor: One or more arguments are out of range value.", "capacity or maxCapacity or both")
    477477        End If
    478478
     
    506506    Sub rangeCheck(index As Long)
    507507        If index < 0 Or index > size Then
    508             Throw New ArgumentOutOfRangeException("StringBuilder: Index argument has out of range value.")
     508            Throw New ArgumentOutOfRangeException("StringBuilder: Index argument is out of range value.")
    509509        End If
    510510    End Sub
     
    517517        'length < 0は判定に入っていないことに注意
    518518        If startIndex < 0 Or count < 0 Or startIndex + count > length Then
    519             Throw New ArgumentOutOfRangeException("StringBuilder: One or more arguments have out of range value.", "startIndex or count or both")
     519            Throw New ArgumentOutOfRangeException("StringBuilder: One or more arguments are out of range value.", "startIndex or count or both")
    520520        End If
    521521    End Sub
Note: See TracChangeset for help on using the changeset viewer.