String

constructor(init: String? = null)(source)

Creates a new #GString, initialized with the given string.

Return

the new #GString

Parameters

init

the initial text to copy into the string, or null to start with an empty string


constructor(init: String, len: Long)(source)

Creates a new #GString with @len bytes of the @init buffer. Because a length is provided, @init need not be nul-terminated, and can contain embedded nul bytes.

Since this function does not stop at nul bytes, it is the caller's responsibility to ensure that @init has at least @len addressable bytes.

Return

a new #GString

Parameters

init

initial contents of the string

len

length of @init to use


constructor(dflSize: <Error class: unknown class>)(source)

Creates a new #GString, with enough space for @dfl_size bytes. This is useful if you are going to add a lot of text to the string and don't want it to be reallocated too often.

Return

the new #GString

Parameters

dflSize

the default size of the space allocated to hold the string


constructor()(source)

Allocate a new String.

This instance will be allocated on the native heap and automatically freed when this class instance is garbage collected.


constructor(scope: <Error class: unknown class>)(source)

Allocate a new String using the provided AutofreeScope.

The AutofreeScope manages the allocation lifetime. The most common usage is with memScoped.

Parameters

scope

The AutofreeScope to allocate this structure in.


constructor(str: String?, len: <Error class: unknown class>, allocatedLen: <Error class: unknown class>)(source)

Allocate a new String.

This instance will be allocated on the native heap and automatically freed when this class instance is garbage collected.

Parameters

str

points to the character data. It may move as text is added. The @str field is null-terminated and so can be used as an ordinary C string.

len

contains the length of the string, not including the terminating nul byte.

allocatedLen

the number of bytes that can be stored in the string before it needs to be reallocated. May be larger than @len.


constructor(str: String?, len: <Error class: unknown class>, allocatedLen: <Error class: unknown class>, scope: <Error class: unknown class>)(source)

Allocate a new String using the provided AutofreeScope.

The AutofreeScope manages the allocation lifetime. The most common usage is with memScoped.

Parameters

str

points to the character data. It may move as text is added. The @str field is null-terminated and so can be used as an ordinary C string.

len

contains the length of the string, not including the terminating nul byte.

allocatedLen

the number of bytes that can be stored in the string before it needs to be reallocated. May be larger than @len.

scope

The AutofreeScope to allocate this structure in.


constructor(glibStringPointer: <Error class: unknown class><<Error class: unknown class>>)(source)