glib.global

Undocumented in source.

Members

Functions

access
int access(string filename, int mode)

A wrapper for the POSIX access() function. This function is used to test a pathname for one or several of read, write or execute permissions, or just existence.

alignedAlloc
void* alignedAlloc(size_t nBlocks, size_t nBlockBytes, size_t alignment)

This function is similar to glib.global.gmalloc, allocating (n_blocks * n_block_bytes) bytes, but care is taken to align the allocated memory to with the given alignment value. Additionally, it will detect possible overflow during multiplication.

alignedAlloc0
void* alignedAlloc0(size_t nBlocks, size_t nBlockBytes, size_t alignment)

This function is similar to glib.global.alignedAlloc, but it will also clear the allocated memory before returning it.

alignedFree
void alignedFree(void* mem)

Frees the memory allocated by glib.global.alignedAlloc.

alignedFreeSized
void alignedFreeSized(void* mem, size_t alignment, size_t size)

Frees the memory pointed to by mem, assuming it is has the given size and alignment.

asciiDigitValue
int asciiDigitValue(char c)

Determines the numeric value of a character as a decimal digit. If the character is not a decimal digit according to funcGLib.ascii_isdigit, -1 is returned.

asciiDtostr
string asciiDtostr(string buffer, int bufLen, double d)

Converts a graphene.types.PI_2 to a string, using the '.' as decimal point.

asciiFormatd
string asciiFormatd(string buffer, int bufLen, string format, double d)

Converts a graphene.types.PI_2 to a string, using the '.' as decimal point. To format the number you pass in a printf()-style format string. Allowed conversion specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.

asciiStrcasecmp
int asciiStrcasecmp(string s1, string s2)

Compare two strings, ignoring the case of ASCII characters.

asciiStrdown
string asciiStrdown(string str, ptrdiff_t len)

Converts all upper case ASCII letters to lower case ASCII letters, with semantics that exactly match funcGLib.ascii_tolower.

asciiStringToSigned
bool asciiStringToSigned(string str, uint base, long min, long max, long outNum)

A convenience function for converting a string to a signed number.

asciiStringToUnsigned
bool asciiStringToUnsigned(string str, uint base, ulong min, ulong max, ulong outNum)

A convenience function for converting a string to an unsigned number.

asciiStrncasecmp
int asciiStrncasecmp(string s1, string s2, size_t n)

Compare s1 and s2, ignoring the case of ASCII characters and any characters after the first n in each string. If either string is less than n bytes long, comparison will stop at the first nul byte encountered.

asciiStrtod
double asciiStrtod(string nptr, string endptr)

Converts a string to a floating point value.

asciiStrtoll
long asciiStrtoll(string nptr, string endptr, uint base)

Converts a string to a gst.types.FORMAT_PERCENT_SCALE value.

asciiStrtoull
ulong asciiStrtoull(string nptr, string endptr, uint base)

Converts a string to a vte.types.TEST_FLAGS_NONE value.

asciiStrup
string asciiStrup(string str, ptrdiff_t len)

Converts all lower case ASCII letters to upper case ASCII letters, with semantics that exactly match funcGLib.ascii_toupper.

asciiTolower
char asciiTolower(char c)

Convert a character to ASCII lower case. If the character is not an ASCII upper case letter, it is returned unchanged.

asciiToupper
char asciiToupper(char c)

Convert a character to ASCII upper case. If the character is not an ASCII lower case letter, it is returned unchanged.

asciiXdigitValue
int asciiXdigitValue(char c)

Determines the numeric value of a character as a hexadecimal digit. If the character is not a hex digit according to funcGLib.ascii_isxdigit, -1 is returned.

assertWarning
void assertWarning(string logDomain, string file, int line, string prettyFunction, string expression)
assertionMessage
void assertionMessage(string domain, string file, int line, string func, string message)
assertionMessageCmpint
void assertionMessageCmpint(string domain, string file, int line, string func, string expr, ulong arg1, string cmp, ulong arg2, char numtype)
assertionMessageCmpstr
void assertionMessageCmpstr(string domain, string file, int line, string func, string expr, string arg1, string cmp, string arg2)
assertionMessageCmpstrv
void assertionMessageCmpstrv(string domain, string file, int line, string func, string expr, string[] arg1, string[] arg2, size_t firstWrongIdx)
assertionMessageError
void assertionMessageError(string domain, string file, int line, string func, string expr, glib.error.ErrorG error, glib.types.Quark errorDomain, int errorCode)
atomicIntAdd
int atomicIntAdd(int atomic, int val)

Atomically adds val to the value of atomic.

atomicIntAnd
uint atomicIntAnd(uint atomic, uint val)

Performs an atomic bitwise 'and' of the value of atomic and val, storing the result back in atomic.

atomicIntCompareAndExchange
bool atomicIntCompareAndExchange(int atomic, int oldval, int newval)

Compares atomic to oldval and, if equal, sets it to newval. If atomic was not equal to oldval then no change occurs.

atomicIntCompareAndExchangeFull
bool atomicIntCompareAndExchangeFull(int atomic, int oldval, int newval, int preval)

Compares atomic to oldval and, if equal, sets it to newval. If atomic was not equal to oldval then no change occurs. In any case the value of atomic before this operation is stored in preval.

atomicIntDecAndTest
bool atomicIntDecAndTest(int atomic)

Decrements the value of atomic by 1.

atomicIntExchange
int atomicIntExchange(int atomic, int newval)

Sets the atomic to newval and returns the old value from atomic.

atomicIntExchangeAndAdd
int atomicIntExchangeAndAdd(int atomic, int val)

This function existed before glib.global.atomicIntAdd returned the prior value of the integer (which it now does). It is retained only for compatibility reasons. Don't use this function in new code.

atomicIntGet
int atomicIntGet(int atomic)

Gets the current value of atomic.

atomicIntInc
void atomicIntInc(int atomic)

Increments the value of atomic by 1.

atomicIntOr
uint atomicIntOr(uint atomic, uint val)

Performs an atomic bitwise 'or' of the value of atomic and val, storing the result back in atomic.

atomicIntSet
void atomicIntSet(int atomic, int newval)

Sets the value of atomic to newval.

atomicIntXor
uint atomicIntXor(uint atomic, uint val)

Performs an atomic bitwise 'xor' of the value of atomic and val, storing the result back in atomic.

atomicPointerAdd
ptrdiff_t atomicPointerAdd(void* atomic, ptrdiff_t val)

Atomically adds val to the value of atomic.

atomicPointerAnd
size_t atomicPointerAnd(void* atomic, size_t val)

Performs an atomic bitwise 'and' of the value of atomic and val, storing the result back in atomic.

atomicPointerCompareAndExchange
bool atomicPointerCompareAndExchange(void* atomic, void* oldval, void* newval)

Compares atomic to oldval and, if equal, sets it to newval. If atomic was not equal to oldval then no change occurs.

atomicPointerCompareAndExchangeFull
bool atomicPointerCompareAndExchangeFull(void* atomic, void* oldval, void* newval, void* preval)

Compares atomic to oldval and, if equal, sets it to newval. If atomic was not equal to oldval then no change occurs. In any case the value of atomic before this operation is stored in preval.

atomicPointerExchange
void* atomicPointerExchange(void* atomic, void* newval)

Sets the atomic to newval and returns the old value from atomic.

atomicPointerGet
void* atomicPointerGet(void* atomic)

Gets the current value of atomic.

atomicPointerOr
size_t atomicPointerOr(void* atomic, size_t val)

Performs an atomic bitwise 'or' of the value of atomic and val, storing the result back in atomic.

atomicPointerSet
void atomicPointerSet(void* atomic, void* newval)

Sets the value of atomic to newval.

atomicPointerXor
size_t atomicPointerXor(void* atomic, size_t val)

Performs an atomic bitwise 'xor' of the value of atomic and val, storing the result back in atomic.

atomicRcBoxAcquire
void* atomicRcBoxAcquire(void* memBlock)

Atomically acquires a reference on the data pointed by mem_block.

atomicRcBoxAlloc
void* atomicRcBoxAlloc(size_t blockSize)

Allocates block_size bytes of memory, and adds atomic reference counting semantics to it.

atomicRcBoxAlloc0
void* atomicRcBoxAlloc0(size_t blockSize)

Allocates block_size bytes of memory, and adds atomic reference counting semantics to it.

atomicRcBoxDup
void* atomicRcBoxDup(size_t blockSize, const(void)* memBlock)

Allocates a new block of data with atomic reference counting semantics, and copies block_size bytes of mem_block into it.

atomicRcBoxGetSize
size_t atomicRcBoxGetSize(void* memBlock)

Retrieves the size of the reference counted data pointed by mem_block.

atomicRcBoxRelease
void atomicRcBoxRelease(void* memBlock)

Atomically releases a reference on the data pointed by mem_block.

atomicRcBoxReleaseFull
void atomicRcBoxReleaseFull(void* memBlock, glib.types.DestroyNotify clearFunc)

Atomically releases a reference on the data pointed by mem_block.

atomicRefCountCompare
bool atomicRefCountCompare(int arc, int val)

Atomically compares the current value of arc with val.

atomicRefCountDec
bool atomicRefCountDec(int arc)

Atomically decreases the reference count.

atomicRefCountInc
void atomicRefCountInc(int arc)

Atomically increases the reference count.

atomicRefCountInit
void atomicRefCountInit(int arc)

Initializes a reference count variable to 1.

base64Decode
ubyte[] base64Decode(string text)

Decode a sequence of Base-64 encoded text into binary data. Note that the returned binary data is not necessarily zero-terminated, so it should not be used as a character string.

base64Encode
string base64Encode(ubyte[] data)

Encode a sequence of binary data into its Base-64 stringified representation.

basename
string basename(string fileName)

Gets the name of the file without any leading directory components. It returns a pointer into the given file name string.

bitLock
void bitLock(int address, int lockBit)

Sets the indicated lock_bit in address. If the bit is already set, this call will block until glib.global.bitUnlock unsets the corresponding bit.

bitNthLsf
int bitNthLsf(gulong mask, int nthBit)

Find the position of the first bit set in mask, searching from (but not including) nth_bit upwards. Bits are numbered from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the 0th bit, set nth_bit to -1.

bitNthMsf
int bitNthMsf(gulong mask, int nthBit)

Find the position of the first bit set in mask, searching from (but not including) nth_bit downwards. Bits are numbered from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the last bit, set nth_bit to -1 or GLIB_SIZEOF_LONG * 8.

bitStorage
uint bitStorage(gulong number)

Gets the number of bits used to hold number, e.g. if number is 4, 3 bits are needed.

bitTrylock
bool bitTrylock(int address, int lockBit)

Sets the indicated lock_bit in address, returning true if successful. If the bit is already set, returns false immediately.

bitUnlock
void bitUnlock(int address, int lockBit)

Clears the indicated lock_bit in address. If another thread is currently blocked in glib.global.bitLock on this same bit then it will be woken up.

blowChunks
void blowChunks()
buildFilenamev
string buildFilenamev(string[] args)

Creates a filename from a vector of elements using the correct separator for the current platform.

buildPathv
string buildPathv(string separator, string[] args)

Behaves exactly like glib.global.buildPath, but takes the path elements as a string array, instead of variadic arguments.

canonicalizeFilename
string canonicalizeFilename(string filename, string relativeTo)

Gets the canonical file name from filename. All triple slashes are turned into single slashes, and all .. and .s resolved against relative_to.

chdir
int chdir(string path)

A wrapper for the POSIX chdir() function. The function changes the current directory of the process to path.

checkVersion
string checkVersion(uint requiredMajor, uint requiredMinor, uint requiredMicro)

Checks that the GLib library in use is compatible with the given version.

childWatchAdd
uint childWatchAdd(int priority, glib.types.Pid pid, glib.types.ChildWatchFunc function_)

Sets a function to be called when the child indicated by pid exits, at the priority priority.

childWatchSourceNew
glib.source.Source childWatchSourceNew(glib.types.Pid pid)

Creates a new child_watch source.

chmod
int chmod(string filename, int mode)

A wrapper for the POSIX chmod() function. The chmod() function is used to set the permissions of a file system object.

clearError
void clearError()

If err or *err is null, does nothing. Otherwise, calls glib.error.ErrorG.free on *err and sets *err to null.

close
bool close(int fd)

This wraps the close() call. In case of error, errno will be preserved, but the error will also be stored as a #GError in error. In case of success, errno is undefined.

closefrom
int closefrom(int lowfd)

Close every file descriptor equal to or greater than lowfd.

computeChecksumForBytes
string computeChecksumForBytes(glib.types.ChecksumType checksumType, glib.bytes.Bytes data)

Computes the checksum for a binary data. This is a convenience wrapper for glib.checksum.Checksum.new_, glib.checksum.Checksum.getString and glib.checksum.Checksum.free.

computeChecksumForData
string computeChecksumForData(glib.types.ChecksumType checksumType, ubyte[] data)

Computes the checksum for a binary data of length. This is a convenience wrapper for glib.checksum.Checksum.new_, glib.checksum.Checksum.getString and glib.checksum.Checksum.free.

computeChecksumForString
string computeChecksumForString(glib.types.ChecksumType checksumType, string str, ptrdiff_t length)

Computes the checksum of a string.

computeHmacForBytes
string computeHmacForBytes(glib.types.ChecksumType digestType, glib.bytes.Bytes key, glib.bytes.Bytes data)

Computes the HMAC for a binary data. This is a convenience wrapper for glib.hmac.Hmac.new_, glib.hmac.Hmac.getString and glib.hmac.Hmac.unref.

computeHmacForData
string computeHmacForData(glib.types.ChecksumType digestType, ubyte[] key, ubyte[] data)

Computes the HMAC for a binary data of length. This is a convenience wrapper for glib.hmac.Hmac.new_, glib.hmac.Hmac.getString and glib.hmac.Hmac.unref.

computeHmacForString
string computeHmacForString(glib.types.ChecksumType digestType, ubyte[] key, string str, ptrdiff_t length)

Computes the HMAC for a string.

convert
ubyte[] convert(ubyte[] str, string toCodeset, string fromCodeset, size_t bytesRead)

Converts a string from one character set to another.

convertErrorQuark
glib.types.Quark convertErrorQuark()
convertWithFallback
ubyte[] convertWithFallback(ubyte[] str, string toCodeset, string fromCodeset, string fallback, size_t bytesRead)

Converts a string from one character set to another, possibly including fallback sequences for characters not representable in the output. Note that it is not guaranteed that the specification for the fallback sequences in fallback will be honored. Some systems may do an approximate conversion from from_codeset to to_codeset in their iconv() functions, in which case GLib will simply return that approximate conversion.

creat
int creat(string filename, int mode)

A wrapper for the POSIX creat() function. The creat() function is used to convert a pathname into a file descriptor, creating a file if necessary.

datasetDestroy
void datasetDestroy(const(void)* datasetLocation)

Destroys the dataset, freeing all memory allocated, and calling any destroy functions set for data elements.

datasetForeach
void datasetForeach(const(void)* datasetLocation, glib.types.DataForeachFunc func)

Calls the given function for each data element which is associated with the given location. Note that this function is NOT thread-safe. So unless dataset_location can be protected from any modifications during invocation of this function, it should not be called.

datasetIdGetData
void* datasetIdGetData(const(void)* datasetLocation, glib.types.Quark keyId)

Gets the data element corresponding to a #GQuark.

dcgettext
string dcgettext(string domain, string msgid, int category)

This is a variant of glib.global.dgettext that allows specifying a locale category instead of always using LC_MESSAGES. See glib.global.dgettext for more information about how this functions differs from calling dcgettext() directly.

dgettext
string dgettext(string domain, string msgid)

This function is a wrapper of dgettext() which does not translate the message if the default domain as set with textdomain() has no translations for the current locale.

directEqual
bool directEqual(const(void)* v1, const(void)* v2)

Compares two #gpointer arguments and returns true if they are equal. It can be passed to glib.hash_table.HashTable.new_ as the key_equal_func parameter, when using opaque pointers compared by pointer value as keys in a #GHashTable.

directHash
uint directHash(const(void)* v)

Converts a gpointer to a hash value. It can be passed to glib.hash_table.HashTable.new_ as the hash_func parameter, when using opaque pointers compared by pointer value as keys in a #GHashTable.

dngettext
string dngettext(string domain, string msgid, string msgidPlural, gulong n)

This function is a wrapper of dngettext() which does not translate the message if the default domain as set with textdomain() has no translations for the current locale.

doubleEqual
bool doubleEqual(const(void)* v1, const(void)* v2)

Compares the two #gdouble values being pointed to and returns true if they are equal. It can be passed to glib.hash_table.HashTable.new_ as the key_equal_func parameter, when using non-null pointers to doubles as keys in a #GHashTable.

doubleHash
uint doubleHash(const(void)* v)

Converts a pointer to a #gdouble to a hash value. It can be passed to glib.hash_table.HashTable.new_ as the hash_func parameter, It can be passed to glib.hash_table.HashTable.new_ as the hash_func parameter, when using non-null pointers to doubles as keys in a #GHashTable.

dpgettext
string dpgettext(string domain, string msgctxtid, size_t msgidoffset)

This function is a variant of glib.global.dgettext which supports a disambiguating message context. GNU gettext uses the '\004' character to separate the message context and message id in msgctxtid. If 0 is passed as msgidoffset, this function will fall back to trying to use the deprecated convention of using "|" as a separation character.

dpgettext2
string dpgettext2(string domain, string context, string msgid)

This function is a variant of glib.global.dgettext which supports a disambiguating message context. GNU gettext uses the '\004' character to separate the message context and message id in msgctxtid.

environGetenv
string environGetenv(string[] envp, string variable)

Returns the value of the environment variable variable in the provided list envp.

fdwalkSetCloexec
int fdwalkSetCloexec(int lowfd)

Mark every file descriptor equal to or greater than lowfd to be closed at the next execve() or similar, as if via the FD_CLOEXEC flag.

fileErrorFromErrno
glib.types.FileError fileErrorFromErrno(int errNo)

Gets a #GFileError constant based on the passed-in err_no.

fileErrorQuark
glib.types.Quark fileErrorQuark()
fileGetContents
bool fileGetContents(string filename, ubyte[] contents)

Reads an entire file into allocated memory, with good error checking.

fileOpenTmp
int fileOpenTmp(string tmpl, string nameUsed)

Opens a file for writing in the preferred directory for temporary files (as returned by glib.global.getTmpDir).

fileReadLink
string fileReadLink(string filename)

Reads the contents of the symbolic link filename like the POSIX readlink() function.

fileSetContents
bool fileSetContents(string filename, ubyte[] contents)

Writes all of contents to a file named filename. This is a convenience wrapper around calling glib.global.fileSetContentsFull with flags set to G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING and mode set to 0666.

fileSetContentsFull
bool fileSetContentsFull(string filename, ubyte[] contents, glib.types.FileSetContentsFlags flags, int mode)

Writes all of contents to a file named filename, with good error checking. If a file called filename already exists it will be overwritten.

fileTest
bool fileTest(string filename, glib.types.FileTest test)

Returns true if any of the tests in the bitfield test are true. For example, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) will return true if the file exists; the check whether it's a directory doesn't matter since the existence test is true. With the current set of available tests, there's no point passing in more than one test at a time.

filenameDisplayBasename
string filenameDisplayBasename(string filename)

Returns the display basename for the particular filename, guaranteed to be valid UTF-8. The display name might not be identical to the filename, for instance there might be problems converting it to UTF-8, and some files can be translated in the display.

filenameDisplayName
string filenameDisplayName(string filename)

Converts a filename into a valid UTF-8 string. The conversion is not necessarily reversible, so you should keep the original around and use the return value of this function only for display purposes. Unlike glib.global.filenameToUtf8, the result is guaranteed to be non-null even if the filename actually isn't in the GLib file name encoding.

filenameFromUri
string filenameFromUri(string uri, string hostname)

Converts an escaped ASCII-encoded URI to a local filename in the encoding used for filenames.

filenameFromUtf8
string filenameFromUtf8(string utf8string, ptrdiff_t len, size_t bytesRead, size_t bytesWritten)

Converts a string from UTF-8 to the encoding GLib uses for filenames. Note that on Windows GLib uses UTF-8 for filenames; on other platforms, this function indirectly depends on the [current locale]setlocale.

filenameToUri
string filenameToUri(string filename, string hostname)

Converts an absolute filename to an escaped ASCII-encoded URI, with the path component following Section 3.3. of RFC 2396.

filenameToUtf8
string filenameToUtf8(string opsysstring, ptrdiff_t len, size_t bytesRead, size_t bytesWritten)

Converts a string which is in the encoding used by GLib for filenames into a UTF-8 string. Note that on Windows GLib uses UTF-8 for filenames; on other platforms, this function indirectly depends on the [current locale]setlocale.

findProgramInPath
string findProgramInPath(string program)

Locates the first executable named program in the user's path, in the same way that execvp() would locate it. Returns an allocated string with the absolute path name, or null if the program is not found in the path. If program is already an absolute path, returns a copy of program if program exists and is executable, and null otherwise.

fopen
void* fopen(string filename, string mode)

A wrapper for the stdio fopen() function. The fopen() function opens a file and associates a new stream with it.

formatSize
string formatSize(ulong size)

Formats a size (for example the size of a file) into a human readable string. Sizes are rounded to the nearest size prefix (kB, MB, GB) and are displayed rounded to the nearest tenth. E.g. the file size 3292528 bytes will be converted into the string "3.2 MB". The returned string is UTF-8, and may use a non-breaking space to separate the number and units, to ensure they aren’t separated when line wrapped.

formatSizeForDisplay
string formatSizeForDisplay(long size)

Formats a size (for example the size of a file) into a human readable string. Sizes are rounded to the nearest size prefix (KB, MB, GB) and are displayed rounded to the nearest tenth. E.g. the file size 3292528 bytes will be converted into the string "3.1 MB".

formatSizeFull
string formatSizeFull(ulong size, glib.types.FormatSizeFlags flags)

Formats a size.

freeSized
void freeSized(void* mem, size_t size)

Frees the memory pointed to by mem, assuming it is has the given size.

freopen
void* freopen(string filename, string mode, void* stream)

A wrapper for the POSIX freopen() function. The freopen() function opens a file and associates it with an existing stream.

fsync
int fsync(int fd)

A wrapper for the POSIX fsync() function. On Windows, _commit() will be used. On macOS, fcntl(F_FULLFSYNC) will be used. The fsync() function is used to synchronize a file's in-core state with that of the disk.

getApplicationName
string getApplicationName()

Gets a human-readable name for the application, as set by glib.global.setApplicationName. This name should be localized if possible, and is intended for display to the user. Contrast with glib.global.getPrgname, which gets a non-localized name. If glib.global.setApplicationName has not been called, returns the result of glib.global.getPrgname (which may be null if glib.global.setPrgname has also not been called).

getCharset
bool getCharset(string charset)

Obtains the character set for the [current locale]setlocale; you might use this character set as an argument to glib.global.convert, to convert from the current locale's encoding to some other encoding. (Frequently glib.global.localeToUtf8 and glib.global.localeFromUtf8 are nice shortcuts, though.)

getCodeset
string getCodeset()

Gets the character set for the current locale.

getConsoleCharset
bool getConsoleCharset(string charset)

Obtains the character set used by the console attached to the process, which is suitable for printing output to the terminal.

getCurrentDir
string getCurrentDir()

Gets the current directory.

getCurrentTime
void getCurrentTime(glib.time_val.TimeVal result)

Equivalent to the UNIX gettimeofday() function, but portable.

getEnviron
string[] getEnviron()

Gets the list of environment variables for the current process.

getFilenameCharsets
bool getFilenameCharsets(string[] filenameCharsets)

Determines the preferred character sets used for filenames. The first character set from the charsets is the filename encoding, the subsequent character sets are used when trying to generate a displayable representation of a filename, see glib.global.filenameDisplayName.

getHomeDir
string getHomeDir()

Gets the current user's home directory.

getHostName
string getHostName()

Return a name for the machine.

getLanguageNames
string[] getLanguageNames()

Computes a list of applicable locale names, which can be used to e.g. construct locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable and always contains the default locale "C".

getLanguageNamesWithCategory
string[] getLanguageNamesWithCategory(string categoryName)

Computes a list of applicable locale names with a locale category name, which can be used to construct the fallback locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable and always contains the default locale "C".

getLocaleVariants
string[] getLocaleVariants(string locale)

Returns a list of derived variants of locale, which can be used to e.g. construct locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable. This function handles territory, charset and extra locale modifiers. See `setlocale(3)` for information about locales and their format.

getMonotonicTime
long getMonotonicTime()

Queries the system monotonic time.

getNumProcessors
uint getNumProcessors()

Determine the approximate number of threads that the system will schedule simultaneously for this process. This is intended to be used as a parameter to glib.thread_pool.ThreadPool.new_ for CPU bound tasks and similar cases.

getOsInfo
string getOsInfo(string keyName)

Get information about the operating system.

getPrgname
string getPrgname()

Gets the name of the program. This name should not be localized, in contrast to glib.global.getApplicationName.

getRealName
string getRealName()

Gets the real name of the user. This usually comes from the user's entry in the passwd file. The encoding of the returned string is system-defined. (On Windows, it is, however, always UTF-8.) If the real user name cannot be determined, the string "Unknown" is returned.

getRealTime
long getRealTime()

Queries the system wall-clock time.

getSystemConfigDirs
string[] getSystemConfigDirs()

Returns an ordered list of base directories in which to access system-wide configuration information.

getSystemDataDirs
string[] getSystemDataDirs()

Returns an ordered list of base directories in which to access system-wide application data.

getTmpDir
string getTmpDir()

Gets the directory to use for temporary files.

getUserCacheDir
string getUserCacheDir()

Returns a base directory in which to store non-essential, cached data specific to particular user.

getUserConfigDir
string getUserConfigDir()

Returns a base directory in which to store user-specific application configuration information such as user preferences and settings.

getUserDataDir
string getUserDataDir()

Returns a base directory in which to access application data such as icons that is customized for a particular user.

getUserName
string getUserName()

Gets the user name of the current user. The encoding of the returned string is system-defined. On UNIX, it might be the preferred file name encoding, or something else, and there is no guarantee that it is even consistent on a machine. On Windows, it is always UTF-8.

getUserRuntimeDir
string getUserRuntimeDir()

Returns a directory that is unique to the current user on the local system.

getUserSpecialDir
string getUserSpecialDir(glib.types.UserDirectory directory)

Returns the full path of a special directory using its logical id.

getUserStateDir
string getUserStateDir()

Returns a base directory in which to store state files specific to particular user.

getenv
string getenv(string variable)

Returns the value of an environment variable.

gfree
void gfree(void* mem)

Frees the memory pointed to by mem.

gmalloc
void* gmalloc(size_t nBytes)

Allocates n_bytes bytes of memory. If n_bytes is 0 it returns null.

hostnameIsAsciiEncoded
bool hostnameIsAsciiEncoded(string hostname)

Tests if hostname contains segments with an ASCII-compatible encoding of an Internationalized Domain Name. If this returns true, you should decode the hostname with glib.global.hostnameToUnicode before displaying it to the user.

hostnameIsIpAddress
bool hostnameIsIpAddress(string hostname)

Tests if hostname is the string form of an IPv4 or IPv6 address. (Eg, "192.168.0.1".)

hostnameIsNonAscii
bool hostnameIsNonAscii(string hostname)

Tests if hostname contains Unicode characters. If this returns true, you need to encode the hostname with glib.global.hostnameToAscii before using it in non-IDN-aware contexts.

hostnameToAscii
string hostnameToAscii(string hostname)

Converts hostname to its canonical ASCII form; an ASCII-only string containing no uppercase letters and not ending with a trailing dot.

hostnameToUnicode
string hostnameToUnicode(string hostname)

Converts hostname to its canonical presentation form; a UTF-8 string in Unicode normalization form C, containing no uppercase letters, no forbidden characters, and no ASCII-encoded segments, and not ending with a trailing dot.

idleAdd
uint idleAdd(int priority, glib.types.SourceFunc function_)

Adds a function to be called whenever there are no higher priority events pending.

idleRemoveByData
bool idleRemoveByData(void* data)

Removes the idle function with the given data.

idleSourceNew
glib.source.Source idleSourceNew()

Creates a new idle source.

int64Equal
bool int64Equal(const(void)* v1, const(void)* v2)

Compares the two #gint64 values being pointed to and returns true if they are equal. It can be passed to glib.hash_table.HashTable.new_ as the key_equal_func parameter, when using non-null pointers to 64-bit integers as keys in a #GHashTable.

int64Hash
uint int64Hash(const(void)* v)

Converts a pointer to a #gint64 to a hash value.

intEqual
bool intEqual(const(void)* v1, const(void)* v2)

Compares the two #gint values being pointed to and returns true if they are equal. It can be passed to glib.hash_table.HashTable.new_ as the key_equal_func parameter, when using non-null pointers to integers as keys in a #GHashTable.

intHash
uint intHash(const(void)* v)

Converts a pointer to a #gint to a hash value. It can be passed to glib.hash_table.HashTable.new_ as the hash_func parameter, when using non-null pointers to integer values as keys in a #GHashTable.

internStaticString
string internStaticString(string string_)

Returns a canonical representation for string. Interned strings can be compared for equality by comparing the pointers, instead of using strcmp(). glib.global.internStaticString does not copy the string, therefore string must not be freed or modified.

internString
string internString(string string_)

Returns a canonical representation for string. Interned strings can be compared for equality by comparing the pointers, instead of using strcmp().

ioAddWatch
uint ioAddWatch(glib.iochannel.IOChannel channel, int priority, glib.types.IOCondition condition, glib.types.IOFunc func)

Adds the #GIOChannel into the default main loop context with the given priority.

ioCreateWatch
glib.source.Source ioCreateWatch(glib.iochannel.IOChannel channel, glib.types.IOCondition condition)

Creates a #GSource that's dispatched when condition is met for the given channel. For example, if condition is glib.types.IOCondition.In, the source will be dispatched when there's data available for reading.

listenv
string[] listenv()

Gets the names of all variables set in the environment.

localeFromUtf8
ubyte[] localeFromUtf8(string utf8string, ptrdiff_t len, size_t bytesRead)

Converts a string from UTF-8 to the encoding used for strings by the C runtime (usually the same as that used by the operating system) in the [current locale]setlocale. On Windows this means the system codepage.

localeToUtf8
string localeToUtf8(ubyte[] opsysstring, size_t bytesRead, size_t bytesWritten)

Converts a string which is in the encoding used for strings by the C runtime (usually the same as that used by the operating system) in the [current locale]setlocale into a UTF-8 string.

logDefaultHandler
void logDefaultHandler(string logDomain, glib.types.LogLevelFlags logLevel, string message, void* unusedData)

The default log handler set up by GLib; funcGLib.log_set_default_handler allows to install an alternate default log handler.

logGetDebugEnabled
bool logGetDebugEnabled()

Return whether debug output from the GLib logging system is enabled.

logRemoveHandler
void logRemoveHandler(string logDomain, uint handlerId)

Removes the log handler.

logSetAlwaysFatal
glib.types.LogLevelFlags logSetAlwaysFatal(glib.types.LogLevelFlags fatalMask)

Sets the message levels which are always fatal, in any log domain.

logSetDebugEnabled
void logSetDebugEnabled(bool enabled)

Enable or disable debug output from the GLib logging system for all domains.

logSetFatalMask
glib.types.LogLevelFlags logSetFatalMask(string logDomain, glib.types.LogLevelFlags fatalMask)

Sets the log levels which are fatal in the given domain.

logSetHandler
uint logSetHandler(string logDomain, glib.types.LogLevelFlags logLevels, glib.types.LogFunc logFunc)

Like funcGLib.log_set_handler, but takes a destroy notify for the user_data.

logVariant
void logVariant(string logDomain, glib.types.LogLevelFlags logLevel, glib.variant.VariantG fields)

Log a message with structured data, accepting the data within a glib.variant.VariantG.

logWriterDefaultSetDebugDomains
void logWriterDefaultSetDebugDomains(string[] domains)

Reset the list of domains to be logged, that might be initially set by the G_MESSAGES_DEBUG environment variable.

logWriterDefaultSetUseStderr
void logWriterDefaultSetUseStderr(bool useStderr)

Configure whether the built-in log functions will output all log messages to stderr.

logWriterDefaultWouldDrop
bool logWriterDefaultWouldDrop(glib.types.LogLevelFlags logLevel, string logDomain)

Check whether funcGLib.log_writer_default and funcGLib.log_default_handler would ignore a message with the given domain and level.

logWriterIsJournald
bool logWriterIsJournald(int outputFd)

Check whether the given output_fd file descriptor is a connection to the systemd journal, or something else (like a log file or stdout or stderr).

logWriterSupportsColor
bool logWriterSupportsColor(int outputFd)

Check whether the given output_fd file descriptor supports ANSI color escape sequences.

lstat
int lstat(string filename, glib.types.StatBuf buf)

A wrapper for the POSIX lstat() function. The lstat() function is like stat() except that in the case of symbolic links, it returns information about the symbolic link itself and not the file that it refers to. If the system does not support symbolic links glib.global.lstat is identical to glib.global.stat.

mainCurrentSource
glib.source.Source mainCurrentSource()

Returns the currently firing source for this thread.

mainDepth
int mainDepth()

Returns the depth of the stack of calls to glib.main_context.MainContext.dispatch on any #GMainContext in the current thread. That is, when called from the toplevel, it gives 0. When called from within a callback from glib.main_context.MainContext.iteration (or glib.main_loop.MainLoop.run, etc.) it returns 1. When called from within a callback to a recursive call to glib.main_context.MainContext.iteration, it returns 2. And so forth.

malloc0
void* malloc0(size_t nBytes)

Allocates n_bytes bytes of memory, initialized to 0's. If n_bytes is 0 it returns null.

malloc0N
void* malloc0N(size_t nBlocks, size_t nBlockBytes)

This function is similar to glib.global.malloc0, allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

mallocN
void* mallocN(size_t nBlocks, size_t nBlockBytes)

This function is similar to glib.global.gmalloc, allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

markupErrorQuark
glib.types.Quark markupErrorQuark()
markupEscapeText
string markupEscapeText(string text, ptrdiff_t length)

Escapes text so that the markup parser will parse it verbatim. Less than, greater than, ampersand, etc. are replaced with the corresponding entities. This function would typically be used when writing out a file to be parsed with the markup parser.

memIsSystemMalloc
bool memIsSystemMalloc()

Checks whether the allocator used by glib.global.gmalloc is the system's malloc implementation. If it returns true memory allocated with malloc() can be used interchangeably with memory allocated using glib.global.gmalloc. This function is useful for avoiding an extra copy of allocated memory returned by a non-GLib-based API.

memProfile
void memProfile()

GLib used to support some tools for memory profiling, but this no longer works. There are many other useful tools for memory profiling these days which can be used instead.

memSetVtable
void memSetVtable(glib.types.MemVTable vtable)

This function used to let you override the memory allocation function. However, its use was incompatible with the use of global constructors in GLib and GIO, because those use the GLib allocators before main is reached. Therefore this function is now deprecated and is just a stub.

memdup
void* memdup(const(void)* mem, uint byteSize)

Allocates byte_size bytes of memory, and copies byte_size bytes into it from mem. If mem is NULL it returns NULL.

memdup2
void* memdup2(const(void)* mem, size_t byteSize)

Allocates byte_size bytes of memory, and copies byte_size bytes into it from mem. If mem is NULL it returns NULL.

mkdir
int mkdir(string filename, int mode)

A wrapper for the POSIX mkdir() function. The mkdir() function attempts to create a directory with the given name and permissions. The mode argument is ignored on Windows.

mkdirWithParents
int mkdirWithParents(string pathname, int mode)

Create a directory if it doesn't already exist. Create intermediate parent directories as needed, too.

nullifyPointer
void nullifyPointer(void* nullifyLocation)

Set the pointer at the specified location to null.

numberParserErrorQuark
glib.types.Quark numberParserErrorQuark()
onErrorQuery
void onErrorQuery(string prgName)

Prompts the user with [E]xit, [H]alt, show [S]tack trace or [P]roceed. This function is intended to be used for debugging use only. The following example shows how it can be used together with the glib.global.log functions.

onErrorStackTrace
void onErrorStackTrace(string prgName)

Invokes gdb, which attaches to the current process and shows a stack trace. Called by glib.global.onErrorQuery when the "Stack trace" option is selected. You can get the current process's program name with glib.global.getPrgname, assuming that you have called gtk.global.init_ or gdk.global.init_.

open
int open(string filename, int flags, int mode)

A wrapper for the POSIX open() function. The open() function is used to convert a pathname into a file descriptor.

optionErrorQuark
glib.types.Quark optionErrorQuark()
pathGetBasename
string pathGetBasename(string fileName)

Gets the last component of the filename.

pathGetDirname
string pathGetDirname(string fileName)

Gets the directory components of a file name. For example, the directory component of /usr/bin/test is /usr/bin. The directory component of / is /.

pathIsAbsolute
bool pathIsAbsolute(string fileName)

Returns true if the given file_name is an absolute file name. Note that this is a somewhat vague concept on Windows.

pathSkipRoot
string pathSkipRoot(string fileName)

Returns a pointer into file_name after the root component, i.e. after the "/" in UNIX or "C:\" under Windows. If file_name is not an absolute path it returns null.

patternMatchSimple
bool patternMatchSimple(string pattern, string string_)

Matches a string against a pattern given as a string. If this function is to be called in a loop, it's more efficient to compile the pattern once with glib.pattern_spec.PatternSpec.new_ and call glib.global.patternMatchString repeatedly.

pointerBitLock
void pointerBitLock(void* address, int lockBit)

This is equivalent to g_bit_lock, but working on pointers (or other pointer-sized values).

pointerBitLockAndGet
void pointerBitLockAndGet(void* address, uint lockBit, size_t outPtr)

This is equivalent to g_bit_lock, but working on pointers (or other pointer-sized values).

pointerBitLockMaskPtr
void* pointerBitLockMaskPtr(void* ptr, uint lockBit, bool set, size_t preserveMask, void* preservePtr)

This mangles ptr as glib.global.pointerBitLock and glib.global.pointerBitUnlock do.

pointerBitTrylock
bool pointerBitTrylock(void* address, int lockBit)

This is equivalent to glib.global.bitTrylock, but working on pointers (or other pointer-sized values).

pointerBitUnlock
void pointerBitUnlock(void* address, int lockBit)

This is equivalent to g_bit_unlock, but working on pointers (or other pointer-sized values).

pointerBitUnlockAndSet
void pointerBitUnlockAndSet(void* address, uint lockBit, void* ptr, size_t preserveMask)

This is equivalent to glib.global.pointerBitUnlock and atomically setting the pointer value.

poll
int poll(glib.types.PollFD fds, uint nfds, int timeout)

Polls fds, as with the poll() system call, but portably. (On systems that don't have poll(), it is emulated using select().) This is used internally by #GMainContext, but it can be called directly if you need to block until a file descriptor is ready, but don't want to run the full main loop.

propagateError
void propagateError(glib.error.ErrorG dest, glib.error.ErrorG src)

If dest is null, free src; otherwise, moves src into *dest. The error variable dest points to must be null.

qsortWithData
void qsortWithData(const(void)* pbase, int totalElems, size_t size, glib.types.CompareDataFunc compareFunc)

This is just like the standard C qsort() function, but the comparison routine accepts a user data argument.

quarkFromStaticString
glib.types.Quark quarkFromStaticString(string string_)

Gets the #GQuark identifying the given (static) string. If the string does not currently have an associated #GQuark, a new #GQuark is created, linked to the given string.

quarkFromString
glib.types.Quark quarkFromString(string string_)

Gets the #GQuark identifying the given string. If the string does not currently have an associated #GQuark, a new #GQuark is created, using a copy of the string.

quarkToString
string quarkToString(glib.types.Quark quark)

Gets the string associated with the given #GQuark.

quarkTryString
glib.types.Quark quarkTryString(string string_)

Gets the #GQuark associated with the given string, or 0 if string is null or it has no associated #GQuark.

randomDouble
double randomDouble()

Returns a random #gdouble equally distributed over the range [0..1).

randomDoubleRange
double randomDoubleRange(double begin, double end)

Returns a random #gdouble equally distributed over the range [begin..end).

randomInt
uint randomInt()

Return a random #guint32 equally distributed over the range [0..2^32-1].

randomIntRange
int randomIntRange(int begin, int end)

Returns a random #gint32 equally distributed over the range [begin..end-1].

randomSetSeed
void randomSetSeed(uint seed)

Sets the seed for the global random number generator, which is used by the g_random_* functions, to seed.

rcBoxAcquire
void* rcBoxAcquire(void* memBlock)

Acquires a reference on the data pointed by mem_block.

rcBoxAlloc
void* rcBoxAlloc(size_t blockSize)

Allocates block_size bytes of memory, and adds reference counting semantics to it.

rcBoxAlloc0
void* rcBoxAlloc0(size_t blockSize)

Allocates block_size bytes of memory, and adds reference counting semantics to it.

rcBoxDup
void* rcBoxDup(size_t blockSize, const(void)* memBlock)

Allocates a new block of data with reference counting semantics, and copies block_size bytes of mem_block into it.

rcBoxGetSize
size_t rcBoxGetSize(void* memBlock)

Retrieves the size of the reference counted data pointed by mem_block.

rcBoxRelease
void rcBoxRelease(void* memBlock)

Releases a reference on the data pointed by mem_block.

rcBoxReleaseFull
void rcBoxReleaseFull(void* memBlock, glib.types.DestroyNotify clearFunc)

Releases a reference on the data pointed by mem_block.

realloc
void* realloc(void* mem, size_t nBytes)

Reallocates the memory pointed to by mem, so that it now has space for n_bytes bytes of memory. It returns the new address of the memory, which may have been moved. mem may be null, in which case it's considered to have zero-length. n_bytes may be 0, in which case null will be returned and mem will be freed unless it is null.

reallocN
void* reallocN(void* mem, size_t nBlocks, size_t nBlockBytes)

This function is similar to glib.global.realloc, allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

refCountCompare
bool refCountCompare(int rc, int val)

Compares the current value of rc with val.

refCountDec
bool refCountDec(int rc)

Decreases the reference count.

refCountInc
void refCountInc(int rc)

Increases the reference count.

refCountInit
void refCountInit(int rc)

Initializes a reference count variable to 1.

refStringAcquire
string refStringAcquire(string str)

Acquires a reference on a string.

refStringLength
size_t refStringLength(string str)

Retrieves the length of str.

refStringNew
string refStringNew(string str)

Creates a new reference counted string and copies the contents of str into it.

refStringNewIntern
string refStringNewIntern(string str)

Creates a new reference counted string and copies the content of str into it.

refStringNewLen
string refStringNewLen(string str, ptrdiff_t len)

Creates a new reference counted string and copies the contents of str into it, up to len bytes.

refStringRelease
void refStringRelease(string str)

Releases a reference on a string; if it was the last reference, the resources allocated by the string are freed as well.

reloadUserSpecialDirsCache
void reloadUserSpecialDirsCache()

Resets the cache used for glib.global.getUserSpecialDir, so that the latest on-disk version is used. Call this only if you just changed the data on disk yourself.

remove
int remove(string filename)

A wrapper for the POSIX remove() function. The remove() function deletes a name from the filesystem.

rename
int rename(string oldfilename, string newfilename)

A wrapper for the POSIX rename() function. The rename() function renames a file, moving it between directories if required.

rmdir
int rmdir(string filename)

A wrapper for the POSIX rmdir() function. The rmdir() function deletes a directory from the filesystem.

setApplicationName
void setApplicationName(string applicationName)

Sets a human-readable name for the application. This name should be localized if possible, and is intended for display to the user. Contrast with glib.global.setPrgname, which sets a non-localized name. glib.global.setPrgname will be called automatically by gtk.global.init_, but glib.global.setApplicationName will not.

setErrorLiteral
void setErrorLiteral(glib.error.ErrorG err, glib.types.Quark domain, int code, string message)

Does nothing if err is null; if err is non-null, then *err must be null. A new #GError is created and assigned to *err. Unlike glib.global.setError, message is not a printf()-style format string. Use this function if message contains text you don't have control over, that could include printf() escape sequences.

setPrgname
void setPrgname(string prgname)

Sets the name of the program. This name should not be localized, in contrast to glib.global.setApplicationName.

setenv
bool setenv(string variable, string value, bool overwrite)

Sets an environment variable. On UNIX, both the variable's name and value can be arbitrary byte strings, except that the variable's name cannot contain '='. On Windows, they should be in UTF-8.

shellErrorQuark
glib.types.Quark shellErrorQuark()
shellParseArgv
bool shellParseArgv(string commandLine, string[] argvp)

Parses a command line into an argument vector, in much the same way the shell would, but without many of the expansions the shell would perform (variable expansion, globs, operators, filename expansion, etc. are not supported).

shellQuote
string shellQuote(string unquotedString)

Quotes a string so that the shell (/bin/sh) will interpret the quoted string to mean unquoted_string.

shellUnquote
string shellUnquote(string quotedString)

Unquotes a string as the shell (/bin/sh) would.

sliceAlloc
void* sliceAlloc(size_t blockSize)

Allocates a block of memory from the libc allocator.

sliceAlloc0
void* sliceAlloc0(size_t blockSize)

Allocates a block of memory via glib.global.sliceAlloc and initializes the returned memory to 0.

sliceCopy
void* sliceCopy(size_t blockSize, const(void)* memBlock)

Allocates a block of memory from the slice allocator and copies block_size bytes into it from mem_block.

sliceFree1
void sliceFree1(size_t blockSize, void* memBlock)

Frees a block of memory.

sliceFreeChainWithOffset
void sliceFreeChainWithOffset(size_t blockSize, void* memChain, size_t nextOffset)

Frees a linked list of memory blocks of structure type type.

sliceGetConfig
long sliceGetConfig(glib.types.SliceConfig ckey)
sliceGetConfigState
long[] sliceGetConfigState(glib.types.SliceConfig ckey, long address)
sliceSetConfig
void sliceSetConfig(glib.types.SliceConfig ckey, long value)
spacedPrimesClosest
uint spacedPrimesClosest(uint num)

Gets the smallest prime number from a built-in array of primes which is larger than num. This is used within GLib to calculate the optimum size of a #GHashTable.

spawnAsync
bool spawnAsync(string workingDirectory, string[] argv, string[] envp, glib.types.SpawnFlags flags, glib.types.SpawnChildSetupFunc childSetup, glib.types.Pid childPid)

Executes a child program asynchronously.

spawnAsyncWithFds
bool spawnAsyncWithFds(string workingDirectory, string[] argv, string[] envp, glib.types.SpawnFlags flags, glib.types.SpawnChildSetupFunc childSetup, glib.types.Pid childPid, int stdinFd, int stdoutFd, int stderrFd)

Executes a child program asynchronously.

spawnAsyncWithPipes
bool spawnAsyncWithPipes(string workingDirectory, string[] argv, string[] envp, glib.types.SpawnFlags flags, glib.types.SpawnChildSetupFunc childSetup, glib.types.Pid childPid, int standardInput, int standardOutput, int standardError)

Identical to glib.global.spawnAsyncWithPipesAndFds but with n_fds set to zero, so no FD assignments are used.

spawnAsyncWithPipesAndFds
bool spawnAsyncWithPipesAndFds(string workingDirectory, string[] argv, string[] envp, glib.types.SpawnFlags flags, glib.types.SpawnChildSetupFunc childSetup, int stdinFd, int stdoutFd, int stderrFd, int[] sourceFds, int[] targetFds, glib.types.Pid childPidOut, int stdinPipeOut, int stdoutPipeOut, int stderrPipeOut)

Executes a child program asynchronously (your program will not block waiting for the child to exit).

spawnCheckExitStatus
bool spawnCheckExitStatus(int waitStatus)

An old name for glib.global.spawnCheckWaitStatus, deprecated because its name is misleading.

spawnCheckWaitStatus
bool spawnCheckWaitStatus(int waitStatus)

Set error if wait_status indicates the child exited abnormally (e.g. with a nonzero exit code, or via a fatal signal).

spawnClosePid
void spawnClosePid(glib.types.Pid pid)

On some platforms, notably Windows, the #GPid type represents a resource which must be closed to prevent resource leaking. glib.global.spawnClosePid is provided for this purpose. It should be used on all platforms, even though it doesn't do anything under UNIX.

spawnCommandLineAsync
bool spawnCommandLineAsync(string commandLine)

A simple version of glib.global.spawnAsync that parses a command line with glib.global.shellParseArgv and passes it to glib.global.spawnAsync.

spawnCommandLineSync
bool spawnCommandLineSync(string commandLine, string standardOutput, string standardError, int waitStatus)

A simple version of glib.global.spawnSync with little-used parameters removed, taking a command line instead of an argument vector.

spawnErrorQuark
glib.types.Quark spawnErrorQuark()
spawnExitErrorQuark
glib.types.Quark spawnExitErrorQuark()
spawnSync
bool spawnSync(string workingDirectory, string[] argv, string[] envp, glib.types.SpawnFlags flags, glib.types.SpawnChildSetupFunc childSetup, string standardOutput, string standardError, int waitStatus)

Executes a child synchronously (waits for the child to exit before returning).

stat
int stat(string filename, glib.types.StatBuf buf)

A wrapper for the POSIX stat() function. The stat() function returns information about a file. On Windows the stat() function in the C library checks only the FAT-style READONLY attribute and does not look at the ACL at all. Thus on Windows the protection bits in the st_mode field are a fabrication of little use.

stpcpy
string stpcpy(string dest, string src)

Copies a nul-terminated string into the destination buffer, including the trailing nul byte, and returns a pointer to the trailing nul byte in dest. The return value is useful for concatenating multiple strings without having to repeatedly scan for the end.

strEqual
bool strEqual(const(void)* v1, const(void)* v2)

Compares two strings for byte-by-byte equality and returns true if they are equal. It can be passed to glib.hash_table.HashTable.new_ as the key_equal_func parameter, when using non-null strings as keys in a #GHashTable.

strHasPrefix
bool strHasPrefix(string str, string prefix)

Looks whether the string str begins with prefix.

strHasSuffix
bool strHasSuffix(string str, string suffix)

Looks whether a string ends with suffix.

strHash
uint strHash(const(void)* v)

Converts a string to a hash value.

strIsAscii
bool strIsAscii(string str)

Determines if a string is pure ASCII. A string is pure ASCII if it contains no bytes with the high bit set.

strMatchString
bool strMatchString(string searchTerm, string potentialHit, bool acceptAlternates)

Checks if a search conducted for search_term should match potential_hit.

strToAscii
string strToAscii(string str, string fromLocale)

Transliterate str to plain ASCII.

strTokenizeAndFold
string[] strTokenizeAndFold(string string_, string translitLocale, string[] asciiAlternates)

Tokenizes string and performs folding on each token.

strcanon
string strcanon(string string_, string validChars, char substitutor)

For each character in string, if the character is not in valid_chars, replaces the character with substitutor.

strcasecmp
int strcasecmp(string s1, string s2)

A case-insensitive string comparison, corresponding to the standard strcasecmp() function on platforms which support it.

strchomp
string strchomp(string string_)

Removes trailing whitespace from a string.

strchug
string strchug(string string_)

Removes leading whitespace from a string, by moving the rest of the characters forward.

strcmp0
int strcmp0(string str1, string str2)

Compares str1 and str2 like strcmp(). Handles null gracefully by sorting it before non-null strings. Comparing two null pointers returns 0.

strcompress
string strcompress(string source)

Replaces all escaped characters with their one byte equivalent.

strdelimit
string strdelimit(string string_, string delimiters, char newDelimiter)

Converts any delimiter characters in string to new_delimiter.

strdown
string strdown(string string_)

Converts a string to lower case.

strdup
string strdup(string str)

Duplicates a string. If str is NULL it returns NULL.

strdupv
string[] strdupv(string[] strArray)

Copies an array of strings. The copy is a deep copy; each string is also copied.

strerror
string strerror(int errnum)

Returns a string corresponding to the given error code, e.g. "no such process".

strescape
string strescape(string source, string exceptions)

Escapes the special characters '\b', '\f', '\n', '\r', '\t', '\v', '\' and '"' in the string source by inserting a '\' before them. Additionally all characters in the range 0x01-0x1F (everything below SPACE) and in the range 0x7F-0xFF (all non-ASCII chars) are replaced with a '\' followed by their octal representation. Characters supplied in exceptions are not escaped.

stripContext
string stripContext(string msgid, string msgval)

An auxiliary function for gettext() support (see Q_()).

strjoinv
string strjoinv(string separator, string[] strArray)

Joins an array of strings together to form one long string, with the optional separator inserted between each of them.

strlcat
size_t strlcat(string dest, string src, size_t destSize)

Portability wrapper that calls strlcat() on systems which have it, and emulates it otherwise. Appends nul-terminated src string to dest, guaranteeing nul-termination for dest. The total size of dest won't exceed dest_size.

strlcpy
size_t strlcpy(string dest, string src, size_t destSize)

Portability wrapper that calls strlcpy() on systems which have it, and emulates strlcpy() otherwise. Copies src to dest; dest is guaranteed to be nul-terminated; src must be nul-terminated; dest_size is the buffer size, not the number of bytes to copy.

strncasecmp
int strncasecmp(string s1, string s2, uint n)

A case-insensitive string comparison, corresponding to the standard strncasecmp() function on platforms which support it. It is similar to funcGLib.strcasecmp except it only compares the first n characters of the strings.

strndup
string strndup(string str, size_t n)

Duplicates the first n bytes of a string, returning a newly-allocated buffer n + 1 bytes long which will always be nul-terminated. If str is less than n bytes long the buffer is padded with nuls. If str is NULL it returns NULL.

strnfill
string strnfill(size_t length, char fillChar)

Creates a new string length bytes long filled with fill_char.

strreverse
string strreverse(string string_)

Reverses all of the bytes in a string. For example, g_strreverse ("abcdef") will result in "fedcba".

strrstr
string strrstr(string haystack, string needle)

Searches the string haystack for the last occurrence of the string needle.

strrstrLen
string strrstrLen(string haystack, ptrdiff_t haystackLen, string needle)

Searches the string haystack for the last occurrence of the string needle, limiting the length of the search to haystack_len.

strsignal
string strsignal(int signum)

Returns a string describing the given signal, e.g. "Segmentation fault". If the signal is unknown, it returns “unknown signal (<signum\>)”.

strsplit
string[] strsplit(string string_, string delimiter, int maxTokens)

Splits a string into a maximum of max_tokens pieces, using the given delimiter. If max_tokens is reached, the remainder of string is appended to the last token.

strsplitSet
string[] strsplitSet(string string_, string delimiters, int maxTokens)

Splits string into a number of tokens not containing any of the characters in delimiters. A token is the (possibly empty) longest string that does not contain any of the characters in delimiters. If max_tokens is reached, the remainder is appended to the last token.

strstrLen
string strstrLen(string haystack, ptrdiff_t haystackLen, string needle)

Searches the string haystack for the first occurrence of the string needle, limiting the length of the search to haystack_len or a nul terminator byte (whichever is reached first).

strtod
double strtod(string nptr, string endptr)

Converts a string to a floating point value.

strup
string strup(string string_)

Converts a string to upper case.

strvContains
bool strvContains(string[] strv, string str)

Checks if an array of strings contains the string str according to funcGLib.str_equal. strv must not be NULL.

strvEqual
bool strvEqual(string[] strv1, string[] strv2)

Checks if two arrays of strings contain exactly the same elements in exactly the same order.

strvGetType
gobject.types.GType strvGetType()
strvLength
uint strvLength(string[] strArray)

Returns the length of an array of strings. str_array must not be NULL.

testAddDataFunc
void testAddDataFunc(string testpath, const(void)* testData, glib.types.TestDataFunc testFunc)

Create a new test case, similar to glib.global.testCreateCase. However the test is assumed to use no fixture, and test suites are automatically created on the fly and added to the root fixture, based on the slash-separated portions of testpath. The test_data argument will be passed as first argument to test_func.

testAssertExpectedMessagesInternal
void testAssertExpectedMessagesInternal(string domain, string file, int line, string func)
testBug
void testBug(string bugUriSnippet)

This function adds a message to test reports that associates a bug URI with a test case.

testBugBase
void testBugBase(string uriPattern)

Specify the base URI for bug reports.

testDisableCrashReporting
void testDisableCrashReporting()

Attempt to disable system crash reporting infrastructure.

testExpectMessage
void testExpectMessage(string logDomain, glib.types.LogLevelFlags logLevel, string pattern)

Indicates that a message with the given log_domain and log_level, with text matching pattern, is expected to be logged.

testFail
void testFail()

Indicates that a test failed. This function can be called multiple times from the same test. You can use this function if your test failed in a recoverable way.

testFailed
bool testFailed()

Returns whether a test has already failed. This will be the case when glib.global.testFail, glib.global.testIncomplete or glib.global.testSkip have been called, but also if an assertion has failed.

testGetDir
string testGetDir(glib.types.TestFileType fileType)

Gets the pathname of the directory containing test files of the type specified by file_type.

testGetPath
string testGetPath()

Gets the test path for the test currently being run.

testIncomplete
void testIncomplete(string msg)

Indicates that a test failed because of some incomplete functionality. This function can be called multiple times from the same test.

testLogTypeName
string testLogTypeName(glib.types.TestLogType logType)
testQueueFree
void testQueueFree(void* gfreePointer)

Enqueue a pointer to be released with glib.global.gfree during the next teardown phase. This is equivalent to calling glib.global.testQueueDestroy with a destroy callback of glib.global.gfree.

testRandDouble
double testRandDouble()

Get a reproducible random floating point number, see glib.global.testRandInt for details on test case random numbers.

testRandDoubleRange
double testRandDoubleRange(double rangeStart, double rangeEnd)

Get a reproducible random floating pointer number out of a specified range, see glib.global.testRandInt for details on test case random numbers.

testRandInt
int testRandInt()

Get a reproducible random integer number.

testRandIntRange
int testRandIntRange(int begin, int end)

Get a reproducible random integer number out of a specified range, see glib.global.testRandInt for details on test case random numbers.

testRun
int testRun()

Runs all tests under the toplevel suite which can be retrieved with glib.global.testGetRoot. Similar to glib.global.testRunSuite, the test cases to be run are filtered according to test path arguments (-p testpath and -s testpath) as parsed by glib.global.testInit. glib.global.testRunSuite or glib.global.testRun may only be called once in a program.

testRunSuite
int testRunSuite(glib.test_suite.TestSuite suite)

Execute the tests within suite and all nested #GTestSuites. The test suites to be executed are filtered according to test path arguments (-p testpath and -s testpath) as parsed by glib.global.testInit. See the glib.global.testRun documentation for more information on the order that tests are run in.

testSetNonfatalAssertions
void testSetNonfatalAssertions()

Changes the behaviour of the various g_assert_*() macros, g_test_assert_expected_messages() and the various g_test_trap_assert_*() macros to not abort to program, but instead call glib.global.testFail and continue. (This also changes the behavior of glib.global.testFail so that it will not cause the test program to abort after completing the failed test.)

testSkip
void testSkip(string msg)

Indicates that a test was skipped.

testSubprocess
bool testSubprocess()

Returns true (after glib.global.testInit has been called) if the test program is running under glib.global.testTrapSubprocess.

testSummary
void testSummary(string summary)

Set the summary for a test, which describes what the test checks, and how it goes about checking it. This may be included in test report output, and is useful documentation for anyone reading the source code or modifying a test in future. It must be a single line.

testTimerElapsed
double testTimerElapsed()

Get the number of seconds since the last start of the timer with glib.global.testTimerStart.

testTimerLast
double testTimerLast()

Report the last result of glib.global.testTimerElapsed.

testTimerStart
void testTimerStart()

Start a timing test. Call glib.global.testTimerElapsed when the task is supposed to be done. Call this function again to restart the timer.

testTrapAssertions
void testTrapAssertions(string domain, string file, int line, string func, ulong assertionFlags, string pattern)
testTrapFork
bool testTrapFork(ulong usecTimeout, glib.types.TestTrapFlags testTrapFlags)

Fork the current test program to execute a test case that might not return or that might abort.

testTrapHasPassed
bool testTrapHasPassed()

Check the result of the last glib.global.testTrapSubprocess call.

testTrapReachedTimeout
bool testTrapReachedTimeout()

Check the result of the last glib.global.testTrapSubprocess call.

testTrapSubprocess
void testTrapSubprocess(string testPath, ulong usecTimeout, glib.types.TestSubprocessFlags testFlags)

Respawns the test program to run only test_path in a subprocess.

testTrapSubprocessWithEnvp
void testTrapSubprocessWithEnvp(string testPath, string[] envp, ulong usecTimeout, glib.types.TestSubprocessFlags testFlags)

Respawns the test program to run only test_path in a subprocess with the given envp environment.

timeoutAdd
uint timeoutAdd(int priority, uint interval, glib.types.SourceFunc function_)

Sets a function to be called at regular intervals, with the given priority. The function is called repeatedly until it returns false, at which point the timeout is automatically destroyed and the function will not be called again. The notify function is called when the timeout is destroyed. The first call to the function will be at the end of the first interval.

timeoutAddSeconds
uint timeoutAddSeconds(int priority, uint interval, glib.types.SourceFunc function_)

Sets a function to be called at regular intervals, with priority.

timeoutSourceNew
glib.source.Source timeoutSourceNew(uint interval)

Creates a new timeout source.

timeoutSourceNewSeconds
glib.source.Source timeoutSourceNewSeconds(uint interval)

Creates a new timeout source.

tryMalloc
void* tryMalloc(size_t nBytes)

Attempts to allocate n_bytes, and returns null on failure. Contrast with glib.global.gmalloc, which aborts the program on failure.

tryMalloc0
void* tryMalloc0(size_t nBytes)

Attempts to allocate n_bytes, initialized to 0's, and returns null on failure. Contrast with glib.global.malloc0, which aborts the program on failure.

tryMalloc0N
void* tryMalloc0N(size_t nBlocks, size_t nBlockBytes)

This function is similar to glib.global.tryMalloc0, allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

tryMallocN
void* tryMallocN(size_t nBlocks, size_t nBlockBytes)

This function is similar to glib.global.tryMalloc, allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

tryRealloc
void* tryRealloc(void* mem, size_t nBytes)

Attempts to realloc mem to a new size, n_bytes, and returns null on failure. Contrast with glib.global.realloc, which aborts the program on failure.

tryReallocN
void* tryReallocN(void* mem, size_t nBlocks, size_t nBlockBytes)

This function is similar to glib.global.tryRealloc, allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

ucs4ToUtf16
ushort[] ucs4ToUtf16(dchar[] str, glong itemsRead, glong itemsWritten)

Convert a string from UCS-4 to UTF-16. A 0 character will be added to the result after the converted text.

ucs4ToUtf8
string ucs4ToUtf8(dchar[] str, glong itemsRead, glong itemsWritten)

Convert a string from a 32-bit fixed width representation as UCS-4. to UTF-8. The result will be terminated with a 0 byte.

unicharBreakType
glib.types.UnicodeBreakType unicharBreakType(dchar c)

Determines the break type of c. c should be a Unicode character (to derive a character from UTF-8 encoded text, use glib.global.utf8GetChar). The break type is used to find word and line breaks ("text boundaries"), Pango implements the Unicode boundary resolution algorithms and normally you would use a function such as pango.global.break_ instead of caring about break types yourself.

unicharCombiningClass
int unicharCombiningClass(dchar uc)

Determines the canonical combining class of a Unicode character.

unicharCompose
bool unicharCompose(dchar a, dchar b, dchar ch)

Performs a single composition step of the Unicode canonical composition algorithm.

unicharDecompose
bool unicharDecompose(dchar ch, dchar a, dchar b)

Performs a single decomposition step of the Unicode canonical decomposition algorithm.

unicharDigitValue
int unicharDigitValue(dchar c)

Determines the numeric value of a character as a decimal digit.

unicharFullyDecompose
size_t unicharFullyDecompose(dchar ch, bool compat, dchar result, size_t resultLen)

Computes the canonical or compatibility decomposition of a Unicode character. For compatibility decomposition, pass true for compat; for canonical decomposition pass false for compat.

unicharGetMirrorChar
bool unicharGetMirrorChar(dchar ch, dchar mirroredCh)

In Unicode, some characters are "mirrored". This means that their images are mirrored horizontally in text that is laid out from right to left. For instance, "(" would become its mirror image, ")", in right-to-left text.

unicharGetScript
glib.types.UnicodeScript unicharGetScript(dchar ch)

Looks up the #GUnicodeScript for a particular character (as defined by Unicode Standard Annex \#24). No check is made for ch being a valid Unicode character; if you pass in invalid character, the result is undefined.

unicharIsalnum
bool unicharIsalnum(dchar c)

Determines whether a character is alphanumeric. Given some UTF-8 text, obtain a character value with glib.global.utf8GetChar.

unicharIsalpha
bool unicharIsalpha(dchar c)

Determines whether a character is alphabetic (i.e. a letter). Given some UTF-8 text, obtain a character value with glib.global.utf8GetChar.

unicharIscntrl
bool unicharIscntrl(dchar c)

Determines whether a character is a control character. Given some UTF-8 text, obtain a character value with glib.global.utf8GetChar.

unicharIsdefined
bool unicharIsdefined(dchar c)

Determines if a given character is assigned in the Unicode standard.

unicharIsdigit
bool unicharIsdigit(dchar c)

Determines whether a character is numeric (i.e. a digit). This covers ASCII 0-9 and also digits in other languages/scripts. Given some UTF-8 text, obtain a character value with glib.global.utf8GetChar.

unicharIsgraph
bool unicharIsgraph(dchar c)

Determines whether a character is printable and not a space (returns false for control characters, format characters, and spaces). glib.global.unicharIsprint is similar, but returns true for spaces. Given some UTF-8 text, obtain a character value with glib.global.utf8GetChar.

unicharIslower
bool unicharIslower(dchar c)

Determines whether a character is a lowercase letter. Given some UTF-8 text, obtain a character value with glib.global.utf8GetChar.

unicharIsmark
bool unicharIsmark(dchar c)

Determines whether a character is a mark (non-spacing mark, combining mark, or enclosing mark in Unicode speak). Given some UTF-8 text, obtain a character value with glib.global.utf8GetChar.

unicharIsprint
bool unicharIsprint(dchar c)

Determines whether a character is printable. Unlike glib.global.unicharIsgraph, returns true for spaces. Given some UTF-8 text, obtain a character value with glib.global.utf8GetChar.

unicharIspunct
bool unicharIspunct(dchar c)

Determines whether a character is punctuation or a symbol. Given some UTF-8 text, obtain a character value with glib.global.utf8GetChar.

unicharIsspace
bool unicharIsspace(dchar c)

Determines whether a character is a space, tab, or line separator (newline, carriage return, etc.). Given some UTF-8 text, obtain a character value with glib.global.utf8GetChar.

unicharIstitle
bool unicharIstitle(dchar c)

Determines if a character is titlecase. Some characters in Unicode which are composites, such as the DZ digraph have three case variants instead of just two. The titlecase form is used at the beginning of a word where only the first letter is capitalized. The titlecase form of the DZ digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z.

unicharIsupper
bool unicharIsupper(dchar c)

Determines if a character is uppercase.

unicharIswide
bool unicharIswide(dchar c)

Determines if a character is typically rendered in a double-width cell.

unicharIswideCjk
bool unicharIswideCjk(dchar c)

Determines if a character is typically rendered in a double-width cell under legacy East Asian locales. If a character is wide according to glib.global.unicharIswide, then it is also reported wide with this function, but the converse is not necessarily true. See the Unicode Standard Annex #11

for details.

unicharIsxdigit
bool unicharIsxdigit(dchar c)

Determines if a character is a hexadecimal digit.

unicharIszerowidth
bool unicharIszerowidth(dchar c)

Determines if a given character typically takes zero width when rendered. The return value is true for all non-spacing and enclosing marks (e.g., combining accents), format characters, zero-width space, but not U+00AD SOFT HYPHEN.

unicharTolower
dchar unicharTolower(dchar c)

Converts a character to lower case.

unicharTotitle
dchar unicharTotitle(dchar c)

Converts a character to the titlecase.

unicharToupper
dchar unicharToupper(dchar c)

Converts a character to uppercase.

unicharType
glib.types.UnicodeType unicharType(dchar c)

Classifies a Unicode character by type.

unicharValidate
bool unicharValidate(dchar ch)

Checks whether ch is a valid Unicode character. Some possible integer values of ch will not be valid. 0 is considered a valid character, though it's normally a string terminator.

unicharXdigitValue
int unicharXdigitValue(dchar c)

Determines the numeric value of a character as a hexadecimal digit.

unicodeCanonicalDecomposition
dchar[] unicodeCanonicalDecomposition(dchar ch)

Computes the canonical decomposition of a Unicode character.

unicodeCanonicalOrdering
void unicodeCanonicalOrdering(dchar[] string_)

Computes the canonical ordering of a string in-place. This rearranges decomposed characters in the string according to their combining classes. See the Unicode manual for more information.

unixErrorQuark
glib.types.Quark unixErrorQuark()
unixFdAddFull
uint unixFdAddFull(int priority, int fd, glib.types.IOCondition condition, glib.types.UnixFDSourceFunc function_)

Sets a function to be called when the IO condition, as specified by condition becomes true for fd.

unixFdSourceNew
glib.source.Source unixFdSourceNew(int fd, glib.types.IOCondition condition)

Creates a #GSource to watch for a particular I/O condition on a file descriptor.

unixGetPasswdEntry
void* unixGetPasswdEntry(string userName)

Get the passwd file entry for the given user_name using getpwnam_r(). This can fail if the given user_name doesn’t exist.

unixOpenPipe
bool unixOpenPipe(int[] fds, int flags)

Similar to the UNIX pipe() call, but on modern systems like Linux uses the pipe2() system call, which atomically creates a pipe with the configured flags.

unixSetFdNonblocking
bool unixSetFdNonblocking(int fd, bool nonblock)

Control the non-blocking state of the given file descriptor, according to nonblock. On most systems this uses O_NONBLOCK, but on some older ones may use O_NDELAY.

unixSignalAdd
uint unixSignalAdd(int priority, int signum, glib.types.SourceFunc handler)

A convenience function for glib.global.unixSignalSourceNew, which attaches to the default #GMainContext. You can remove the watch using glib.source.Source.remove.

unixSignalSourceNew
glib.source.Source unixSignalSourceNew(int signum)

Create a #GSource that will be dispatched upon delivery of the UNIX signal signum. In GLib versions before 2.36, only SIGHUP, SIGINT, SIGTERM can be monitored. In GLib 2.36, SIGUSR1 and SIGUSR2 were added. In GLib 2.54, SIGWINCH was added.

unlink
int unlink(string filename)

A wrapper for the POSIX unlink() function. The unlink() function deletes a name from the filesystem. If this was the last link to the file and no processes have it opened, the diskspace occupied by the file is freed.

unsetenv
void unsetenv(string variable)

Removes an environment variable from the environment.

usleep
void usleep(gulong microseconds)

Pauses the current thread for the given number of microseconds.

utf16ToUcs4
dchar[] utf16ToUcs4(ushort[] str, glong itemsRead)

Convert a string from UTF-16 to UCS-4. The result will be nul-terminated.

utf16ToUtf8
string utf16ToUtf8(ushort[] str, glong itemsRead, glong itemsWritten)

Convert a string from UTF-16 to UTF-8. The result will be terminated with a 0 byte.

utf8Casefold
string utf8Casefold(string str, ptrdiff_t len)

Converts a string into a form that is independent of case. The result will not correspond to any particular case, but can be compared for equality or ordered with the results of calling glib.global.utf8Casefold on other strings.

utf8Collate
int utf8Collate(string str1, string str2)

Compares two strings for ordering using the linguistically correct rules for the [current locale]setlocale. When sorting a large number of strings, it will be significantly faster to obtain collation keys with glib.global.utf8CollateKey and compare the keys with strcmp() when sorting instead of sorting the original strings.

utf8CollateKey
string utf8CollateKey(string str, ptrdiff_t len)

Converts a string into a collation key that can be compared with other collation keys produced by the same function using strcmp().

utf8CollateKeyForFilename
string utf8CollateKeyForFilename(string str, ptrdiff_t len)

Converts a string into a collation key that can be compared with other collation keys produced by the same function using strcmp().

utf8FindNextChar
string utf8FindNextChar(string p, string end)

Finds the start of the next UTF-8 character in the string after p.

utf8FindPrevChar
string utf8FindPrevChar(string str, string p)

Given a position p with a UTF-8 encoded string str, find the start of the previous UTF-8 character starting before p. Returns null if no UTF-8 characters are present in str before p.

utf8GetChar
dchar utf8GetChar(string p)

Converts a sequence of bytes encoded as UTF-8 to a Unicode character.

utf8GetCharValidated
dchar utf8GetCharValidated(string p, ptrdiff_t maxLen)

Convert a sequence of bytes encoded as UTF-8 to a Unicode character. This function checks for incomplete characters, for invalid characters such as characters that are out of the range of Unicode, and for overlong encodings of valid characters.

utf8MakeValid
string utf8MakeValid(string str, ptrdiff_t len)

If the provided string is valid UTF-8, return a copy of it. If not, return a copy in which bytes that could not be interpreted as valid Unicode are replaced with the Unicode replacement character (U+FFFD).

utf8Normalize
string utf8Normalize(string str, ptrdiff_t len, glib.types.NormalizeMode mode)

Converts a string into 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. The string has to be valid UTF-8, otherwise null is returned. You should generally call glib.global.utf8Normalize before comparing two Unicode strings.

utf8OffsetToPointer
string utf8OffsetToPointer(string str, glong offset)

Converts from an integer character offset to a pointer to a position within the string.

utf8PointerToOffset
glong utf8PointerToOffset(string str, string pos)

Converts from a pointer to position within a string to an integer character offset.

utf8PrevChar
string utf8PrevChar(string p)

Finds the previous UTF-8 character in the string before p.

utf8Strchr
string utf8Strchr(string p, ptrdiff_t len, dchar c)

Finds the leftmost occurrence of the given Unicode character in a UTF-8 encoded string, while limiting the search to len bytes. If len is -1, allow unbounded search.

utf8Strdown
string utf8Strdown(string str, ptrdiff_t len)

Converts all Unicode characters in the string that have a case to lowercase. The exact manner that this is done depends on the current locale, and may result in the number of characters in the string changing.

utf8Strlen
glong utf8Strlen(string p, ptrdiff_t max)

Computes the length of the string in characters, not including the terminating nul character. If the max'th byte falls in the middle of a character, the last (partial) character is not counted.

utf8Strncpy
string utf8Strncpy(string dest, string src, size_t n)

Like the standard C strncpy() function, but copies a given number of characters instead of a given number of bytes. The src string must be valid UTF-8 encoded text. (Use glib.global.utf8Validate on all text before trying to use UTF-8 utility functions with it.)

utf8Strrchr
string utf8Strrchr(string p, ptrdiff_t len, dchar c)

Find the rightmost occurrence of the given Unicode character in a UTF-8 encoded string, while limiting the search to len bytes. If len is -1, allow unbounded search.

utf8Strreverse
string utf8Strreverse(string str, ptrdiff_t len)

Reverses a UTF-8 string. str must be valid UTF-8 encoded text. (Use glib.global.utf8Validate on all text before trying to use UTF-8 utility functions with it.)

utf8Strup
string utf8Strup(string str, ptrdiff_t len)

Converts all Unicode characters in the string that have a case to uppercase. The exact manner that this is done depends on the current locale, and may result in the number of characters in the string increasing. (For instance, the German ess-zet will be changed to SS.)

utf8Substring
string utf8Substring(string str, glong startPos, glong endPos)

Copies a substring out of a UTF-8 encoded string. The substring will contain end_pos - start_pos characters.

utf8ToUcs4
dchar[] utf8ToUcs4(string str, glong len, glong itemsRead)

Convert a string from UTF-8 to a 32-bit fixed width representation as UCS-4. A trailing 0 character will be added to the string after the converted text.

utf8ToUcs4Fast
dchar[] utf8ToUcs4Fast(string str)

Convert a string from UTF-8 to a 32-bit fixed width representation as UCS-4, assuming valid UTF-8 input. This function is roughly twice as fast as glib.global.utf8ToUcs4 but does no error checking on the input. A trailing 0 character will be added to the string after the converted text.

utf8ToUtf16
ushort[] utf8ToUtf16(string str, glong len, glong itemsRead)

Convert a string from UTF-8 to UTF-16. A 0 character will be added to the result after the converted text.

utf8TruncateMiddle
string utf8TruncateMiddle(string string_, size_t truncateLength)

Cuts off the middle of the string, preserving half of truncate_length characters at the beginning and half at the end.

utf8Validate
bool utf8Validate(ubyte[] str, string end)

Validates UTF-8 encoded text. str is the text to validate; if str is nul-terminated, then max_len can be -1, otherwise max_len should be the number of bytes to validate. If end is non-null, then the end of the valid range will be stored there (i.e. the start of the first invalid character if some bytes were invalid, or the end of the text being validated otherwise).

utf8ValidateLen
bool utf8ValidateLen(ubyte[] str, string end)

Validates UTF-8 encoded text.

uuidStringIsValid
bool uuidStringIsValid(string str)

Parses the string str and verify if it is a UUID.

uuidStringRandom
string uuidStringRandom()

Generates a random UUID (RFC 4122 version 4) as a string. It has the same randomness guarantees as #GRand, so must not be used for cryptographic purposes such as key generation, nonces, salts or one-time pads.

variantGetGtype
gobject.types.GType variantGetGtype()