String
Creates a new #GString, initialized with the given string.
Return
the new #GString
Parameters
the initial text to copy into the string, or null to start with an empty string
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
initial contents of the string
length of @init to use
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
the default size of the space allocated to hold the string
Allocate a new String.
This instance will be allocated on the native heap and automatically freed when this class instance is garbage collected.
Allocate a new String using the provided AutofreeScope.
The AutofreeScope manages the allocation lifetime. The most common usage is with memScoped
.
Parameters
The AutofreeScope to allocate this structure in.
Allocate a new String.
This instance will be allocated on the native heap and automatically freed when this class instance is garbage collected.
Parameters
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.
contains the length of the string, not including the terminating nul byte.
the number of bytes that can be stored in the string before it needs to be reallocated. May be larger than @len.
Allocate a new String using the provided AutofreeScope.
The AutofreeScope manages the allocation lifetime. The most common usage is with memScoped
.
Parameters
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.
contains the length of the string, not including the terminating nul byte.
the number of bytes that can be stored in the string before it needs to be reallocated. May be larger than @len.
The AutofreeScope to allocate this structure in.