Sets our main struct and passes it to the parent class
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.
Appends len bytes of val to string. Because len is provided, val may contain embedded nuls and need not be nul-terminated. Since this function does not stop at nul bytes, it is the caller's responsibility to ensure that val has at least len addressable bytes.
Adds a byte onto the end of a GString, expanding it if necessary.
Converts a Unicode character into UTF-8, and appends it to the string.
Appends unescaped to string, escaped any characters that are reserved in URIs using URI-style escape sequences. Since 2.16
Appends a formatted string onto the end of a GString. This function is similar to g_string_append_printf() except that the arguments to the format string are passed as a va_list. Since 2.14
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.
Warning g_string_down has been deprecated since version 2.2 and should not be used in newly-written code. This function uses the locale-specific tolower() function, which is almost never the right thing. Use g_string_ascii_down() or g_utf8_strdown() instead. Converts a GString to lowercase.
Compares two strings for equality, returning TRUE if they are equal. For use with GHashTable.
Removes len bytes from a GString, starting at position pos. The rest of the GString is shifted down to fill the gap.
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().
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. Since 2.34
the main Gtk struct as a void*
Creates a hash code for str; for use with GHashTable.
Inserts len bytes of val into string at pos. Because len is provided, val may contain embedded nuls and need not be nul-terminated. If pos is -1, bytes are inserted at the end of the string. Since this function does not stop at nul bytes, it is the caller's responsibility to ensure that val has at least len addressable bytes.
Inserts a byte into a GString, expanding it if necessary.
Converts a Unicode character into UTF-8, and insert it into the string at the given position.
Overwrites part of a string, lengthening it if necessary. This function will work with embedded nuls. Since 2.14
Prepends len bytes of val to string. Because len is provided, val may contain embedded nuls and need not be nul-terminated. Since this function does not stop at nul bytes, it is the caller's responsibility to ensure that val has at least len addressable bytes.
Adds a byte onto the start of a GString, expanding it if necessary.
Converts a Unicode character into UTF-8, and prepends it to the string.
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.)
Cuts off the end of the GString, leaving the first len bytes.
Warning g_string_up has been deprecated since version 2.2 and should not be used in newly-written code. This function uses the locale-specific toupper() function, which is almost never the right thing. Use g_string_ascii_up() or g_utf8_strup() instead. Converts a GString to uppercase.
Writes a formatted string into a GString. This function is similar to g_string_printf() except that the arguments to the format string are passed as a va_list. Since 2.14
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.
the main Gtk struct
A GString is an object that handles the memory management of a C string for you. 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 g_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.