![]() |
![]() |
![]() |
GSK Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
Glib Helper RoutinesGlib Helper Routines — Miscellaneous helper routines that could conceivably be moved to glib someday. |
void gsk_g_ptr_array_foreach (GPtrArray *array, GFunc func, gpointer data); gpointer gsk_g_tree_min (GTree *tree); gpointer gsk_g_tree_max (GTree *tree); GSList * gsk_g_tree_key_slist (GTree *tree); GSList * gsk_g_tree_value_slist (GTree *tree); GSList * gsk_g_hash_table_key_slist (GHashTable *table); GSList * gsk_g_hash_table_value_slist (GHashTable *table); gint64 gsk_strtoll (const char *str, char **endp, int base); guint64 gsk_strtoull (const char *str, char **endp, int base); guint gsk_strnlen (const char *ptr, guint max_len); gboolean gsk_fd_set_nonblocking (int fd);
void gsk_g_ptr_array_foreach (GPtrArray *array, GFunc func, gpointer data);
Like g_slist_foreach()
, except it iterates over a GPtrArray instead.
|
array to iterate over. |
|
function to call on each element of array .
|
|
second parameter to func .
|
gpointer gsk_g_tree_min (GTree *tree);
Find the minimum key in the tree.
|
tree to examine. |
Returns : |
smallest key in the tree. |
gpointer gsk_g_tree_max (GTree *tree);
Find the maximum key in the tree.
|
tree to examine. |
Returns : |
largest key in the tree. |
GSList * gsk_g_tree_key_slist (GTree *tree);
Get a list of all the keys in the trees, sorted.
|
the tree to scan. |
Returns : |
the newly allocated list of pointers to the keys. |
GSList * gsk_g_tree_value_slist (GTree *tree);
Get a list of all the values in the trees, sorted by key.
|
the tree to scan. |
Returns : |
the newly allocated list of pointers to the keys. |
GSList * gsk_g_hash_table_key_slist (GHashTable *table);
Accumulate all the keys in the hash table into a big list. You may not assume anything about the order of the list.
|
the hash table to scan. |
Returns : |
an allocated GSList of all the keys in the hash-table. |
GSList * gsk_g_hash_table_value_slist (GHashTable *table);
Accumulate all the values in the hash table into a big list. You may not assume anything about the order of the list.
|
the hash table to scan. |
Returns : |
an allocated GSList of all the values in the hash-table. |
gint64 gsk_strtoll (const char *str, char **endp, int base);
Like strtol, but for 64-bit integers.
|
the string to parse a longlong integer (gint64) from. |
|
optional place to store the character right past
the number in str . If *endp == str , then you may assume an error
occurred.
|
|
the assumed base for the number to parse. eg "2" to parse a binary, "8" for octal, "10" for decimal, "16" for hexidecimal. Also, "0" is autodetects the C-style base. |
Returns : |
the parsed integer. |
guint64 gsk_strtoull (const char *str, char **endp, int base);
Like strtol, but for 64-bit unsigned integers.
|
the string to parse a longlong unsigned integer (guint64) from. |
|
optional place to store the character right past
the number in str . If *endp == str , then you may assume an error
occurred.
|
|
the assumed base for the number to parse. eg "2" to parse a binary, "8" for octal, "10" for decimal, "16" for hexidecimal. Also, "0" is autodetects the C-style base. |
Returns : |
the parsed unsigned integer. |
guint gsk_strnlen (const char *ptr, guint max_len);
Find the length of a string, which is only allocated
max_len
bytes, and does not need to be NUL-terminated.
|
the string to find the length of. |
|
the maximum length the string could be. |
Returns : |
the length. |
gboolean gsk_fd_set_nonblocking (int fd);
Make a file-descriptor non-blocking.
When it is non-blocking, operations that would
cause it to block should instead return
EAGAIN. (Although you should use gsk_errno_is_ignorable()
to test, since windoze uses a different code, EWOULDBLOCK,
and you should always ignore EINTR.)
|
the file-descriptor to make non-blocking. |
Returns : |
whether it was able to set the file descriptor non-blocking. |