📄 glib-full.h
字号:
void g_list_free_1 (GList *list);GList* g_list_append (GList *list, gpointer data);GList* g_list_prepend (GList *list, gpointer data);GList* g_list_insert (GList *list, gpointer data, gint position);GList* g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func);GList* g_list_concat (GList *list1, GList *list2);GList* g_list_remove (GList *list, gpointer data);GList* g_list_remove_link (GList *list, GList *llink);GList* g_list_reverse (GList *list);GList* g_list_copy (GList *list);GList* g_list_nth (GList *list, guint n);GList* g_list_find (GList *list, gpointer data);GList* g_list_find_custom (GList *list, gpointer data, GCompareFunc func);gint g_list_position (GList *list, GList *llink);gint g_list_index (GList *list, gpointer data);GList* g_list_last (GList *list);GList* g_list_first (GList *list);guint g_list_length (GList *list);void g_list_foreach (GList *list, GFunc func, gpointer user_data);GList* g_list_sort (GList *list, GCompareFunc compare_func);gpointer g_list_nth_data (GList *list, guint n);#define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL)#define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL)/* Singly linked lists */void g_slist_push_allocator (GAllocator *allocator);void g_slist_pop_allocator (void);GSList* g_slist_alloc (void);void g_slist_free (GSList *list);void g_slist_free_1 (GSList *list);GSList* g_slist_append (GSList *list, gpointer data);GSList* g_slist_prepend (GSList *list, gpointer data);GSList* g_slist_insert (GSList *list, gpointer data, gint position);GSList* g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func);GSList* g_slist_concat (GSList *list1, GSList *list2);GSList* g_slist_remove (GSList *list, gpointer data);GSList* g_slist_remove_link (GSList *list, GSList *llink);GSList* g_slist_reverse (GSList *list);GSList* g_slist_copy (GSList *list);GSList* g_slist_nth (GSList *list, guint n);GSList* g_slist_find (GSList *list, gpointer data);GSList* g_slist_find_custom (GSList *list, gpointer data, GCompareFunc func);gint g_slist_position (GSList *list, GSList *llink);gint g_slist_index (GSList *list, gpointer data);GSList* g_slist_last (GSList *list);guint g_slist_length (GSList *list);void g_slist_foreach (GSList *list, GFunc func, gpointer user_data);GSList* g_slist_sort (GSList *list, GCompareFunc compare_func);gpointer g_slist_nth_data (GSList *list, guint n);#define g_slist_next(slist) ((slist) ? (((GSList *)(slist))->next) : NULL)/* Hash tables */GHashTable* g_hash_table_new (GHashFunc hash_func, GCompareFunc key_compare_func);void g_hash_table_destroy (GHashTable *hash_table);void g_hash_table_insert (GHashTable *hash_table, gpointer key, gpointer value);void g_hash_table_remove (GHashTable *hash_table, gconstpointer key);gpointer g_hash_table_lookup (GHashTable *hash_table, gconstpointer key);gboolean g_hash_table_lookup_extended(GHashTable *hash_table, gconstpointer lookup_key, gpointer *orig_key, gpointer *value);void g_hash_table_freeze (GHashTable *hash_table);void g_hash_table_thaw (GHashTable *hash_table);void g_hash_table_foreach (GHashTable *hash_table, GHFunc func, gpointer user_data);guint g_hash_table_foreach_remove (GHashTable *hash_table, GHRFunc func, gpointer user_data);guint g_hash_table_size (GHashTable *hash_table);/* Caches */GCache* g_cache_new (GCacheNewFunc value_new_func, GCacheDestroyFunc value_destroy_func, GCacheDupFunc key_dup_func, GCacheDestroyFunc key_destroy_func, GHashFunc hash_key_func, GHashFunc hash_value_func, GCompareFunc key_compare_func);void g_cache_destroy (GCache *cache);gpointer g_cache_insert (GCache *cache, gpointer key);void g_cache_remove (GCache *cache, gpointer value);void g_cache_key_foreach (GCache *cache, GHFunc func, gpointer user_data);void g_cache_value_foreach (GCache *cache, GHFunc func, gpointer user_data);/* Balanced binary trees */GTree* g_tree_new (GCompareFunc key_compare_func);void g_tree_destroy (GTree *tree);void g_tree_insert (GTree *tree, gpointer key, gpointer value);void g_tree_remove (GTree *tree, gpointer key);gpointer g_tree_lookup (GTree *tree, gpointer key);void g_tree_traverse (GTree *tree, GTraverseFunc traverse_func, GTraverseType traverse_type, gpointer data);gpointer g_tree_search (GTree *tree, GSearchFunc search_func, gpointer data);gint g_tree_height (GTree *tree);gint g_tree_nnodes (GTree *tree);/* N-way tree implementation */struct _GNode{ gpointer data; GNode *next; GNode *prev; GNode *parent; GNode *children;};#define G_NODE_IS_ROOT(node) (((GNode*) (node))->parent == NULL && \ ((GNode*) (node))->prev == NULL && \ ((GNode*) (node))->next == NULL)#define G_NODE_IS_LEAF(node) (((GNode*) (node))->children == NULL)void g_node_push_allocator (GAllocator *allocator);void g_node_pop_allocator (void);GNode* g_node_new (gpointer data);void g_node_destroy (GNode *root);void g_node_unlink (GNode *node);GNode* g_node_insert (GNode *parent, gint position, GNode *node);GNode* g_node_insert_before (GNode *parent, GNode *sibling, GNode *node);GNode* g_node_prepend (GNode *parent, GNode *node);guint g_node_n_nodes (GNode *root, GTraverseFlags flags);GNode* g_node_get_root (GNode *node);gboolean g_node_is_ancestor (GNode *node, GNode *descendant);guint g_node_depth (GNode *node);GNode* g_node_find (GNode *root, GTraverseType order, GTraverseFlags flags, gpointer data);/* convenience macros */#define g_node_append(parent, node) \ g_node_insert_before ((parent), NULL, (node))#define g_node_insert_data(parent, position, data) \ g_node_insert ((parent), (position), g_node_new (data))#define g_node_insert_data_before(parent, sibling, data) \ g_node_insert_before ((parent), (sibling), g_node_new (data))#define g_node_prepend_data(parent, data) \ g_node_prepend ((parent), g_node_new (data))#define g_node_append_data(parent, data) \ g_node_insert_before ((parent), NULL, g_node_new (data))/* traversal function, assumes that `node' is root * (only traverses `node' and its subtree). * this function is just a high level interface to * low level traversal functions, optimized for speed. */void g_node_traverse (GNode *root, GTraverseType order, GTraverseFlags flags, gint max_depth, GNodeTraverseFunc func, gpointer data);/* return the maximum tree height starting with `node', this is an expensive * operation, since we need to visit all nodes. this could be shortened by * adding `guint height' to struct _GNode, but then again, this is not very * often needed, and would make g_node_insert() more time consuming. */guint g_node_max_height (GNode *root);void g_node_children_foreach (GNode *node, GTraverseFlags flags, GNodeForeachFunc func, gpointer data);void g_node_reverse_children (GNode *node);guint g_node_n_children (GNode *node);GNode* g_node_nth_child (GNode *node, guint n);GNode* g_node_last_child (GNode *node);GNode* g_node_find_child (GNode *node, GTraverseFlags flags, gpointer data);gint g_node_child_position (GNode *node, GNode *child);gint g_node_child_index (GNode *node, gpointer data);GNode* g_node_first_sibling (GNode *node);GNode* g_node_last_sibling (GNode *node);#define g_node_prev_sibling(node) ((node) ? \ ((GNode*) (node))->prev : NULL)#define g_node_next_sibling(node) ((node) ? \ ((GNode*) (node))->next : NULL)#define g_node_first_child(node) ((node) ? \ ((GNode*) (node))->children : NULL)/* Callback maintenance functions */#define G_HOOK_FLAG_USER_SHIFT (4)typedef enum{ G_HOOK_FLAG_ACTIVE = 1 << 0, G_HOOK_FLAG_IN_CALL = 1 << 1, G_HOOK_FLAG_MASK = 0x0f} GHookFlagMask;#define G_HOOK_DEFERRED_DESTROY ((GHookFreeFunc) 0x01)struct _GHookList{ guint seq_id; guint hook_size; guint is_setup : 1; GHook *hooks; GMemChunk *hook_memchunk; GHookFreeFunc hook_free; /* virtual function */ GHookFreeFunc hook_destroy; /* virtual function */};struct _GHook{ gpointer data; GHook *next; GHook *prev; guint ref_count; guint hook_id; guint flags; gpointer func; GDestroyNotify destroy;};#define G_HOOK_ACTIVE(hook) ((((GHook*) hook)->flags & \ G_HOOK_FLAG_ACTIVE) != 0)#define G_HOOK_IN_CALL(hook) ((((GHook*) hook)->flags & \ G_HOOK_FLAG_IN_CALL) != 0)#define G_HOOK_IS_VALID(hook) (((GHook*) hook)->hook_id != 0 && \ G_HOOK_ACTIVE (hook))#define G_HOOK_IS_UNLINKED(hook) (((GHook*) hook)->next == NULL && \ ((GHook*) hook)->prev == NULL && \ ((GHook*) hook)->hook_id == 0 && \ ((GHook*) hook)->ref_count == 0)void g_hook_list_init (GHookList *hook_list, guint hook_size);void g_hook_list_clear (GHookList *hook_list);GHook* g_hook_alloc (GHookList *hook_list);void g_hook_free (GHookList *hook_list, GHook *hook);void g_hook_ref (GHookList *hook_list, GHook *hook);void g_hook_unref (GHookList *hook_list, GHook *hook);gboolean g_hook_destroy (GHookList *hook_list, guint hook_id);void g_hook_destroy_link (GHookList *hook_list, GHook *hook);void g_hook_prepend (GHookList *hook_list, GHook *hook);void g_hook_insert_before (GHookList *hook_list, GHook *sibling, GHook *hook);void g_hook_insert_sorted (GHookList *hook_list, GHook *hook, GHookCompareFunc func);GHook* g_hook_get (GHookList *hook_list, guint hook_id);GHook* g_hook_find (GHookList *hook_list, gboolean need_valids, GHookFindFunc func, gpointer data);GHook* g_hook_find_data (GHookList *hook_list, gboolean need_valids, gpointer data);GHook* g_hook_find_func (GHookList *hook_list, gboolean need_valids, gpointer func);GHook* g_hook_find_func_data (GHookList *hook_list, gboolean need_valids, gpointer func, gpointer data);/* return the first valid hook, and increment its reference count */GHook* g_hook_first_valid (GHookList *hook_list, gboolean may_be_in_call);/* return the next valid hook with incremented reference count, and * decrement the reference count of the original hook */GHook* g_hook_next_valid (GHookList *hook_list, GHook *hook, gboolean may_be_in_call);/* GHookCompareFunc implementation to insert hooks sorted by their id */gint g_hook_compare_ids (GHook *new_hook, GHook *sibling);/* convenience macros */#define g_hook_append( hook_list, hook ) \ g_hook_insert_before ((hook_list), NULL, (hook))/* invoke all valid hooks with the (*GHookFunc) signature. */void g_hook_list_invoke (GHookList *hook_list, gboolean may_recurse);/* invoke all valid hooks with the (*GHookCheckFunc) signature, * and destroy the hook if FALSE is returned. */void g_hook_list_invoke_check (GHookList *hook_list, gboolean may_recurse);/* invoke a marshaller on all valid hooks. */void g_hook_list_marshal (GHookList *hook_list, gboolean may_recurse, GHookMarshaller marshaller, gpointer data);void g_hook_list_marshal_check (GHookList *hook_list, gboolean may_recurse, GHookCheckMarshaller marshaller, gpointer data);/* Fatal error handlers. * g_on_error_query() will prompt the user to either * [E]xit, [H]alt, [P]roceed or show [S]tack trace. * g_on_error_stack_trace() invokes gdb, which attaches to the current * process and shows a stack trace. * These function may cause different actions on non-unix platforms. * The prg_name arg is required by gdb to find the executable, if it is * passed as NULL, g_on_error_query() will try g_get_prgname(). */void g_on_error_query (const gchar *prg_name);void g_on_error_stack_trace (const gchar *prg_name);/* Logging mechanism */extern const gchar *g_log_domain_glib;guint g_log_set_handler (const gchar *log_domain, GLogLevelFlags log_levels, GLogFunc log_func, gpointer user_data);void g_log_remove_handler (const gchar *log_domain, guint handler_id);void g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data);void g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...) G_GNUC_PRINTF (3, 4);void g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args);GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask);GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask);#ifndef G_LOG_DOMAIN#define G_LOG_DOMAIN ((gchar*) 0)#endif /* G_LOG_DOMAIN */#ifdef __GNUC__#define g_error(format, args...) g_log (G_LOG_DOMAIN, \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -