glib.c.types

C types for glib2 library

Types 226

aliasGDateDay = ubyte

Integer representing a day of the month; between 1 and 31.

The [glib.types.DATE_BAD_DAY] value represents an invalid day of the month.

aliasGDateYear = ushort

Integer type representing a year.

The [glib.types.DATE_BAD_YEAR] value is the invalid value. The year must be 1 or higher; negative (BCE) years are not allowed.

The year is represented with four digits.

aliasGMainContextPusher = void

Opaque type. See g_main_context_pusher_new() for details.

aliasGMutexLocker = void

Opaque type. See g_mutex_locker_new() for details.

aliasGPid = int

A type which is used to hold a process identification.

On UNIX, processes are identified by a process id (an integer), while Windows uses process handles (which are pointers).

GPid is used in GLib only for descendant processes spawned with the g_spawn functions.

aliasGQuark = uint

A GQuark is a non-zero integer which uniquely identifies a particular string.

A GQuark value of zero is associated to NULL.

Given either the string or the GQuark identifier it is possible to retrieve the other.

Quarks are used for both

datasets and keyed data lists.

To create a new quark from a string, use func@GLib.quark_from_string or func@GLib.quark_from_static_string.

To find the string corresponding to a given GQuark, use func@GLib.quark_to_string.

To find the GQuark corresponding to a given string, use func@GLib.quark_try_string.

Another use for the string pool maintained for the quark functions is string interning, using func@GLib.intern_string or func@GLib.intern_static_string. An interned string is a canonical representation for a string. One important advantage of interned strings is that they can be compared for equality by a simple pointer comparison, rather than using strcmp().

Opaque type. See g_rw_lock_reader_locker_new() for details.

Opaque type. See g_rw_lock_writer_locker_new() for details.

aliasGRecMutexLocker = void

Opaque type. See g_rec_mutex_locker_new() for details.

aliasGRefString = char

A typedef for a reference-counted string. A pointer to a #GRefString can be treated like a standard char* array by all code, but can additionally have g_ref_string_*() methods called on it. g_ref_string_*() methods cannot be called on char* arrays not allocated using [glib.global.refStringNew].

If using #GRefString with autocleanups, g_autoptr() must be used rather than g_autofree(), so that the reference counting metadata is also freed.

aliasGStrv = char * *

A typedef alias for gchar**. This is mostly useful when used together with g_auto().

aliasGTime = int

Simply a replacement for time_t. It has been deprecated since it is not equivalent to time_t on 64-bit platforms with a 64-bit time_t.

Unrelated to #GTimer.

Note that #GTime is defined to always be a 32-bit integer, unlike time_t which may be 64-bit on some systems. Therefore, #GTime will overflow in the year 2038, and you cannot use the address of a #GTime variable as argument to the UNIX time() function.

Instead, do the following:

time_t ttime;
GTime gtime;

time (&ttime);
gtime = (GTime)ttime;

Deprecated

This is not Y2038-safe.

Use #GDateTime or #time_t instead.

aliasGTimeSpan = long

A value representing an interval of time, in microseconds.

aliasGIConv = void *
enumGAsciiType : uint
Alnum = 1
Alpha = 2
Cntrl = 4
Digit = 8
Graph = 16
Lower = 32
Print = 64
Punct = 128
Space = 256
Upper = 512
Xdigit = 1024

Error codes returned by bookmark file parsing.

InvalidUri = 0URI was ill-formed
InvalidValue = 1a requested field was not found
AppNotRegistered = 2a requested application did not register a bookmark
UriNotFound = 3a requested URI was not found
Read = 4document was ill formed
UnknownEncoding = 5the text being parsed was in an unknown encoding
Write = 6an error occurred while writing
FileNotFound = 7requested file was not found

The hashing algorithm to be used by #GChecksum when performing the digest of some data.

Note that the #GChecksumType enumeration may be extended at a later date to include new hashing algorithm types.

Md5 = 0Use the MD5 hashing algorithm
Sha1 = 1Use the SHA-1 hashing algorithm
Sha256 = 2Use the SHA-256 hashing algorithm
Sha512 = 3Use the SHA-512 hashing algorithm (Since: 2.36)
Sha384 = 4Use the SHA-384 hashing algorithm (Since: 2.51)

Error codes returned by character set conversion routines.

NoConversion = 0Conversion between the requested character sets is not supported.
IllegalSequence = 1Invalid byte sequence in conversion input; or the character sequence could not be represented in the target character set.
Failed = 2Conversion failed for some reason.
PartialInput = 3Partial character sequence at end of input.
BadUri = 4URI is invalid.
NotAbsolutePath = 5Pathname is not an absolute path.
NoMemory = 6No memory available. Since: 2.40
EmbeddedNul = 7An embedded NUL character is present in conversion output where a NUL-terminated string is expected. Since: 2.56

This enumeration isn't used in the API, but may be useful if you need to mark a number as a day, month, or year.

Day = 0a day
Month = 1a month
Year = 2a year

Enumeration representing a month; values are G_DATE_JANUARY, G_DATE_FEBRUARY, etc. G_DATE_BAD_MONTH is the invalid value.

BadMonth = 0invalid value
January = 1January
February = 2February
March = 3March
April = 4April
May = 5May
June = 6June
July = 7July
August = 8August
September = 9September
October = 10October
November = 11November
December = 12December

Enumeration representing a day of the week; G_DATE_MONDAY, G_DATE_TUESDAY, etc. G_DATE_BAD_WEEKDAY is an invalid weekday.

BadWeekday = 0invalid value
Monday = 1Monday
Tuesday = 2Tuesday
Wednesday = 3Wednesday
Thursday = 4Thursday
Friday = 5Friday
Saturday = 6Saturday
Sunday = 7Sunday

The possible errors, used in the @v_error field of #GTokenValue, when the token is a G_TOKEN_ERROR.

Unknown = 0unknown error
UnexpEof = 1unexpected end of file
UnexpEofInString = 2unterminated string constant
UnexpEofInComment = 3unterminated comment
NonDigitInConst = 4non-digit character in a number
DigitRadix = 5digit beyond radix in a number
FloatRadix = 6non-decimal floating point number
FloatMalformed = 7malformed floating point number

Values corresponding to @errno codes returned from file operations on UNIX. Unlike @errno codes, GFileError values are available on all systems, even Windows. The exact meaning of each code depends on what sort of file operation you were performing; the UNIX documentation gives more details. The following error code descriptions come from the GNU C Library manual, and are under the copyright of that manual.

It's not very portable to make detailed assumptions about exactly which errors will be returned from a given operation. Some errors don't occur on some systems, etc., sometimes there are subtle differences in when a system will report a given error, etc.

Exist = 0Operation not permitted; only the owner of the file (or other resource) or processes with special privileges can perform the operation.
Isdir = 1File is a directory; you cannot open a directory for writing, or create or remove hard links to it.
Acces = 2Permission denied; the file permissions do not allow the attempted operation.
Nametoolong = 3Filename too long.
Noent = 4No such file or directory. This is a "file doesn't exist" error for ordinary files that are referenced in contexts where they are expected to already exist.
Notdir = 5A file that isn't a directory was specified when a directory is required.
Nxio = 6No such device or address. The system tried to use the device represented by a file you specified, and it couldn't find the device. This can mean that the device file was installed incorrectly, or ...
Nodev = 7The underlying file system of the specified file does not support memory mapping.
Rofs = 8The directory containing the new link can't be modified because it's on a read-only file system.
Txtbsy = 9Text file busy.
Fault = 10You passed in a pointer to bad memory. (GLib won't reliably return this, don't pass in pointers to bad memory.)
Loop = 11Too many levels of symbolic links were encountered in looking up a file name. This often indicates a cycle of symbolic links.
Nospc = 12No space left on device; write operation on a file failed because the disk is full.
Nomem = 13No memory available. The system cannot allocate more virtual memory because its capacity is full.
Mfile = 14The current process has too many files open and can't open any more. Duplicate descriptors do count toward this limit.
Nfile = 15There are too many distinct file openings in the entire system.
Badf = 16Bad file descriptor; for example, I/O on a descriptor that has been closed or reading from a descriptor open only for writing (or vice versa).
Inval = 17Invalid argument. This is used to indicate various kinds of problems with passing the wrong argument to a library function.
Pipe = 18Broken pipe; there is no process reading from the other end of a pipe. Every library function that returns this error code also generates a 'SIGPIPE' signal; this signal terminates the program if n...
Again = 19Resource temporarily unavailable; the call might work if you try again later.
Intr = 20Interrupted function call; an asynchronous signal occurred and prevented completion of the call. When this happens, you should try the call again.
Io = 21Input/output error; usually used for physical read or write errors. i.e. the disk or other physical device hardware is returning errors.
Perm = 22Operation not permitted; only the owner of the file (or other resource) or processes with special privileges can perform the operation.
Nosys = 23Function not implemented; this indicates that the system is missing some functionality.
Failed = 24Does not correspond to a UNIX error code; this is the standard "failed for unspecified reason" error code present in all #GError error code enumerations. Returned if no specific code applies.

Flags to pass to [glib.global.fileSetContentsFull] to affect its safety and performance.

None = 0No guarantees about file consistency or durability. The most dangerous setting, which is slightly faster than other settings.
Consistent = 1Guarantee file consistency: after a crash, either the old version of the file or the new version of the file will be available, but not a mixture. On Unix systems this equates to an `fsync()` on th...
Durable = 2Guarantee file durability: after a crash, the new version of the file will be available. On Unix systems this equates to an `fsync()` on the file (if `GFILESETCONTENTSCONSISTENT` is unset), or the ...
OnlyExisting = 4Only apply consistency and durability guarantees if the file already exists. This may speed up file operations if the file doesn’t currently exist, but may result in a corrupted version of the ne...
enumGFileTest : uint

A test to perform on a file using [glib.global.fileTest].

IsRegular = 1true if the file is a regular file (not a directory). Note that this test will also return true if the tested file is a symlink to a regular file.
IsSymlink = 2true if the file is a symlink.
IsDir = 4true if the file is a directory.
IsExecutable = 8true if the file is executable.
Exists = 16true if the file exists. It may or may not be a regular file.
enumGFormatSizeFlags : uint

Flags to modify the format of the string returned by [glib.global.formatSizeFull].

Default = 0behave the same as [glib.global.formatSize]
LongFormat = 1include the exact number of bytes as part of the returned string. For example, "45.6 kB (45,612 bytes)".
IecUnits = 2use IEC (base 1024) units with "KiB"-style suffixes. IEC units should only be used for reporting things with a strong "power of 2" basis, like RAM sizes or RAID stripe sizes. Network and storage si...
Bits = 4set the size as a quantity in bits, rather than bytes, and return units in bits. For example, ‘Mbit’ rather than ‘MB’.
OnlyValue = 8return only value, without unit; this should not be used together with @GFORMATSIZELONGFORMAT nor @GFORMATSIZEONLYUNIT. Since: 2.74
OnlyUnit = 16return only unit, without value; this should not be used together with @GFORMATSIZELONGFORMAT nor @GFORMATSIZEONLYVALUE. Since: 2.74
enumGHookFlagMask : uint

Flags used internally in the #GHook implementation.

Active = 1set if the hook has not been destroyed
InCall = 2set if the hook is currently being run
Mask = 15A mask covering all bits reserved for hook flags; see [glib.types.HOOKFLAGUSER_SHIFT]

Error codes returned by #GIOChannel operations.

Fbig = 0File too large.
Inval = 1Invalid argument.
Io = 2IO error.
Isdir = 3File is a directory.
Nospc = 4No space left on device.
Nxio = 5No such device or address.
Overflow = 6Value too large for defined datatype.
Pipe = 7Broken pipe.
Failed = 8Some other error.
enumGIOCondition : uint

A bitwise combination representing a condition to watch for on an event source.

In = 1There is data to read.
Out = 4Data can be written (without blocking).
Pri = 2There is urgent data to read.
Err = 8Error condition.
Hup = 16Hung up (the connection has been broken, usually for pipes and sockets).
Nval = 32Invalid request. The file descriptor is not open.

#GIOError is only used by the deprecated functions [glib.iochannel.IOChannel.read], [glib.iochannel.IOChannel.write], and [glib.iochannel.IOChannel.seek].

None = 0no error
Again = 1an EAGAIN error occurred
Inval = 2an EINVAL error occurred
Unknown = 3another error occurred
enumGIOFlags : uint

Specifies properties of a #GIOChannel. Some of the flags can only be read with [glib.iochannel.IOChannel.getFlags], but not changed with [glib.iochannel.IOChannel.setFlags].

None = 0no special flags set. Since: 2.74
Append = 1turns on append mode, corresponds to `O_APPEND` (see the documentation of the UNIX open() syscall)
Nonblock = 2turns on nonblocking mode, corresponds to `ONONBLOCK`/`ONDELAY` (see the documentation of the UNIX open() syscall)
IsReadable = 4indicates that the io channel is readable. This flag cannot be changed.
IsWritable = 8indicates that the io channel is writable. This flag cannot be changed.
IsWriteable = 8a misspelled version of @GIOFLAGISWRITABLE that existed before the spelling was fixed in GLib 2.30. It is kept here for compatibility reasons. Deprecated since 2.30
IsSeekable = 16indicates that the io channel is seekable, i.e. that [glib.iochannel.IOChannel.seekPosition] can be used on it. This flag cannot be changed.
Mask = 31the mask that specifies all the valid flags.
GetMask = 31the mask of the flags that are returned from [glib.iochannel.IOChannel.getFlags]
SetMask = 3the mask of the flags that the user can modify with [glib.iochannel.IOChannel.setFlags]

Statuses returned by most of the #GIOFuncs functions.

Error = 0An error occurred.
Normal = 1Success.
Eof = 2End of file.
Again = 3Resource temporarily unavailable.

Error codes returned by key file parsing.

UnknownEncoding = 0the text being parsed was in an unknown encoding
Parse = 1document was ill-formed
NotFound = 2the file was not found
KeyNotFound = 3a requested key was not found
GroupNotFound = 4a requested group was not found
InvalidValue = 5a value could not be parsed
enumGKeyFileFlags : uint

Flags which influence the parsing.

None = 0No flags, default behaviour
KeepComments = 1Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise all comments will be lost when the key file is written back.
KeepTranslations = 2Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise only the translations for the current language will be written back.
enumGLogLevelFlags : uint

Flags specifying the level of log messages.

It is possible to change how GLib treats messages of the various levels using func@GLib.log_set_handler and func@GLib.log_set_fatal_mask.

FlagRecursion = 1internal flag
FlagFatal = 2internal flag
LevelError = 4log level for errors, see `func@GLib.error`. This level is also used for messages produced by `func@GLib.assert`.
LevelCritical = 8log level for critical warning messages, see `func@GLib.critical`. This level is also used for messages produced by `func@GLib.returniffail` and `func@GLib.returnvalif_fail`.
LevelWarning = 16log level for warnings, see `func@GLib.warning`
LevelMessage = 32log level for messages, see `func@GLib.message`
LevelInfo = 64log level for informational messages, see `func@GLib.info`
LevelDebug = 128log level for debug messages, see `func@GLib.debug`
LevelMask = - 4a mask including all log levels

Return values from #GLogWriterFuncs to indicate whether the given log entry was successfully handled by the writer, or whether there was an error in handling it (and hence a fallback writer should be used).

If a #GLogWriterFunc ignores a log entry, it should return G_LOG_WRITER_HANDLED.

Handled = 1Log writer has handled the log entry.
Unhandled = 0Log writer could not handle the log entry.

Flags to pass to [glib.main_context.MainContext.newWithFlags] which affect the behaviour of a #GMainContext.

None = 0Default behaviour.
OwnerlessPolling = 1Assume that polling for events will free the thread to process other jobs. That's useful if you're using `gmaincontext_{prepare,query,check,dispatch}` to integrate GMainContext in other event loops.

A mixed enumerated type and flags field. You must specify one type (string, strdup, boolean, tristate). Additionally, you may optionally bitwise OR the type with the flag G_MARKUP_COLLECT_OPTIONAL.

It is likely that this enum will be extended in the future to support other types.

Invalid = 0used to terminate the list of attributes to collect
String = 1collect the string pointer directly from the attributevalues[] array. Expects a parameter of type (const char **). If `GMARKUPCOLLECTOPTIONAL` is specified and the attribute isn't present then the ...
Strdup = 2as with `GMARKUPCOLLECT_STRING`, but expects a parameter of type (char **) and [glib.global.strdup]s the returned pointer. The pointer must be freed with [glib.global.gfree]
Boolean = 3expects a parameter of type (gboolean *) and parses the attribute value as a boolean. Sets false if the attribute isn't present. Valid boolean values consist of (case-insensitive) "false", "f", "no...
Tristate = 4as with `GMARKUPCOLLECTBOOLEAN`, but in the case of a missing attribute a value is set that compares equal to neither false nor true GMARKUPCOLLECTOPTIONAL is implied
Optional = 65536can be bitwise ORed with the other fields. If present, allows the attribute not to appear. A default value is set depending on what value type is used

Error codes returned by markup parsing.

BadUtf8 = 0text being parsed was not valid UTF-8
Empty = 1document contained nothing, or only whitespace
Parse = 2document was ill-formed
UnknownElement = 3error should be set by #GMarkupParser functions; element wasn't known
UnknownAttribute = 4error should be set by #GMarkupParser functions; attribute wasn't known
InvalidContent = 5error should be set by #GMarkupParser functions; content was invalid
MissingAttribute = 6error should be set by #GMarkupParser functions; a required attribute was missing

Flags that affect the behaviour of the parser.

DefaultFlags = 0No special behaviour. Since: 2.74
DoNotUseThisUnsupportedFlag = 1flag you should not use
TreatCdataAsText = 2When this flag is set, CDATA marked sections are not passed literally to the @passthrough function of the parser. Instead, the content of the section (without the `<![CDATA[` and `]]>`) is passed t...
PrefixErrorPosition = 4Normally errors caught by GMarkup itself have line/column information prefixed to them to let the caller know the location of the error. When this flag is set the location information is also prefi...
IgnoreQualified = 8Ignore (don't report) qualified attributes and tags, along with their contents. A qualified attribute or tag is one that contains ':' in its name (ie: is in another namespace). Since: 2.40.

Defines how a Unicode string is transformed in a canonical form, standardizing such issues as whether a character with an accent is represented as a base character and combining accent or as a single precomposed character. Unicode strings should generally be normalized before comparing them.

Default = 0standardize differences that do not affect the text content, such as the above-mentioned accent representation
Nfd = 0another name for [glib.types.NormalizeMode.Default]
DefaultCompose = 1like [glib.types.NormalizeMode.Default], but with composed forms rather than a maximally decomposed form
Nfc = 1another name for [glib.types.NormalizeMode.DefaultCompose]
All = 2beyond [glib.types.NormalizeMode.Default] also standardize the "compatibility" characters in Unicode, such as SUPERSCRIPT THREE to the standard forms (in this case DIGIT THREE). Formatting informat...
Nfkd = 2another name for [glib.types.NormalizeMode.All]
AllCompose = 3like [glib.types.NormalizeMode.All], but with composed forms rather than a maximally decomposed form
Nfkc = 3another name for [glib.types.NormalizeMode.AllCompose]

Error codes returned by functions converting a string to a number.

Invalid = 0string was not a valid number
OutOfBounds = 1string was a number, but out of bounds

The possible statuses of a one-time initialization function controlled by a #GOnce struct.

Notcalled = 0the function has not been called yet.
Progress = 1the function call is currently in progress.
Ready = 2the function has been called.

The #GOptionArg enum values determine which type of extra argument the options expect to find. If an option expects an extra argument, it can be specified in several ways; with a short option: -x arg, with a long option: --name arg or combined in a single argument: --name=arg.

None = 0No extra argument. This is useful for simple flags or booleans.
String = 1The option takes a UTF-8 string argument.
Int = 2The option takes an integer argument.
Callback = 3The option provides a callback (of type #GOptionArgFunc) to parse the extra argument.
Filename = 4The option takes a filename as argument, which will be in the GLib filename encoding rather than UTF-8.
StringArray = 5The option takes a string argument, multiple uses of the option are collected into an array of strings.
FilenameArray = 6The option takes a filename as argument, multiple uses of the option are collected into an array of strings.
Double = 7The option takes a double argument. The argument can be formatted either for the user's locale or for the "C" locale. Since 2.12
Int64 = 8The option takes a 64-bit integer. Like `GOPTIONARG_INT` but for larger numbers. The number can be in decimal base, or in hexadecimal (when prefixed with `0x`, for example, `0xffffffff`). Since 2.12

Error codes returned by option parsing.

UnknownOption = 0An option was not known to the parser. This error will only be reported, if the parser hasn't been instructed to ignore unknown options, see [glib.option_context.OptionContext.setIgnoreUnknownOptio...
BadValue = 1A value couldn't be parsed.
Failed = 2A #GOptionArgFunc callback failed.
enumGOptionFlags : uint

Flags which modify individual options.

None = 0No flags. Since: 2.42.
Hidden = 1The option doesn't appear in `--help` output.
InMain = 2The option appears in the main section of the `--help` output, even if it is defined in a group.
Reverse = 4For options of the `GOPTIONARG_NONE` kind, this flag indicates that the sense of the option is reversed. i.e. false will be stored into the argument rather than true.
NoArg = 8For options of the `GOPTIONARGCALLBACK` kind, this flag indicates that the callback does not take any argument (like a `GOPTIONARGNONE` option). Since 2.8
Filename = 16For options of the `GOPTIONARG_CALLBACK` kind, this flag indicates that the argument should be passed to the callback in the GLib filename encoding rather than UTF-8. Since 2.8
OptionalArg = 32For options of the `GOPTIONARG_CALLBACK` kind, this flag indicates that the argument supply is optional. If no argument is given then data of [glib.types.OptionParseFunc] will be set to NULL. Since...
Noalias = 64This flag turns off the automatic conflict resolution which prefixes long option names with `groupname-` if there is a conflict. This option should only be used in situations where aliasing is nece...

Flags specifying compile-time options.

Default = 0No special options set. Since: 2.74
Caseless = 1Letters in the pattern match both upper- and lowercase letters. This option can be changed within a pattern by a "(?i)" option setting.
Multiline = 2By default, GRegex treats the strings as consisting of a single line of characters (even if it actually contains newlines). The "start of line" metacharacter ("^") matches only at the start of the ...
Dotall = 4A dot metacharacter (".") in the pattern matches all characters, including newlines. Without it, newlines are excluded. This option can be changed within a pattern by a ("?s") option setting.
Extended = 8Whitespace data characters in the pattern are totally ignored except when escaped or inside a character class. Whitespace does not include the VT character (code 11). In addition, characters betwee...
Anchored = 16The pattern is forced to be "anchored", that is, it is constrained to match only at the first matching point in the string that is being searched. This effect can also be achieved by appropriate co...
DollarEndonly = 32A dollar metacharacter ("$") in the pattern matches only at the end of the string. Without this option, a dollar also matches immediately before the final character if it is a newline (but not befo...
Ungreedy = 512Inverts the "greediness" of the quantifiers so that they are not greedy by default, but become greedy if followed by "?". It can also be set by a "(?U)" option setting within the pattern.
Raw = 2048Usually strings must be valid UTF-8 strings, using this flag they are considered as a raw sequence of bytes.
NoAutoCapture = 4096Disables the use of numbered capturing parentheses in the pattern. Any opening parenthesis that is not followed by "?" behaves as if it were followed by "?:" but named parentheses can still be used...
Optimize = 8192Since 2.74 and the port to pcre2, requests JIT compilation, which, if the just-in-time compiler is available, further processes a compiled pattern into machine code that executes much faster. Howev...
Firstline = 262144Limits an unanchored pattern to match before (or at) the first newline. Since: 2.34
Dupnames = 524288Names used to identify capturing subpatterns need not be unique. This can be helpful for certain types of pattern when it is known that only one instance of the named subpattern can ever be matched.
NewlineCr = 1048576Usually any newline character or character sequence is recognized. If this option is set, the only recognized newline character is '\r'.
NewlineLf = 2097152Usually any newline character or character sequence is recognized. If this option is set, the only recognized newline character is '\n'.
NewlineCrlf = 3145728Usually any newline character or character sequence is recognized. If this option is set, the only recognized newline character sequence is '\r\n'.
NewlineAnycrlf = 5242880Usually any newline character or character sequence is recognized. If this option is set, the only recognized newline character sequences are '\r', '\n', and '\r\n'. Since: 2.34
BsrAnycrlf = 8388608Usually any newline character or character sequence is recognised. If this option is set, then "\R" only recognizes the newline characters '\r', '\n' and '\r\n'. Since: 2.34
JavascriptCompat = 33554432Changes behaviour so that it is compatible with JavaScript rather than PCRE. Since GLib 2.74 this is no longer supported, as libpcre2 does not support it. Since: 2.34 Deprecated: 2.74

Error codes returned by regular expressions functions.

Compile = 0Compilation of the regular expression failed.
Optimize = 1Optimization of the regular expression failed.
Replace = 2Replacement failed due to an ill-formed replacement string.
Match = 3The match process failed.
Internal = 4Internal error of the regular expression engine. Since 2.16
StrayBackslash = 101"\\" at end of pattern. Since 2.16
MissingControlChar = 102"\\c" at end of pattern. Since 2.16
UnrecognizedEscape = 103Unrecognized character follows "\\". Since 2.16
QuantifiersOutOfOrder = 104Numbers out of order in "{}" quantifier. Since 2.16
QuantifierTooBig = 105Number too big in "{}" quantifier. Since 2.16
UnterminatedCharacterClass = 106Missing terminating "]" for character class. Since 2.16
InvalidEscapeInCharacterClass = 107Invalid escape sequence in character class. Since 2.16
RangeOutOfOrder = 108Range out of order in character class. Since 2.16
NothingToRepeat = 109Nothing to repeat. Since 2.16
UnrecognizedCharacter = 112Unrecognized character after "(?", "(?<" or "(?P". Since 2.16
PosixNamedClassOutsideClass = 113POSIX named classes are supported only within a class. Since 2.16
UnmatchedParenthesis = 114Missing terminating ")" or ")" without opening "(". Since 2.16
InexistentSubpatternReference = 115Reference to non-existent subpattern. Since 2.16
UnterminatedComment = 118Missing terminating ")" after comment. Since 2.16
ExpressionTooLarge = 120Regular expression too large. Since 2.16
MemoryError = 121Failed to get memory. Since 2.16
VariableLengthLookbehind = 125Lookbehind assertion is not fixed length. Since 2.16
MalformedCondition = 126Malformed number or name after "(?(". Since 2.16
TooManyConditionalBranches = 127Conditional group contains more than two branches. Since 2.16
AssertionExpected = 128Assertion expected after "(?(". Since 2.16
UnknownPosixClassName = 130Unknown POSIX class name. Since 2.16
PosixCollatingElementsNotSupported = 131POSIX collating elements are not supported. Since 2.16
HexCodeTooLarge = 134Character value in "\\x{...}" sequence is too large. Since 2.16
InvalidCondition = 135Invalid condition "(?(0)". Since 2.16
SingleByteMatchInLookbehind = 136\\C not allowed in lookbehind assertion. Since 2.16
InfiniteLoop = 140Recursive call could loop indefinitely. Since 2.16
MissingSubpatternNameTerminator = 142Missing terminator in subpattern name. Since 2.16
DuplicateSubpatternName = 143Two named subpatterns have the same name. Since 2.16
MalformedProperty = 146Malformed "\\P" or "\\p" sequence. Since 2.16
UnknownProperty = 147Unknown property name after "\\P" or "\\p". Since 2.16
SubpatternNameTooLong = 148Subpattern name is too long (maximum 32 characters). Since 2.16
TooManySubpatterns = 149Too many named subpatterns (maximum 10,000). Since 2.16
InvalidOctalValue = 151Octal value is greater than "\\377". Since 2.16
TooManyBranchesInDefine = 154"DEFINE" group contains more than one branch. Since 2.16
DefineRepetion = 155Repeating a "DEFINE" group is not allowed. This error is never raised. Since: 2.16 Deprecated: 2.34
InconsistentNewlineOptions = 156Inconsistent newline options. Since 2.16
MissingBackReference = 157"\\g" is not followed by a braced, angle-bracketed, or quoted name or number, or by a plain number. Since: 2.16
InvalidRelativeReference = 158relative reference must not be zero. Since: 2.34
BacktrackingControlVerbArgumentForbidden = 159the backtracing control verb used does not allow an argument. Since: 2.34
UnknownBacktrackingControlVerb = 160unknown backtracing control verb. Since: 2.34
NumberTooBig = 161number is too big in escape sequence. Since: 2.34
MissingSubpatternName = 162Missing subpattern name. Since: 2.34
MissingDigit = 163Missing digit. Since 2.34
InvalidDataCharacter = 164In JavaScript compatibility mode, "[" is an invalid data character. Since: 2.34
ExtraSubpatternName = 165different names for subpatterns of the same number are not allowed. Since: 2.34
BacktrackingControlVerbArgumentRequired = 166the backtracing control verb requires an argument. Since: 2.34
InvalidControlChar = 168"\\c" must be followed by an ASCII character. Since: 2.34
MissingName = 169"\\k" is not followed by a braced, angle-bracketed, or quoted name. Since: 2.34
NotSupportedInClass = 171"\\N" is not supported in a class. Since: 2.34
TooManyForwardReferences = 172too many forward references. Since: 2.34
NameTooLong = 175the name is too long in "(MARK)", "(PRUNE)", "(SKIP)", or "(THEN)". Since: 2.34
CharacterValueTooLarge = 176the character value in the \\u sequence is too large. Since: 2.34
enumGRegexMatchFlags : uint

Flags specifying match-time options.

Default = 0No special options set. Since: 2.74
Anchored = 16The pattern is forced to be "anchored", that is, it is constrained to match only at the first matching point in the string that is being searched. This effect can also be achieved by appropriate co...
Notbol = 128Specifies that first character of the string is not the beginning of a line, so the circumflex metacharacter should not match before it. Setting this without `GREGEXMULTILINE` (at compile time) cau...
Noteol = 256Specifies that the end of the subject string is not the end of a line, so the dollar metacharacter should not match it nor (except in multiline mode) a newline immediately before it. Setting this w...
Notempty = 1024An empty string is not considered to be a valid match if this option is set. If there are alternatives in the pattern, they are tried. If all the alternatives match the empty string, the entire mat...
Partial = 32768Turns on the partial matching feature, for more documentation on partial matching see [glib.match_info.MatchInfo.isPartialMatch].
NewlineCr = 1048576Overrides the newline definition set when creating a new #GRegex, setting the '\r' character as line terminator.
NewlineLf = 2097152Overrides the newline definition set when creating a new #GRegex, setting the '\n' character as line terminator.
NewlineCrlf = 3145728Overrides the newline definition set when creating a new #GRegex, setting the '\r\n' characters sequence as line terminator.
NewlineAny = 4194304Overrides the newline definition set when creating a new #GRegex, any Unicode newline sequence is recognised as a newline. These are '\r', '\n' and '\rn', and the single characters U+000B LINE TABU...
NewlineAnycrlf = 5242880Overrides the newline definition set when creating a new #GRegex; any '\r', '\n', or '\r\n' character sequence is recognized as a newline. Since: 2.34
BsrAnycrlf = 8388608Overrides the newline definition for "\R" set when creating a new #GRegex; only '\r', '\n', or '\r\n' character sequences are recognized as a newline by "\R". Since: 2.34
BsrAny = 16777216Overrides the newline definition for "\R" set when creating a new #GRegex; any Unicode newline character or character sequence are recognized as a newline by "\R". These are '\r', '\n' and '\rn', a...
PartialSoft = 32768An alias for `GREGEXMATCH_PARTIAL`. Since: 2.34
PartialHard = 134217728Turns on the partial matching feature. In contrast to to `GREGEXMATCHPARTIALSOFT`, this stops matching as soon as a partial match is found, without continuing to search for a possible complete matc...
NotemptyAtstart = 268435456Like `GREGEXMATCH_NOTEMPTY`, but only applied to the start of the matched string. For anchored patterns this can only happen for pattern containing "\K". Since: 2.34

An enumeration specifying the base position for a [glib.iochannel.IOChannel.seekPosition] operation.

Cur = 0the current position in the file.
Set = 1the start of the file.
End = 2the end of the file.

Error codes returned by shell functions.

BadQuoting = 0Mismatched or otherwise mangled quoting.
EmptyString = 1String to be parsed was empty.
Failed = 2Some other error.
AlwaysMalloc = 1
BypassMagazines = 2
WorkingSetMsecs = 3
ColorIncrement = 4
ChunkSizes = 5
ContentionCounter = 6

Error codes returned by spawning processes.

Fork = 0Fork failed due to lack of memory.
Read = 1Read or select on pipes failed.
Chdir = 2Changing to working directory failed.
Acces = 3execv() returned `EACCES`
Perm = 4execv() returned `EPERM`
TooBig = 5execv() returned `E2BIG`
_2big = 5deprecated alias for `GSPAWNERRORTOOBIG` (deprecated since GLib 2.32)
Noexec = 6execv() returned `ENOEXEC`
Nametoolong = 7execv() returned `ENAMETOOLONG`
Noent = 8execv() returned `ENOENT`
Nomem = 9execv() returned `ENOMEM`
Notdir = 10execv() returned `ENOTDIR`
Loop = 11execv() returned `ELOOP`
Txtbusy = 12execv() returned `ETXTBUSY`
Io = 13execv() returned `EIO`
Nfile = 14execv() returned `ENFILE`
Mfile = 15execv() returned `EMFILE`
Inval = 16execv() returned `EINVAL`
Isdir = 17execv() returned `EISDIR`
Libbad = 18execv() returned `ELIBBAD`
Failed = 19Some other fatal failure, `error->message` should explain.
enumGSpawnFlags : uint

Flags passed to [glib.global.spawnSync], [glib.global.spawnAsync] and [glib.global.spawnAsyncWithPipes].

Default = 0no flags, default behaviour
LeaveDescriptorsOpen = 1the parent's open file descriptors will be inherited by the child; otherwise all descriptors except stdin, stdout and stderr will be closed before calling exec() in the child.
DoNotReapChild = 2the child will not be automatically reaped; you must use [glib.global.childWatchAdd] yourself (or call waitpid() or handle `SIGCHLD` yourself), or the child will become a zombie.
SearchPath = 4`argv[0]` need not be an absolute path, it will be looked for in the user's `PATH`.
StdoutToDevNull = 8the child's standard output will be discarded, instead of going to the same location as the parent's standard output.
StderrToDevNull = 16the child's standard error will be discarded.
ChildInheritsStdin = 32the child will inherit the parent's standard input (by default, the child's standard input is attached to `/dev/null`).
FileAndArgvZero = 64the first element of `argv` is the file to execute, while the remaining elements are the actual argument vector to pass to the file. Normally [glib.global.spawnAsyncWithPipes] uses `argv[0]` as the...
SearchPathFromEnvp = 128if `argv[0]` is not an absolute path, it will be looked for in the `PATH` from the passed child environment. Since: 2.34
CloexecPipes = 256create all pipes with the `O_CLOEXEC` flag set. Since: 2.40
ChildInheritsStdout = 512The child will inherit the parent's standard output.
ChildInheritsStderr = 1024The child will inherit the parent's standard error.
StdinFromDevNull = 2048The child's standard input is attached to `/dev/null`.

The type of file to return the filename for, when used with [glib.global.testBuildFilename].

These two options correspond rather directly to the 'dist' and 'built' terminology that automake uses and are explicitly used to distinguish between the 'srcdir' and 'builddir' being separate. All files in your project should either be dist (in the EXTRA_DIST or dist_schema_DATA sense, in which case they will always be in the srcdir) or built (in the BUILT_SOURCES sense, in which case they will always be in the builddir).

Note

as a general rule of automake, files that are generated only as

part of the build-from-git process (but then are distributed with the tarball) always go in srcdir (even if doing a srcdir != builddir build from git) and are considered as distributed files.

Dist = 0a file that was included in the distribution tarball
Built = 1a file that was built on the compiling machine
None = 0
Error = 1
StartBinary = 2
ListCase = 3
SkipCase = 4
StartCase = 5
StopCase = 6
MinResult = 7
MaxResult = 8
Message = 9
StartSuite = 10
StopSuite = 11
Success = 0
Skipped = 1
Failure = 2
Incomplete = 3

Flags to pass to [glib.global.testTrapSubprocess] to control input and output.

Note that in contrast with [glib.global.testTrapFork], the default is to not show stdout and stderr.

Default = 0Default behaviour. Since: 2.74
InheritStdin = 1If this flag is given, the child process will inherit the parent's stdin. Otherwise, the child's stdin is redirected to `/dev/null`.
InheritStdout = 2If this flag is given, the child process will inherit the parent's stdout. Otherwise, the child's stdout will not be visible, but it will be captured to allow later tests with gtesttrapassertstdout().
InheritStderr = 4If this flag is given, the child process will inherit the parent's stderr. Otherwise, the child's stderr will not be visible, but it will be captured to allow later tests with gtesttrapassertstderr().
enumGTestTrapFlags : uint

Test traps are guards around forked tests. These flags determine what traps to set.

Deprecated

#GTestTrapFlags is used only with [glib.global.testTrapFork],

which is deprecated. [glib.global.testTrapSubprocess] uses #GTestSubprocessFlags.

Default = 0Default behaviour. Since: 2.74
SilenceStdout = 128Redirect stdout of the test child to `/dev/null` so it cannot be observed on the console during test runs. The actual output is still captured though to allow later tests with gtesttrapassertstdout().
SilenceStderr = 256Redirect stderr of the test child to `/dev/null` so it cannot be observed on the console during test runs. The actual output is still captured though to allow later tests with gtesttrapassertstderr().
InheritStdin = 512If this flag is given, stdin of the child process is shared with stdin of its parent process. It is redirected to `/dev/null` otherwise.

Possible errors of thread related functions.

ThreadErrorAgain = 0a thread couldn't be created due to resource shortage. Try again later.

Thread priorities.

Deprecated

Thread priorities no longer have any effect.
Low = 0a priority lower than normal
Normal = 1the default priority
High = 2a priority higher than normal
Urgent = 3the highest priority

Disambiguates a given time in two ways.

First, specifies if the given time is in universal or local time.

Second, if the time is in local time, specifies if it is local standard time or local daylight time. This is important for the case where the same local time occurs twice (during daylight savings time transitions, for example).

Standard = 0the time is in local standard time
Daylight = 1the time is in local daylight time
Universal = 2the time is in UTC

The possible types of token returned from each [glib.scanner.Scanner.getNextToken] call.

Eof = 0the end of the file
LeftParen = 40a '(' character
RightParen = 41a ')' character
LeftCurly = 123a '{' character
RightCurly = 125a '}' character
LeftBrace = 91a '[' character
RightBrace = 93a ']' character
EqualSign = 61a '=' character
Comma = 44a ',' character
None = 256not a token
Error = 257an error occurred
Char = 258a character
Binary = 259a binary integer
Octal = 260an octal integer
Int = 261an integer
Hex = 262a hex integer
Float = 263a floating point number
String = 264a string
Symbol = 265a symbol
Identifier = 266an identifier
IdentifierNull = 267a null identifier
CommentSingle = 268one line comment
CommentMulti = 269multi line comment
enumGTraverseFlags : uint

Specifies which nodes are visited during several of the tree functions, including [glib.node.Node.traverse] and [glib.node.Node.find].

Leaves = 1only leaf nodes should be visited. This name has been introduced in 2.6, for older version use `GTRAVERSELEAFS`.
NonLeaves = 2only non-leaf nodes should be visited. This name has been introduced in 2.6, for older version use `GTRAVERSENON_LEAFS`.
All = 3all nodes should be visited.
Mask = 3a mask of all traverse flags.
Leafs = 1identical to `GTRAVERSELEAVES`.
NonLeafs = 2identical to `GTRAVERSENON_LEAVES`.

Specifies the type of traversal performed by [glib.tree.Tree.traverse], [glib.node.Node.traverse] and [glib.node.Node.find]. The different orders are illustrated here:

  • In order: A, B, C, D, E, F, G, H, I

![](Sorted_binary_tree_inorder.svg)

  • Pre order: F, B, A, D, C, E, G, I, H

![](Sorted_binary_tree_preorder.svg)

  • Post order: A, C, E, D, B, H, I, G, F

![](Sorted_binary_tree_postorder.svg)

  • Level order: F, B, G, A, D, I, C, E, H

![](Sorted_binary_tree_breadth-first_traversal.svg)

InOrder = 0vists a node's left child first, then the node itself, then its right child. This is the one to use if you want the output sorted according to the compare function.
PreOrder = 1visits a node, then its children.
PostOrder = 2visits the node's children, then the node itself.
LevelOrder = 3is not implemented for [balanced binary trees][glib-Balanced-Binary-Trees]. For [n-ary trees][glib-N-ary-Trees], it vists the root node first, then its children, then its grandchildren, and so on. ...

These are the possible line break classifications.

Since new Unicode versions may add new types here, applications should be ready to handle unknown values. They may be regarded as [glib.types.UnicodeBreakType.Unknown].

See Unicode Line Breaking Algorithm.

Mandatory = 0Mandatory Break (BK)
CarriageReturn = 1Carriage Return (CR)
LineFeed = 2Line Feed (LF)
CombiningMark = 3Attached Characters and Combining Marks (CM)
Surrogate = 4Surrogates (SG)
ZeroWidthSpace = 5Zero Width Space (ZW)
Inseparable = 6Inseparable (IN)
NonBreakingGlue = 7Non-breaking ("Glue") (GL)
Contingent = 8Contingent Break Opportunity (CB)
Space = 9Space (SP)
After = 10Break Opportunity After (BA)
Before = 11Break Opportunity Before (BB)
BeforeAndAfter = 12Break Opportunity Before and After (B2)
Hyphen = 13Hyphen (HY)
NonStarter = 14Nonstarter (NS)
OpenPunctuation = 15Opening Punctuation (OP)
ClosePunctuation = 16Closing Punctuation (CL)
Quotation = 17Ambiguous Quotation (QU)
Exclamation = 18Exclamation/Interrogation (EX)
Ideographic = 19Ideographic (ID)
Numeric = 20Numeric (NU)
InfixSeparator = 21Infix Separator (Numeric) (IS)
Symbol = 22Symbols Allowing Break After (SY)
Alphabetic = 23Ordinary Alphabetic and Symbol Characters (AL)
Prefix = 24Prefix (Numeric) (PR)
Postfix = 25Postfix (Numeric) (PO)
ComplexContext = 26Complex Content Dependent (South East Asian) (SA)
Ambiguous = 27Ambiguous (Alphabetic or Ideographic) (AI)
Unknown = 28Unknown (XX)
NextLine = 29Next Line (NL)
WordJoiner = 30Word Joiner (WJ)
HangulLJamo = 31Hangul L Jamo (JL)
HangulVJamo = 32Hangul V Jamo (JV)
HangulTJamo = 33Hangul T Jamo (JT)
HangulLvSyllable = 34Hangul LV Syllable (H2)
HangulLvtSyllable = 35Hangul LVT Syllable (H3)
CloseParanthesis = 36Closing Parenthesis (CP). Since 2.28. Deprecated: 2.70: Use [glib.types.UnicodeBreakType.CloseParenthesis] instead.
CloseParenthesis = 36Closing Parenthesis (CP). Since 2.70
ConditionalJapaneseStarter = 37Conditional Japanese Starter (CJ). Since: 2.32
HebrewLetter = 38Hebrew Letter (HL). Since: 2.32
RegionalIndicator = 39Regional Indicator (RI). Since: 2.36
EmojiBase = 40Emoji Base (EB). Since: 2.50
EmojiModifier = 41Emoji Modifier (EM). Since: 2.50
ZeroWidthJoiner = 42Zero Width Joiner (ZWJ). Since: 2.50
Aksara = 43Aksara (AK). Since: 2.80 @GUNICODEBREAKAKSARAPREBASE (AP). Since: 2.80 @GUNICODEBREAKAKSARASTART (AS). Since: 2.80 @GUNICODEBREAKVIRAMAFINAL (VF). Since: 2.80 @GUNICODEBREAKVIRAMA (VI). Since: 2.80
AksaraPreBase = 44
AksaraStart = 45
ViramaFinal = 46
Virama = 47

The #GUnicodeScript enumeration identifies different writing systems. The values correspond to the names as defined in the Unicode standard. The enumeration has been added in GLib 2.14, and is interchangeable with #PangoScript.

Note that new types may be added in the future. Applications should be ready to handle unknown values. See Unicode Standard Annex #24: Script names.

InvalidCode = - 1a value never returned from [glib.global.unicharGetScript]
Common = 0a character used by multiple different scripts
Inherited = 1a mark glyph that takes its script from the base glyph to which it is attached
Arabic = 2Arabic
Armenian = 3Armenian
Bengali = 4Bengali
Bopomofo = 5Bopomofo
Cherokee = 6Cherokee
Coptic = 7Coptic
Cyrillic = 8Cyrillic
Deseret = 9Deseret
Devanagari = 10Devanagari
Ethiopic = 11Ethiopic
Georgian = 12Georgian
Gothic = 13Gothic
Greek = 14Greek
Gujarati = 15Gujarati
Gurmukhi = 16Gurmukhi
Han = 17Han
Hangul = 18Hangul
Hebrew = 19Hebrew
Hiragana = 20Hiragana
Kannada = 21Kannada
Katakana = 22Katakana
Khmer = 23Khmer
Lao = 24Lao
Latin = 25Latin
Malayalam = 26Malayalam
Mongolian = 27Mongolian
Myanmar = 28Myanmar
Ogham = 29Ogham
OldItalic = 30Old Italic
Oriya = 31Oriya
Runic = 32Runic
Sinhala = 33Sinhala
Syriac = 34Syriac
Tamil = 35Tamil
Telugu = 36Telugu
Thaana = 37Thaana
Thai = 38Thai
Tibetan = 39Tibetan
CanadianAboriginal = 40Canadian Aboriginal
Yi = 41Yi
Tagalog = 42Tagalog
Hanunoo = 43Hanunoo
Buhid = 44Buhid
Tagbanwa = 45Tagbanwa
Braille = 46Braille
Cypriot = 47Cypriot
Limbu = 48Limbu
Osmanya = 49Osmanya
Shavian = 50Shavian
LinearB = 51Linear B
TaiLe = 52Tai Le
Ugaritic = 53Ugaritic
NewTaiLue = 54New Tai Lue
Buginese = 55Buginese
Glagolitic = 56Glagolitic
Tifinagh = 57Tifinagh
SylotiNagri = 58Syloti Nagri
OldPersian = 59Old Persian
Kharoshthi = 60Kharoshthi
Unknown = 61an unassigned code point
Balinese = 62Balinese
Cuneiform = 63Cuneiform
Phoenician = 64Phoenician
PhagsPa = 65Phags-pa
Nko = 66N'Ko
KayahLi = 67Kayah Li. Since 2.16.3
Lepcha = 68Lepcha. Since 2.16.3
Rejang = 69Rejang. Since 2.16.3
Sundanese = 70Sundanese. Since 2.16.3
Saurashtra = 71Saurashtra. Since 2.16.3
Cham = 72Cham. Since 2.16.3
OlChiki = 73Ol Chiki. Since 2.16.3
Vai = 74Vai. Since 2.16.3
Carian = 75Carian. Since 2.16.3
Lycian = 76Lycian. Since 2.16.3
Lydian = 77Lydian. Since 2.16.3
Avestan = 78Avestan. Since 2.26
Bamum = 79Bamum. Since 2.26
EgyptianHieroglyphs = 80Egyptian Hieroglpyhs. Since 2.26
ImperialAramaic = 81Imperial Aramaic. Since 2.26
InscriptionalPahlavi = 82Inscriptional Pahlavi. Since 2.26
InscriptionalParthian = 83Inscriptional Parthian. Since 2.26
Javanese = 84Javanese. Since 2.26
Kaithi = 85Kaithi. Since 2.26
Lisu = 86Lisu. Since 2.26
MeeteiMayek = 87Meetei Mayek. Since 2.26
OldSouthArabian = 88Old South Arabian. Since 2.26
OldTurkic = 89Old Turkic. Since 2.28
Samaritan = 90Samaritan. Since 2.26
TaiTham = 91Tai Tham. Since 2.26
TaiViet = 92Tai Viet. Since 2.26
Batak = 93Batak. Since 2.28
Brahmi = 94Brahmi. Since 2.28
Mandaic = 95Mandaic. Since 2.28
Chakma = 96Chakma. Since: 2.32
MeroiticCursive = 97Meroitic Cursive. Since: 2.32
MeroiticHieroglyphs = 98Meroitic Hieroglyphs. Since: 2.32
Miao = 99Miao. Since: 2.32
Sharada = 100Sharada. Since: 2.32
SoraSompeng = 101Sora Sompeng. Since: 2.32
Takri = 102Takri. Since: 2.32
BassaVah = 103Bassa. Since: 2.42
CaucasianAlbanian = 104Caucasian Albanian. Since: 2.42
Duployan = 105Duployan. Since: 2.42
Elbasan = 106Elbasan. Since: 2.42
Grantha = 107Grantha. Since: 2.42
Khojki = 108Kjohki. Since: 2.42
Khudawadi = 109Khudawadi, Sindhi. Since: 2.42
LinearA = 110Linear A. Since: 2.42
Mahajani = 111Mahajani. Since: 2.42
Manichaean = 112Manichaean. Since: 2.42
MendeKikakui = 113Mende Kikakui. Since: 2.42
Modi = 114Modi. Since: 2.42
Mro = 115Mro. Since: 2.42
Nabataean = 116Nabataean. Since: 2.42
OldNorthArabian = 117Old North Arabian. Since: 2.42
OldPermic = 118Old Permic. Since: 2.42
PahawhHmong = 119Pahawh Hmong. Since: 2.42
Palmyrene = 120Palmyrene. Since: 2.42
PauCinHau = 121Pau Cin Hau. Since: 2.42
PsalterPahlavi = 122Psalter Pahlavi. Since: 2.42
Siddham = 123Siddham. Since: 2.42
Tirhuta = 124Tirhuta. Since: 2.42
WarangCiti = 125Warang Citi. Since: 2.42
Ahom = 126Ahom. Since: 2.48
AnatolianHieroglyphs = 127Anatolian Hieroglyphs. Since: 2.48
Hatran = 128Hatran. Since: 2.48
Multani = 129Multani. Since: 2.48
OldHungarian = 130Old Hungarian. Since: 2.48
Signwriting = 131Signwriting. Since: 2.48
Adlam = 132Adlam. Since: 2.50
Bhaiksuki = 133Bhaiksuki. Since: 2.50
Marchen = 134Marchen. Since: 2.50
Newa = 135Newa. Since: 2.50
Osage = 136Osage. Since: 2.50
Tangut = 137Tangut. Since: 2.50
MasaramGondi = 138Masaram Gondi. Since: 2.54
Nushu = 139Nushu. Since: 2.54
Soyombo = 140Soyombo. Since: 2.54
ZanabazarSquare = 141Zanabazar Square. Since: 2.54
Dogra = 142Dogra. Since: 2.58
GunjalaGondi = 143Gunjala Gondi. Since: 2.58
HanifiRohingya = 144Hanifi Rohingya. Since: 2.58
Makasar = 145Makasar. Since: 2.58
Medefaidrin = 146Medefaidrin. Since: 2.58
OldSogdian = 147Old Sogdian. Since: 2.58
Sogdian = 148Sogdian. Since: 2.58
Elymaic = 149Elym. Since: 2.62
Nandinagari = 150Nand. Since: 2.62
NyiakengPuachueHmong = 151Rohg. Since: 2.62
Wancho = 152Wcho. Since: 2.62
Chorasmian = 153Chorasmian. Since: 2.66
DivesAkuru = 154Dives Akuru. Since: 2.66
KhitanSmallScript = 155Khitan small script. Since: 2.66
Yezidi = 156Yezidi. Since: 2.66
CyproMinoan = 157Cypro-Minoan. Since: 2.72
OldUyghur = 158Old Uyghur. Since: 2.72
Tangsa = 159Tangsa. Since: 2.72
Toto = 160Toto. Since: 2.72
Vithkuqi = 161Vithkuqi. Since: 2.72
Math = 162Mathematical notation. Since: 2.72
Kawi = 163Kawi. Since 2.74
NagMundari = 164Nag Mundari. Since 2.74

These are the possible character classifications from the Unicode specification. See Unicode Character Database.

Control = 0General category "Other, Control" (Cc)
Format = 1General category "Other, Format" (Cf)
Unassigned = 2General category "Other, Not Assigned" (Cn)
PrivateUse = 3General category "Other, Private Use" (Co)
Surrogate = 4General category "Other, Surrogate" (Cs)
LowercaseLetter = 5General category "Letter, Lowercase" (Ll)
ModifierLetter = 6General category "Letter, Modifier" (Lm)
OtherLetter = 7General category "Letter, Other" (Lo)
TitlecaseLetter = 8General category "Letter, Titlecase" (Lt)
UppercaseLetter = 9General category "Letter, Uppercase" (Lu)
SpacingMark = 10General category "Mark, Spacing" (Mc)
EnclosingMark = 11General category "Mark, Enclosing" (Me)
NonSpacingMark = 12General category "Mark, Nonspacing" (Mn)
DecimalNumber = 13General category "Number, Decimal Digit" (Nd)
LetterNumber = 14General category "Number, Letter" (Nl)
OtherNumber = 15General category "Number, Other" (No)
ConnectPunctuation = 16General category "Punctuation, Connector" (Pc)
DashPunctuation = 17General category "Punctuation, Dash" (Pd)
ClosePunctuation = 18General category "Punctuation, Close" (Pe)
FinalPunctuation = 19General category "Punctuation, Final quote" (Pf)
InitialPunctuation = 20General category "Punctuation, Initial quote" (Pi)
OtherPunctuation = 21General category "Punctuation, Other" (Po)
OpenPunctuation = 22General category "Punctuation, Open" (Ps)
CurrencySymbol = 23General category "Symbol, Currency" (Sc)
ModifierSymbol = 24General category "Symbol, Modifier" (Sk)
MathSymbol = 25General category "Symbol, Math" (Sm)
OtherSymbol = 26General category "Symbol, Other" (So)
LineSeparator = 27General category "Separator, Line" (Zl)
ParagraphSeparator = 28General category "Separator, Paragraph" (Zp)
SpaceSeparator = 29General category "Separator, Space" (Zs)

Mnemonic constants for the ends of a Unix pipe.

Read = 0The readable file descriptor 0
Write = 1The writable file descriptor 1

Error codes returned by #GUri methods.

Failed = 0Generic error if no more specific error is available. See the error message for details.
BadScheme = 1The scheme of a URI could not be parsed.
BadUser = 2The user/userinfo of a URI could not be parsed.
BadPassword = 3The password of a URI could not be parsed.
BadAuthParams = 4The authentication parameters of a URI could not be parsed.
BadHost = 5The host of a URI could not be parsed.
BadPort = 6The port of a URI could not be parsed.
BadPath = 7The path of a URI could not be parsed.
BadQuery = 8The query of a URI could not be parsed.
BadFragment = 9The fragment of a URI could not be parsed.
enumGUriFlags : uint

Flags that describe a URI.

When parsing a URI, if you need to choose different flags based on the type of URI, you can use [glib.uri.Uri.peekScheme] on the URI string to check the scheme first, and use that to decide what flags to parse it with.

None = 0No flags set.
ParseRelaxed = 1Parse the URI more relaxedly than the [RFC 3986](https://tools.ietf.org/html/rfc3986) grammar specifies, fixing up or ignoring common mistakes in URIs coming from external sources. This is also nee...
HasPassword = 2The userinfo field may contain a password, which will be separated from the username by `:`.
HasAuthParams = 4The userinfo may contain additional authentication-related parameters, which will be separated from the username and/or password by `;`.
Encoded = 8When parsing a URI, this indicates that `%`-encoded characters in the userinfo, path, query, and fragment fields should not be decoded. (And likewise the host field if `GURIFLAGSNONDNS` is also set...
NonDns = 16The host component should not be assumed to be a DNS hostname or IP address (for example, for `smb` URIs with NetBIOS hostnames).
EncodedQuery = 32Same as `GURIFLAGS_ENCODED`, for the query field only.
EncodedPath = 64Same as `GURIFLAGS_ENCODED`, for the path only.
EncodedFragment = 128Same as `GURIFLAGS_ENCODED`, for the fragment only.
SchemeNormalize = 256A scheme-based normalization will be applied. For example, when parsing an HTTP URI changing omitted path to `/` and omitted port to `80`; and when building a URI, changing empty path to `/` and de...
enumGUriHideFlags : uint

Flags describing what parts of the URI to hide in [glib.uri.Uri.toStringPartial]. Note that G_URI_HIDE_PASSWORD and G_URI_HIDE_AUTH_PARAMS will only work if the #GUri was parsed with the corresponding flags.

None = 0No flags set.
Userinfo = 1Hide the userinfo.
Password = 2Hide the password.
AuthParams = 4Hide the auth_params.
Query = 8Hide the query.
Fragment = 16Hide the fragment.
enumGUriParamsFlags : uint

Flags modifying the way parameters are handled by [glib.uri.Uri.parseParams] and #GUriParamsIter.

None = 0No flags set.
CaseInsensitive = 1Parameter names are case insensitive.
WwwForm = 2Replace `+` with space character. Only useful for URLs on the web, using the `https` or `http` schemas.
ParseRelaxed = 4See `GURIFLAGSPARSERELAXED`.

These are logical ids for special directories which are defined depending on the platform used. You should use [glib.global.getUserSpecialDir] to retrieve the full path associated to the logical id.

The #GUserDirectory enumeration can be extended at later date. Not every platform has a directory for every logical id in this enumeration.

DirectoryDesktop = 0the user's Desktop directory
DirectoryDocuments = 1the user's Documents directory
DirectoryDownload = 2the user's Downloads directory
DirectoryMusic = 3the user's Music directory
DirectoryPictures = 4the user's Pictures directory
DirectoryPublicShare = 5the user's shared directory
DirectoryTemplates = 6the user's Templates directory
DirectoryVideos = 7the user's Movies directory
NDirectories = 8the number of enum values

The range of possible top-level types of #GVariant instances.

Boolean = 98The #GVariant is a boolean.
Byte = 121The #GVariant is a byte.
Int16 = 110The #GVariant is a signed 16 bit integer.
Uint16 = 113The #GVariant is an unsigned 16 bit integer.
Int32 = 105The #GVariant is a signed 32 bit integer.
Uint32 = 117The #GVariant is an unsigned 32 bit integer.
Int64 = 120The #GVariant is a signed 64 bit integer.
Uint64 = 116The #GVariant is an unsigned 64 bit integer.
Handle = 104The #GVariant is a file handle index.
Double = 100The #GVariant is a double precision floating point value.
String = 115The #GVariant is a normal string.
ObjectPath = 111The #GVariant is a D-Bus object path string.
Signature = 103The #GVariant is a D-Bus signature string.
Variant = 118The #GVariant is a variant.
Maybe = 109The #GVariant is a maybe-typed value.
Array = 97The #GVariant is an array.
Tuple = 40The #GVariant is a tuple.
DictEntry = 123The #GVariant is a dictionary entry.

Error codes returned by parsing text-format GVariants.

Failed = 0generic error (unused)
BasicTypeExpected = 1a non-basic #GVariantType was given where a basic type was expected
CannotInferType = 2cannot infer the #GVariantType
DefiniteTypeExpected = 3an indefinite #GVariantType was given where a definite type was expected
InputNotAtEnd = 4extra data after parsing finished
InvalidCharacter = 5invalid character in number or unicode escape
InvalidFormatString = 6not a valid #GVariant format string
InvalidObjectPath = 7not a valid object path
InvalidSignature = 8not a valid type signature
InvalidTypeString = 9not a valid #GVariant type string
NoCommonType = 10could not find a common type for array entries
NumberOutOfRange = 11the numerical value is out of range of the given type
NumberTooBig = 12the numerical value is out of range for any type
TypeError = 13cannot parse as variant of the specified type
UnexpectedToken = 14an unexpected token was encountered
UnknownKeyword = 15an unknown keyword was encountered
UnterminatedStringConstant = 16unterminated string constant
ValueExpected = 17no value given
Recursion = 18variant was too deeply nested; #GVariant is only guaranteed to handle nesting up to 64 levels (Since: 2.64)
structGArray

Contains the public fields of a GArray.

Fields
char * dataa pointer to the element data. The data may be moved as elements are added to the #GArray.
uint lenthe number of elements in the #GArray not including the possible terminating zero element.

An opaque data structure which represents an asynchronous queue.

It should only be accessed through the g_async_queue_* functions.

[glib.bookmark_file.BookmarkFile] lets you parse, edit or create files containing bookmarks.

Bookmarks refer to a URI, along with some meta-data about the resource pointed by the URI like its MIME type, the application that is registering the bookmark and the icon that should be used to represent the bookmark. The data is stored using the

Desktop Bookmark Specification.

The syntax of the bookmark files is described in detail inside the Desktop Bookmark Specification, here is a quick summary: bookmark files use a sub-class of the XML Bookmark Exchange Language specification, consisting of valid UTF-8 encoded XML, under the <xbel> root element; each bookmark is stored inside a <bookmark> element, using its URI: no relative paths can be used inside a bookmark file. The bookmark may have a user defined title and description, to be used instead of the URI. Under the <metadata> element, with its owner attribute set to http://freedesktop.org, is stored the meta-data about a resource pointed by its URI. The meta-data consists of the resource's MIME type; the applications that have registered a bookmark; the groups to which a bookmark belongs to; a visibility flag, used to set the bookmark as "private" to the applications and groups that has it registered; the URI and MIME type of an icon, to be used when displaying the bookmark inside a GUI.

Here is an example of a bookmark file:

bookmarks.xbel

A bookmark file might contain more than one bookmark; each bookmark is accessed through its URI.

The important caveat of bookmark files is that when you add a new bookmark you must also add the application that is registering it, using [glib.bookmark_file.BookmarkFile.addApplication] or [glib.bookmark_file.BookmarkFile.setApplicationInfo]. If a bookmark has no applications then it won't be dumped when creating the on disk representation, using [glib.bookmark_file.BookmarkFile.toData] or [glib.bookmark_file.BookmarkFile.toFile].

Contains the public fields of a GByteArray.

Fields
ubyte * dataa pointer to the element data. The data may be moved as elements are added to the #GByteArray
uint lenthe number of elements in the #GByteArray
structGBytes

A simple refcounted data type representing an immutable sequence of zero or more bytes from an unspecified origin.

The purpose of a #GBytes is to keep the memory region that it holds alive for as long as anyone holds a reference to the bytes. When the last reference count is dropped, the memory is released. Multiple unrelated callers can use byte data in the #GBytes without coordinating their activities, resting assured that the byte data will not change or move while they hold a reference.

A #GBytes can come from many different origins that may have different procedures for freeing the memory region. Examples are memory from [glib.global.gmalloc], from memory slices, from a #GMappedFile or memory from other allocators.

#GBytes work well as keys in #GHashTable. Use [glib.bytes.Bytes.equal] and [glib.bytes.Bytes.hash] as parameters to [glib.hash_table.HashTable.new_] or [glib.hash_table.HashTable.newFull]. #GBytes can also be used as keys in a #GTree by passing the [glib.bytes.Bytes.compare] function to [glib.tree.Tree.new_].

The data pointed to by this bytes must not be modified. For a mutable array of bytes see #GByteArray. Use [glib.bytes.Bytes.unrefToArray] to create a mutable array for a #GBytes sequence. To create an immutable #GBytes from a mutable #GByteArray, use the [glib.byte_array.ByteArray.freeToBytes] function.

structGCache

A [glib.cache.Cache] allows sharing of complex data structures, in order to save system resources.

[glib.cache.Cache] uses keys and values. A [glib.cache.Cache] key describes the properties of a particular resource. A [glib.cache.Cache] value is the actual resource.

[glib.cache.Cache] has been marked as deprecated, since this API is rarely used and not very actively maintained.

Deprecated

Use a #GHashTable instead
structGChecksum

GLib provides a generic API for computing checksums (or ‘digests’) for a sequence of arbitrary bytes, using various hashing algorithms like MD5, SHA-1 and SHA-256. Checksums are commonly used in various environments and specifications.

To create a new [glib.checksum.Checksum], use [glib.checksum.Checksum.new_]. To free a [glib.checksum.Checksum], use [glib.checksum.Checksum.free].

GLib supports incremental checksums using the [glib.checksum.Checksum] data structure, by calling [glib.checksum.Checksum.update] as long as there’s data available and then using [glib.checksum.Checksum.getString] or [glib.checksum.Checksum.getDigest] to compute the checksum and return it either as a string in hexadecimal form, or as a raw sequence of bytes. To compute the checksum for binary blobs and nul-terminated strings in one go, use the convenience functions func@GLib.compute_checksum_for_data and func@GLib.compute_checksum_for_string, respectively.

[glib.completion.Completion] provides support for automatic completion of a string using any group of target strings. It is typically used for file name completion as is common in many UNIX shells.

A [glib.completion.Completion] is created using [glib.completion.Completion.new_]. Target items are added and removed with [glib.completion.Completion.addItems], [glib.completion.Completion.removeItems] and [glib.completion.Completion.clearItems]. A completion attempt is requested with [glib.completion.Completion.complete] or [glib.completion.Completion.completeUtf8]. When no longer needed, the [glib.completion.Completion] is freed with [glib.completion.Completion.free].

Items in the completion can be simple strings (e.g. filenames), or pointers to arbitrary data structures. If data structures are used you must provide a [glib.types.CompletionFunc] in [glib.completion.Completion.new_], which retrieves the item’s string from the data structure. You can change the way in which strings are compared by setting a different [glib.types.CompletionStrncmpFunc] in [glib.completion.Completion.setCompare].

[glib.completion.Completion] has been marked as deprecated, since this API is rarely used and not very actively maintained.

Deprecated

Rarely used API
Fields
GList * itemslist of target items (strings or data structures).
GCompletionFunc funcfunction which is called to get the string associated with a target item. It is null if the target items are strings.
char * prefixthe last prefix passed to [glib.completion.Completion.complete] or [glib.completion.Completion.completeUtf8].
GList * cachethe list of items which begin with @prefix.
GCompletionStrncmpFunc strncmpFuncThe function to use when comparing strings. Use [glib.completion.Completion.setCompare] to modify this function.
structGCond

The #GCond struct is an opaque data structure that represents a condition. Threads can block on a #GCond if they find a certain condition to be false. If other threads change the state of this condition they signal the #GCond, and that causes the waiting threads to be woken up.

Consider the following example of a shared variable. One or more threads can wait for data to be published to the variable and when another thread publishes the data, it can signal one of the waiting threads to wake up to collect the data.

Here is an example for using GCond to block a thread until a condition is satisfied:

gpointer current_data = NULL;
 GMutex data_mutex;
 GCond data_cond;

 void
 push_data (gpointer data)
 {
   g_mutex_lock (&data_mutex);
   current_data = data;
   g_cond_signal (&data_cond);
   g_mutex_unlock (&data_mutex);
 }

 gpointer
 pop_data (void)
 {
   gpointer data;

   g_mutex_lock (&data_mutex);
   while (!current_data)
     g_cond_wait (&data_cond, &data_mutex);
   data = current_data;
   current_data = NULL;
   g_mutex_unlock (&data_mutex);

   return data;
 }
Whenever a thread calls pop_data() now, it will wait until current_data is non-null, i.e. until some other thread has called push_data().

The example shows that use of a condition variable must always be paired with a mutex. Without the use of a mutex, there would be a race between the check of @current_data by the while loop in pop_data() and waiting. Specifically, another thread could set @current_data after the check, and signal the cond (with nobody waiting on it) before the first thread goes to sleep. #GCond is specifically useful for its ability to release the mutex and go to sleep atomically.

It is also important to use the [glib.cond.Cond.wait] and [glib.cond.Cond.waitUntil] functions only inside a loop which checks for the condition to be true. See [glib.cond.Cond.wait] for an explanation of why the condition may not be true even after it returns.

If a #GCond is allocated in static storage then it can be used without initialisation. Otherwise, you should call [glib.cond.Cond.init_] on it and [glib.cond.Cond.clear] when done.

A #GCond should only be accessed via the g_cond_ functions.

Fields
void * p
uint[2] i
structGData

An opaque data structure that represents a keyed data list.

See also: Keyed data lists.

structGDate

[glib.date.Date] is a struct for calendrical calculations.

The [glib.date.Date] data structure represents a day between January 1, Year 1, and sometime a few thousand years in the future (right now it will go to the year 65535 or so, but [glib.date.Date.setParse] only parses up to the year 8000 or so - just count on "a few thousand"). [glib.date.Date] is meant to represent everyday dates, not astronomical dates or historical dates or ISO timestamps or the like. It extrapolates the current Gregorian calendar forward and backward in time; there is no attempt to change the calendar to match time periods or locations. [glib.date.Date] does not store time information; it represents a day.

The [glib.date.Date] implementation has several nice features; it is only a 64-bit struct, so storing large numbers of dates is very efficient. It can keep both a Julian and day-month-year representation of the date, since some calculations are much easier with one representation or the other. A Julian representation is simply a count of days since some fixed day in the past; for #GDate the fixed day is January 1, 1 AD. ("Julian" dates in the #GDate API aren't really Julian dates in the technical sense; technically, Julian dates count from the start of the Julian period, Jan 1, 4713 BC).

[glib.date.Date] is simple to use. First you need a "blank" date; you can get a dynamically allocated date from [glib.date.Date.new_], or you can declare an automatic variable or array and initialize it by calling [glib.date.Date.clear]. A cleared date is safe; it's safe to call [glib.date.Date.setDmy] and the other mutator functions to initialize the value of a cleared date. However, a cleared date is initially invalid, meaning that it doesn't represent a day that exists. It is undefined to call any of the date calculation routines on an invalid date. If you obtain a date from a user or other unpredictable source, you should check its validity with the [glib.date.Date.valid] predicate. [glib.date.Date.valid] is also used to check for errors with [glib.date.Date.setParse] and other functions that can fail. Dates can be invalidated by calling [glib.date.Date.clear] again.

It is very important to use the API to access the [glib.date.Date] struct. Often only the day-month-year or only the Julian representation is valid. Sometimes neither is valid. Use the API.

GLib also features [glib.date_time.DateTime] which represents a precise time.

Fields
uint julianDaysthe Julian representation of the date
uint julianthis bit is set if @julian_days is valid
uint dmythis is set if @day, @month and @year are valid
uint daythe day of the day-month-year representation of the date, as a number between 1 and 31
uint monththe month of the day-month-year representation of the date, as a number between 1 and 12
uint yearthe year of the day-month-year representation of the date
structGDateTime

[glib.date_time.DateTime] is a structure that combines a Gregorian date and time into a single structure.

[glib.date_time.DateTime] provides many conversion and methods to manipulate dates and times. Time precision is provided down to microseconds and the time can range (proleptically) from 0001-01-01 00:00:00 to 9999-12-31 23:59:59.999999. [glib.date_time.DateTime] follows POSIX time in the sense that it is oblivious to leap seconds.

[glib.date_time.DateTime] is an immutable object; once it has been created it cannot be modified further. All modifiers will create a new [glib.date_time.DateTime]. Nearly all such functions can fail due to the date or time going out of range, in which case null will be returned.

[glib.date_time.DateTime] is reference counted: the reference count is increased by calling [glib.date_time.DateTime.ref_] and decreased by calling [glib.date_time.DateTime.unref]. When the reference count drops to 0, the resources allocated by the [glib.date_time.DateTime] structure are released.

Many parts of the API may produce non-obvious results. As an example, adding two months to January 31st will yield March 31st whereas adding one month and then one month again will yield either March 28th or March 29th. Also note that adding 24 hours is not always the same as adding one day (since days containing daylight savings time transitions are either 23 or 25 hours in length).

structGDebugKey

Associates a string with a bit flag. Used in [glib.global.parseDebugString].

Fields
const(char) * keythe string
uint valuethe flag
structGDir

An opaque structure representing an opened directory.

structGError

The [glib.error.ErrorWrap] structure contains information about an error that has occurred.

Fields
GQuark domainerror domain, e.g. `GFILEERROR`
int codeerror code, e.g. `GFILEERROR_NOENT`
char * messagehuman-readable informative error message

The #GHashTable struct is an opaque data structure to represent a [Hash Table][glib-Hash-Tables]. It should only be accessed via the following functions.

A GHashTableIter structure represents an iterator that can be used to iterate over the elements of a #GHashTable. GHashTableIter structures are typically allocated on the stack and then initialized with [glib.hash_table_iter.HashTableIter.init_].

The iteration order of a #GHashTableIter over the keys/values in a hash table is not defined.

Fields
void * dummy1
void * dummy2
void * dummy3
int dummy4
gboolean dummy5
void * dummy6
structGHmac

HMACs should be used when producing a cookie or hash based on data and a key. Simple mechanisms for using SHA1 and other algorithms to digest a key and data together are vulnerable to various security issues.

HMAC

uses algorithms like SHA1 in a secure way to produce a digest of a key and data.

Both the key and data are arbitrary byte arrays of bytes or characters.

Support for HMAC Digests has been added in GLib 2.30, and support for SHA-512 in GLib 2.42. Support for SHA-384 was added in GLib 2.52.

To create a new [glib.hmac.Hmac], use [glib.hmac.Hmac.new_]. To free a [glib.hmac.Hmac], use [glib.hmac.Hmac.unref].

structGHook

The #GHook struct represents a single hook function in a #GHookList.

Fields
void * datadata which is passed to func when this hook is invoked
GHook * nextpointer to the next hook in the list
GHook * prevpointer to the previous hook in the list
uint refCountthe reference count of this hook
gulong hookIdthe id of this hook, which is unique within its list
uint flagsflags which are set for this hook. See #GHookFlagMask for predefined flags
void * functhe function to call when this hook is invoked. The possible signatures for this function are #GHookFunc and #GHookCheckFunc
GDestroyNotify destroythe default @finalize_hook function of a #GHookList calls this member of the hook that is being finalized
structGHookList

The #GHookList struct represents a list of hook functions.

Fields
gulong seqIdthe next free #GHook id
uint hookSizethe size of the #GHookList elements, in bytes
uint isSetup1 if the #GHookList has been initialized
GHook * hooksthe first #GHook element in the list
void * dummy3unused
GHookFinalizeFunc finalizeHookthe function to call to finalize a #GHook element. The default behaviour is to call the hooks @destroy function
void *[2] dummyunused

The [glib.iochannel.IOChannel] data type aims to provide a portable method for using file descriptors, pipes, and sockets, and integrating them into the main event loop (see [glib.main_context.MainContext]). Currently, full support is available on UNIX platforms; support for Windows is only partially complete.

To create a new [glib.iochannel.IOChannel] on UNIX systems use [glib.iochannel.IOChannel.unixNew]. This works for plain file descriptors, pipes and sockets. Alternatively, a channel can be created for a file in a system independent manner using [glib.iochannel.IOChannel.newFile].

Once a [glib.iochannel.IOChannel] has been created, it can be used in a generic manner with the functions [glib.iochannel.IOChannel.readChars], [glib.iochannel.IOChannel.writeChars], [glib.iochannel.IOChannel.seekPosition], and [glib.iochannel.IOChannel.shutdown].

To add a [glib.iochannel.IOChannel] to the main event loop, use func@GLib.io_add_watch or func@GLib.io_add_watch_full. Here you specify which events you are interested in on the [glib.iochannel.IOChannel], and provide a function to be called whenever these events occur.

[glib.iochannel.IOChannel] instances are created with an initial reference count of 1. [glib.iochannel.IOChannel.ref_] and [glib.iochannel.IOChannel.unref] can be used to increment or decrement the reference count respectively. When the reference count falls to 0, the [glib.iochannel.IOChannel] is freed. (Though it isn’t closed automatically, unless it was created using [glib.iochannel.IOChannel.newFile].) Using func@GLib.io_add_watch or func@GLib.io_add_watch_full increments a channel’s reference count.

The new functions [glib.iochannel.IOChannel.readChars], [glib.iochannel.IOChannel.readLine], [glib.iochannel.IOChannel.readLineString], [glib.iochannel.IOChannel.readToEnd], [glib.iochannel.IOChannel.writeChars], [glib.iochannel.IOChannel.seekPosition], and [glib.iochannel.IOChannel.flush] should not be mixed with the deprecated functions [glib.iochannel.IOChannel.read], [glib.iochannel.IOChannel.write], and [glib.iochannel.IOChannel.seek] on the same channel.

structGIOFuncs

A table of functions used to handle different types of #GIOChannel in a generic way.

Fields
GIOStatus function(GIOChannel * channel, char * buf, size_t count, size_t * bytesRead, GError * * _err) ioReadreads raw bytes from the channel. This is called from various functions such as [glib.iochannel.IOChannel.readChars] to read raw bytes from the channel. Encoding and buffering issues are dealt wi...
GIOStatus function(GIOChannel * channel, const(char) * buf, size_t count, size_t * bytesWritten, GError * * _err) ioWritewrites raw bytes to the channel. This is called from various functions such as [glib.iochannel.IOChannel.writeChars] to write raw bytes to the channel. Encoding and buffering issues are dealt wit...
GIOStatus function(GIOChannel * channel, long offset, GSeekType type, GError * * _err) ioSeekseeks the channel. This is called from [glib.iochannel.IOChannel.seek] on channels that support it.
GIOStatus function(GIOChannel * channel, GError * * _err) ioClosecloses the channel. This is called from [glib.iochannel.IOChannel.close] after flushing the buffers.
GSource * function(GIOChannel * channel, GIOCondition condition) ioCreateWatchcreates a watch on the channel. This call corresponds directly to [glib.global.ioCreateWatch].
void function(GIOChannel * channel) ioFreecalled from [glib.iochannel.IOChannel.unref] when the channel needs to be freed. This function must free the memory associated with the channel, including freeing the #GIOChannel structure itself....
GIOStatus function(GIOChannel * channel, GIOFlags flags, GError * * _err) ioSetFlagssets the #GIOFlags on the channel. This is called from [glib.iochannel.IOChannel.setFlags] with all flags except for `GIOFLAGAPPEND` and `GIOFLAGNONBLOCK` masked out.
GIOFlags function(GIOChannel * channel) ioGetFlagsgets the #GIOFlags for the channel. This function need only return the `GIOFLAGAPPEND` and `GIOFLAGNONBLOCK` flags; [glib.iochannel.IOChannel.getFlags] automatically adds the others as appropriate.
structGKeyFile

[glib.key_file.KeyFile] parses .ini-like config files.

[glib.key_file.KeyFile] lets you parse, edit or create files containing groups of key-value pairs, which we call "key files" for lack of a better name. Several freedesktop.org specifications use key files now, e.g the

Desktop Entry Specification

and the Icon Theme Specification.

The syntax of key files is described in detail in the

Desktop Entry Specification,

here is a quick summary: Key files consists of groups of key-value pairs, interspersed with comments.

# this is just an example
# there can be comments before the first group

[First Group]

Name=Key File Example\tthis value shows\nescaping

# localized strings are stored in multiple key-value pairs
Welcome=Hello
Welcome[de]=Hallo
Welcome[fr_FR]=Bonjour
Welcome[it]=Ciao

[Another Group]

Numbers=2;20;-200;0

Booleans=true;false;true;true

Lines beginning with a '#' and blank lines are considered comments.

Groups are started by a header line containing the group name enclosed in '[' and ']', and ended implicitly by the start of the next group or the end of the file. Each key-value pair must be contained in a group.

Key-value pairs generally have the form key=value, with the exception of localized strings, which have the form key[locale]=value, with a locale identifier of the form lang_COUNTRY@MODIFIER where COUNTRY and MODIFIER are optional. Space before and after the '=' character are ignored. Newline, tab, carriage return and backslash characters in value are escaped as \n, \t, \r, and `\\\\`, respectively. To preserve leading spaces in values, these can also be escaped as \s.

Key files can store strings (possibly with localized variants), integers, booleans and lists of these. Lists are separated by a separator character, typically ';' or ','. To use the list separator character in a value in a list, it has to be escaped by prefixing it with a backslash.

This syntax is obviously inspired by the .ini files commonly met on Windows, but there are some important differences:

  • .ini files use the ';' character to begin comments,

key files use the '#' character.

  • Key files do not allow for ungrouped keys meaning only

comments can precede the first group.

  • Key files are always encoded in UTF-8.
  • Key and Group names are case-sensitive. For example, a group called

[GROUP] is a different from [group].

  • .ini files don't have a strongly typed boolean entry type,

they only have GetProfileInt(). In key files, only true and false (in lower case) are allowed.

Note that in contrast to the

Desktop Entry Specification,

groups in key files may contain the same key multiple times; the last entry wins. Key files may also contain multiple groups with the same name; they are merged together. Another difference is that keys and group names in key files are not restricted to ASCII characters.

Here is an example of loading a key file and reading a value:

g_autoptr(GError) error = NULL;
g_autoptr(GKeyFile) key_file = g_key_file_new ();

if (!g_key_file_load_from_file (key_file, "key-file.ini", flags, &error))
 {
   if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
     g_warning ("Error loading key file: %s", error->message);
   return;
 }

g_autofree gchar *val = g_key_file_get_string (key_file, "Group Name", "SomeKey", &error);
if (val == NULL &&
   !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND))
 {
   g_warning ("Error finding key in key file: %s", error->message);
   return;
 }
else if (val == NULL)
 {
   // Fall back to a default value.
   val = g_strdup ("default-value");
 }

Here is an example of creating and saving a key file:

g_autoptr(GKeyFile) key_file = g_key_file_new ();
const gchar *val = …;
g_autoptr(GError) error = NULL;

g_key_file_set_string (key_file, "Group Name", "SomeKey", val);

// Save as a file.
if (!g_key_file_save_to_file (key_file, "key-file.ini", &error))
 {
   g_warning ("Error saving key file: %s", error->message);
   return;
 }

// Or store to a GBytes for use elsewhere.
gsize data_len;
g_autofree guint8 *data = (guint8 *) g_key_file_to_data (key_file, &data_len, &error);
if (data == NULL)
 {
   g_warning ("Error saving key file: %s", error->message);
   return;
 }
g_autoptr(GBytes) bytes = g_bytes_new_take (g_steal_pointer (&data), data_len);

structGList

The #GList struct is used for each element in a doubly-linked list.

Fields
void * dataholds the element's data, which can be a pointer to any kind of data, or any integer value using the [Type Conversion Macros][glib-Type-Conversion-Macros]
GList * nextcontains the link to the next element in the list
GList * prevcontains the link to the previous element in the list
structGLogField

Structure representing a single field in a structured log entry. See [glib.global.logStructured] for details.

Log fields may contain arbitrary values, including binary with embedded nul bytes. If the field contains a string, the string must be UTF-8 encoded and have a trailing nul byte. Otherwise, @length must be set to a non-negative value.

Fields
const(char) * keyfield name (UTF-8 string)
const(void) * valuefield value (arbitrary bytes)
ptrdiff_t lengthlength of @value, in bytes, or -1 if it is nul-terminated

The [glib.main_context.MainContext] struct is an opaque data type representing a set of sources to be handled in a main loop.

structGMainLoop

The [glib.main_loop.MainLoop] struct is an opaque data type representing the main event loop of a GLib or GTK application.

The #GMappedFile represents a file mapping created with [glib.mapped_file.MappedFile.new_]. It has only private members and should not be accessed directly.

A parse context is used to parse a stream of bytes that you expect to contain marked-up text.

See [glib.markup_parse_context.MarkupParseContext.new_], #GMarkupParser, and so on for more details.

Any of the fields in #GMarkupParser can be null, in which case they will be ignored. Except for the @error function, any of these callbacks can set an error; in particular the G_MARKUP_ERROR_UNKNOWN_ELEMENT, G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, and G_MARKUP_ERROR_INVALID_CONTENT errors are intended to be set from these callbacks. If you set an error from a callback, [glib.markup_parse_context.MarkupParseContext.parse] will report that error back to its caller.

Fields
void function(GMarkupParseContext * context, const(char) * elementName, const(char *) * attributeNames, const(char *) * attributeValues, void * userData, GError * * _err) startElementCallback to invoke when the opening tag of an element is seen. The callback's @attributenames and @attributevalues parameters are null-terminated.
void function(GMarkupParseContext * context, const(char) * elementName, void * userData, GError * * _err) endElementCallback to invoke when the closing tag of an element is seen. Note that this is also called for empty tags like `<empty/>`.
void function(GMarkupParseContext * context, const(char) * text, size_t textLen, void * userData, GError * * _err) textCallback to invoke when some text is seen (text is always inside an element). Note that the text of an element may be spread over multiple calls of this function. If the `GMARKUPTREATCDATAAS_TEXT` ...
void function(GMarkupParseContext * context, const(char) * passthroughText, size_t textLen, void * userData, GError * * _err) passthroughCallback to invoke for comments, processing instructions and doctype declarations; if you're re-writing the parsed document, write the passthrough text back out in the same position. If the `GMARKU...
void function(GMarkupParseContext * context, GError * error, void * userData) errorCallback to invoke when an error occurs.

A GMatchInfo is an opaque struct used to return information about matches.

structGMemChunk

A set of functions used to perform memory allocation. The same #GMemVTable must be used for all allocations in the same program; a call to [glib.global.memSetVtable], if it exists, should be prior to any use of GLib.

This functions related to this has been deprecated in 2.46, and no longer work.

Fields
void * function(size_t nBytes) mallocfunction to use for allocating memory.
void * function(void * mem, size_t nBytes) reallocfunction to use for reallocating memory.
void function(void * mem) freefunction to use to free memory.
void * function(size_t nBlocks, size_t nBlockBytes) callocfunction to use for allocating zero-filled memory.
void * function(size_t nBytes) tryMallocfunction to use for allocating memory without a default error handler.
void * function(void * mem, size_t nBytes) tryReallocfunction to use for reallocating memory without a default error handler.
unionGMutex

The #GMutex struct is an opaque data structure to represent a mutex (mutual exclusion). It can be used to protect data against shared access.

Take for example the following function:

int
 give_me_next_number (void)
 {
   static int current_number = 0;

   // now do a very complicated calculation to calculate the new
   // number, this might for example be a random number generator
   current_number = calc_next_number (current_number);

   return current_number;
 }
It is easy to see that this won't work in a multi-threaded application. There current_number must be protected against shared access. A #GMutex can be used as a solution to this problem:
int
 give_me_next_number (void)
 {
   static GMutex mutex;
   static int current_number = 0;
   int ret_val;

   g_mutex_lock (&mutex);
   ret_val = current_number = calc_next_number (current_number);
   g_mutex_unlock (&mutex);

   return ret_val;
 }
Notice that the #GMutex is not initialised to any particular value. Its placement in static storage ensures that it will be initialised to all-zeros, which is appropriate.

If a #GMutex is placed in other contexts (eg: embedded in a struct) then it must be explicitly initialised using [glib.mutex.Mutex.init_].

A #GMutex should only be accessed via g_mutex_ functions.

Fields
void * p
uint[2] i
structGNode

The #GNode struct represents one node in a [n-ary tree][glib-N-ary-Trees].

Fields
void * datacontains the actual data of the node.
GNode * nextpoints to the node's next sibling (a sibling is another #GNode with the same parent).
GNode * prevpoints to the node's previous sibling.
GNode * parentpoints to the parent of the #GNode, or is null if the #GNode is the root of the tree.
GNode * childrenpoints to the first child of the #GNode. The other children are accessed by using the @next pointer of each child.
structGOnce

A #GOnce struct controls a one-time initialization function. Any one-time initialization function must have its own unique #GOnce struct.

Fields
GOnceStatus statusthe status of the #GOnce
void * retvalthe value returned by the call to the function, if @status is `GONCESTATUS_READY`

A [glib.option_context.OptionContext] struct defines which options are accepted by the commandline option parser. The struct has only private fields and should not be directly accessed.

A GOptionEntry struct defines a single option. To have an effect, they must be added to a #GOptionGroup with [glib.option_context.OptionContext.addMainEntries] or [glib.option_group.OptionGroup.addEntries].

Fields
const(char) * longNameThe long name of an option can be used to specify it in a commandline as `--longname`. Every option must have a long name. To resolve conflicts if multiple option groups contain the same long name,...
char shortNameIf an option has a short name, it can be specified `-shortname` in a commandline. @shortname must be a printable ASCII character different from '-', or zero if the option has no short name.
int flagsFlags from #GOptionFlags
GOptionArg argThe type of the option, as a #GOptionArg
void * argDataIf the @arg type is `GOPTIONARGCALLBACK`, then @argdata must point to a #GOptionArgFunc callback function, which will be called to handle the extra argument. Otherwise, @argdata is a pointer to a l...
const(char) * descriptionthe description for the option in `--help` output. The @description is translated using the @translatefunc of the group, see [glib.optiongroup.OptionGroup.setTranslationDomain].
const(char) * argDescriptionThe placeholder to use for the extra argument parsed by the option in `--help` output. The @argdescription is translated using the @translatefunc of the group, see [glib.option_group.OptionGroup.se...

A [glib.option_group.OptionGroup] struct defines the options in a single group. The struct has only private fields and should not be directly accessed.

All options in a group share the same translation function. Libraries which need to parse commandline options are expected to provide a function for getting a [glib.option_group.OptionGroup] holding their options, which the application can then add to its #GOptionContext.

structGPathBuf

[glib.path_buf.PathBuf] is a helper type that allows you to easily build paths from individual elements, using the platform specific conventions for path separators.

g_auto (GPathBuf) path;

g_path_buf_init (&path);

g_path_buf_push (&path, "usr");
g_path_buf_push (&path, "bin");
g_path_buf_push (&path, "echo");

g_autofree char *echo = g_path_buf_to_path (&path);
g_assert_cmpstr (echo, ==, "/usr/bin/echo");

You can also load a full path and then operate on its components:

g_auto (GPathBuf) path;

g_path_buf_init_from_path (&path, "/usr/bin/echo");

g_path_buf_pop (&path);
g_path_buf_push (&path, "sh");

g_autofree char *sh = g_path_buf_to_path (&path);
g_assert_cmpstr (sh, ==, "/usr/bin/sh");

Fields
void *[8] dummy

A [glib.pattern_spec.PatternSpec] struct is the 'compiled' form of a glob-style pattern.

The func@GLib.pattern_match_simple and [glib.pattern_spec.PatternSpec.match] functions match a string against a pattern containing '*' and '?' wildcards with similar semantics as the standard glob() function: '*' matches an arbitrary, possibly empty, string, '?' matches an arbitrary character.

Note that in contrast to glob(), the '/' character can be matched by the wildcards, there are no '[...]' character ranges and '*' and '?' can not be escaped to include them literally in a pattern.

When multiple strings must be matched against the same pattern, it is better to compile the pattern to a [glib.pattern_spec.PatternSpec] using [glib.pattern_spec.PatternSpec.new_] and use [glib.pattern_spec.PatternSpec.matchString] instead of func@GLib.pattern_match_simple. This avoids the overhead of repeated pattern compilation.

structGPollFD

Represents a file descriptor, which events to poll for, and which events occurred.

Fields
int fdthe file descriptor to poll (or a HANDLE on Win32)
ushort eventsa bitwise combination from #GIOCondition, specifying which events should be polled for. Typically for reading from a file descriptor you would use [glib.types.IOCondition.In] | [glib.types.IOCondit...
ushort reventsa bitwise combination of flags from #GIOCondition, returned from the poll() function to indicate which events occurred.
structGPrivate

The #GPrivate struct is an opaque data structure to represent a thread-local data key. It is approximately equivalent to the pthread_setspecific()/pthread_getspecific() APIs on POSIX and to TlsSetValue()/TlsGetValue() on Windows.

If you don't already know why you might want this functionality, then you probably don't need it.

#GPrivate is a very limited resource (as far as 128 per program, shared between all libraries). It is also not possible to destroy a #GPrivate after it has been used. As such, it is only ever acceptable to use #GPrivate in static scope, and even then sparingly so.

See G_PRIVATE_INIT() for a couple of examples.

The #GPrivate structure should be considered opaque. It should only be accessed via the g_private_ functions.

Fields
void * p
void *[2] future
structGPtrArray

Contains the public fields of a pointer array.

Fields
void * * pdatapoints to the array of pointers, which may be moved when the array grows
uint lennumber of pointers in the array
structGQueue

Contains the public fields of a [Queue][glib-Double-ended-Queues].

Fields
GList * heada pointer to the first element of the queue
GList * taila pointer to the last element of the queue
uint lengththe number of elements in the queue
structGRWLock

The GRWLock struct is an opaque data structure to represent a reader-writer lock. It is similar to a #GMutex in that it allows multiple threads to coordinate access to a shared resource.

The difference to a mutex is that a reader-writer lock discriminates between read-only ('reader') and full ('writer') access. While only one thread at a time is allowed write access (by holding the 'writer' lock via [glib.rwlock.RWLock.writerLock]), multiple threads can gain simultaneous read-only access (by holding the 'reader' lock via [glib.rwlock.RWLock.readerLock]).

It is unspecified whether readers or writers have priority in acquiring the lock when a reader already holds the lock and a writer is queued to acquire it.

Here is an example for an array with access functions:

GRWLock lock;
 GPtrArray *array;

 gpointer
 my_array_get (guint index)
 {
   gpointer retval = NULL;

   if (!array)
     return NULL;

   g_rw_lock_reader_lock (&lock);
   if (index < array->len)
     retval = g_ptr_array_index (array, index);
   g_rw_lock_reader_unlock (&lock);

   return retval;
 }

 void
 my_array_set (guint index, gpointer data)
 {
   g_rw_lock_writer_lock (&lock);

   if (!array)
     array = g_ptr_array_new ();

   if (index >= array->len)
     g_ptr_array_set_size (array, index+1);
   g_ptr_array_index (array, index) = data;

   g_rw_lock_writer_unlock (&lock);
 }
This example shows an array which can be accessed by many readers (the my_array_get() function) simultaneously, whereas the writers (the my_array_set() function) will only be allowed one at a time and only if no readers currently access the array. This is because of the potentially dangerous resizing of the array. Using these functions is fully multi-thread safe now.

If a #GRWLock is allocated in static storage then it can be used without initialisation. Otherwise, you should call [glib.rwlock.RWLock.init_] on it and [glib.rwlock.RWLock.clear] when done.

A GRWLock should only be accessed with the g_rw_lock_ functions.

Fields
void * p
uint[2] i
structGRand

The GRand struct is an opaque data structure. It should only be accessed through the g_rand_* functions.

structGRecMutex

The GRecMutex struct is an opaque data structure to represent a recursive mutex. It is similar to a #GMutex with the difference that it is possible to lock a GRecMutex multiple times in the same thread without deadlock. When doing so, care has to be taken to unlock the recursive mutex as often as it has been locked.

If a #GRecMutex is allocated in static storage then it can be used without initialisation. Otherwise, you should call [glib.rec_mutex.RecMutex.init_] on it and [glib.rec_mutex.RecMutex.clear] when done.

A GRecMutex should only be accessed with the g_rec_mutex_ functions.

Fields
void * p
uint[2] i
structGRegex

A [glib.regex.Regex] is the "compiled" form of a regular expression pattern.

[glib.regex.Regex] implements regular expression pattern matching using syntax and semantics similar to Perl regular expression. See the

PCRE documentation) for the syntax definition.

Some functions accept a @start_position argument, setting it differs from just passing over a shortened string and setting G_REGEX_MATCH_NOTBOL in the case of a pattern that begins with any kind of lookbehind assertion. For example, consider the pattern "\Biss\B" which finds occurrences of "iss" in the middle of words. ("\B" matches only if the current position in the subject is not a word boundary.) When applied to the string "Mississipi" from the fourth byte, namely "issipi", it does not match, because "\B" is always false at the start of the subject, which is deemed to be a word boundary. However, if the entire string is passed , but with @start_position set to 4, it finds the second occurrence of "iss" because it is able to look behind the starting point to discover that it is preceded by a letter.

Note that, unless you set the G_REGEX_RAW flag, all the strings passed to these functions must be encoded in UTF-8. The lengths and the positions inside the strings are in bytes and not in characters, so, for instance, "\xc3\xa0" (i.e. "à") is two bytes long but it is treated as a single character. If you set G_REGEX_RAW the strings can be non-valid UTF-8 strings and a byte is treated as a character, so "\xc3\xa0" is two bytes and two characters long.

When matching a pattern, "\n" matches only against a "\n" character in the string, and "\r" matches only a "\r" character. To match any newline sequence use "\R". This particular group matches either the two-character sequence CR + LF ("\r\n"), or one of the single characters LF (linefeed, U+000A, "\n"), VT vertical tab, U+000B, "\v"), FF (formfeed, U+000C, "\f"), CR (carriage return, U+000D, "\r"), NEL (next line, U+0085), LS (line separator, U+2028), or PS (paragraph separator, U+2029).

The behaviour of the dot, circumflex, and dollar metacharacters are affected by newline characters, the default is to recognize any newline character (the same characters recognized by "\R"). This can be changed with G_REGEX_NEWLINE_CR, G_REGEX_NEWLINE_LF and G_REGEX_NEWLINE_CRLF compile options, and with G_REGEX_MATCH_NEWLINE_ANY, G_REGEX_MATCH_NEWLINE_CR, G_REGEX_MATCH_NEWLINE_LF and G_REGEX_MATCH_NEWLINE_CRLF match options. These settings are also relevant when compiling a pattern if G_REGEX_EXTENDED is set, and an unescaped "#" outside a character class is encountered. This indicates a comment that lasts until after the next newline.

Creating and manipulating the same [glib.regex.Regex] structure from different threads is not a problem as [glib.regex.Regex] does not modify its internal state between creation and destruction, on the other hand [glib.match_info.MatchInfo] is not threadsafe.

The regular expressions low-level functionalities are obtained through the excellent PCRE library written by Philip Hazel.

structGRelation

A [glib.relation.Relation] is a table of data which can be indexed on any number of fields, rather like simple database tables. A [glib.relation.Relation] contains a number of records, called tuples. Each record contains a number of fields. Records are not ordered, so it is not possible to find the record at a particular index.

Note that [glib.relation.Relation] tables are currently limited to 2 fields.

To create a [glib.relation.Relation], use [glib.relation.Relation.new_].

To specify which fields should be indexed, use [glib.relation.Relation.index]. Note that this must be called before any tuples are added to the [glib.relation.Relation].

To add records to a [glib.relation.Relation] use [glib.relation.Relation.insert].

To determine if a given record appears in a [glib.relation.Relation], use [glib.relation.Relation.exists]. Note that fields are compared directly, so pointers must point to the exact same position (i.e. different copies of the same string will not match.)

To count the number of records which have a particular value in a given field, use [glib.relation.Relation.count].

To get all the records which have a particular value in a given field, use [glib.relation.Relation.select]. To access fields of the resulting records, use [glib.tuples.Tuples.index]. To free the resulting records use [glib.tuples.Tuples.destroy].

To delete all records which have a particular value in a given field, use [glib.relation.Relation.delete_].

To destroy the [glib.relation.Relation], use [glib.relation.Relation.destroy].

To help debug [glib.relation.Relation] objects, use [glib.relation.Relation.print].

[glib.relation.Relation] has been marked as deprecated, since this API has never been fully implemented, is not very actively maintained and rarely used.

Deprecated

Rarely used API
structGSList

The #GSList struct is used for each element in the singly-linked list.

Fields
void * dataholds the element's data, which can be a pointer to any kind of data, or any integer value using the [Type Conversion Macros][glib-Type-Conversion-Macros]
GSList * nextcontains the link to the next element in the list.
structGScanner

[glib.scanner.Scanner] provides a general-purpose lexical scanner.

You should set @input_name after creating the scanner, since it is used by the default message handler when displaying warnings and errors. If you are scanning a file, the filename would be a good choice.

The @user_data and @max_parse_errors fields are not used. If you need to associate extra data with the scanner you can place them here.

If you want to use your own message handler you can set the @msg_handler field. The type of the message handler function is declared by #GScannerMsgFunc.

Fields
void * userDataunused
uint maxParseErrorsunused
uint parseErrors[glib.scanner.Scanner.error] increments this field
const(char) * inputNamename of input stream, featured by the default message handler
GData * qdataquarked data
GScannerConfig * configlink into the scanner configuration
GTokenType tokentoken parsed by the last [glib.scanner.Scanner.getNextToken]
GTokenValue valuevalue of the last token from [glib.scanner.Scanner.getNextToken]
uint lineline number of the last token from [glib.scanner.Scanner.getNextToken]
uint positionchar number of the last token from [glib.scanner.Scanner.getNextToken]
GTokenType nextTokentoken parsed by the last [glib.scanner.Scanner.peekNextToken]
GTokenValue nextValuevalue of the last token from [glib.scanner.Scanner.peekNextToken]
uint nextLineline number of the last token from [glib.scanner.Scanner.peekNextToken]
uint nextPositionchar number of the last token from [glib.scanner.Scanner.peekNextToken]
GHashTable * symbolTable
int inputFd
const(char) * text
const(char) * textEnd
char * buffer
uint scopeId
GScannerMsgFunc msgHandlerhandler function for warn and error

Specifies the #GScanner parser configuration. Most settings can be changed during the parsing phase and will affect the lexical parsing of the next unpeeked token.

Fields
char * csetSkipCharactersspecifies which characters should be skipped by the scanner (the default is the whitespace characters: space, tab, carriage-return and line-feed).
char * csetIdentifierFirstspecifies the characters which can start identifiers (the default is [glib.types.CSETa2z], "", and [glib.types.CSETA2_Z]).
char * csetIdentifierNthspecifies the characters which can be used in identifiers, after the first character (the default is [glib.types.CSETa2z], "0123456789", [glib.types.CSETA2Z], `GCSETLATINS`, `GCSET_LATINC`).
char * cpairCommentSinglespecifies the characters at the start and end of single-line comments. The default is "#\n" which means that single-line comments start with a '#' and continue until a '\n' (end of line).
uint caseSensitivespecifies if symbols are case sensitive (the default is false).
uint skipCommentMultispecifies if multi-line comments are skipped and not returned as tokens (the default is true).
uint skipCommentSinglespecifies if single-line comments are skipped and not returned as tokens (the default is true).
uint scanCommentMultispecifies if multi-line comments are recognized (the default is true).
uint scanIdentifierspecifies if identifiers are recognized (the default is true).
uint scanIdentifier1charspecifies if single-character identifiers are recognized (the default is false).
uint scanIdentifierNULLspecifies if null is reported as `GTOKENIDENTIFIER_NULL` (the default is false).
uint scanSymbolsspecifies if symbols are recognized (the default is true).
uint scanBinaryspecifies if binary numbers are recognized (the default is false).
uint scanOctalspecifies if octal numbers are recognized (the default is true).
uint scanFloatspecifies if floating point numbers are recognized (the default is true).
uint scanHexspecifies if hexadecimal numbers are recognized (the default is true).
uint scanHexDollarspecifies if '$' is recognized as a prefix for hexadecimal numbers (the default is false).
uint scanStringSqspecifies if strings can be enclosed in single quotes (the default is true).
uint scanStringDqspecifies if strings can be enclosed in double quotes (the default is true).
uint numbers2Intspecifies if binary, octal and hexadecimal numbers are reported as `GTOKENINT` (the default is true).
uint int2Floatspecifies if all numbers are reported as `GTOKENFLOAT` (the default is false).
uint identifier2Stringspecifies if identifiers are reported as strings (the default is false).
uint char2Tokenspecifies if characters are reported by setting `token = ch` or as `GTOKENCHAR` (the default is true).
uint symbol2Tokenspecifies if symbols are reported by setting `token = vsymbol` or as `GTOKEN_SYMBOL` (the default is false).
uint scope0Fallbackspecifies if a symbol is searched for in the default scope in addition to the current scope (the default is false).
uint storeInt64use value.vint64 rather than vint
uint paddingDummy
structGSequence

The #GSequence struct is an opaque data type representing a [sequence][glib-Sequences] data type.

The #GSequenceIter struct is an opaque data type representing an iterator pointing into a #GSequence.

structGSource

The [glib.source.Source] struct is an opaque data type representing an event source.

Fields
void * callbackData
GSourceCallbackFuncs * callbackFuncs
const(GSourceFuncs) * sourceFuncs
uint refCount
GMainContext * context
int priority
uint flags
uint sourceId
GSList * pollFds
GSource * prev
GSource * next
char * name

The [glib.types.SourceCallbackFuncs] struct contains functions for managing callback objects.

Fields
void function(void * cbData) ref_Called when a reference is added to the callback object
void function(void * cbData) unrefCalled when a reference to the callback object is dropped
void function(void * cbData, GSource * source, GSourceFunc * func, void * * data) getCalled to extract the callback function and data from the callback object.

The [glib.types.SourceFuncs] struct contains a table of functions used to handle event sources in a generic manner.

For idle sources, the prepare and check functions always return true to indicate that the source is always ready to be processed. The prepare function also returns a timeout value of 0 to ensure that the poll() call doesn't block (since that would be time wasted which could have been spent running the idle function).

For timeout sources, the prepare and check functions both return true if the timeout interval has expired. The prepare function also returns a timeout value to ensure that the poll() call doesn't block too long and miss the next timeout.

For file descriptor sources, the prepare function typically returns false, since it must wait until poll() has been called before it knows whether any events need to be processed. It sets the returned timeout to -1 to indicate that it doesn't mind how long the poll() call blocks. In the check function, it tests the results of the poll() call to see if the required condition has been met, and returns true if so.

Fields
gboolean function(GSource * source, int * timeout) prepareCalled before all the file descriptors are polled. If the source can determine that it is ready here (without waiting for the results of the poll() call) it should return true. It can also return a...
gboolean function(GSource * source) checkCalled after all the file descriptors are polled. The source should return true if it is ready to be dispatched. Note that some time may have passed since the previous prepare function was called, ...
gboolean function(GSource * source, GSourceFunc callback, void * userData) dispatchCalled to dispatch the event source, after it has returned true in either its @prepare or its @check function, or if a ready time has been reached. The @dispatch function receives a callback functi...
void function(GSource * source) finalizeCalled when the source is finalized. At this point, the source will have been destroyed, had its callback cleared, and have been removed from its #GMainContext, but it will still have its final ref...
GSourceFunc closureCallback
GSourceDummyMarshal closureMarshal
structGStatBuf

A type corresponding to the appropriate struct type for the stat() system call, depending on the platform and/or compiler being used.

See [glib.global.stat] for more information.

A #GStaticMutex works like a #GMutex.

Prior to GLib 2.32, GStaticMutex had the significant advantage that it doesn't need to be created at run-time, but can be defined at compile-time. Since 2.32, #GMutex can be statically allocated as well, and GStaticMutex has been deprecated.

Here is a version of our give_me_next_number() example using a GStaticMutex:

int
 give_me_next_number (void)
 {
   static int current_number = 0;
   int ret_val;
   static GStaticMutex mutex = G_STATIC_MUTEX_INIT;

   g_static_mutex_lock (&mutex);
   ret_val = current_number = calc_next_number (current_number);
   g_static_mutex_unlock (&mutex);

   return ret_val;
 }

Sometimes you would like to dynamically create a mutex. If you don't want to require prior calling to [glib.thread.Thread.init_], because your code should also be usable in non-threaded programs, you are not able to use [glib.mutex.Mutex.new_] and thus #GMutex, as that requires a prior call to [glib.thread.Thread.init_]. In these cases you can also use a #GStaticMutex. It must be initialized with [glib.static_mutex.StaticMutex.init_] before using it and freed with with [glib.static_mutex.StaticMutex.free] when not needed anymore to free up any allocated resources.

Even though #GStaticMutex is not opaque, it should only be used with the following functions, as it is defined differently on different platforms.

All of the g_static_mutex_* functions apart from g_static_mutex_get_mutex() can also be used even if [glib.thread.Thread.init_] has not yet been called. Then they do nothing, apart from g_static_mutex_trylock() which does nothing but returning true.

All of the g_static_mutex_* functions are actually macros. Apart from taking their addresses, you can however use them as if they were functions.

Fields
GMutex * mutex

A #GStaticPrivate works almost like a #GPrivate, but it has one significant advantage. It doesn't need to be created at run-time like a #GPrivate, but can be defined at compile-time. This is similar to the difference between #GMutex and #GStaticMutex.

Now look at our give_me_next_number() example with #GStaticPrivate:

int
 give_me_next_number ()
 {
   static GStaticPrivate current_number_key = G_STATIC_PRIVATE_INIT;
   int *current_number = g_static_private_get (¤t_number_key);

   if (!current_number)
     {
       current_number = g_new (int, 1);
       *current_number = 0;
       g_static_private_set (&current_number_key, current_number, g_free);
     }

   *current_number = calc_next_number (*current_number);

   return *current_number;
 }

Fields
uint index

The #GStaticRWLock struct represents a read-write lock. A read-write lock can be used for protecting data that some portions of code only read from, while others also write. In such situations it is desirable that several readers can read at once, whereas of course only one writer may write at a time.

Take a look at the following example:

GStaticRWLock rwlock = G_STATIC_RW_LOCK_INIT;
 GPtrArray *array;

 gpointer
 my_array_get (guint index)
 {
   gpointer retval = NULL;

   if (!array)
     return NULL;

   g_static_rw_lock_reader_lock (&rwlock);
   if (index < array->len)
     retval = g_ptr_array_index (array, index);
   g_static_rw_lock_reader_unlock (&rwlock);

   return retval;
 }

 void
 my_array_set (guint index, gpointer data)
 {
   g_static_rw_lock_writer_lock (&rwlock);

   if (!array)
     array = g_ptr_array_new ();

   if (index >= array->len)
     g_ptr_array_set_size (array, index + 1);
   g_ptr_array_index (array, index) = data;

   g_static_rw_lock_writer_unlock (&rwlock);
 }

This example shows an array which can be accessed by many readers (the my_array_get() function) simultaneously, whereas the writers (the my_array_set() function) will only be allowed once at a time and only if no readers currently access the array. This is because of the potentially dangerous resizing of the array. Using these functions is fully multi-thread safe now.

Most of the time, writers should have precedence over readers. That means, for this implementation, that as soon as a writer wants to lock the data, no other reader is allowed to lock the data, whereas, of course, the readers that already have locked the data are allowed to finish their operation. As soon as the last reader unlocks the data, the writer will lock it.

Even though #GStaticRWLock is not opaque, it should only be used with the following functions.

All of the g_static_rw_lock_* functions can be used even if [glib.thread.Thread.init_] has not been called. Then they do nothing, apart from g_static_rw_lock_*_trylock, which does nothing but returning true.

A read-write lock has a higher overhead than a mutex. For example, both [glib.static_rwlock.StaticRWLock.readerLock] and [glib.static_rwlock.StaticRWLock.readerUnlock] have to lock and unlock a #GStaticMutex, so it takes at least twice the time to lock and unlock a #GStaticRWLock that it does to lock and unlock a #GStaticMutex. So only data structures that are accessed by multiple readers, and which keep the lock for a considerable time justify a #GStaticRWLock. The above example most probably would fare better with a #GStaticMutex.

Deprecated

Use a #GRWLock instead
Fields
GCond * readCond
GCond * writeCond
uint readCounter
gboolean haveWriter
uint wantToRead
uint wantToWrite

A #GStaticRecMutex works like a #GStaticMutex, but it can be locked multiple times by one thread. If you enter it n times, you have to unlock it n times again to let other threads lock it. An exception is the function [glib.static_rec_mutex.StaticRecMutex.unlockFull]: that allows you to unlock a #GStaticRecMutex completely returning the depth, (i.e. the number of times this mutex was locked). The depth can later be used to restore the state of the #GStaticRecMutex by calling [glib.static_rec_mutex.StaticRecMutex.lockFull]. In GLib 2.32, #GStaticRecMutex has been deprecated in favor of #GRecMutex.

Even though #GStaticRecMutex is not opaque, it should only be used with the following functions.

All of the g_static_rec_mutex_* functions can be used even if [glib.thread.Thread.init_] has not been called. Then they do nothing, apart from [glib.static_rec_mutex.StaticRecMutex.trylock], which does nothing but returning true.

Fields
uint depth
structGString

A [glib.string_.String] is an object that handles the memory management of a C string.

The emphasis of [glib.string_.String] is on text, typically UTF-8. Crucially, the "str" member of a [glib.string_.String] 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 [glib.string_.String] can also hold arbitrary binary data, because it has a "len" member, which includes any possible embedded nul characters in the data. Conceptually then, [glib.string_.String] is like a [glib.byte_array.ByteArray] with the addition of many convenience methods for text, and a guaranteed nul terminator.

Fields
char * strpoints 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.
size_t lencontains the length of the string, not including the terminating nul byte.
size_t allocatedLenthe number of bytes that can be stored in the string before it needs to be reallocated. May be larger than @len.

[glib.string_chunk.StringChunk] provides efficient storage of groups of strings

String chunks are used to store groups of strings. Memory is allocated in blocks, and as strings are added to the [glib.string_chunk.StringChunk] they are copied into the next free position in a block. When a block is full a new block is allocated.

When storing a large number of strings, string chunks are more efficient than using func@GLib.strdup since fewer calls to malloc() are needed, and less memory is wasted in memory allocation overheads.

By adding strings with [glib.string_chunk.StringChunk.insertConst] it is also possible to remove duplicates.

To create a new [glib.string_chunk.StringChunk] use [glib.string_chunk.StringChunk.new_].

To add strings to a [glib.string_chunk.StringChunk] use [glib.string_chunk.StringChunk.insert].

To add strings to a [glib.string_chunk.StringChunk], but without duplicating strings which are already in the [glib.string_chunk.StringChunk], use [glib.string_chunk.StringChunk.insertConst].

To free the entire [glib.string_chunk.StringChunk] use [glib.string_chunk.StringChunk.free]. It is not possible to free individual strings.

[glib.strv_builder.StrvBuilder] is a helper object to build a null-terminated string arrays.

The following example shows how to build a two element array:

g_autoptr(GStrvBuilder) builder = g_strv_builder_new ();
 g_strv_builder_add (builder, "hello");
 g_strv_builder_add (builder, "world");
 g_auto(GStrv) array = g_strv_builder_end (builder);

structGTestCase

An opaque structure representing a test case.

Fields
gboolean testInitialized
gboolean testQuick
gboolean testPerf
gboolean testVerbose
gboolean testQuiet
gboolean testUndefined
Fields
GString * data
GSList * msgs
Fields
GTestLogType logType
uint nStrings
char * * strings
uint nNums
real * nums

An opaque structure representing a test suite.

structGThread

The #GThread struct represents a running thread. This struct is returned by [glib.thread.Thread.new_] or [glib.thread.Thread.tryNew]. You can obtain the #GThread struct representing the current thread by calling [glib.thread.Thread.self].

GThread is refcounted, see [glib.thread.Thread.ref_] and [glib.thread.Thread.unref]. The thread represented by it holds a reference while it is running, and [glib.thread.Thread.join] consumes the reference that it is given, so it is normally not necessary to manage GThread references explicitly.

The structure is opaque -- none of its fields may be directly accessed.

Fields
void * data
gboolean joinable

This function table is no longer used by [glib.thread.Thread.init_] to initialize the thread system.

Fields
GMutex * function() mutexNewvirtual function pointer for [glib.mutex.Mutex.new_]
void function(GMutex * mutex) mutexLockvirtual function pointer for [glib.mutex.Mutex.lock]
gboolean function(GMutex * mutex) mutexTrylockvirtual function pointer for [glib.mutex.Mutex.trylock]
void function(GMutex * mutex) mutexUnlockvirtual function pointer for [glib.mutex.Mutex.unlock]
void function(GMutex * mutex) mutexFreevirtual function pointer for [glib.mutex.Mutex.free]
GCond * function() condNewvirtual function pointer for [glib.cond.Cond.new_]
void function(GCond * cond) condSignalvirtual function pointer for [glib.cond.Cond.signal]
void function(GCond * cond) condBroadcastvirtual function pointer for [glib.cond.Cond.broadcast]
void function(GCond * cond, GMutex * mutex) condWaitvirtual function pointer for [glib.cond.Cond.wait]
gboolean function(GCond * cond, GMutex * mutex, GTimeVal * endTime) condTimedWaitvirtual function pointer for [glib.cond.Cond.timedWait]
void function(GCond * cond) condFreevirtual function pointer for [glib.cond.Cond.free]
GPrivate * function(GDestroyNotify destructor) privateNewvirtual function pointer for [glib.private.Private.new]
void * function(GPrivate * privateKey) privateGetvirtual function pointer for [glib.private_.Private.get]
void function(GPrivate * privateKey, void * data) privateSetvirtual function pointer for [glib.private_.Private.set]
void function(GThreadFunc func, void * data, gulong stackSize, gboolean joinable, gboolean bound, GThreadPriority priority, void * thread, GError * * _err) threadCreatevirtual function pointer for [glib.thread.Thread.create]
void function() threadYieldvirtual function pointer for [glib.thread.Thread.yield]
void function(void * thread) threadJoinvirtual function pointer for [glib.thread.Thread.join]
void function() threadExitvirtual function pointer for [glib.thread.Thread.exit]
void function(void * thread, GThreadPriority priority) threadSetPriorityvirtual function pointer for [glib.thread.Thread.setPriority]
void function(void * thread) threadSelfvirtual function pointer for [glib.thread.Thread.self]
gboolean function(void * thread1, void * thread2) threadEqualused internally by recursive mutex locks and by some assertion checks

The [glib.thread_pool.ThreadPool] struct represents a thread pool.

A thread pool is useful when you wish to asynchronously fork out the execution of work and continue working in your own thread. If that will happen often, the overhead of starting and destroying a thread each time might be too high. In such cases reusing already started threads seems like a good idea. And it indeed is, but implementing this can be tedious and error-prone.

Therefore GLib provides thread pools for your convenience. An added advantage is, that the threads can be shared between the different subsystems of your program, when they are using GLib.

To create a new thread pool, you use [glib.thread_pool.ThreadPool.new_]. It is destroyed by [glib.thread_pool.ThreadPool.free].

If you want to execute a certain task within a thread pool, use [glib.thread_pool.ThreadPool.push].

To get the current number of running threads you call [glib.thread_pool.ThreadPool.getNumThreads]. To get the number of still unprocessed tasks you call [glib.thread_pool.ThreadPool.unprocessed]. To control the maximum number of threads for a thread pool, you use [glib.thread_pool.ThreadPool.getMaxThreads]. and [glib.thread_pool.ThreadPool.setMaxThreads].

Finally you can control the number of unused threads, that are kept alive by GLib for future use. The current number can be fetched with [glib.thread_pool.ThreadPool.getNumUnusedThreads]. The maximum number can be controlled by [glib.thread_pool.ThreadPool.getMaxUnusedThreads] and [glib.thread_pool.ThreadPool.setMaxUnusedThreads]. All currently unused threads can be stopped by calling [glib.thread_pool.ThreadPool.stopUnusedThreads].

Fields
GFunc functhe function to execute in the threads of this pool
void * userDatathe user data for the threads of this pool
gboolean exclusiveare all threads exclusive to this pool
structGTimeVal

Represents a precise time, with seconds and microseconds.

Similar to the struct timeval returned by the gettimeofday() UNIX system call.

GLib is attempting to unify around the use of 64-bit integers to represent microsecond-precision time. As such, this type will be removed from a future version of GLib. A consequence of using glong for tv_sec is that on 32-bit systems [glib.time_val.TimeVal] is subject to the year 2038 problem.

Deprecated

Use #GDateTime or #guint64 instead.
Fields
glong tvSecseconds
glong tvUsecmicroseconds
structGTimeZone

A [glib.time_zone.TimeZone] represents a time zone, at no particular point in time.

The [glib.time_zone.TimeZone] struct is refcounted and immutable.

Each time zone has an identifier (for example, ‘Europe/London’) which is platform dependent. See [glib.time_zone.TimeZone.new_] for information on the identifier formats. The identifier of a time zone can be retrieved using [glib.time_zone.TimeZone.getIdentifier].

A time zone contains a number of intervals. Each interval has an abbreviation to describe it (for example, ‘PDT’), an offset to UTC and a flag indicating if the daylight savings time is in effect during that interval. A time zone always has at least one interval — interval 0. Note that interval abbreviations are not the same as time zone identifiers (apart from ‘UTC’), and cannot be passed to [glib.time_zone.TimeZone.new_].

Every UTC time is contained within exactly one interval, but a given local time may be contained within zero, one or two intervals (due to incontinuities associated with daylight savings time).

An interval may refer to a specific period of time (eg: the duration of daylight savings time during 2010) or it may refer to many periods of time that share the same properties (eg: all periods of daylight savings time). It is also possible (usually for political reasons) that some properties (like the abbreviation) change between intervals without other properties changing.

structGTimer

[glib.timer.Timer] records a start time, and counts microseconds elapsed since that time.

This is done somewhat differently on different platforms, and can be tricky to get exactly right, so [glib.timer.Timer] provides a portable/convenient interface.

A union holding the value of the token.

Fields
void * vSymboltoken symbol value
char * vIdentifiertoken identifier value
gulong vBinarytoken binary integer value
gulong vOctaloctal integer value
gulong vIntinteger value
ulong vInt6464-bit integer value
double vFloatfloating point value
gulong vHexhex integer value
char * vStringstring value
char * vCommentcomment value
ubyte vCharcharacter value
uint vErrorerror value

A [glib.types.TrashStack] is an efficient way to keep a stack of unused allocated memory chunks. Each memory chunk is required to be large enough to hold a [xlib.types.void*]. This allows the stack to be maintained without any space overhead, since the stack pointers can be stored inside the memory chunks.

There is no function to create a [glib.types.TrashStack]. A NULL GTrashStack* is a perfectly valid empty stack.

Each piece of memory that is pushed onto the stack is cast to a GTrashStack*.

There is no longer any good reason to use [glib.types.TrashStack]. If you have extra pieces of memory, free() them and allocate them again later.

Deprecated

[glib.types.TrashStack] is deprecated without replacement
Fields
GTrashStack * nextpointer to the previous element of the stack, gets stored in the first `sizeof (gpointer)` bytes of the element
structGTree

The GTree struct is an opaque data structure representing a [balanced binary tree][glib-Balanced-Binary-Trees]. It should be accessed only by using the following functions.

structGTreeNode

An opaque type which identifies a specific node in a #GTree.

structGTuples

The #GTuples struct is used to return records (or tuples) from the #GRelation by [glib.relation.Relation.select]. It only contains one public member - the number of records that matched. To access the matched records, you must use [glib.tuples.Tuples.index].

Deprecated

Rarely used API
Fields
uint lenthe number of records that matched.
structGUnixPipe

A Unix pipe. The advantage of this type over int[2] is that it can be closed automatically when it goes out of scope, using g_auto(GUnixPipe), on compilers that support that feature.

Fields
int[2] fdsA pair of file descriptors, each negative if closed or not yet opened. The file descriptor with index `GUNIXPIPEENDREAD` is readable. The file descriptor with index `GUNIXPIPEENDWRITE` is writable.
structGUri

The [glib.uri.Uri] type and related functions can be used to parse URIs into their components, and build valid URIs from individual components.

Since [glib.uri.Uri] only represents absolute URIs, all [glib.uri.Uri]s will have a URI scheme, so [glib.uri.Uri.getScheme] will always return a non-NULL answer. Likewise, by definition, all URIs have a path component, so [glib.uri.Uri.getPath] will always return a non-NULL string (which may be empty).

If the URI string has an

‘authority’ component (that

is, if the scheme is followed by `://` rather than just `:`), then the [glib.uri.Uri] will contain a hostname, and possibly a port and ‘userinfo’. Additionally, depending on how the [glib.uri.Uri] was constructed/parsed (for example, using the G_URI_FLAGS_HAS_PASSWORD and G_URI_FLAGS_HAS_AUTH_PARAMS flags), the userinfo may be split out into a username, password, and additional authorization-related parameters.

Normally, the components of a [glib.uri.Uri] will have all `%`-encoded characters decoded. However, if you construct/parse a [glib.uri.Uri] with G_URI_FLAGS_ENCODED, then the `%`-encoding will be preserved instead in the userinfo, path, and query fields (and in the host field if also created with G_URI_FLAGS_NON_DNS). In particular, this is necessary if the URI may contain binary data or non-UTF-8 text, or if decoding the components might change the interpretation of the URI.

For example, with the encoded flag:

g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fparam%3Dvalue", G_URI_FLAGS_ENCODED, &err);
g_assert_cmpstr (g_uri_get_query (uri), ==, "query=http%3A%2F%2Fhost%2Fpath%3Fparam%3Dvalue");

While the default `%`-decoding behaviour would give:

g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fparam%3Dvalue", G_URI_FLAGS_NONE, &err);
g_assert_cmpstr (g_uri_get_query (uri), ==, "query=http://host/path?param=value");

During decoding, if an invalid UTF-8 string is encountered, parsing will fail with an error indicating the bad string location:

g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fbad%3D%00alue", G_URI_FLAGS_NONE, &err);
g_assert_error (err, G_URI_ERROR, G_URI_ERROR_BAD_QUERY);

You should pass G_URI_FLAGS_ENCODED or G_URI_FLAGS_ENCODED_QUERY if you need to handle that case manually. In particular, if the query string contains `=` characters that are `%`-encoded, you should let [glib.uri.Uri.parseParams] do the decoding once of the query.

[glib.uri.Uri] is immutable once constructed, and can safely be accessed from multiple threads. Its reference counting is atomic.

Note that the scope of [glib.uri.Uri] is to help manipulate URIs in various applications, following RFC 3986. In particular, it doesn't intend to cover web browser needs, and doesn’t implement the

WHATWG URL standard. No APIs are provided to

help prevent

homograph attacks, so

[glib.uri.Uri] is not suitable for formatting URIs for display to the user for making security-sensitive decisions.

Relative and absolute URIs

As defined in RFC 3986, the hierarchical nature of URIs means that they can either be ‘relative references’ (sometimes referred to as ‘relative URIs’) or ‘URIs’ (for clarity, ‘URIs’ are referred to in this documentation as ‘absolute URIs’ — although

in constrast to RFC 3986,

fragment identifiers are always allowed).

Relative references have one or more components of the URI missing. In particular, they have no scheme. Any other component, such as hostname, query, etc. may be missing, apart from a path, which has to be specified (but may be empty). The path may be relative, starting with `./` rather than `/`.

For example, a valid relative reference is ./path?query, /?query#fragment or //example.com.

Absolute URIs have a scheme specified. Any other components of the URI which are missing are specified as explicitly unset in the URI, rather than being resolved relative to a base URI using [glib.uri.Uri.parseRelative].

For example, a valid absolute URI is file:///home/bob or https://search.com?query=string.

A [glib.uri.Uri] instance is always an absolute URI. A string may be an absolute URI or a relative reference; see the documentation for individual functions as to what forms they accept.

Parsing URIs

The most minimalist APIs for parsing URIs are [glib.uri.Uri.split] and [glib.uri.Uri.splitWithUser]. These split a URI into its component parts, and return the parts; the difference between the two is that [glib.uri.Uri.split] treats the ‘userinfo’ component of the URI as a single element, while [glib.uri.Uri.splitWithUser] can (depending on the [glib.types.UriFlags] you pass) treat it as containing a username, password, and authentication parameters. Alternatively, [glib.uri.Uri.splitNetwork] can be used when you are only interested in the components that are needed to initiate a network connection to the service (scheme, host, and port).

[glib.uri.Uri.parse] is similar to [glib.uri.Uri.split], but instead of returning individual strings, it returns a [glib.uri.Uri] structure (and it requires that the URI be an absolute URI).

[glib.uri.Uri.resolveRelative] and [glib.uri.Uri.parseRelative] allow you to resolve a relative URI relative to a base URI. [glib.uri.Uri.resolveRelative] takes two strings and returns a string, and [glib.uri.Uri.parseRelative] takes a [glib.uri.Uri] and a string and returns a [glib.uri.Uri].

All of the parsing functions take a [glib.types.UriFlags] argument describing exactly how to parse the URI; see the documentation for that type for more details on the specific flags that you can pass. If you need to choose different flags based on the type of URI, you can use [glib.uri.Uri.peekScheme] on the URI string to check the scheme first, and use that to decide what flags to parse it with.

For example, you might want to use G_URI_PARAMS_WWW_FORM when parsing the params for a web URI, so compare the result of [glib.uri.Uri.peekScheme] against http and https.

Building URIs

[glib.uri.Uri.join] and [glib.uri.Uri.joinWithUser] can be used to construct valid URI strings from a set of component strings. They are the inverse of [glib.uri.Uri.split] and [glib.uri.Uri.splitWithUser].

Similarly, [glib.uri.Uri.build] and [glib.uri.Uri.buildWithUser] can be used to construct a [glib.uri.Uri] from a set of component strings.

As with the parsing functions, the building functions take a [glib.types.UriFlags] argument. In particular, it is important to keep in mind whether the URI components you are using are already `%`-encoded. If so, you must pass the G_URI_FLAGS_ENCODED flag.

file:// URIs

Note that Windows and Unix both define special rules for parsing file:// URIs (involving non-UTF-8 character sets on Unix, and the interpretation of path separators on Windows). [glib.uri.Uri] does not implement these rules. Use func@GLib.filename_from_uri and func@GLib.filename_to_uri if you want to properly convert between file:// URIs and local filenames.

URI Equality

Note that there is no g_uri_equal () function, because comparing URIs usefully requires scheme-specific knowledge that [glib.uri.Uri] does not have. [glib.uri.Uri] can help with normalization if you use the various encoded [glib.types.UriFlags] as well as G_URI_FLAGS_SCHEME_NORMALIZE however it is not comprehensive. For example, data:,foo and data:;base64,Zm9v resolve to the same thing according to the data: URI specification which GLib does not handle.

Many URI schemes include one or more attribute/value pairs as part of the URI value. For example scheme://server/path?query=string&is=there has two attributes – query=string and is=there – in its query part.

A #GUriParamsIter structure represents an iterator that can be used to iterate over the attribute/value pairs of a URI query string. #GUriParamsIter structures are typically allocated on the stack and then initialized with [glib.uri_params_iter.UriParamsIter.init_]. See the documentation for [glib.uri_params_iter.UriParamsIter.init_] for a usage example.

Fields
int dummy0
void * dummy1
void * dummy2
ubyte[256] dummy3
structGVariant

[glib.variant.Variant] is a variant datatype; it can contain one or more values along with information about the type of the values.

A [glib.variant.Variant] may contain simple types, like an integer, or a boolean value; or complex types, like an array of two strings, or a dictionary of key value pairs. A [glib.variant.Variant] is also immutable: once it’s been created neither its type nor its content can be modified further.

[glib.variant.Variant] is useful whenever data needs to be serialized, for example when sending method parameters in D-Bus, or when saving settings using [[gio.settings.Settings]](../gio/class.Settings.html).

When creating a new [glib.variant.Variant], you pass the data you want to store in it along with a string representing the type of data you wish to pass to it.

For instance, if you want to create a [glib.variant.Variant] holding an integer value you can use:

GVariant *v = g_variant_new ("u", 40);

The string u in the first argument tells [glib.variant.Variant] that the data passed to the constructor (40) is going to be an unsigned integer.

More advanced examples of [glib.variant.Variant] in use can be found in documentation for [[glib.variant.Variant] format strings](gvariant-format-strings.html#pointers).

The range of possible values is determined by the type.

The type system used by [glib.variant.Variant] is [glib.variant_type.VariantType].

[glib.variant.Variant] instances always have a type and a value (which are given at construction time). The type and value of a [glib.variant.Variant] instance can never change other than by the [glib.variant.Variant] itself being destroyed. A [glib.variant.Variant] cannot contain a pointer.

[glib.variant.Variant] is reference counted using [glib.variant.Variant.ref_] and [glib.variant.Variant.unref]. [glib.variant.Variant] also has floating reference counts — see [glib.variant.Variant.refSink].

[glib.variant.Variant] is completely threadsafe. A [glib.variant.Variant] instance can be concurrently accessed in any way from any number of threads without problems.

[glib.variant.Variant] is heavily optimised for dealing with data in serialized form. It works particularly well with data located in memory-mapped files. It can perform nearly all deserialization operations in a small constant time, usually touching only a single memory page. Serialized [glib.variant.Variant] data can also be sent over the network.

[glib.variant.Variant] is largely compatible with D-Bus. Almost all types of [glib.variant.Variant] instances can be sent over D-Bus. See [glib.variant_type.VariantType] for exceptions. (However, [glib.variant.Variant]’s serialization format is not the same as the serialization format of a D-Bus message body: use

GDBusMessage, in the GIO library, for those.)

For space-efficiency, the [glib.variant.Variant] serialization format does not automatically include the variant’s length, type or endianness, which must either be implied from context (such as knowledge that a particular file format always contains a little-endian G_VARIANT_TYPE_VARIANT which occupies the whole length of the file) or supplied out-of-band (for instance, a length, type and/or endianness indicator could be placed at the beginning of a file, network message or network stream).

A [glib.variant.Variant]’s size is limited mainly by any lower level operating system constraints, such as the number of bits in [gobject.types.size_t]. For example, it is reasonable to have a 2GB file mapped into memory with [glib.mapped_file.MappedFile], and call [glib.variant.Variant.newFromData] on it.

For convenience to C programmers, [glib.variant.Variant] features powerful varargs-based value construction and destruction. This feature is designed to be embedded in other libraries.

There is a Python-inspired text language for describing [glib.variant.Variant] values. [glib.variant.Variant] includes a printer for this language and a parser with type inferencing.

Memory Use

[glib.variant.Variant] tries to be quite efficient with respect to memory use. This section gives a rough idea of how much memory is used by the current implementation. The information here is subject to change in the future.

The memory allocated by [glib.variant.Variant] can be grouped into 4 broad purposes: memory for serialized data, memory for the type information cache, buffer management memory and memory for the [glib.variant.Variant] structure itself.

Serialized Data Memory

This is the memory that is used for storing [glib.variant.Variant] data in serialized form. This is what would be sent over the network or what would end up on disk, not counting any indicator of the endianness, or of the length or type of the top-level variant.

The amount of memory required to store a boolean is 1 byte. 16, 32 and 64 bit integers and double precision floating point numbers use their ‘natural’ size. Strings (including object path and signature strings) are stored with a nul terminator, and as such use the length of the string plus 1 byte.

‘Maybe’ types use no space at all to represent the null value and use the same amount of space (sometimes plus one byte) as the equivalent non-maybe-typed value to represent the non-null case.

Arrays use the amount of space required to store each of their members, concatenated. Additionally, if the items stored in an array are not of a fixed-size (ie: strings, other arrays, etc) then an additional framing offset is stored for each item. The size of this offset is either 1, 2 or 4 bytes depending on the overall size of the container. Additionally, extra padding bytes are added as required for alignment of child values.

Tuples (including dictionary entries) use the amount of space required to store each of their members, concatenated, plus one framing offset (as per arrays) for each non-fixed-sized item in the tuple, except for the last one. Additionally, extra padding bytes are added as required for alignment of child values.

Variants use the same amount of space as the item inside of the variant, plus 1 byte, plus the length of the type string for the item inside the variant.

As an example, consider a dictionary mapping strings to variants. In the case that the dictionary is empty, 0 bytes are required for the serialization.

If we add an item ‘width’ that maps to the int32 value of 500 then we will use 4 bytes to store the int32 (so 6 for the variant containing it) and 6 bytes for the string. The variant must be aligned to 8 after the 6 bytes of the string, so that’s 2 extra bytes. 6 (string) + 2 (padding) + 6 (variant) is 14 bytes used for the dictionary entry. An additional 1 byte is added to the array as a framing offset making a total of 15 bytes.

If we add another entry, ‘title’ that maps to a nullable string that happens to have a value of null, then we use 0 bytes for the null value (and 3 bytes for the variant to contain it along with its type string) plus 6 bytes for the string. Again, we need 2 padding bytes. That makes a total of 6 + 2 + 3 = 11 bytes.

We now require extra padding between the two items in the array. After the 14 bytes of the first item, that’s 2 bytes required. We now require 2 framing offsets for an extra two bytes. 14 + 2 + 11 + 2 = 29 bytes to encode the entire two-item dictionary.

Type Information Cache

For each [glib.variant.Variant] type that currently exists in the program a type information structure is kept in the type information cache. The type information structure is required for rapid deserialization.

Continuing with the above example, if a [glib.variant.Variant] exists with the type a{sv} then a type information struct will exist for a{sv}, {sv}, s, and v. Multiple uses of the same type will share the same type information. Additionally, all single-digit types are stored in read-only static memory and do not contribute to the writable memory footprint of a program using [glib.variant.Variant].

Aside from the type information structures stored in read-only memory, there are two forms of type information. One is used for container types where there is a single element type: arrays and maybe types. The other is used for container types where there are multiple element types: tuples and dictionary entries.

Array type info structures are 6 * sizeof (void *), plus the memory required to store the type string itself. This means that on 32-bit systems, the cache entry for a{sv} would require 30 bytes of memory (plus allocation overhead).

Tuple type info structures are 6 * sizeof (void *), plus 4 * sizeof (void *) for each item in the tuple, plus the memory required to store the type string itself. A 2-item tuple, for example, would have a type information structure that consumed writable memory in the size of 14 * sizeof (void *) (plus type string) This means that on 32-bit systems, the cache entry for {sv} would require 61 bytes of memory (plus allocation overhead).

This means that in total, for our a{sv} example, 91 bytes of type information would be allocated.

The type information cache, additionally, uses a [glib.hash_table.HashTable] to store and look up the cached items and stores a pointer to this hash table in static storage. The hash table is freed when there are zero items in the type cache.

Although these sizes may seem large it is important to remember that a program will probably only have a very small number of different types of values in it and that only one type information structure is required for many different values of the same type.

Buffer Management Memory

[glib.variant.Variant] uses an internal buffer management structure to deal with the various different possible sources of serialized data that it uses. The buffer is responsible for ensuring that the correct call is made when the data is no longer in use by [glib.variant.Variant]. This may involve a func@GLib.free or even [glib.mapped_file.MappedFile.unref].

One buffer management structure is used for each chunk of serialized data. The size of the buffer management structure is 4 * (void *). On 32-bit systems, that’s 16 bytes.

GVariant structure

The size of a [glib.variant.Variant] structure is 6 * (void *). On 32-bit systems, that’s 24 bytes.

[glib.variant.Variant] structures only exist if they are explicitly created with API calls. For example, if a [glib.variant.Variant] is constructed out of serialized data for the example given above (with the dictionary) then although there are 9 individual values that comprise the entire dictionary (two keys, two values, two variants containing the values, two dictionary entries, plus the dictionary itself), only 1 [glib.variant.Variant] instance exists — the one referring to the dictionary.

If calls are made to start accessing the other values then [glib.variant.Variant] instances will exist for those values only for as long as they are in use (ie: until you call [glib.variant.Variant.unref]). The type information is shared. The serialized data and the buffer management structure for that serialized data is shared by the child.

Summary

To put the entire example together, for our dictionary mapping strings to variants (with two entries, as given above), we are using 91 bytes of memory for type information, 29 bytes of memory for the serialized data, 16 bytes for buffer management and 24 bytes for the [glib.variant.Variant] instance, or a total of 160 bytes, plus allocation overhead. If we were to use [glib.variant.Variant.getChildValue] to access the two dictionary entries, we would use an additional 48 bytes. If we were to have other dictionaries of the same type, we would use more memory for the serialized data and buffer management for those dictionaries, but the type information would be shared.

A utility type for constructing container-type #GVariant instances.

This is an opaque structure and may only be accessed using the following functions.

#GVariantBuilder is not threadsafe in any way. Do not attempt to access it from more than one thread.

Fields
UType u

#GVariantDict is a mutable interface to #GVariant dictionaries.

It can be used for doing a sequence of dictionary lookups in an efficient way on an existing #GVariant dictionary or it can be used to construct new dictionaries with a hashtable-like interface. It can also be used for taking existing dictionaries and modifying them in order to create new ones.

#GVariantDict can only be used with G_VARIANT_TYPE_VARDICT dictionaries.

It is possible to use #GVariantDict allocated on the stack or on the heap. When using a stack-allocated #GVariantDict, you begin with a call to [glib.variant_dict.VariantDict.init_] and free the resources with a call to [glib.variant_dict.VariantDict.clear].

Heap-allocated #GVariantDict follows normal refcounting rules: you allocate it with [glib.variant_dict.VariantDict.new_] and use [glib.variant_dict.VariantDict.ref_] and [glib.variant_dict.VariantDict.unref].

[glib.variant_dict.VariantDict.end] is used to convert the #GVariantDict back into a dictionary-type #GVariant. When used with stack-allocated instances, this also implicitly frees all associated memory, but for heap-allocated instances, you must still call [glib.variant_dict.VariantDict.unref] afterwards.

You will typically want to use a heap-allocated #GVariantDict when you expose it as part of an API. For most other uses, the stack-allocated form will be more convenient.

Consider the following two examples that do the same thing in each style: take an existing dictionary and look up the "count" uint32 key, adding 1 to it if it is found, or returning an error if the key is not found. Each returns the new dictionary as a floating #GVariant.

Using a stack-allocated GVariantDict

GVariant *
 add_to_count (GVariant  *orig,
               GError   **error)
 {
   GVariantDict dict;
   guint32 count;

   g_variant_dict_init (&dict, orig);
   if (!g_variant_dict_lookup (&dict, "count", "u", &count))
     {
       g_set_error (...);
       g_variant_dict_clear (&dict);
       return NULL;
     }

   g_variant_dict_insert (&dict, "count", "u", count + 1);

   return g_variant_dict_end (&dict);
 }

Using heap-allocated GVariantDict

GVariant *
 add_to_count (GVariant  *orig,
               GError   **error)
 {
   GVariantDict *dict;
   GVariant *result;
   guint32 count;

   dict = g_variant_dict_new (orig);

   if (g_variant_dict_lookup (dict, "count", "u", &count))
     {
       g_variant_dict_insert (dict, "count", "u", count + 1);
       result = g_variant_dict_end (dict);
     }
   else
     {
       g_set_error (...);
       result = NULL;
     }

   g_variant_dict_unref (dict);

   return result;
 }

#GVariantIter is an opaque data structure and can only be accessed using the following functions.

Fields
size_t[16] x

A type in the [glib.variant.Variant] type system.

This section introduces the [glib.variant.Variant] type system. It is based, in large part, on the D-Bus type system, with two major changes and some minor lifting of restrictions. The

D-Bus specification,

therefore, provides a significant amount of information that is useful when working with [glib.variant.Variant].

The first major change with respect to the D-Bus type system is the introduction of maybe (or ‘nullable’) types. Any type in [glib.variant.Variant] can be converted to a maybe type, in which case, nothing (or null) becomes a valid value. Maybe types have been added by introducing the character m to type strings.

The second major change is that the [glib.variant.Variant] type system supports the concept of ‘indefinite types’ — types that are less specific than the normal types found in D-Bus. For example, it is possible to speak of ‘an array of any type’ in [glib.variant.Variant], where the D-Bus type system would require you to speak of ‘an array of integers’ or ‘an array of strings’. Indefinite types have been added by introducing the characters `*`, `?` and r to type strings.

Finally, all arbitrary restrictions relating to the complexity of types are lifted along with the restriction that dictionary entries may only appear nested inside of arrays.

Just as in D-Bus, [glib.variant.Variant] types are described with strings (‘type strings’). Subject to the differences mentioned above, these strings are of the same form as those found in D-Bus. Note, however: D-Bus always works in terms of messages and therefore individual type strings appear nowhere in its interface. Instead, ‘signatures’ are a concatenation of the strings of the type of each argument in a message. [glib.variant.Variant] deals with single values directly so [glib.variant.Variant] type strings always describe the type of exactly one value. This means that a D-Bus signature string is generally not a valid [glib.variant.Variant] type string — except in the case that it is the signature of a message containing exactly one argument.

An indefinite type is similar in spirit to what may be called an abstract type in other type systems. No value can exist that has an indefinite type as its type, but values can exist that have types that are subtypes of indefinite types. That is to say, [glib.variant.Variant.getType] will never return an indefinite type, but calling [glib.variant.Variant.isOfType] with an indefinite type may return true. For example, you cannot have a value that represents ‘an array of no particular type’, but you can have an ‘array of integers’ which certainly matches the type of ‘an array of no particular type’, since ‘array of integers’ is a subtype of ‘array of no particular type’.

This is similar to how instances of abstract classes may not directly exist in other type systems, but instances of their non-abstract subtypes may. For example, in GTK, no object that has the type of [[gtk.widget.Widget]](https://docs.gtk.org/gtk4/class.Widget.html) can exist (since [gtk.widget.Widget] is an abstract class), but a [[gtk.window.Window]](https://docs.gtk.org/gtk4/class.Window.html) can certainly be instantiated, and you would say that a [gtk.window.Window] is a [gtk.widget.Widget] (since [gtk.window.Window] is a subclass of [gtk.widget.Widget]).

Two types may not be compared by value; use [glib.variant_type.VariantType.equal] or [glib.variant_type.VariantType.isSubtypeOf] May be copied using [glib.variant_type.VariantType.copy] and freed using [glib.variant_type.VariantType.free].

GVariant Type Strings

A [glib.variant.Variant] type string can be any of the following:

  • any basic type string (listed below)
  • v, r or `*`
  • one of the characters a or m, followed by another type string
  • the character `(`, followed by a concatenation of zero or more other

type strings, followed by the character `)`

  • the character `{`, followed by a basic type string (see below),

followed by another type string, followed by the character `}`

A basic type string describes a basic type (as per [glib.variant_type.VariantType.isBasic]) and is always a single character in length. The valid basic type strings are b, y, n, q, i, u, x, t, h, d, s, o, g and `?`.

The above definition is recursive to arbitrary depth. aaaaai and (ui(nq((y)))s) are both valid type strings, as is a(aa(ui)(qna{ya(yd)})). In order to not hit memory limits, [glib.variant.Variant] imposes a limit on recursion depth of 65 nested containers. This is the limit in the D-Bus specification (64) plus one to allow a [[gio.dbus_message.DBusMessage]](../gio/class.DBusMessage.html) to be nested in a top-level tuple.

The meaning of each of the characters is as follows:

  • b: the type string of G_VARIANT_TYPE_BOOLEAN; a boolean value.
  • y: the type string of G_VARIANT_TYPE_BYTE; a byte.
  • n: the type string of G_VARIANT_TYPE_INT16; a signed 16 bit integer.
  • q: the type string of G_VARIANT_TYPE_UINT16; an unsigned 16 bit integer.
  • i: the type string of G_VARIANT_TYPE_INT32; a signed 32 bit integer.
  • u: the type string of G_VARIANT_TYPE_UINT32; an unsigned 32 bit integer.
  • x: the type string of G_VARIANT_TYPE_INT64; a signed 64 bit integer.
  • t: the type string of G_VARIANT_TYPE_UINT64; an unsigned 64 bit integer.
  • h: the type string of G_VARIANT_TYPE_HANDLE; a signed 32 bit value

that, by convention, is used as an index into an array of file descriptors that are sent alongside a D-Bus message.

  • d: the type string of G_VARIANT_TYPE_DOUBLE; a double precision

floating point value.

  • s: the type string of G_VARIANT_TYPE_STRING; a string.
  • o: the type string of G_VARIANT_TYPE_OBJECT_PATH; a string in the form

of a D-Bus object path.

  • g: the type string of G_VARIANT_TYPE_SIGNATURE; a string in the form of

a D-Bus type signature.

  • `?`: the type string of G_VARIANT_TYPE_BASIC; an indefinite type that

is a supertype of any of the basic types.

  • v: the type string of G_VARIANT_TYPE_VARIANT; a container type that

contain any other type of value.

  • a: used as a prefix on another type string to mean an array of that

type; the type string ai, for example, is the type of an array of signed 32-bit integers.

  • m: used as a prefix on another type string to mean a ‘maybe’, or

‘nullable’, version of that type; the type string ms, for example, is the type of a value that maybe contains a string, or maybe contains nothing.

  • `()`: used to enclose zero or more other concatenated type strings to

create a tuple type; the type string (is), for example, is the type of a pair of an integer and a string.

  • r: the type string of G_VARIANT_TYPE_TUPLE; an indefinite type that is

a supertype of any tuple type, regardless of the number of items.

  • `{}`: used to enclose a basic type string concatenated with another type

string to create a dictionary entry type, which usually appears inside of an array to form a dictionary; the type string a{sd}, for example, is the type of a dictionary that maps strings to double precision floating point values.

The first type (the basic type) is the key type and the second type is the value type. The reason that the first type is restricted to being a basic type is so that it can easily be hashed.

  • `*`: the type string of G_VARIANT_TYPE_ANY; the indefinite type that is

a supertype of all types. Note that, as with all type strings, this character represents exactly one type. It cannot be used inside of tuples to mean ‘any number of items’.

Any type string of a container that contains an indefinite type is, itself, an indefinite type. For example, the type string a* (corresponding to G_VARIANT_TYPE_ARRAY) is an indefinite type that is a supertype of every array type. (*s) is a supertype of all tuples that contain exactly two items where the second item is a string.

a{?*} is an indefinite type that is a supertype of all arrays containing dictionary entries where the key is any basic type and the value is any type at all. This is, by definition, a dictionary, so this type string corresponds to G_VARIANT_TYPE_DICTIONARY. Note that, due to the restriction that the key of a dictionary entry must be a basic type, `{**}` is not a valid type string.

aliasGCacheDestroyFunc = void function(void * value)
aliasGCacheDupFunc = void * function(void * value)
aliasGCacheNewFunc = void * function(void * key)
aliasGChildWatchFunc = void function(GPid pid, int waitStatus, void * userData)
aliasGClearHandleFunc = void function(uint handleId)
aliasGCompareDataFunc = int function(const(void) * a, const(void) * b, void * userData)
aliasGCompareFunc = int function(const(void) * a, const(void) * b)
aliasGCompletionFunc = char * function(void * item)
aliasGCompletionStrncmpFunc = int function(const(char) * s1, const(char) * s2, size_t n)
aliasGCopyFunc = void * function(const(void) * src, void * data)
aliasGDataForeachFunc = void function(GQuark keyId, void * data, void * userData)
aliasGDestroyNotify = void function(void * data)
aliasGDuplicateFunc = void * function(void * data, void * userData)
aliasGEqualFunc = gboolean function(const(void) * a, const(void) * b)
aliasGEqualFuncFull = gboolean function(const(void) * a, const(void) * b, void * userData)
aliasGErrorClearFunc = void function(GError * error)
aliasGErrorCopyFunc = void function(const(GError) * srcError, GError * destError)
aliasGErrorInitFunc = void function(GError * error)
aliasGFreeFunc = void function(void * data)
aliasGFunc = void function(void * data, void * userData)
aliasGHFunc = void function(void * key, void * value, void * userData)
aliasGHRFunc = gboolean function(void * key, void * value, void * userData)
aliasGHashFunc = uint function(const(void) * key)
aliasGHookCheckFunc = gboolean function(void * data)
aliasGHookCheckMarshaller = gboolean function(GHook * hook, void * marshalData)
aliasGHookCompareFunc = int function(GHook * newHook, GHook * sibling)
aliasGHookFinalizeFunc = void function(GHookList * hookList, GHook * hook)
aliasGHookFindFunc = gboolean function(GHook * hook, void * data)
aliasGHookFunc = void function(void * data)
aliasGHookMarshaller = void function(GHook * hook, void * marshalData)
aliasGIOFunc = gboolean function(GIOChannel * source, GIOCondition condition, void * data)
aliasGLogFunc = void function(const(char) * logDomain, GLogLevelFlags logLevel, const(char) * message, void * userData)
aliasGLogWriterFunc = GLogWriterOutput function(GLogLevelFlags logLevel, const(GLogField) * fields, size_t nFields, void * userData)
aliasGNodeForeachFunc = void function(GNode * node, void * data)
aliasGNodeTraverseFunc = gboolean function(GNode * node, void * data)
aliasGOptionArgFunc = gboolean function(const(char) * optionName, const(char) * value, void * data, GError * * _err)
aliasGOptionErrorFunc = void function(GOptionContext * context, GOptionGroup * group, void * data, GError * * _err)
aliasGOptionParseFunc = gboolean function(GOptionContext * context, GOptionGroup * group, void * data, GError * * _err)
aliasGPollFunc = int function(GPollFD * ufds, uint nfsd, int timeout)
aliasGPrintFunc = void function(const(char) * string_)
aliasGRegexEvalCallback = gboolean function(const(GMatchInfo) * matchInfo, GString * result, void * userData)
aliasGScannerMsgFunc = void function(GScanner * scanner, char * message, gboolean error)
aliasGSequenceIterCompareFunc = int function(GSequenceIter * a, GSequenceIter * b, void * data)
aliasGSourceDisposeFunc = void function(GSource * source)
aliasGSourceDummyMarshal = void function()
aliasGSourceFunc = gboolean function(void * userData)
aliasGSourceOnceFunc = void function(void * userData)
aliasGSpawnChildSetupFunc = void function(void * data)
aliasGTestDataFunc = void function(const(void) * userData)
aliasGTestFixtureFunc = void function(void * fixture, const(void) * userData)
aliasGTestFunc = void function()
aliasGTestLogFatalFunc = gboolean function(const(char) * logDomain, GLogLevelFlags logLevel, const(char) * message, void * userData)
aliasGThreadFunc = void * function(void * data)
aliasGTranslateFunc = const(char) * function(const(char) * str, void * data)
aliasGTraverseFunc = gboolean function(void * key, void * value, void * data)
aliasGTraverseNodeFunc = gboolean function(GTreeNode * node, void * data)
aliasGUnixFDSourceFunc = gboolean function(int fd, GIOCondition condition, void * userData)
aliasGVoidFunc = void function()