StringG

The GString struct contains the public fields of a GString.

Constructors

this
this(GString* gString, bool ownedRef)

Sets our main struct and passes it to the parent class.

Members

Functions

append
StringG append(string val)

Adds a string onto the end of a #GString, expanding it if necessary.

appendC
StringG appendC(char c)

Adds a byte onto the end of a #GString, expanding it if necessary.

appendLen
StringG appendLen(string val, ptrdiff_t len)

Appends @len bytes of @val to @string. Because @len is provided, @val may contain embedded nuls and need not be nul-terminated.

appendUnichar
StringG appendUnichar(dchar wc)

Converts a Unicode character into UTF-8, and appends it to the string.

appendUriEscaped
StringG appendUriEscaped(string unescaped, string reservedCharsAllowed, bool allowUtf8)

Appends @unescaped to @string, escaped any characters that are reserved in URIs using URI-style escape sequences.

appendVprintf
void appendVprintf(string format, void* args)

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.

asciiDown
StringG asciiDown()

Converts all uppercase ASCII letters to lowercase ASCII letters.

asciiUp
StringG asciiUp()

Converts all lowercase ASCII letters to uppercase ASCII letters.

assign
StringG 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.

down
StringG down()

Converts a #GString to lowercase.

equal
bool equal(StringG v2)

Compares two strings for equality, returning %TRUE if they are equal. For use with #GHashTable.

erase
StringG erase(ptrdiff_t pos, ptrdiff_t len)

Removes @len bytes from a #GString, starting at position @pos. The rest of the #GString is shifted down to fill the gap.

free
string free(bool freeSegment)

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().

freeToBytes
Bytes freeToBytes()

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.

getStringGStruct
GString* getStringGStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

hash
uint hash()

Creates a hash code for @str; for use with #GHashTable.

insert
StringG insert(ptrdiff_t pos, string val)

Inserts a copy of a string into a #GString, expanding it if necessary.

insertC
StringG insertC(ptrdiff_t pos, char c)

Inserts a byte into a #GString, expanding it if necessary.

insertLen
StringG insertLen(ptrdiff_t pos, string val, ptrdiff_t len)

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.

insertUnichar
StringG insertUnichar(ptrdiff_t pos, dchar wc)

Converts a Unicode character into UTF-8, and insert it into the string at the given position.

overwrite
StringG overwrite(size_t pos, string val)

Overwrites part of a string, lengthening it if necessary.

overwriteLen
StringG overwriteLen(size_t pos, string val, ptrdiff_t len)

Overwrites part of a string, lengthening it if necessary. This function will work with embedded nuls.

prepend
StringG prepend(string val)

Adds a string on to the start of a #GString, expanding it if necessary.

prependC
StringG prependC(char c)

Adds a byte onto the start of a #GString, expanding it if necessary.

prependLen
StringG prependLen(string val, ptrdiff_t len)

Prepends @len bytes of @val to @string. Because @len is provided, @val may contain embedded nuls and need not be nul-terminated.

prependUnichar
StringG prependUnichar(dchar wc)

Converts a Unicode character into UTF-8, and prepends it to the string.

setSize
StringG setSize(size_t 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.)

truncate
StringG truncate(size_t len)

Cuts off the end of the GString, leaving the first @len bytes.

up
StringG up()

Converts a #GString to uppercase.

vprintf
void vprintf(string format, void* args)

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.

Static functions

stringNew
StringG stringNew(string init)

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

stringNewLen
StringG stringNewLen(string init, ptrdiff_t 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.

stringSizedNew
StringG stringSizedNew(size_t dflSize)

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.

Variables

gString
GString* gString;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta