glib.global

Global functions for glib2 library

fn access alignedAlloc alignedAlloc0 alignedFree alignedFreeSized asciiDigitValue asciiDtostr asciiFormatd asciiStrcasecmp asciiStrdown asciiStringToSigned asciiStringToUnsigned asciiStrncasecmp asciiStrtod asciiStrtoll asciiStrtoull asciiStrup asciiTolower asciiToupper asciiXdigitValue assertionMessage assertionMessageCmpint assertionMessageCmpstr assertionMessageCmpstrv assertionMessageError assertWarning atomicIntAdd atomicIntAnd atomicIntCompareAndExchange atomicIntCompareAndExchangeFull atomicIntDecAndTest atomicIntExchange atomicIntExchangeAndAdd atomicIntGet atomicIntInc atomicIntOr atomicIntSet atomicIntXor atomicPointerAdd atomicPointerAnd atomicPointerCompareAndExchange atomicPointerCompareAndExchangeFull atomicPointerExchange atomicPointerGet atomicPointerOr atomicPointerSet atomicPointerXor atomicRcBoxAcquire atomicRcBoxAlloc atomicRcBoxAlloc0 atomicRcBoxDup atomicRcBoxGetSize atomicRcBoxRelease atomicRcBoxReleaseFull atomicRefCountCompare atomicRefCountDec atomicRefCountInc atomicRefCountInit base64Decode base64Encode basename bitLock bitNthLsf bitNthMsf bitStorage bitTrylock bitUnlock blowChunks buildFilenamev buildPathv canonicalizeFilename chdir checkVersion childWatchAdd childWatchSourceNew chmod clearError close closefrom computeChecksumForBytes computeChecksumForData computeChecksumForString computeHmacForBytes computeHmacForData computeHmacForString convert convertErrorQuark convertWithFallback creat datasetDestroy datasetForeach datasetIdGetData dcgettext dgettext directEqual directHash dngettext doubleEqual doubleHash dpgettext dpgettext2 environGetenv fdwalkSetCloexec fileErrorFromErrno fileErrorQuark fileGetContents filenameDisplayBasename filenameDisplayName filenameFromUri filenameFromUtf8 filenameToUri filenameToUtf8 fileOpenTmp fileReadLink fileSetContents fileSetContentsFull fileTest findProgramInPath fopen formatSize formatSizeForDisplay formatSizeFull freeSized freopen fsync getApplicationName getCharset getCodeset getConsoleCharset getCurrentDir getCurrentTime getenv getEnviron getFilenameCharsets getHomeDir getHostName getLanguageNames getLanguageNamesWithCategory getLocaleVariants getMonotonicTime getNumProcessors getOsInfo getPrgname getRealName getRealTime getSystemConfigDirs getSystemDataDirs getTmpDir getUserCacheDir getUserConfigDir getUserDataDir getUserName getUserRuntimeDir getUserSpecialDir getUserStateDir gfree gmalloc hostnameIsAsciiEncoded hostnameIsIpAddress hostnameIsNonAscii hostnameToAscii hostnameToUnicode idleAdd idleRemoveByData idleSourceNew int64Equal int64Hash intEqual internStaticString internString intHash ioAddWatch ioCreateWatch listenv localeFromUtf8 localeToUtf8 logDefaultHandler logGetDebugEnabled logRemoveHandler logSetAlwaysFatal logSetDebugEnabled logSetFatalMask logSetHandler logVariant logWriterDefaultSetDebugDomains logWriterDefaultSetUseStderr logWriterDefaultWouldDrop logWriterIsJournald logWriterSupportsColor lstat mainCurrentSource mainDepth malloc0 malloc0N mallocN markupErrorQuark markupEscapeText memdup memdup2 memIsSystemMalloc memProfile memSetVtable mkdir mkdirWithParents nullifyPointer numberParserErrorQuark onErrorQuery onErrorStackTrace open optionErrorQuark pathGetBasename pathGetDirname pathIsAbsolute pathSkipRoot patternMatchSimple pointerBitLock pointerBitLockAndGet pointerBitLockMaskPtr pointerBitTrylock pointerBitUnlock pointerBitUnlockAndSet poll propagateError qsortWithData quarkFromStaticString quarkFromString quarkToString quarkTryString randomDouble randomDoubleRange randomInt randomIntRange randomSetSeed rcBoxAcquire rcBoxAlloc rcBoxAlloc0 rcBoxDup rcBoxGetSize rcBoxRelease rcBoxReleaseFull realloc reallocN refCountCompare refCountDec refCountInc refCountInit refStringAcquire refStringLength refStringNew refStringNewIntern refStringNewLen refStringRelease reloadUserSpecialDirsCache remove rename rmdir setApplicationName setenv setErrorLiteral setPrgname shellErrorQuark shellParseArgv shellQuote shellUnquote sliceAlloc sliceAlloc0 sliceCopy sliceFree1 sliceFreeChainWithOffset sliceGetConfig sliceGetConfigState sliceSetConfig spacedPrimesClosest spawnAsync spawnAsyncWithFds spawnAsyncWithPipes spawnAsyncWithPipesAndFds spawnCheckExitStatus spawnCheckWaitStatus spawnClosePid spawnCommandLineAsync spawnCommandLineSync spawnErrorQuark spawnExitErrorQuark spawnSync stat stpcpy strcanon strcasecmp strchomp strchug strcmp0 strcompress strdelimit strdown strdup strdupv strEqual strerror strescape strHash strHasPrefix strHasSuffix stripContext strIsAscii strjoinv strMatchString strncasecmp strndup strnfill strreverse strrstr strsignal strsplit strsplitSet strToAscii strtod strTokenizeAndFold strup strvContains strvEqual strvGetType strvLength testAddDataFunc testAssertExpectedMessagesInternal testBug testBugBase testDisableCrashReporting testExpectMessage testFail testFailed testGetDir testGetPath testIncomplete testLogTypeName testQueueFree testRandDouble testRandDoubleRange testRandInt testRandIntRange testRun testRunSuite testSetNonfatalAssertions testSkip testSubprocess testSummary testTimerElapsed testTimerLast testTimerStart testTrapAssertions testTrapFork testTrapHasPassed testTrapReachedTimeout testTrapSubprocess testTrapSubprocessWithEnvp timeoutAdd timeoutAddSeconds timeoutSourceNew timeoutSourceNewSeconds tryMalloc tryMalloc0 tryMalloc0N tryMallocN tryRealloc tryReallocN ucs4ToUtf16 ucs4ToUtf8 unicharBreakType unicharCombiningClass unicharCompose unicharDecompose unicharDigitValue unicharFullyDecompose unicharGetMirrorChar unicharGetScript unicharIsalnum unicharIsalpha unicharIscntrl unicharIsdefined unicharIsdigit unicharIsgraph unicharIslower unicharIsmark unicharIsprint unicharIspunct unicharIsspace unicharIstitle unicharIsupper unicharIswide unicharIswideCjk unicharIsxdigit unicharIszerowidth unicharTolower unicharTotitle unicharToupper unicharType unicharValidate unicharXdigitValue unicodeCanonicalDecomposition unicodeCanonicalOrdering unixErrorQuark unixFdAddFull unixFdSourceNew unixGetPasswdEntry unixOpenPipe unixSetFdNonblocking unixSignalAdd unixSignalSourceNew unlink unsetenv usleep utf16ToUcs4 utf16ToUtf8 utf8Casefold utf8Collate utf8CollateKey utf8CollateKeyForFilename utf8FindNextChar utf8FindPrevChar utf8GetChar utf8GetCharValidated utf8MakeValid utf8Normalize utf8OffsetToPointer utf8PointerToOffset utf8PrevChar utf8Strchr utf8Strdown utf8Strlen utf8Strncpy utf8Strrchr utf8Strreverse utf8Strup utf8Substring utf8ToUcs4 utf8ToUcs4Fast utf8ToUtf16 utf8TruncateMiddle utf8Validate utf8ValidateLen uuidStringIsValid uuidStringRandom variantGetGtype

Functions 443

fnint access(string filename, int mode) nothrowA 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.
fnvoid * alignedAlloc(size_t nBlocks, size_t nBlockBytes, size_t alignment) nothrowThis 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 w...
fnvoid * alignedAlloc0(size_t nBlocks, size_t nBlockBytes, size_t alignment) nothrowThis function is similar to [glib.global.alignedAlloc], but it will also clear the allocated memory before returning it.
fnvoid alignedFree(void * mem = null) nothrowFrees the memory allocated by [glib.global.alignedAlloc].
fnvoid alignedFreeSized(void * mem, size_t alignment, size_t size) nothrowFrees the memory pointed to by mem, assuming it is has the given size and alignment.
fnint asciiDigitValue(char c) nothrowDetermines 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.
fnvoid asciiDtostr(ref char[] buffer, double d) nothrowConverts a `gdouble` to a string, using the '.' as decimal point.
fnvoid asciiFormatd(ref char[] buffer, string format, double d) nothrowConverts a `gdouble` 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'.
fnint asciiStrcasecmp(string s1, string s2) nothrowCompare two strings, ignoring the case of ASCII characters.
fnstring asciiStrdown(string str) nothrowConverts all upper case ASCII letters to lower case ASCII letters, with semantics that exactly match `funcGLib.ascii_tolower`.
fnbool asciiStringToSigned(string str, uint base, long min, long max, out long outNum)A convenience function for converting a string to a signed number.
fnbool asciiStringToUnsigned(string str, uint base, ulong min, ulong max, out ulong outNum)A convenience function for converting a string to an unsigned number.
fnint asciiStrncasecmp(string s1, string s2, size_t n) nothrowCompare 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 b...
fndouble asciiStrtod(string nptr, out string endptr) nothrowConverts a string to a floating point value.
fnlong asciiStrtoll(string nptr, out string endptr, uint base) nothrowConverts a string to a [gst.types.long] value.
fnulong asciiStrtoull(string nptr, out string endptr, uint base) nothrowConverts a string to a [gst.types.ulong] value.
fnstring asciiStrup(string str) nothrowConverts all lower case ASCII letters to upper case ASCII letters, with semantics that exactly match `funcGLib.ascii_toupper`.
fnchar asciiTolower(char c) nothrowConvert a character to ASCII lower case. If the character is not an ASCII upper case letter, it is returned unchanged.
fnchar asciiToupper(char c) nothrowConvert a character to ASCII upper case. If the character is not an ASCII lower case letter, it is returned unchanged.
fnint asciiXdigitValue(char c) nothrowDetermines 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.
fnvoid assertWarning(string logDomain, string file, int line, string prettyFunction, string expression) nothrow
fnvoid assertionMessage(string domain, string file, int line, string func, string message) nothrow
fnvoid assertionMessageCmpint(string domain, string file, int line, string func, string expr, ulong arg1, string cmp, ulong arg2, char numtype) nothrow
fnvoid assertionMessageCmpstr(string domain, string file, int line, string func, string expr, string arg1, string cmp, string arg2) nothrow
fnvoid assertionMessageCmpstrv(string domain, string file, int line, string func, string expr, string[] arg1, string[] arg2, size_t firstWrongIdx) nothrow
fnvoid assertionMessageError(string domain, string file, int line, string func, string expr, glib.error.ErrorWrap error, glib.types.Quark errorDomain, int errorCode) nothrow
fnint atomicIntAdd(ref int atomic, int val) nothrowAtomically adds val to the value of atomic.
fnuint atomicIntAnd(ref uint atomic, uint val) nothrowPerforms an atomic bitwise 'and' of the value of atomic and val, storing the result back in atomic.
fnbool atomicIntCompareAndExchange(ref int atomic, int oldval, int newval) nothrowCompares atomic to oldval and, if equal, sets it to newval. If atomic was not equal to oldval then no change occurs.
fnbool atomicIntCompareAndExchangeFull(ref int atomic, int oldval, int newval, out int preval) nothrowCompares 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.
fnbool atomicIntDecAndTest(ref int atomic) nothrowDecrements the value of atomic by 1.
fnint atomicIntExchange(ref int atomic, int newval) nothrowSets the atomic to newval and returns the old value from atomic.
fnint atomicIntExchangeAndAdd(ref int atomic, int val) nothrowThis 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 ...
fnint atomicIntGet(out int atomic) nothrowGets the current value of atomic.
fnvoid atomicIntInc(ref int atomic) nothrowIncrements the value of atomic by 1.
fnuint atomicIntOr(ref uint atomic, uint val) nothrowPerforms an atomic bitwise 'or' of the value of atomic and val, storing the result back in atomic.
fnvoid atomicIntSet(ref int atomic, int newval) nothrowSets the value of atomic to newval.
fnuint atomicIntXor(ref uint atomic, uint val) nothrowPerforms an atomic bitwise 'xor' of the value of atomic and val, storing the result back in atomic.
fnptrdiff_t atomicPointerAdd(void * atomic, ptrdiff_t val) nothrowAtomically adds val to the value of atomic.
fnsize_t atomicPointerAnd(void * atomic, size_t val) nothrowPerforms an atomic bitwise 'and' of the value of atomic and val, storing the result back in atomic.
fnbool atomicPointerCompareAndExchange(void * atomic, void * oldval = null, void * newval = null) nothrowCompares atomic to oldval and, if equal, sets it to newval. If atomic was not equal to oldval then no change occurs.
fnbool atomicPointerCompareAndExchangeFull(void * atomic, void * oldval, void * newval, out void * preval) nothrowCompares 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.
fnvoid * atomicPointerExchange(void * atomic = null, void * newval = null) nothrowSets the atomic to newval and returns the old value from atomic.
fnvoid * atomicPointerGet(void * atomic) nothrowGets the current value of atomic.
fnsize_t atomicPointerOr(void * atomic, size_t val) nothrowPerforms an atomic bitwise 'or' of the value of atomic and val, storing the result back in atomic.
fnvoid atomicPointerSet(void * atomic, void * newval = null) nothrowSets the value of atomic to newval.
fnsize_t atomicPointerXor(void * atomic, size_t val) nothrowPerforms an atomic bitwise 'xor' of the value of atomic and val, storing the result back in atomic.
fnvoid * atomicRcBoxAcquire(void * memBlock) nothrowAtomically acquires a reference on the data pointed by mem_block.
fnvoid * atomicRcBoxAlloc(size_t blockSize) nothrowAllocates block_size bytes of memory, and adds atomic reference counting semantics to it.
fnvoid * atomicRcBoxAlloc0(size_t blockSize) nothrowAllocates block_size bytes of memory, and adds atomic reference counting semantics to it.
fnvoid * atomicRcBoxDup(size_t blockSize, const(void) * memBlock) nothrowAllocates a new block of data with atomic reference counting semantics, and copies block_size bytes of mem_block into it.
fnsize_t atomicRcBoxGetSize(void * memBlock) nothrowRetrieves the size of the reference counted data pointed by mem_block.
fnvoid atomicRcBoxRelease(void * memBlock) nothrowAtomically releases a reference on the data pointed by mem_block.
fnvoid atomicRcBoxReleaseFull(void * memBlock, glib.types.DestroyNotify clearFunc) nothrowAtomically releases a reference on the data pointed by mem_block.
fnbool atomicRefCountCompare(ref int arc, int val) nothrowAtomically compares the current value of arc with val.
fnbool atomicRefCountDec(ref int arc) nothrowAtomically decreases the reference count.
fnvoid atomicRefCountInc(ref int arc) nothrowAtomically increases the reference count.
fnvoid atomicRefCountInit(ref int arc) nothrowInitializes a reference count variable to 1.
fnubyte[] base64Decode(string text) nothrowDecode 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.
fnstring base64Encode(ubyte[] data = null) nothrowEncode a sequence of binary data into its Base-64 stringified representation.
fnstring basename(string fileName) nothrowGets the name of the file without any leading directory components. It returns a pointer into the given file name string.
fnvoid bitLock(ref int address, int lockBit) nothrowSets the indicated lock_bit in address. If the bit is already set, this call will block until [glib.global.bitUnlock] unsets the corresponding bit.
fnint bitNthLsf(gulong mask, int nthBit) nothrowFind 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 s...
fnint bitNthMsf(gulong mask, int nthBit) nothrowFind 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 ...
fnuint bitStorage(gulong number) nothrowGets the number of bits used to hold number, e.g. if number is 4, 3 bits are needed.
fnbool bitTrylock(ref int address, int lockBit) nothrowSets the indicated lock_bit in address, returning true if successful. If the bit is already set, returns false immediately.
fnvoid bitUnlock(ref int address, int lockBit) nothrowClears 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.
fnvoid blowChunks() nothrow
fnstring buildFilenamev(string[] args) nothrowCreates a filename from a vector of elements using the correct separator for the current platform.
fnstring buildPathv(string separator, string[] args) nothrowBehaves exactly like [glib.global.buildPath], but takes the path elements as a string array, instead of variadic arguments.
fnstring canonicalizeFilename(string filename, string relativeTo = null) nothrowGets the canonical file name from filename. All triple slashes are turned into single slashes, and all `..` and `.`s resolved against relative_to.
fnint chdir(string path) nothrowA wrapper for the POSIX chdir() function. The function changes the current directory of the process to path.
fnstring checkVersion(uint requiredMajor, uint requiredMinor, uint requiredMicro) nothrowChecks that the GLib library in use is compatible with the given version.
fnuint childWatchAdd(int priority, glib.types.Pid pid, glib.types.ChildWatchFunc function_) nothrowSets a function to be called when the child indicated by pid exits, at the priority priority.
fnglib.source.Source childWatchSourceNew(glib.types.Pid pid) nothrowCreates a new child_watch source.
fnint chmod(string filename, int mode) nothrowA wrapper for the POSIX chmod() function. The chmod() function is used to set the permissions of a file system object.
fnvoid clearError()If err or *err is null, does nothing. Otherwise, calls [glib.error.ErrorWrap.free] on *err and sets *err to null. Throws: [ErrorWrap]
fnbool 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.
fnint closefrom(int lowfd) nothrowClose every file descriptor equal to or greater than lowfd.
fnstring computeChecksumForBytes(glib.types.ChecksumType checksumType, glib.bytes.Bytes data) nothrowComputes 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].
fnstring computeChecksumForData(glib.types.ChecksumType checksumType, ubyte[] data) nothrowComputes 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].
fnstring computeChecksumForString(glib.types.ChecksumType checksumType, string str) nothrowComputes the checksum of a string.
fnstring computeHmacForBytes(glib.types.ChecksumType digestType, glib.bytes.Bytes key, glib.bytes.Bytes data) nothrowComputes 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].
fnstring computeHmacForData(glib.types.ChecksumType digestType, ubyte[] key, ubyte[] data) nothrowComputes 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].
fnstring computeHmacForString(glib.types.ChecksumType digestType, ubyte[] key, string str) nothrowComputes the HMAC for a string.
fnubyte[] convert(ubyte[] str, string toCodeset, string fromCodeset, out size_t bytesRead)Converts a string from one character set to another.
fnubyte[] convertWithFallback(ubyte[] str, string toCodeset, string fromCodeset, string fallback, out 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 ...
fnint creat(string filename, int mode) nothrowA wrapper for the POSIX creat() function. The creat() function is used to convert a pathname into a file descriptor, creating a file if necessary.
fnvoid datasetDestroy(const(void) * datasetLocation) nothrowDestroys the dataset, freeing all memory allocated, and calling any destroy functions set for data elements.
fnvoid datasetForeach(const(void) * datasetLocation, glib.types.DataForeachFunc func) nothrowCalls 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 modifica...
fnvoid * datasetIdGetData(const(void) * datasetLocation, glib.types.Quark keyId) nothrowGets the data element corresponding to a #GQuark.
fnstring dcgettext(string domain, string msgid, int category) nothrowThis 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 ...
fnstring dgettext(string domain, string msgid) nothrowThis 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.
fnbool directEqual(const(void) * v1 = null, const(void) * v2 = null) nothrowCompares 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 poi...
fnuint directHash(const(void) * v = null) nothrowConverts 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.
fnstring dngettext(string domain, string msgid, string msgidPlural, gulong n) nothrowThis 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.
fnbool doubleEqual(const(void) * v1, const(void) * v2) nothrowCompares 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 point...
fnuint doubleHash(const(void) * v) nothrowConverts 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_f...
fnstring dpgettext(string domain, string msgctxtid, size_t msgidoffset) nothrowThis 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 msgctxt...
fnstring dpgettext2(string domain, string context, string msgid) nothrowThis 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.
fnstring environGetenv(string[] envp, string variable) nothrowReturns the value of the environment variable variable in the provided list envp.
fnint fdwalkSetCloexec(int lowfd) nothrowMark 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.
fnglib.types.FileError fileErrorFromErrno(int errNo) nothrowGets a #GFileError constant based on the passed-in err_no.
fnbool fileGetContents(string filename, out ubyte[] contents)Reads an entire file into allocated memory, with good error checking.
fnint fileOpenTmp(string tmpl, out string nameUsed)Opens a file for writing in the preferred directory for temporary files (as returned by [glib.global.getTmpDir]).
fnstring fileReadLink(string filename)Reads the contents of the symbolic link filename like the POSIX `readlink()` function.
fnbool 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_CONT...
fnbool 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.
fnbool fileTest(string filename, glib.types.FileTest test) nothrowReturns 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 does...
fnstring filenameDisplayBasename(string filename) nothrowReturns 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 t...
fnstring filenameDisplayName(string filename) nothrowConverts 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 purpos...
fnstring filenameFromUri(string uri, out string hostname)Converts an escaped ASCII-encoded URI to a local filename in the encoding used for filenames.
fnubyte[] filenameFromUtf8(ubyte[] utf8string, out size_t bytesRead)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...
fnstring filenameToUri(string filename, string hostname = null)Converts an absolute filename to an escaped ASCII-encoded URI, with the path component following Section 3.3. of RFC 2396.
fnstring filenameToUtf8(ubyte[] opsysstring, out size_t bytesRead)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 o...
fnstring findProgramInPath(string program) nothrowLocates 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 ...
fnvoid * fopen(string filename, string mode) nothrowA wrapper for the stdio `fopen()` function. The `fopen()` function opens a file and associates a new stream with it.
fnstring formatSize(ulong size) nothrowFormats 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 fil...
fnstring formatSizeForDisplay(long size) nothrowFormats 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...
fnstring formatSizeFull(ulong size, glib.types.FormatSizeFlags flags) nothrowFormats a size.
fnvoid gfree(void * mem = null) nothrowFrees the memory pointed to by mem.
fnvoid freeSized(void * mem, size_t size) nothrowFrees the memory pointed to by mem, assuming it is has the given size.
fnvoid * freopen(string filename, string mode, void * stream = null) nothrowA wrapper for the POSIX freopen() function. The freopen() function opens a file and associates it with an existing stream.
fnint fsync(int fd) nothrowA 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 wi...
fnstring getApplicationName() nothrowGets 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....
fnbool getCharset(out string charset) nothrowObtains 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 ...
fnstring getCodeset() nothrowGets the character set for the current locale. Returns: a newly allocated string containing the name of the character set. This string must be freed with [glib.global.gfree].
fnbool getConsoleCharset(out string charset) nothrowObtains the character set used by the console attached to the process, which is suitable for printing output to the terminal.
fnstring getCurrentDir() nothrowGets the current directory.
fnvoid getCurrentTime(out glib.time_val.TimeVal result) nothrowEquivalent to the UNIX gettimeofday() function, but portable.
fnstring[] getEnviron() nothrowGets the list of environment variables for the current process.
fnbool getFilenameCharsets(out string[] filenameCharsets) nothrowDetermines 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 disp...
fnstring getHomeDir() nothrowGets the current user's home directory.
fnstring getHostName() nothrowReturn a name for the machine.
fnstring[] getLanguageNames() nothrowComputes 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 al...
fnstring[] getLanguageNamesWithCategory(string categoryName) nothrowComputes 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...
fnstring[] getLocaleVariants(string locale) nothrowReturns 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. Thi...
fnlong getMonotonicTime() nothrowQueries the system monotonic time.
fnuint getNumProcessors() nothrowDetermine 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 ...
fnstring getOsInfo(string keyName) nothrowGet information about the operating system.
fnstring getPrgname() nothrowGets the name of the program. This name should not be localized, in contrast to [glib.global.getApplicationName].
fnstring getRealName() nothrowGets 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 ...
fnlong getRealTime() nothrowQueries the system wall-clock time.
fnstring[] getSystemConfigDirs() nothrowReturns an ordered list of base directories in which to access system-wide configuration information.
fnstring[] getSystemDataDirs() nothrowReturns an ordered list of base directories in which to access system-wide application data.
fnstring getTmpDir() nothrowGets the directory to use for temporary files.
fnstring getUserCacheDir() nothrowReturns a base directory in which to store non-essential, cached data specific to particular user.
fnstring getUserConfigDir() nothrowReturns a base directory in which to store user-specific application configuration information such as user preferences and settings.
fnstring getUserDataDir() nothrowReturns a base directory in which to access application data such as icons that is customized for a particular user.
fnstring getUserName() nothrowGets 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 th...
fnstring getUserRuntimeDir() nothrowReturns a directory that is unique to the current user on the local system.
fnstring getUserSpecialDir(glib.types.UserDirectory directory) nothrowReturns the full path of a special directory using its logical id.
fnstring getUserStateDir() nothrowReturns a base directory in which to store state files specific to particular user.
fnstring getenv(string variable) nothrowReturns the value of an environment variable.
fnbool hostnameIsAsciiEncoded(string hostname) nothrowTests 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] ...
fnbool hostnameIsIpAddress(string hostname) nothrowTests if hostname is the string form of an IPv4 or IPv6 address. (Eg, "192.168.0.1".)
fnbool hostnameIsNonAscii(string hostname) nothrowTests 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.
fnstring hostnameToAscii(string hostname) nothrowConverts hostname to its canonical ASCII form; an ASCII-only string containing no uppercase letters and not ending with a trailing dot.
fnstring hostnameToUnicode(string hostname) nothrowConverts 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 no...
fnuint idleAdd(int priority, glib.types.SourceFunc function_) nothrowAdds a function to be called whenever there are no higher priority events pending.
fnbool idleRemoveByData(void * data = null) nothrowRemoves the idle function with the given data.
fnglib.source.Source idleSourceNew() nothrowCreates a new idle source.
fnbool int64Equal(const(void) * v1, const(void) * v2) nothrowCompares 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 pointe...
fnuint int64Hash(const(void) * v) nothrowConverts a pointer to a #gint64 to a hash value.
fnbool intEqual(const(void) * v1, const(void) * v2) nothrowCompares 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...
fnuint intHash(const(void) * v) nothrowConverts 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.
fnstring internStaticString(string string_ = null) nothrowReturns 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...
fnstring internString(string string_ = null) nothrowReturns a canonical representation for string. Interned strings can be compared for equality by comparing the pointers, instead of using strcmp().
fnuint ioAddWatch(glib.iochannel.IOChannel channel, int priority, glib.types.IOCondition condition, glib.types.IOFunc func) nothrowAdds the #GIOChannel into the default main loop context with the given priority.
fnglib.source.Source ioCreateWatch(glib.iochannel.IOChannel channel, glib.types.IOCondition condition) nothrowCreates 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...
fnstring[] listenv() nothrowGets the names of all variables set in the environment.
fnubyte[] localeFromUtf8(ubyte[] utf8string, out 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 ...
fnstring localeToUtf8(ubyte[] opsysstring, out size_t bytesRead)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.
fnvoid logDefaultHandler(string logDomain, glib.types.LogLevelFlags logLevel, string message = null, void * unusedData = null) nothrowThe default log handler set up by GLib; `funcGLib.log_set_default_handler` allows to install an alternate default log handler.
fnbool logGetDebugEnabled() nothrowReturn whether debug output from the GLib logging system is enabled.
fnvoid logRemoveHandler(string logDomain, uint handlerId) nothrowRemoves the log handler.
fnglib.types.LogLevelFlags logSetAlwaysFatal(glib.types.LogLevelFlags fatalMask) nothrowSets the message levels which are always fatal, in any log domain.
fnvoid logSetDebugEnabled(bool enabled) nothrowEnable or disable debug output from the GLib logging system for all domains.
fnglib.types.LogLevelFlags logSetFatalMask(string logDomain, glib.types.LogLevelFlags fatalMask) nothrowSets the log levels which are fatal in the given domain.
fnuint logSetHandler(string logDomain, glib.types.LogLevelFlags logLevels, glib.types.LogFunc logFunc) nothrowLike `funcGLib.log_set_handler`, but takes a destroy notify for the user_data.
fnvoid logVariant(string logDomain, glib.types.LogLevelFlags logLevel, glib.variant.Variant fields) nothrowLog a message with structured data, accepting the data within a [glib.variant.Variant].
fnvoid logWriterDefaultSetDebugDomains(string[] domains = null) nothrowReset the list of domains to be logged, that might be initially set by the `G_MESSAGES_DEBUG` environment variable.
fnvoid logWriterDefaultSetUseStderr(bool useStderr) nothrowConfigure whether the built-in log functions will output all log messages to `stderr`.
fnbool logWriterDefaultWouldDrop(glib.types.LogLevelFlags logLevel, string logDomain = null) nothrowCheck whether `funcGLib.log_writer_default` and `funcGLib.log_default_handler` would ignore a message with the given domain and level.
fnbool logWriterIsJournald(int outputFd) nothrowCheck 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`).
fnbool logWriterSupportsColor(int outputFd) nothrowCheck whether the given output_fd file descriptor supports [ANSI color escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code).
fnint lstat(string filename, glib.types.StatBuf buf) nothrowA 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 ...
fnglib.source.Source mainCurrentSource() nothrowReturns the currently firing source for this thread. Returns: The currently firing source or null.
fnint mainDepth() nothrowReturns 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 ...
fnvoid * gmalloc(size_t nBytes) nothrowAllocates n_bytes bytes of memory. If n_bytes is 0 it returns null.
fnvoid * malloc0(size_t nBytes) nothrowAllocates n_bytes bytes of memory, initialized to 0's. If n_bytes is 0 it returns null.
fnvoid * malloc0N(size_t nBlocks, size_t nBlockBytes) nothrowThis function is similar to [glib.global.malloc0], allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.
fnvoid * mallocN(size_t nBlocks, size_t nBlockBytes) nothrowThis function is similar to [glib.global.gmalloc], allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.
fnstring markupEscapeText(string text) nothrowEscapes 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 writ...
fnbool memIsSystemMalloc() nothrowChecks 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...
fnvoid memProfile() nothrowGLib 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.
fnvoid memSetVtable(glib.types.MemVTable vtable) nothrowThis 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 b...
fnvoid * memdup(const(void) * mem, uint byteSize) nothrowAllocates byte_size bytes of memory, and copies byte_size bytes into it from mem. If mem is `NULL` it returns `NULL`.
fnvoid * memdup2(const(void) * mem, size_t byteSize) nothrowAllocates byte_size bytes of memory, and copies byte_size bytes into it from mem. If mem is `NULL` it returns `NULL`.
fnint mkdir(string filename, int mode) nothrowA 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.
fnint mkdirWithParents(string pathname, int mode) nothrowCreate a directory if it doesn't already exist. Create intermediate parent directories as needed, too.
fnvoid nullifyPointer(out void * nullifyLocation) nothrowSet the pointer at the specified location to null.
fnvoid onErrorQuery(string prgName) nothrowPrompts 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 th...
fnvoid onErrorStackTrace(string prgName) nothrowInvokes gdb, which attaches to the current process and shows a stack trace. Called by [glib.global.onErrorQuery] when the "[S]tack trace" option is selected. You can get the current process's progr...
fnint open(string filename, int flags, int mode) nothrowA wrapper for the POSIX open() function. The open() function is used to convert a pathname into a file descriptor.
fnstring pathGetBasename(string fileName) nothrowGets the last component of the filename.
fnstring pathGetDirname(string fileName) nothrowGets the directory components of a file name. For example, the directory component of `/usr/bin/test` is `/usr/bin`. The directory component of `/` is `/`.
fnbool pathIsAbsolute(string fileName) nothrowReturns true if the given file_name is an absolute file name. Note that this is a somewhat vague concept on Windows.
fnstring pathSkipRoot(string fileName) nothrowReturns 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.
fnbool patternMatchSimple(string pattern, string string_) nothrowMatches 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 ...
fnvoid pointerBitLock(void * address, int lockBit) nothrowThis is equivalent to g_bit_lock, but working on pointers (or other pointer-sized values).
fnvoid pointerBitLockAndGet(void * address, uint lockBit, out size_t outPtr) nothrowThis is equivalent to g_bit_lock, but working on pointers (or other pointer-sized values).
fnvoid * pointerBitLockMaskPtr(void * ptr, uint lockBit, bool set, size_t preserveMask, void * preservePtr = null) nothrowThis mangles ptr as [glib.global.pointerBitLock] and [glib.global.pointerBitUnlock] do.
fnbool pointerBitTrylock(void * address, int lockBit) nothrowThis is equivalent to [glib.global.bitTrylock], but working on pointers (or other pointer-sized values).
fnvoid pointerBitUnlock(void * address, int lockBit) nothrowThis is equivalent to g_bit_unlock, but working on pointers (or other pointer-sized values).
fnvoid pointerBitUnlockAndSet(void * address, uint lockBit, void * ptr, size_t preserveMask) nothrowThis is equivalent to [glib.global.pointerBitUnlock] and atomically setting the pointer value.
fnint poll(glib.types.PollFD fds, uint nfds, int timeout) nothrowPolls 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 ...
fnvoid propagateError(out glib.error.ErrorWrap dest, glib.error.ErrorWrap src) nothrowIf dest is null, free src; otherwise, moves src into *dest. The error variable dest points to must be null.
fnvoid qsortWithData(const(void) * pbase, int totalElems, size_t size, glib.types.CompareDataFunc compareFunc) nothrowThis is just like the standard C qsort() function, but the comparison routine accepts a user data argument.
fnglib.types.Quark quarkFromStaticString(string string_ = null) nothrowGets 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.
fnglib.types.Quark quarkFromString(string string_ = null) nothrowGets 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.
fnstring quarkToString(glib.types.Quark quark) nothrowGets the string associated with the given #GQuark.
fnglib.types.Quark quarkTryString(string string_ = null) nothrowGets the #GQuark associated with the given string, or 0 if string is null or it has no associated #GQuark.
fndouble randomDouble() nothrowReturns a random #gdouble equally distributed over the range [0..1). Returns: a random number
fndouble randomDoubleRange(double begin, double end) nothrowReturns a random #gdouble equally distributed over the range [begin..end).
fnuint randomInt() nothrowReturn a random #guint32 equally distributed over the range [0..2^32-1]. Returns: a random number
fnint randomIntRange(int begin, int end) nothrowReturns a random #gint32 equally distributed over the range [begin..end-1].
fnvoid randomSetSeed(uint seed) nothrowSets the seed for the global random number generator, which is used by the g_random_* functions, to seed.
fnvoid * rcBoxAcquire(void * memBlock) nothrowAcquires a reference on the data pointed by mem_block.
fnvoid * rcBoxAlloc(size_t blockSize) nothrowAllocates block_size bytes of memory, and adds reference counting semantics to it.
fnvoid * rcBoxAlloc0(size_t blockSize) nothrowAllocates block_size bytes of memory, and adds reference counting semantics to it.
fnvoid * rcBoxDup(size_t blockSize, const(void) * memBlock) nothrowAllocates a new block of data with reference counting semantics, and copies block_size bytes of mem_block into it.
fnsize_t rcBoxGetSize(void * memBlock) nothrowRetrieves the size of the reference counted data pointed by mem_block.
fnvoid rcBoxRelease(void * memBlock) nothrowReleases a reference on the data pointed by mem_block.
fnvoid rcBoxReleaseFull(void * memBlock, glib.types.DestroyNotify clearFunc) nothrowReleases a reference on the data pointed by mem_block.
fnvoid * realloc(void * mem, size_t nBytes) nothrowReallocates 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 i...
fnvoid * reallocN(void * mem, size_t nBlocks, size_t nBlockBytes) nothrowThis function is similar to [glib.global.realloc], allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.
fnbool refCountCompare(ref int rc, int val) nothrowCompares the current value of rc with val.
fnbool refCountDec(ref int rc) nothrowDecreases the reference count.
fnvoid refCountInc(ref int rc) nothrowIncreases the reference count.
fnvoid refCountInit(ref int rc) nothrowInitializes a reference count variable to 1.
fnstring refStringAcquire(string str) nothrowAcquires a reference on a string.
fnsize_t refStringLength(string str) nothrowRetrieves the length of str.
fnstring refStringNew(string str) nothrowCreates a new reference counted string and copies the contents of str into it.
fnstring refStringNewIntern(string str) nothrowCreates a new reference counted string and copies the content of str into it.
fnstring refStringNewLen(string str, ptrdiff_t len) nothrowCreates a new reference counted string and copies the contents of str into it, up to len bytes.
fnvoid refStringRelease(string str) nothrowReleases a reference on a string; if it was the last reference, the resources allocated by the string are freed as well.
fnvoid reloadUserSpecialDirsCache() nothrowResets 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.
fnint remove(string filename) nothrowA wrapper for the POSIX remove() function. The remove() function deletes a name from the filesystem.
fnint rename(string oldfilename, string newfilename) nothrowA wrapper for the POSIX rename() function. The rename() function renames a file, moving it between directories if required.
fnint rmdir(string filename) nothrowA wrapper for the POSIX rmdir() function. The rmdir() function deletes a directory from the filesystem.
fnvoid setApplicationName(string applicationName) nothrowSets 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-localize...
fnvoid setErrorLiteral(out glib.error.ErrorWrap err, glib.types.Quark domain, int code, string message) nothrowDoes 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....
fnvoid setPrgname(string prgname) nothrowSets the name of the program. This name should not be localized, in contrast to [glib.global.setApplicationName].
fnbool setenv(string variable, string value, bool overwrite) nothrowSets 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.
fnbool shellParseArgv(string commandLine, out 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 expan...
fnstring shellQuote(string unquotedString) nothrowQuotes a string so that the shell (/bin/sh) will interpret the quoted string to mean unquoted_string.
fnstring shellUnquote(string quotedString)Unquotes a string as the shell (/bin/sh) would.
fnvoid * sliceAlloc(size_t blockSize) nothrowAllocates a block of memory from the libc allocator.
fnvoid * sliceAlloc0(size_t blockSize) nothrowAllocates a block of memory via [glib.global.sliceAlloc] and initializes the returned memory to 0.
fnvoid * sliceCopy(size_t blockSize, const(void) * memBlock = null) nothrowAllocates a block of memory from the slice allocator and copies block_size bytes into it from mem_block.
fnvoid sliceFree1(size_t blockSize, void * memBlock = null) nothrowFrees a block of memory.
fnvoid sliceFreeChainWithOffset(size_t blockSize, void * memChain, size_t nextOffset) nothrowFrees a linked list of memory blocks of structure type type.
fnlong[] sliceGetConfigState(glib.types.SliceConfig ckey, long address) nothrow
fnvoid sliceSetConfig(glib.types.SliceConfig ckey, long value) nothrow
fnuint spacedPrimesClosest(uint num) nothrowGets 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.
fnbool spawnAsync(string workingDirectory, string[] argv, string[] envp, glib.types.SpawnFlags flags, glib.types.SpawnChildSetupFunc childSetup, out glib.types.Pid childPid)Executes a child program asynchronously.
fnbool spawnAsyncWithFds(string workingDirectory, string[] argv, string[] envp, glib.types.SpawnFlags flags, glib.types.SpawnChildSetupFunc childSetup, out glib.types.Pid childPid, int stdinFd, int stdoutFd, int stderrFd)Executes a child program asynchronously.
fnbool spawnAsyncWithPipes(string workingDirectory, string[] argv, string[] envp, glib.types.SpawnFlags flags, glib.types.SpawnChildSetupFunc childSetup, out glib.types.Pid childPid, out int standardInput, out int standardOutput, out int standardError)Identical to [glib.global.spawnAsyncWithPipesAndFds] but with `n_fds` set to zero, so no FD assignments are used.
fnbool 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, out glib.types.Pid childPidOut, out int stdinPipeOut, out int stdoutPipeOut, out int stderrPipeOut)Executes a child program asynchronously (your program will not block waiting for the child to exit).
fnbool spawnCheckExitStatus(int waitStatus)An old name for [glib.global.spawnCheckWaitStatus], deprecated because its name is misleading.
fnbool 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).
fnvoid spawnClosePid(glib.types.Pid pid) nothrowOn 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 use...
fnbool 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].
fnbool spawnCommandLineSync(string commandLine, out string standardOutput, out string standardError, out int waitStatus)A simple version of [glib.global.spawnSync] with little-used parameters removed, taking a command line instead of an argument vector.
fnbool spawnSync(string workingDirectory, string[] argv, string[] envp, glib.types.SpawnFlags flags, glib.types.SpawnChildSetupFunc childSetup, out string standardOutput, out string standardError, out int waitStatus)Executes a child synchronously (waits for the child to exit before returning).
fnint stat(string filename, glib.types.StatBuf buf) nothrowA 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 ...
fnstring stpcpy(string dest, string src) nothrowCopies 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 ...
fnbool strEqual(const(void) * v1, const(void) * v2) nothrowCompares 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 ...
fnbool strHasPrefix(string str, string prefix) nothrowLooks whether the string str begins with prefix.
fnbool strHasSuffix(string str, string suffix) nothrowLooks whether a string ends with suffix.
fnuint strHash(const(void) * v) nothrowConverts a string to a hash value.
fnbool strIsAscii(string str) nothrowDetermines if a string is pure ASCII. A string is pure ASCII if it contains no bytes with the high bit set.
fnbool strMatchString(string searchTerm, string potentialHit, bool acceptAlternates) nothrowChecks if a search conducted for search_term should match potential_hit.
fnstring strToAscii(string str, string fromLocale = null) nothrowTransliterate str to plain ASCII.
fnstring[] strTokenizeAndFold(string string_, string translitLocale, out string[] asciiAlternates) nothrowTokenizes string and performs folding on each token.
fnstring strcanon(string string_, string validChars, char substitutor) nothrowFor each character in string, if the character is not in valid_chars, replaces the character with substitutor.
fnint strcasecmp(string s1, string s2) nothrowA case-insensitive string comparison, corresponding to the standard `strcasecmp()` function on platforms which support it.
fnstring strchomp(string string_) nothrowRemoves trailing whitespace from a string.
fnstring strchug(string string_) nothrowRemoves leading whitespace from a string, by moving the rest of the characters forward.
fnint strcmp0(string str1 = null, string str2 = null) nothrowCompares str1 and str2 like strcmp(). Handles null gracefully by sorting it before non-null strings. Comparing two null pointers returns 0.
fnstring strcompress(string source) nothrowReplaces all escaped characters with their one byte equivalent.
fnstring strdelimit(string string_, string delimiters, char newDelimiter) nothrowConverts any delimiter characters in string to new_delimiter.
fnstring strdown(string string_) nothrowConverts a string to lower case.
fnstring strdup(string str = null) nothrowDuplicates a string. If str is `NULL` it returns `NULL`.
fnstring[] strdupv(string[] strArray = null) nothrowCopies an array of strings. The copy is a deep copy; each string is also copied.
fnstring strerror(int errnum) nothrowReturns a string corresponding to the given error code, e.g. "no such process".
fnstring strescape(string source, string exceptions = null) nothrowEscapes 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 be...
fnstring stripContext(string msgid, string msgval) nothrowAn auxiliary function for gettext() support (see Q_()).
fnstring strjoinv(string separator, string[] strArray) nothrowJoins an array of strings together to form one long string, with the optional separator inserted between each of them.
fnint strncasecmp(string s1, string s2, uint n) nothrowA 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 ...
fnstring strndup(string str, size_t n) nothrowDuplicates 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 n...
fnstring strnfill(size_t length, char fillChar) nothrowCreates a new string length bytes long filled with fill_char.
fnstring strreverse(string string_) nothrowReverses all of the bytes in a string. For example, `g_strreverse ("abcdef")` will result in "fedcba".
fnstring strrstr(string haystack, string needle) nothrowSearches the string haystack for the last occurrence of the string needle.
fnstring strsignal(int signum) nothrowReturns a string describing the given signal, e.g. "Segmentation fault". If the signal is unknown, it returns “unknown signal (<signum\>)”.
fnstring[] strsplit(string string_, string delimiter, int maxTokens) nothrowSplits 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.
fnstring[] strsplitSet(string string_, string delimiters, int maxTokens) nothrowSplits 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. I...
fndouble strtod(string nptr, out string endptr) nothrowConverts a string to a floating point value.
fnstring strup(string string_) nothrowConverts a string to upper case.
fnbool strvContains(string[] strv, string str) nothrowChecks if an array of strings contains the string str according to `funcGLib.str_equal`. strv must not be `NULL`.
fnbool strvEqual(string[] strv1, string[] strv2) nothrowChecks if two arrays of strings contain exactly the same elements in exactly the same order.
fnuint strvLength(string[] strArray) nothrowReturns the length of an array of strings. str_array must not be `NULL`.
fnvoid testAddDataFunc(string testpath, const(void) * testData, glib.types.TestDataFunc testFunc) nothrowCreate 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, b...
fnvoid testAssertExpectedMessagesInternal(string domain, string file, int line, string func) nothrow
fnvoid testBug(string bugUriSnippet) nothrowThis function adds a message to test reports that associates a bug URI with a test case.
fnvoid testBugBase(string uriPattern) nothrowSpecify the base URI for bug reports.
fnvoid testDisableCrashReporting() nothrowAttempt to disable system crash reporting infrastructure.
fnvoid testExpectMessage(string logDomain, glib.types.LogLevelFlags logLevel, string pattern) nothrowIndicates that a message with the given log_domain and log_level, with text matching pattern, is expected to be logged.
fnvoid testFail() nothrowIndicates 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.
fnbool testFailed() nothrowReturns 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 f...
fnstring testGetDir(glib.types.TestFileType fileType) nothrowGets the pathname of the directory containing test files of the type specified by file_type.
fnstring testGetPath() nothrowGets the test path for the test currently being run.
fnvoid testIncomplete(string msg = null) nothrowIndicates that a test failed because of some incomplete functionality. This function can be called multiple times from the same test.
fnstring testLogTypeName(glib.types.TestLogType logType) nothrow
fnvoid testQueueFree(void * gfreePointer = null) nothrowEnqueue 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].
fndouble testRandDouble() nothrowGet a reproducible random floating point number, see [glib.global.testRandInt] for details on test case random numbers. Returns: a random number from the seeded random number generator.
fndouble testRandDoubleRange(double rangeStart, double rangeEnd) nothrowGet a reproducible random floating pointer number out of a specified range, see [glib.global.testRandInt] for details on test case random numbers.
fnint testRandInt() nothrowGet a reproducible random integer number.
fnint testRandIntRange(int begin, int end) nothrowGet a reproducible random integer number out of a specified range, see [glib.global.testRandInt] for details on test case random numbers.
fnint testRun() nothrowRuns 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 ar...
fnint testRunSuite(glib.test_suite.TestSuite suite) nothrowExecute 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....
fnvoid testSetNonfatalAssertions() nothrowChanges 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....
fnvoid testSkip(string msg = null) nothrowIndicates that a test was skipped.
fnbool testSubprocess() nothrowReturns true (after [glib.global.testInit] has been called) if the test program is running under [glib.global.testTrapSubprocess]. Returns: true if the test program is running under [glib.global.te...
fnvoid testSummary(string summary) nothrowSet 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 s...
fndouble testTimerElapsed() nothrowGet the number of seconds since the last start of the timer with [glib.global.testTimerStart]. Returns: the time since the last start of the timer in seconds, as a double
fndouble testTimerLast() nothrowReport the last result of [glib.global.testTimerElapsed]. Returns: the last result of [glib.global.testTimerElapsed], as a double
fnvoid testTimerStart() nothrowStart a timing test. Call [glib.global.testTimerElapsed] when the task is supposed to be done. Call this function again to restart the timer.
fnvoid testTrapAssertions(string domain, string file, int line, string func, ulong assertionFlags, string pattern) nothrow
fnbool testTrapFork(ulong usecTimeout, glib.types.TestTrapFlags testTrapFlags) nothrowFork the current test program to execute a test case that might not return or that might abort.
fnbool testTrapHasPassed() nothrowCheck the result of the last [glib.global.testTrapSubprocess] call. Returns: true if the last test subprocess terminated successfully.
fnbool testTrapReachedTimeout() nothrowCheck the result of the last [glib.global.testTrapSubprocess] call. Returns: true if the last test subprocess got killed due to a timeout.
fnvoid testTrapSubprocess(string testPath, ulong usecTimeout, glib.types.TestSubprocessFlags testFlags) nothrowRespawns the test program to run only test_path in a subprocess.
fnvoid testTrapSubprocessWithEnvp(string testPath, string[] envp, ulong usecTimeout, glib.types.TestSubprocessFlags testFlags) nothrowRespawns the test program to run only test_path in a subprocess with the given envp environment.
fnuint timeoutAdd(int priority, uint interval, glib.types.SourceFunc function_) nothrowSets 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 ...
fnuint timeoutAddSeconds(int priority, uint interval, glib.types.SourceFunc function_) nothrowSets a function to be called at regular intervals, with priority.
fnglib.source.Source timeoutSourceNew(uint interval) nothrowCreates a new timeout source.
fnglib.source.Source timeoutSourceNewSeconds(uint interval) nothrowCreates a new timeout source.
fnvoid * tryMalloc(size_t nBytes) nothrowAttempts to allocate n_bytes, and returns null on failure. Contrast with [glib.global.gmalloc], which aborts the program on failure.
fnvoid * tryMalloc0(size_t nBytes) nothrowAttempts to allocate n_bytes, initialized to 0's, and returns null on failure. Contrast with [glib.global.malloc0], which aborts the program on failure.
fnvoid * tryMalloc0N(size_t nBlocks, size_t nBlockBytes) nothrowThis function is similar to [glib.global.tryMalloc0], allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.
fnvoid * tryMallocN(size_t nBlocks, size_t nBlockBytes) nothrowThis function is similar to [glib.global.tryMalloc], allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.
fnvoid * tryRealloc(void * mem, size_t nBytes) nothrowAttempts 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.
fnvoid * tryReallocN(void * mem, size_t nBlocks, size_t nBlockBytes) nothrowThis function is similar to [glib.global.tryRealloc], allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.
fnushort[] ucs4ToUtf16(dchar[] str, out glong itemsRead, out glong itemsWritten)Convert a string from UCS-4 to UTF-16. A 0 character will be added to the result after the converted text.
fnstring ucs4ToUtf8(dchar[] str, out glong itemsRead, out 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.
fnglib.types.UnicodeBreakType unicharBreakType(dchar c) nothrowDetermines 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 brea...
fnint unicharCombiningClass(dchar uc) nothrowDetermines the canonical combining class of a Unicode character.
fnbool unicharCompose(dchar a, dchar b, out dchar ch) nothrowPerforms a single composition step of the Unicode canonical composition algorithm.
fnbool unicharDecompose(dchar ch, out dchar a, out dchar b) nothrowPerforms a single decomposition step of the Unicode canonical decomposition algorithm.
fnint unicharDigitValue(dchar c) nothrowDetermines the numeric value of a character as a decimal digit.
fnsize_t unicharFullyDecompose(dchar ch, bool compat, out dchar result, size_t resultLen) nothrowComputes the canonical or compatibility decomposition of a Unicode character. For compatibility decomposition, pass true for compat; for canonical decomposition pass false for compat.
fnbool unicharGetMirrorChar(dchar ch, out dchar mirroredCh) nothrowIn 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, ")",...
fnglib.types.UnicodeScript unicharGetScript(dchar ch) nothrowLooks 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 r...
fnbool unicharIsalnum(dchar c) nothrowDetermines whether a character is alphanumeric. Given some UTF-8 text, obtain a character value with [glib.global.utf8GetChar].
fnbool unicharIsalpha(dchar c) nothrowDetermines whether a character is alphabetic (i.e. a letter). Given some UTF-8 text, obtain a character value with [glib.global.utf8GetChar].
fnbool unicharIscntrl(dchar c) nothrowDetermines whether a character is a control character. Given some UTF-8 text, obtain a character value with [glib.global.utf8GetChar].
fnbool unicharIsdefined(dchar c) nothrowDetermines if a given character is assigned in the Unicode standard.
fnbool unicharIsdigit(dchar c) nothrowDetermines 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.utf8G...
fnbool unicharIsgraph(dchar c) nothrowDetermines 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 spac...
fnbool unicharIslower(dchar c) nothrowDetermines whether a character is a lowercase letter. Given some UTF-8 text, obtain a character value with [glib.global.utf8GetChar].
fnbool unicharIsmark(dchar c) nothrowDetermines 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].
fnbool unicharIsprint(dchar c) nothrowDetermines 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].
fnbool unicharIspunct(dchar c) nothrowDetermines whether a character is punctuation or a symbol. Given some UTF-8 text, obtain a character value with [glib.global.utf8GetChar].
fnbool unicharIsspace(dchar c) nothrowDetermines 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].
fnbool unicharIstitle(dchar c) nothrowDetermines 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 begin...
fnbool unicharIsupper(dchar c) nothrowDetermines if a character is uppercase.
fnbool unicharIswide(dchar c) nothrowDetermines if a character is typically rendered in a double-width cell.
fnbool unicharIswideCjk(dchar c) nothrowDetermines 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 wi...
fnbool unicharIsxdigit(dchar c) nothrowDetermines if a character is a hexadecimal digit.
fnbool unicharIszerowidth(dchar c) nothrowDetermines 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 s...
fndchar unicharTolower(dchar c) nothrowConverts a character to lower case.
fndchar unicharTotitle(dchar c) nothrowConverts a character to the titlecase.
fndchar unicharToupper(dchar c) nothrowConverts a character to uppercase.
fnglib.types.UnicodeType unicharType(dchar c) nothrowClassifies a Unicode character by type.
fnbool unicharValidate(dchar ch) nothrowChecks 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.
fnint unicharXdigitValue(dchar c) nothrowDetermines the numeric value of a character as a hexadecimal digit.
fndchar[] unicodeCanonicalDecomposition(dchar ch) nothrowComputes the canonical decomposition of a Unicode character.
fnvoid unicodeCanonicalOrdering(dchar[] string_) nothrowComputes 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.
fnuint unixFdAddFull(int priority, int fd, glib.types.IOCondition condition, glib.types.UnixFDSourceFunc function_) nothrowSets a function to be called when the IO condition, as specified by condition becomes true for fd.
fnglib.source.Source unixFdSourceNew(int fd, glib.types.IOCondition condition) nothrowCreates a #GSource to watch for a particular I/O condition on a file descriptor.
fnvoid * 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.
fnbool 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.
fnbool 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`.
fnuint unixSignalAdd(int priority, int signum, glib.types.SourceFunc handler) nothrowA convenience function for [glib.global.unixSignalSourceNew], which attaches to the default #GMainContext. You can remove the watch using [glib.source.Source.remove].
fnglib.source.Source unixSignalSourceNew(int signum) nothrowCreate 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 `...
fnint unlink(string filename) nothrowA 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...
fnvoid unsetenv(string variable) nothrowRemoves an environment variable from the environment.
fnvoid usleep(gulong microseconds) nothrowPauses the current thread for the given number of microseconds.
fndchar[] utf16ToUcs4(ushort[] str, out glong itemsRead)Convert a string from UTF-16 to UCS-4. The result will be nul-terminated.
fnstring utf16ToUtf8(ushort[] str, out glong itemsRead, out glong itemsWritten)Convert a string from UTF-16 to UTF-8. The result will be terminated with a 0 byte.
fnstring utf8Casefold(string str) nothrowConverts 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.globa...
fnint utf8Collate(string str1, string str2) nothrowCompares 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 colla...
fnstring utf8CollateKey(string str) nothrowConverts a string into a collation key that can be compared with other collation keys produced by the same function using strcmp().
fnstring utf8CollateKeyForFilename(string str) nothrowConverts a string into a collation key that can be compared with other collation keys produced by the same function using strcmp().
fnstring utf8FindNextChar(string p, string end = null) nothrowFinds the start of the next UTF-8 character in the string after `p`.
fnstring utf8FindPrevChar(string str, string p) nothrowGiven 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`.
fndchar utf8GetChar(string p) nothrowConverts a sequence of bytes encoded as UTF-8 to a Unicode character.
fndchar utf8GetCharValidated(string p) nothrowConvert 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, ...
fnstring utf8MakeValid(string str) nothrowIf 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 (...
fnstring utf8Normalize(string str, glib.types.NormalizeMode mode) nothrowConverts 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. ...
fnstring utf8OffsetToPointer(string str, glong offset) nothrowConverts from an integer character offset to a pointer to a position within the string.
fnglong utf8PointerToOffset(string str, string pos) nothrowConverts from a pointer to position within a string to an integer character offset.
fnstring utf8PrevChar(string p) nothrowFinds the previous UTF-8 character in the string before `p`.
fnstring utf8Strchr(string p, dchar c) nothrowFinds 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.
fnstring utf8Strdown(string str) nothrowConverts 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 stri...
fnglong utf8Strlen(string p, ptrdiff_t max) nothrowComputes 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.
fnstring utf8Strncpy(string dest, string src, size_t n) nothrowLike 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] ...
fnstring utf8Strrchr(string p, dchar c) nothrowFind 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.
fnstring utf8Strreverse(string str) nothrowReverses 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.)
fnstring utf8Strup(string str) nothrowConverts 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 stri...
fnstring utf8Substring(string str, glong startPos, glong endPos) nothrowCopies a substring out of a UTF-8 encoded string. The substring will contain end_pos - start_pos characters.
fndchar[] utf8ToUcs4(string str, glong len, out 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.
fndchar[] utf8ToUcs4Fast(string str) nothrowConvert 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 checkin...
fnushort[] utf8ToUtf16(string str, glong len, out glong itemsRead)Convert a string from UTF-8 to UTF-16. A 0 character will be added to the result after the converted text.
fnstring utf8TruncateMiddle(string string_, size_t truncateLength) nothrowCuts off the middle of the string, preserving half of truncate_length characters at the beginning and half at the end.
fnbool utf8Validate(ubyte[] str, out string end) nothrowValidates 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 th...
fnbool utf8ValidateLen(ubyte[] str, out string end) nothrowValidates UTF-8 encoded text.
fnbool uuidStringIsValid(string str) nothrowParses the string str and verify if it is a UUID.
fnstring uuidStringRandom() nothrowGenerates 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 on...