Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gutils.h File Reference
#include <glib/gtypes.h>
#include <stdarg.h>
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  _GDebugKey
 

Macros

#define G_OS_INFO_KEY_NAME
 
#define G_OS_INFO_KEY_PRETTY_NAME
 
#define G_OS_INFO_KEY_VERSION
 
#define G_OS_INFO_KEY_VERSION_CODENAME
 
#define G_OS_INFO_KEY_VERSION_ID
 
#define G_OS_INFO_KEY_ID
 
#define G_OS_INFO_KEY_HOME_URL
 
#define G_OS_INFO_KEY_DOCUMENTATION_URL
 
#define G_OS_INFO_KEY_SUPPORT_URL
 
#define G_OS_INFO_KEY_BUG_REPORT_URL
 
#define G_OS_INFO_KEY_PRIVACY_POLICY_URL
 
#define g_ATEXIT(proc)   (atexit (proc)) GLIB_DEPRECATED_MACRO_IN_2_32
 
#define g_memmove(dest, src, len)    G_STMT_START { memmove ((dest), (src), (len)); } G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_40_FOR(memmove)
 
#define ATEXIT(proc)   g_ATEXIT(proc) GLIB_DEPRECATED_MACRO_IN_2_32
 
#define g_bit_nth_lsf(mask, nth_bit)   g_bit_nth_lsf_impl(mask, nth_bit)
 
#define g_bit_nth_msf(mask, nth_bit)   g_bit_nth_msf_impl(mask, nth_bit)
 
#define g_bit_storage(number)   g_bit_storage_impl(number)
 
#define g_abort()   abort ()
 
#define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)   GLIB_DEPRECATED_MACRO_IN_2_26
 

Typedefs

typedef struct _GDebugKey GDebugKey
 
typedef void(* GVoidFunc) (void) GLIB_DEPRECATED_TYPE_IN_2_32
 

Enumerations

enum  GUserDirectory {
  G_USER_DIRECTORY_DESKTOP , G_USER_DIRECTORY_DOCUMENTS , G_USER_DIRECTORY_DOWNLOAD , G_USER_DIRECTORY_MUSIC ,
  G_USER_DIRECTORY_PICTURES , G_USER_DIRECTORY_PUBLIC_SHARE , G_USER_DIRECTORY_TEMPLATES , G_USER_DIRECTORY_VIDEOS ,
  G_USER_N_DIRECTORIES
}
 
enum  GFormatSizeFlags {
  G_FORMAT_SIZE_DEFAULT = 0 , G_FORMAT_SIZE_LONG_FORMAT = 1 << 0 , G_FORMAT_SIZE_IEC_UNITS = 1 << 1 , G_FORMAT_SIZE_BITS = 1 << 2 ,
  GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 1 << 3 , GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 1 << 3
}
 

Functions

G_BEGIN_DECLS GLIB_AVAILABLE_IN_ALL const gcharg_get_user_name (void)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_real_name (void)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_home_dir (void)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_tmp_dir (void)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_host_name (void)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_prgname (void)
 
GLIB_AVAILABLE_IN_ALL void g_set_prgname (const gchar *prgname)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_application_name (void)
 
GLIB_AVAILABLE_IN_ALL void g_set_application_name (const gchar *application_name)
 
GLIB_AVAILABLE_IN_2_64 gcharg_get_os_info (const gchar *key_name)
 
GLIB_AVAILABLE_IN_ALL void g_reload_user_special_dirs_cache (void)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_user_data_dir (void)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_user_config_dir (void)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_user_cache_dir (void)
 
GLIB_AVAILABLE_IN_2_72 const gcharg_get_user_state_dir (void)
 
GLIB_AVAILABLE_IN_ALL const gchar *const * g_get_system_data_dirs (void)
 
GLIB_AVAILABLE_IN_ALL const gchar *const * g_get_system_config_dirs (void)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_user_runtime_dir (void)
 
GLIB_AVAILABLE_IN_ALL const gcharg_get_user_special_dir (GUserDirectory directory)
 
GLIB_AVAILABLE_IN_ALL guint g_parse_debug_string (const gchar *string, const GDebugKey *keys, guint nkeys)
 
GLIB_AVAILABLE_IN_ALL gint g_snprintf (gchar *string, gulong n, gchar const *format,...) G_GNUC_PRINTF(3
 
GLIB_AVAILABLE_IN_ALL gint GLIB_AVAILABLE_IN_ALL gint g_vsnprintf (gchar *string, gulong n, gchar const *format, va_list args) G_GNUC_PRINTF(3
 
GLIB_AVAILABLE_IN_ALL gint GLIB_AVAILABLE_IN_ALL gint GLIB_AVAILABLE_IN_ALL void g_nullify_pointer (gpointer *nullify_location)
 
GLIB_AVAILABLE_IN_2_30 gcharg_format_size_full (guint64 size, GFormatSizeFlags flags)
 
GLIB_AVAILABLE_IN_2_30 gcharg_format_size (guint64 size)
 
gcharg_format_size_for_display (goffset size)
 
G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_DEPRECATED void g_atexit (GVoidFunc func)
 
G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL gcharg_find_program_in_path (const gchar *program)
 
GLIB_AVAILABLE_IN_ALL gint g_bit_nth_lsf (gulong mask, gint nth_bit)
 
GLIB_AVAILABLE_IN_ALL gint g_bit_nth_msf (gulong mask, gint nth_bit)
 
GLIB_AVAILABLE_IN_ALL guint g_bit_storage (gulong number)
 
static gint g_bit_nth_lsf_impl (gulong mask, gint nth_bit)
 
static gint g_bit_nth_msf_impl (gulong mask, gint nth_bit)
 
static guint g_bit_storage_impl (gulong number)
 

Macro Definition Documentation

◆ ATEXIT

#define ATEXIT ( proc)    g_ATEXIT(proc) GLIB_DEPRECATED_MACRO_IN_2_32

Definition at line 325 of file gutils.h.

◆ g_abort

#define g_abort ( )    abort ()

Definition at line 427 of file gutils.h.

◆ g_ATEXIT

#define g_ATEXIT ( proc)    (atexit (proc)) GLIB_DEPRECATED_MACRO_IN_2_32

Definition at line 313 of file gutils.h.

◆ g_bit_nth_lsf

#define g_bit_nth_lsf ( mask,
nth_bit )   g_bit_nth_lsf_impl(mask, nth_bit)

Definition at line 361 of file gutils.h.

◆ g_bit_nth_msf

#define g_bit_nth_msf ( mask,
nth_bit )   g_bit_nth_msf_impl(mask, nth_bit)

Definition at line 362 of file gutils.h.

◆ g_bit_storage

#define g_bit_storage ( number)    g_bit_storage_impl(number)

Definition at line 363 of file gutils.h.

◆ g_memmove

#define g_memmove ( dest,
src,
len )    G_STMT_START { memmove ((dest), (src), (len)); } G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_40_FOR(memmove)

Definition at line 314 of file gutils.h.

314#define g_memmove(dest,src,len) \
315 G_STMT_START { memmove ((dest), (src), (len)); } G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_40_FOR(memmove)

◆ G_OS_INFO_KEY_BUG_REPORT_URL

#define G_OS_INFO_KEY_BUG_REPORT_URL
Value:
"BUG_REPORT_URL"
#define GLIB_AVAILABLE_MACRO_IN_2_64

G_OS_INFO_KEY_BUG_REPORT_URL:

A key to get the bug reporting page for the operating system, e.g. "https://bugs.yoyo-os.com/"

Since: 2.64

Definition at line 166 of file gutils.h.

166#define G_OS_INFO_KEY_BUG_REPORT_URL \
167 GLIB_AVAILABLE_MACRO_IN_2_64 \
168 "BUG_REPORT_URL"

◆ G_OS_INFO_KEY_DOCUMENTATION_URL

#define G_OS_INFO_KEY_DOCUMENTATION_URL
Value:
"DOCUMENTATION_URL"

G_OS_INFO_KEY_DOCUMENTATION_URL:

A key to get the documentation page for the operating system, e.g. "https://docs.yoyo-os.com/"

Since: 2.64

Definition at line 144 of file gutils.h.

144#define G_OS_INFO_KEY_DOCUMENTATION_URL \
145 GLIB_AVAILABLE_MACRO_IN_2_64 \
146 "DOCUMENTATION_URL"

◆ G_OS_INFO_KEY_HOME_URL

#define G_OS_INFO_KEY_HOME_URL
Value:

G_OS_INFO_KEY_HOME_URL:

A key to get the homepage for the operating system, e.g. "https://www.yoyo-os.com/"

Since: 2.64

Definition at line 133 of file gutils.h.

133#define G_OS_INFO_KEY_HOME_URL \
134 GLIB_AVAILABLE_MACRO_IN_2_64 \
135 "HOME_URL"

◆ G_OS_INFO_KEY_ID

#define G_OS_INFO_KEY_ID
Value:

G_OS_INFO_KEY_ID:

A key to get an ID identifying the operating system suitable for processing by scripts or usage in generated filenames, e.g. "yoyoos"

Since: 2.64

Definition at line 122 of file gutils.h.

122#define G_OS_INFO_KEY_ID \
123 GLIB_AVAILABLE_MACRO_IN_2_64 \
124 "ID"

◆ G_OS_INFO_KEY_NAME

#define G_OS_INFO_KEY_NAME
Value:

G_OS_INFO_KEY_NAME:

A key to get the name of the operating system excluding version information suitable for presentation to the user, e.g. "YoYoOS"

Since: 2.64

Definition at line 67 of file gutils.h.

67#define G_OS_INFO_KEY_NAME \
68 GLIB_AVAILABLE_MACRO_IN_2_64 \
69 "NAME"

◆ G_OS_INFO_KEY_PRETTY_NAME

#define G_OS_INFO_KEY_PRETTY_NAME
Value:

G_OS_INFO_KEY_PRETTY_NAME:

A key to get the name of the operating system in a format suitable for presentation to the user, e.g. "YoYoOS Foo"

Since: 2.64

Definition at line 78 of file gutils.h.

78#define G_OS_INFO_KEY_PRETTY_NAME \
79 GLIB_AVAILABLE_MACRO_IN_2_64 \
80 "PRETTY_NAME"

◆ G_OS_INFO_KEY_PRIVACY_POLICY_URL

#define G_OS_INFO_KEY_PRIVACY_POLICY_URL
Value:
"PRIVACY_POLICY_URL"

G_OS_INFO_KEY_PRIVACY_POLICY_URL:

A key to get the privacy policy for the operating system, e.g. "https://privacy.yoyo-os.com/"

Since: 2.64

Definition at line 177 of file gutils.h.

177#define G_OS_INFO_KEY_PRIVACY_POLICY_URL \
178 GLIB_AVAILABLE_MACRO_IN_2_64 \
179 "PRIVACY_POLICY_URL"

◆ G_OS_INFO_KEY_SUPPORT_URL

#define G_OS_INFO_KEY_SUPPORT_URL
Value:

G_OS_INFO_KEY_SUPPORT_URL:

A key to get the support page for the operating system, e.g. "https://support.yoyo-os.com/"

Since: 2.64

Definition at line 155 of file gutils.h.

155#define G_OS_INFO_KEY_SUPPORT_URL \
156 GLIB_AVAILABLE_MACRO_IN_2_64 \
157 "SUPPORT_URL"

◆ G_OS_INFO_KEY_VERSION

#define G_OS_INFO_KEY_VERSION
Value:

G_OS_INFO_KEY_VERSION:

A key to get the operating system version suitable for presentation to the user, e.g. "42 (Foo)"

Since: 2.64

Definition at line 89 of file gutils.h.

89#define G_OS_INFO_KEY_VERSION \
90 GLIB_AVAILABLE_MACRO_IN_2_64 \
91 "VERSION"

◆ G_OS_INFO_KEY_VERSION_CODENAME

#define G_OS_INFO_KEY_VERSION_CODENAME
Value:
"VERSION_CODENAME"

G_OS_INFO_KEY_VERSION_CODENAME:

A key to get a codename identifying the operating system release suitable for processing by scripts or usage in generated filenames, e.g. "foo"

Since: 2.64

Definition at line 100 of file gutils.h.

100#define G_OS_INFO_KEY_VERSION_CODENAME \
101 GLIB_AVAILABLE_MACRO_IN_2_64 \
102 "VERSION_CODENAME"

◆ G_OS_INFO_KEY_VERSION_ID

#define G_OS_INFO_KEY_VERSION_ID
Value:

G_OS_INFO_KEY_VERSION_ID:

A key to get the version of the operating system suitable for processing by scripts or usage in generated filenames, e.g. "42"

Since: 2.64

Definition at line 111 of file gutils.h.

111#define G_OS_INFO_KEY_VERSION_ID \
112 GLIB_AVAILABLE_MACRO_IN_2_64 \
113 "VERSION_ID"

◆ G_WIN32_DLLMAIN_FOR_DLL_NAME

#define G_WIN32_DLLMAIN_FOR_DLL_NAME ( static,
dll_name )   GLIB_DEPRECATED_MACRO_IN_2_26

Definition at line 451 of file gutils.h.

Typedef Documentation

◆ GDebugKey

typedef struct _GDebugKey GDebugKey

GDebugKey: @key: the string @value: the flag

Associates a string with a bit flag. Used in g_parse_debug_string().

Definition at line 265 of file gutils.h.

◆ GVoidFunc

typedef void(* GVoidFunc) (void) GLIB_DEPRECATED_TYPE_IN_2_32

GVoidFunc:

Declares a type of function which takes no arguments and has no return value. It is used to specify the type function passed to g_atexit().

Definition at line 324 of file gutils.h.

Enumeration Type Documentation

◆ GFormatSizeFlags

Enumerator
G_FORMAT_SIZE_DEFAULT 
G_FORMAT_SIZE_LONG_FORMAT 
G_FORMAT_SIZE_IEC_UNITS 
G_FORMAT_SIZE_BITS 
GLIB_AVAILABLE_ENUMERATOR_IN_2_74 
GLIB_AVAILABLE_ENUMERATOR_IN_2_74 

Definition at line 294 of file gutils.h.

295{
299 G_FORMAT_SIZE_BITS = 1 << 2,
300 G_FORMAT_SIZE_ONLY_VALUE GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 1 << 3,
301 G_FORMAT_SIZE_ONLY_UNIT GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 1 << 4
GFormatSizeFlags
Definition gutils.h:295
@ G_FORMAT_SIZE_LONG_FORMAT
Definition gutils.h:297
@ GLIB_AVAILABLE_ENUMERATOR_IN_2_74
Definition gutils.h:300
@ G_FORMAT_SIZE_IEC_UNITS
Definition gutils.h:298
@ G_FORMAT_SIZE_DEFAULT
Definition gutils.h:296
@ G_FORMAT_SIZE_BITS
Definition gutils.h:299

◆ GUserDirectory

GUserDirectory: @G_USER_DIRECTORY_DESKTOP: the user's Desktop directory @G_USER_DIRECTORY_DOCUMENTS: the user's Documents directory @G_USER_DIRECTORY_DOWNLOAD: the user's Downloads directory @G_USER_DIRECTORY_MUSIC: the user's Music directory @G_USER_DIRECTORY_PICTURES: the user's Pictures directory @G_USER_DIRECTORY_PUBLIC_SHARE: the user's shared directory @G_USER_DIRECTORY_TEMPLATES: the user's Templates directory @G_USER_DIRECTORY_VIDEOS: the user's Movies directory @G_USER_N_DIRECTORIES: the number of enum values

These are logical ids for special directories which are defined depending on the platform used. You should use g_get_user_special_dir() to retrieve the full path associated to the logical id.

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

Since: 2.14

Enumerator
G_USER_DIRECTORY_DESKTOP 
G_USER_DIRECTORY_DOCUMENTS 
G_USER_DIRECTORY_DOWNLOAD 
G_USER_DIRECTORY_MUSIC 
G_USER_DIRECTORY_PICTURES 
G_USER_DIRECTORY_PUBLIC_SHARE 
G_USER_DIRECTORY_TEMPLATES 
G_USER_DIRECTORY_VIDEOS 
G_USER_N_DIRECTORIES 

Definition at line 241 of file gutils.h.

241 {
250
GUserDirectory
Definition gutils.h:241
@ G_USER_DIRECTORY_DOWNLOAD
Definition gutils.h:244
@ G_USER_DIRECTORY_DOCUMENTS
Definition gutils.h:243
@ G_USER_DIRECTORY_TEMPLATES
Definition gutils.h:248
@ G_USER_DIRECTORY_VIDEOS
Definition gutils.h:249
@ G_USER_DIRECTORY_PICTURES
Definition gutils.h:246
@ G_USER_DIRECTORY_DESKTOP
Definition gutils.h:242
@ G_USER_N_DIRECTORIES
Definition gutils.h:251
@ G_USER_DIRECTORY_MUSIC
Definition gutils.h:245
@ G_USER_DIRECTORY_PUBLIC_SHARE
Definition gutils.h:247

Function Documentation

◆ g_atexit()

◆ g_bit_nth_lsf()

GLIB_AVAILABLE_IN_ALL gint g_bit_nth_lsf ( gulong mask,
gint nth_bit )

◆ g_bit_nth_lsf_impl()

static gint g_bit_nth_lsf_impl ( gulong mask,
gint nth_bit )
inlinestatic

Definition at line 375 of file gutils.h.

377{
378 if (G_UNLIKELY (nth_bit < -1))
379 nth_bit = -1;
380 while (nth_bit < ((GLIB_SIZEOF_LONG * 8) - 1))
381 {
382 nth_bit++;
383 if (mask & (1UL << nth_bit))
384 return nth_bit;
385 }
386 return -1;
387}
#define GLIB_SIZEOF_LONG
Definition glibconfig.h:78
#define G_UNLIKELY(expr)
Definition gmacros.h:1252
#define mask(n)

References G_UNLIKELY, GLIB_SIZEOF_LONG, and mask.

◆ g_bit_nth_msf()

GLIB_AVAILABLE_IN_ALL gint g_bit_nth_msf ( gulong mask,
gint nth_bit )

◆ g_bit_nth_msf_impl()

static gint g_bit_nth_msf_impl ( gulong mask,
gint nth_bit )
inlinestatic

Definition at line 390 of file gutils.h.

392{
393 if (nth_bit < 0 || G_UNLIKELY (nth_bit > GLIB_SIZEOF_LONG * 8))
394 nth_bit = GLIB_SIZEOF_LONG * 8;
395 while (nth_bit > 0)
396 {
397 nth_bit--;
398 if (mask & (1UL << nth_bit))
399 return nth_bit;
400 }
401 return -1;
402}

References G_UNLIKELY, GLIB_SIZEOF_LONG, and mask.

◆ g_bit_storage()

GLIB_AVAILABLE_IN_ALL guint g_bit_storage ( gulong number)

◆ g_bit_storage_impl()

static guint g_bit_storage_impl ( gulong number)
inlinestatic

Definition at line 405 of file gutils.h.

406{
407#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
408 return G_LIKELY (number) ?
409 ((GLIB_SIZEOF_LONG * 8U - 1) ^ (guint) __builtin_clzl(number)) + 1 : 1;
410#else
411 guint n_bits = 0;
412
413 do
414 {
415 n_bits++;
416 number >>= 1;
417 }
418 while (number);
419 return n_bits;
420#endif
421}
#define G_LIKELY(expr)
Definition gmacros.h:1251
unsigned int guint
Definition gtypes.h:61

References G_LIKELY, and GLIB_SIZEOF_LONG.

◆ g_find_program_in_path()

G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL gchar * g_find_program_in_path ( const gchar * program)

◆ g_format_size()

GLIB_AVAILABLE_IN_2_30 gchar * g_format_size ( guint64 size)

◆ g_format_size_for_display()

gchar * g_format_size_for_display ( goffset size)

◆ g_format_size_full()

GLIB_AVAILABLE_IN_2_30 gchar * g_format_size_full ( guint64 size,
GFormatSizeFlags flags )

◆ g_get_application_name()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_application_name ( void )

◆ g_get_home_dir()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_home_dir ( void )

◆ g_get_host_name()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_host_name ( void )

◆ g_get_os_info()

GLIB_AVAILABLE_IN_2_64 gchar * g_get_os_info ( const gchar * key_name)

◆ g_get_prgname()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_prgname ( void )

◆ g_get_real_name()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_real_name ( void )

◆ g_get_system_config_dirs()

GLIB_AVAILABLE_IN_ALL const gchar *const * g_get_system_config_dirs ( void )

◆ g_get_system_data_dirs()

GLIB_AVAILABLE_IN_ALL const gchar *const * g_get_system_data_dirs ( void )

◆ g_get_tmp_dir()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_tmp_dir ( void )

◆ g_get_user_cache_dir()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_user_cache_dir ( void )

◆ g_get_user_config_dir()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_user_config_dir ( void )

◆ g_get_user_data_dir()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_user_data_dir ( void )

◆ g_get_user_name()

G_BEGIN_DECLS GLIB_AVAILABLE_IN_ALL const gchar * g_get_user_name ( void )

◆ g_get_user_runtime_dir()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_user_runtime_dir ( void )

◆ g_get_user_special_dir()

GLIB_AVAILABLE_IN_ALL const gchar * g_get_user_special_dir ( GUserDirectory directory)

◆ g_get_user_state_dir()

GLIB_AVAILABLE_IN_2_72 const gchar * g_get_user_state_dir ( void )

◆ g_nullify_pointer()

◆ g_parse_debug_string()

GLIB_AVAILABLE_IN_ALL guint g_parse_debug_string ( const gchar * string,
const GDebugKey * keys,
guint nkeys )

◆ g_reload_user_special_dirs_cache()

GLIB_AVAILABLE_IN_ALL void g_reload_user_special_dirs_cache ( void )

◆ g_set_application_name()

GLIB_AVAILABLE_IN_ALL void g_set_application_name ( const gchar * application_name)

◆ g_set_prgname()

GLIB_AVAILABLE_IN_ALL void g_set_prgname ( const gchar * prgname)

◆ g_snprintf()

GLIB_AVAILABLE_IN_ALL gint g_snprintf ( gchar * string,
gulong n,
gchar const * format,
... )

◆ g_vsnprintf()

GLIB_AVAILABLE_IN_ALL gint GLIB_AVAILABLE_IN_ALL gint g_vsnprintf ( gchar * string,
gulong n,
gchar const * format,
va_list args )