Module glib::functions[][src]

Functions

access
application_name
assert_warning
assertion_message
assertion_message_cmpstr
base64_decode
base64_encode
bit_nth_lsf
bit_nth_msf
bit_storage
build_filenamev

Behaves exactly like g_build_filename(), but takes the path elements as a string array, instead of varargs. This function is mainly meant for language bindings.

build_pathv

Behaves exactly like g_build_path(), but takes the path elements as a string array, instead of varargs. This function is mainly meant for language bindings.

canonicalize_filenamev2_58

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

chdir

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

check_version

Checks that the GLib library in use is compatible with the given version. Generally you would pass in the constants GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION as the three arguments to this function; that produces a check that the library in use is compatible with the version of GLib the application or module was compiled against.

clear_error

If err or *err is None, does nothing. Otherwise, calls g_error_free() on *err and sets *err to None.

codeset
compute_checksum_for_bytes

Computes the checksum for a binary data. This is a convenience wrapper for Checksum::new(), Checksum::string() and g_checksum_free().

compute_checksum_for_data

Computes the checksum for a binary data of length. This is a convenience wrapper for Checksum::new(), Checksum::string() and g_checksum_free().

compute_checksum_for_string

Computes the checksum of a string.

compute_hmac_for_bytesv2_50

Computes the HMAC for a binary data. This is a convenience wrapper for g_hmac_new(), g_hmac_get_string() and g_hmac_unref().

compute_hmac_for_data

Computes the HMAC for a binary data of length. This is a convenience wrapper for g_hmac_new(), g_hmac_get_string() and g_hmac_unref().

compute_hmac_for_string

Computes the HMAC for a string.

console_charsetv2_62
dcgettext
dgettext
dngettext
dpgettext
dpgettext2
environ
file_get_contents
file_open_tmp
file_read_link
file_set_contents
file_set_contents_fullv2_66
file_test
filename_display_basename
filename_display_name
format_size
format_size_full
host_name
hostname_is_ascii_encoded
hostname_is_ip_address
hostname_is_non_ascii
hostname_to_ascii
hostname_to_unicode
language_names
language_names_with_categoryv2_58
listenv
locale_variants
main_current_source
main_depth
markup_escape_text
mkdir_with_parents
mkdtemp
mkdtemp_full
mkstemp_full
monotonic_time
num_processors
on_error_query
on_error_stack_trace
os_infov2_64
path_get_basename
path_get_dirname
path_is_absolute
path_skip_root
pattern_match_simple
random_double
random_double_range
random_int
random_int_range
random_set_seed
real_time
reload_user_special_dirs_cache
return_if_fail_warning
rmdir
set_application_name
shell_parse_argv

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). The results are defined to be the same as those you would get from a UNIX98 /bin/sh, as long as the input contains none of the unsupported shell expansions. If the input does contain such expansions, they are passed through literally. Possible errors are those from the G_SHELL_ERROR domain. Free the returned vector with g_strfreev().

shell_quote

Quotes a string so that the shell (/bin/sh) will interpret the quoted string to mean unquoted_string. If you pass a filename to the shell, for example, you should first quote it with this function. The return value must be freed with g_free(). The quoting style used is undefined (single or double quotes may be used).

shell_unquote

Unquotes a string as the shell (/bin/sh) would. Only handles quotes; if a string contains file globs, arithmetic operators, variables, backticks, redirections, or other special-to-the-shell features, the result will be different from the result a real shell would produce (the variables, backticks, etc. will be passed through literally instead of being expanded). This function is guaranteed to succeed if applied to the result of shell_quote(). If it fails, it returns None and sets the error. The quoted_string need not actually contain quoted or escaped text; shell_unquote() simply goes through the string and unquotes/unescapes anything that the shell would. Both single and double quotes are handled, as are escapes including escaped newlines. The return value must be freed with g_free(). Possible errors are in the G_SHELL_ERROR domain.

spaced_primes_closest

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.

spawn_async

See g_spawn_async_with_pipes() for a full description; this function simply calls the g_spawn_async_with_pipes() without any pipes.

spawn_check_exit_status

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

spawn_command_line_asyncUnix

A simple version of spawn_async() that parses a command line with shell_parse_argv() and passes it to spawn_async(). Runs a command line in the background. Unlike spawn_async(), the SpawnFlags::SEARCH_PATH flag is enabled, other flags are not. Note that SpawnFlags::SEARCH_PATH can have security implications, so consider using spawn_async() directly if appropriate. Possible errors are those from shell_parse_argv() and spawn_async().

stpcpy

Copies a nul-terminated string into the dest buffer, include the trailing nul, and return a pointer to the trailing nul byte. This is useful for concatenating multiple strings together without having to repeatedly scan for the end.

system_config_dirs
system_data_dirs
unlink

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.

user_cache_dir
user_config_dir
user_data_dir
user_runtime_dir
user_special_dir
usleep

Pauses the current thread for the given number of microseconds.

uuid_string_is_validv2_52

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

uuid_string_randomv2_52

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.

warn_message

Internal function used to print messages from the public g_warn_if_reached() and g_warn_if_fail() macros.