Module Interface ADT:StringBuffer

SUMMARY: MODULE | CLASS | TYPE | PROC | VAR | CONST | DETAIL: TYPE | PROC | VAR | CONST

# ADT:StringBuffer

### Import List

        Ascii
        Object
        Object

Class List
StringBuffer | Assembles string values.

Class Summary: StringBuffer [Detail]
      +---Object.Object
           |
           +--ADT:StringBuffer.StringBuffer
Assembles string values. This class is mutable in the sense that it can be modified in place. All variables sharing a reference to an instance of StringBuffer see all changes applied to it.
Field Summary
length-: LONGINT The length of the current string.
Constructor Summary
New(STRING): StringBuffer
NewLatin1(ARRAY OF CHAR): StringBuffer
NewLatin1Region(ARRAY OF CHAR, LONGINT, LONGINT): StringBuffer
Method Summary
Append(Object)
AppendBool(BOOLEAN) Append the string representation of a BOOLEAN val to the current string.
AppendChar(UCS4CHAR)
AppendInt(LONGINT) Append the string representation of LONGINT val to the current string
AppendLatin1(ARRAY OF CHAR)
AppendLatin1Char(CHAR)
AppendLatin1Region(ARRAY OF CHAR, LONGINT, LONGINT)
AppendLn() Append a newline character Ascii.lf to the buffer.
AppendReal(REAL) Append the string representation of REAL val to the current string
AppendSet(SET) Append the string representation of a SET val to the currrent string.
AppendUTF16Region(ARRAY OF LONGCHAR, LONGINT, LONGINT)
CharAt(LONGINT): UCS4CHAR
CharsLatin1(): CharsLatin1 Return a reference to the character data of the string buffer.
CharsUTF16(): CharsUTF16 Return a reference to the character data of the string buffer.
Clear()
[ConvertTo16]()
Delete(LONGINT, LONGINT)
[EnsureCapacity](LONGINT)
INIT(LONGINT)
Insert(Object, LONGINT)
ToString(): STRING Returns a string representation of the object.
Inherited Methods
From Object.Object: Equals, HashCode, ToString

Type Summary
CharsLatin1 = POINTER TO ARRAY OF CHAR
CharsUTF16 = POINTER TO ARRAY OF LONGCHAR

Class Detail: StringBuffer

Field Detail

### length

    FIELD length-: LONGINT

> The length of the current string.

Constructor Detail

### New

    PROCEDURE New(str: STRING): StringBuffer

### NewLatin1

    PROCEDURE NewLatin1(str: ARRAY OF CHAR): StringBuffer

### NewLatin1Region

    PROCEDURE NewLatin1Region(str: ARRAY OF CHAR;
                              start: LONGINT;
                              end: LONGINT): StringBuffer

Method Detail

### Append

    PROCEDURE (b: StringBuffer) Append(obj: Object)

### AppendBool

    PROCEDURE (b: StringBuffer) AppendBool(val: BOOLEAN)

> Append the string representation of a BOOLEAN val to the current string.

### AppendChar

    PROCEDURE (b: StringBuffer) AppendChar(ch: UCS4CHAR)

### AppendInt

    PROCEDURE (b: StringBuffer) AppendInt(val: LONGINT)

> Append the string representation of LONGINT val to the current string

### AppendLatin1

    PROCEDURE (b: StringBuffer) AppendLatin1(data: ARRAY OF CHAR)

### AppendLatin1Char

    PROCEDURE (b: StringBuffer) AppendLatin1Char(ch: CHAR)

### AppendLatin1Region

    PROCEDURE (b: StringBuffer) AppendLatin1Region(data: ARRAY OF CHAR;
                                 start: LONGINT;
                                 end: LONGINT)

### AppendLn

    PROCEDURE (b: StringBuffer) AppendLn()

> Append a newline character Ascii.lf to the buffer.

### AppendReal

    PROCEDURE (b: StringBuffer) AppendReal(val: REAL)

> Append the string representation of REAL val to the current string

### AppendSet

    PROCEDURE (b: StringBuffer) AppendSet(val: SET)

> Append the string representation of a SET val to the currrent string.

### AppendUTF16Region

    PROCEDURE (b: StringBuffer) AppendUTF16Region(data: ARRAY OF LONGCHAR;
                                start: LONGINT;
                                end: LONGINT)

### CharAt

    PROCEDURE (b: StringBuffer) CharAt(index: LONGINT): UCS4CHAR

### CharsLatin1

    PROCEDURE (b: StringBuffer) CharsLatin1(): CharsLatin1

> Return a reference to the character data of the string buffer. It holds valid character data in the index range ``0`' to ``b.length-1`'. The element at index ``b.length`' is ``0X`'. Please note that the string buffer may also contain ``0X`' itself.

> If wide characters have been added to b, then no CharsLatin1 representation is available and result is NIL.

> Important: The reference only remains valid until the first operation that modifies the buffer. After such an operation, it may or may not reflect the current buffer contents.

### CharsUTF16

    PROCEDURE (b: StringBuffer) CharsUTF16(): CharsUTF16

> Return a reference to the character data of the string buffer. It holds valid character data in the index range ``0`' to ``b.length-1`'. The element at index ``b.length`' is ``0X`'. Please note that the string buffer may also contain ``0X`' itself.

> If no wide characters have been added to b, then the internal representation is still CharsLatin1, and result is NIL.

> Important: The reference only remains valid until the first operation that modifies the buffer. After such an operation, it may or may not reflect the current buffer contents.

### Clear

    PROCEDURE (b: StringBuffer) Clear()

### ConvertTo16

    PROCEDURE (b: StringBuffer) [ConvertTo16]()

### Delete

    PROCEDURE (b: StringBuffer) Delete(start: LONGINT;
                     end: LONGINT)

### EnsureCapacity

    PROCEDURE (b: StringBuffer) [EnsureCapacity](cap: LONGINT)

### INIT

    PROCEDURE (b: StringBuffer) INIT(initialCapacity: LONGINT)

### Insert

    PROCEDURE (b: StringBuffer) Insert(obj: Object;
                     at: LONGINT)

### ToString

    PROCEDURE (b: StringBuffer) ToString(): STRING

> Returns a string representation of the object. Typically, the string is some form of "natural" representation of the value. For complex objects, it should describe the type and essential attributes of the object. The exact format of the returned value is intentionally left vague.

> [Description inherited from ToString]

> Redefines: ToString

Type Detail

### CharsLatin1

    TYPE CharsLatin1 = POINTER TO ARRAY OF CHAR

### CharsUTF16

    TYPE CharsUTF16 = POINTER TO ARRAY OF LONGCHAR