Changeset 226


Ignore:
Timestamp:
May 1, 2007, 1:21:27 AM (18 years ago)
Author:
イグトランス (egtra)
Message:

StringTest追加

Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/String.ab

    r221 r226  
    7171        Return Chars
    7272    End Function
    73 
    74 /*  Sub Operator = (ByRef objString As String)
    75         Assign(objString.Chars, objString.m_Length)
    76     End Sub
    77 
    78     Sub Operator = (text As *Byte)
    79         Assign(text As PCTSTR)
    80     End Sub
    81 
    82     Sub Operator = (text As PCSTR)
    83         Assign(text)
    84     End Sub
    85 
    86     Sub Operator = (text As PCWSTR)
    87         Assign(text)
    88     End Sub*/
    8973
    9074    Const Function Operator [] (n As Long) As StrChar
     
    372356
    373357    Static Function Concat(x As String, y As String) As String
    374         If x = Nothing Then
     358        If String.IsNullOrEmpty(x) Then
    375359            Return y
    376360        Else
    377             Return x.Concat(objString.Chars, objString.m_Length)
     361            Return x.Concat(y.Chars, y.m_Length)
    378362        End If
    379363    End Function
     
    513497
    514498    Static Function IsNullOrEmpty(s As String) As Boolean
    515         If s <> Nothing Then
     499        If Not Object.ReferenceEquals(s, Nothing) Then
    516500            If s.m_Length > 0 Then
    517                 Return True
     501                Return False
    518502            End If
    519503        End If
    520         Return False
     504        Return True
    521505    End Function
    522506
     
    573557        Next
    574558    End Function
    575 
     559/*
    576560    Sub Swap(ByRef x As String)
    577561        Dim tempLen As Long
     
    584568        This.Chars = tempChars
    585569    End Sub
    586 
     570*/
    587571    Override Function ToString() As String
    588572        Return This
  • Include/com/bstring.ab

    r208 r226  
    55
    66Class BString
     7    Sub Init(s As PCSTR, len As DWord)
     8        Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, 0, 0)
     9        bs = SysAllocStringLen(0, lenBS)
     10        MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, bs, lenBS)
     11    End Sub
    712Public
    813    Sub BString()
     
    1520
    1621    Sub BString(ByRef s As BString)
    17         BString(s.bs, s.Length)
     22        Init(s.bs, s.Length)
    1823    End Sub
    1924
     
    2732
    2833    Sub BString(s As PCSTR)
    29         BString(s, lstrlenA(s))
     34        Init(s, lstrlenA(s))
    3035    End Sub
    3136
     
    3742
    3843    Sub BString(ByRef s As String)
    39         BString(s.StrPtr, s.Length As DWord)
     44        Init(s.StrPtr, s.Length As DWord)
    4045    End Sub
    4146
     
    4449    End Sub
    4550
    46     Sub Operator =(ByRef bstr As BString)
    47         Clear()
    48         BString(bstr)
    49     End Sub
    50 
    51     Sub Operator =(s As LPCOLESTR)
    52         Clear()
    53         BString(s)
    54     End Sub
    55 
    5651    Sub Assign(ByRef bstr As BString)
    5752        Clear()
    58         BString(bstr)
     53        Init(bstr, bstr.Length)
    5954    End Sub
    6055
    6156    Sub Assign(s As LPCOLESTR)
    6257        Clear()
    63         BString(s)
     58        Init(s, lstrlenW(s))
    6459    End Sub
    6560
  • TestCase/SimpleTestCase/SimpleTestCase.idx

    r224 r226  
    77'プロジェクト内のプログラム ファイル
    88#include "ObjectTest.ab"
     9#include "StringTest.ab"
    910
    1011'リソースファイル
  • TestCase/SimpleTestCase/SimpleTestCase.pj

    r224 r226  
    2828SimpleTestCase.ab
    2929ObjectTest.ab
     30StringTest.ab
Note: See TracChangeset for help on using the changeset viewer.