[591:14] static extends: object
Alternate constructors for GString. Usage:
GStringCtors.<name>(...). The primary constructor lives
directly on GString.
newLen (string init, int len)
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.
init is initial contents of the string.len is length of @init to use.A new GString.newTake (string init)
Creates a new #GString, initialized with the given string. After this call, @init belongs to the #GString and may no longer be modified by the caller. The memory of @init has to be dynamically allocated and will eventually be freed with g_free().
init is initial text used as the string. Ownership of the string is transferred to the #GString. Passing %NULL creates an empty string..A new GString.newSizedNew (int dfl_size)
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.
dfl_size is the default size of the space allocated to hold the string.A new GString.[37:7] extends: object
A GString is an object that handles the memory management of a C string.
The emphasis of GString is on text, typically UTF-8. Crucially, the "str"
member of a GString is guaranteed to have a trailing nul character, and it
is therefore always safe to call functions such as strchr() or strdup()
on it. However, a GString can also hold arbitrary binary data, because it
has a "len" member, which includes any possible embedded nul characters in
the data. Conceptually then, GString is like a GByteArray with the
addition of many convenience methods for text, and a guaranteed nul
terminator.
GString (init = null)
Creates a new #GString, initialized with the given string.
init is the initial text to copy into the string, or %NULL to start with an empty string.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.append (string val)
Adds a string onto the end of a #GString, expanding it if necessary.
val is the string to append onto the end of @string.@string.append_c (int c)
Adds a byte onto the end of a #GString, expanding it if necessary.
c is the byte to append onto the end of @string.@string.append_len (string val, int len)
Appends @len bytes of @val to @string. If @len is positive, @val may contain embedded nuls and need not be nul-terminated. It is the caller's responsibility to ensure that @val has at least @len addressable bytes. If @len is negative, @val must be nul-terminated and @len is considered to request the entire string length. This makes g_string_append_len() equivalent to g_string_append().
val is bytes to append.len is number of bytes of @val to use, or -1 for all of @val.@string.append_printf (string format, list varargs)
Appends a formatted string onto the end of a #GString. This function is similar to g_string_printf() except that the text is appended to the #GString.
format is the string format. See the printf() documentation.... is the parameters to insert into the format string.None.append_unichar (int wc)
Converts a Unicode character into UTF-8, and appends it to the string.
wc is a Unicode character.@string.append_uri_escaped (string unescaped, string reserved_chars_allowed, bool allow_utf8)
Appends @unescaped to @string, escaping any characters that are reserved in URIs using URI-style escape sequences.
unescaped is a string.reserved_chars_allowed is a string of reserved characters allowed to be used, or %NULL.allow_utf8 is set %TRUE if the escaped string may include UTF8 characters.@string.ascii_down ()
Converts all uppercase ASCII letters to lowercase ASCII letters.
passed-in @string pointer, with all the uppercase characters converted to lowercase in place, with semantics that exactly match g_ascii_tolower()..ascii_up ()
Converts all lowercase ASCII letters to uppercase ASCII letters.
passed-in @string pointer, with all the lowercase characters converted to uppercase in place, with semantics that exactly match g_ascii_toupper()..assign (string rval)
Copies the bytes from a string into a #GString, destroying any previous contents. It is rather like the standard strcpy() function, except that you do not have to worry about having enough space to copy the string.
rval is the string to copy into @string.@string.copy ()
Copies the [struct@GLib.String] instance and its contents. This will preserve the allocation length of the [struct@GLib.String] in the copy.
a copy of @string.down ()
Converts a #GString to lowercase.
the #GString.equal (object v2)
Compares two strings for equality, returning %TRUE if they are equal. For use with #GHashTable.
v2 is another #GString.%TRUE if the strings are the same length and contain the same bytes.erase (int pos, int len)
Removes @len bytes from a #GString, starting at position @pos. The rest of the #GString is shifted down to fill the gap.
pos is the position of the content to remove.len is the number of bytes to remove, or -1 to remove all following bytes.@string.free (bool free_segment)
Frees the memory allocated for the #GString. If @free_segment is %TRUE it also frees the character data. If it's %FALSE, the caller gains ownership of the buffer and must free it after use with g_free(). Instead of passing %FALSE to this function, consider using g_string_free_and_steal().
free_segment is if %TRUE, the actual character data is freed as well.the character data of @string (i.e. %NULL if @free_segment is %TRUE).free_and_steal ()
Frees the memory allocated for the #GString. The caller gains ownership of the buffer and must free it after use with g_free().
the character data of @string.free_to_bytes ()
Transfers ownership of the contents of @string to a newly allocated #GBytes. The #GString structure itself is deallocated, and it is therefore invalid to use @string after invoking this function. Note that while #GString ensures that its buffer always has a trailing nul character (not reflected in its "len"), the returned #GBytes does not include this extra nul; i.e. it has length exactly equal to the "len" member.
A newly allocated #GBytes containing contents of @string; @string itself is freed.hash ()
Creates a hash code for @str; for use with #GHashTable.
hash code for @str.insert (int pos, string val)
Inserts a copy of a string into a #GString, expanding it if necessary.
pos is the position to insert the copy of the string.val is the string to insert.@string.insert_c (int pos, int c)
Inserts a byte into a #GString, expanding it if necessary.
pos is the position to insert the byte.c is the byte to insert.@string.insert_len (int pos, string val, int len)
Inserts @len bytes of @val into @string at @pos. If @len is positive,
may contain embedded nuls and need not be nul-terminated. It is the caller's responsibility to ensure that @val has at least @len addressable bytes. If @len is negative, @val must be nul-terminated and @len is considered to request the entire string length. If @pos is -1, bytes are inserted at the end of the string.pos is position in @string where insertion should happen, or -1 for at the end.val is bytes to insert.len is number of bytes of @val to insert, or -1 for all of @val.@string.insert_unichar (int pos, int wc)
Converts a Unicode character into UTF-8, and insert it into the string at the given position.
pos is the position at which to insert character, or -1 to append at the end of the string.wc is a Unicode character.@string.overwrite (int pos, string val)
Overwrites part of a string, lengthening it if necessary.
pos is the position at which to start overwriting.val is the string that will overwrite the @string starting at @pos.@string.overwrite_len (int pos, string val, int len)
Overwrites part of a string, lengthening it if necessary. This function will work with embedded nuls.
pos is the position at which to start overwriting.val is the string that will overwrite the @string starting at @pos.len is the number of bytes to write from @val.@string.prepend (string val)
Adds a string on to the start of a #GString, expanding it if necessary.
val is the string to prepend on the start of @string.@string.prepend_c (int c)
Adds a byte onto the start of a #GString, expanding it if necessary.
c is the byte to prepend on the start of the #GString.@string.prepend_len (string val, int len)
Prepends @len bytes of @val to @string. If @len is positive, @val may contain embedded nuls and need not be nul-terminated. It is the caller's responsibility to ensure that @val has at least @len addressable bytes. If @len is negative, @val must be nul-terminated and @len is considered to request the entire string length. This makes g_string_prepend_len() equivalent to g_string_prepend().
val is bytes to prepend.len is number of bytes in @val to prepend, or -1 for all of @val.@string.prepend_unichar (int wc)
Converts a Unicode character into UTF-8, and prepends it to the string.
wc is a Unicode character.@string.printf (string format, list varargs)
Writes a formatted string into a #GString. This is similar to the standard sprintf() function, except that the #GString buffer automatically expands to contain the results. The previous contents of the #GString are destroyed.
format is the string format. See the printf() documentation.... is the parameters to insert into the format string.None.replace (string find, string replace, int limit)
Replaces the string @find with the string @replace in a #GString up to
times. If the number of instances of @find in the #GString is less than @limit, all instances are replaced. If @limit is 0, all instances of @find are replaced. If @find is the empty string, since versions 2.69.1 and 2.68.4 the replacement will be inserted no more than once per possible position (beginning of string, end of string and between characters). This did not work correctly in earlier versions. If @limit is zero and more than G_MAXUINT instances of @find are in the input string, they will all be replaced, but the return value will be capped at G_MAXUINT.find is the string to find in @string.replace is the string to insert in place of @find.limit is the maximum instances of @find to replace with @replace, or 0 for no limit.the number of find and replace operations performed, up to G_MAXUINT.set_size (int len)
Sets the length of a #GString. If the length is less than the current length, the string will be truncated. If the length is greater than the current length, the contents of the newly added area are undefined. (However, as always, string->str[string->len] will be a nul byte.)
len is the new length.@string.truncate (int len)
Cuts off the end of the GString, leaving the first @len bytes.
len is the new size of @string.@string.up ()
Converts a #GString to uppercase.
@string.[12:14] static extends: object
Generated struct layout helper for GIR record String.
layout ()
Returns the Panama struct layout for
String.