/usr/include/libfm-1.0/fm-list.h is in libfm-dev 1.2.5-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | /*
* fm-list.h
* A generic list container supporting reference counting.
* Copyright 2009 PCMan <pcman.tw@gmail.com>
* Copyright 2012 Andriy Grytsenko (LStranger) <andrej@rep.kiev.ua>
*
* This file is a part of the Libfm library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __FM_LIST_H__
#define __FM_LIST_H__
#include <glib.h>
G_BEGIN_DECLS
typedef struct _FmList FmList;
typedef struct _FmListFuncs FmListFuncs;
struct _FmList
{
/*< private >*/
GQueue list;
FmListFuncs* funcs;
gint n_ref;
};
/**
* FmListFuncs:
* @item_ref: function to increase reference counter on item
* @item_unref: function to decrease reference counter on item
*/
struct _FmListFuncs
{
gpointer (*item_ref)(gpointer item);
void (*item_unref)(gpointer item);
};
FmList* fm_list_new(FmListFuncs* funcs);
FmList* fm_list_ref(FmList* list);
void fm_list_unref(FmList* list);
#define FM_LIST(list) ((FmList*)list)
/* Since FmList is actually a GQueue with reference counting,
* all APIs for GQueue should be usable */
void fm_list_clear(FmList* list);
#ifndef __GTK_DOC_IGNORE__
static inline gboolean fm_list_is_empty(FmList* list)
{
return g_queue_is_empty((GQueue*)list);
}
static inline guint fm_list_get_length(FmList* list)
{
return g_queue_get_length((GQueue*)list);
}
static inline void fm_list_reverse(FmList* list)
{
g_queue_reverse((GQueue*)list);
}
static inline void fm_list_foreach(FmList* list, GFunc f, gpointer d)
{
g_queue_foreach((GQueue*)list,f,d);
}
static inline GList* fm_list_find(FmList* list, gpointer d)
{
return g_queue_find((GQueue*)list,d);
}
static inline GList* fm_list_find_custom(FmList* list, gconstpointer d, GCompareFunc f)
{
return g_queue_find_custom((GQueue*)list,d,f);
}
static inline void fm_list_sort(FmList* list, GCompareDataFunc f, gpointer d)
{
g_queue_sort((GQueue*)list,f,d);
}
static inline void fm_list_push_head(FmList* list, gpointer d)
{
g_queue_push_head((GQueue*)list,(list)->funcs->item_ref(d));
}
static inline void fm_list_push_tail(FmList* list, gpointer d)
{
g_queue_push_tail((GQueue*)list,(list)->funcs->item_ref(d));
}
static inline void fm_list_push_nth(FmList* list, gpointer d, guint n)
{
g_queue_push_nth((GQueue*)list,(list)->funcs->item_ref(d),n);
}
static inline void fm_list_push_head_noref(FmList* list, gpointer d)
{
g_queue_push_head((GQueue*)list,d);
}
static inline void fm_list_push_tail_noref(FmList* list, gpointer d)
{
g_queue_push_tail((GQueue*)list,d);
}
static inline void fm_list_push_nth_noref(FmList* list, gpointer d, guint n)
{
g_queue_push_nth((GQueue*)list,d,n);
}
static inline gpointer fm_list_pop_head(FmList* list)
{
return g_queue_pop_head((GQueue*)list);
}
static inline gpointer fm_list_pop_tail(FmList* list)
{
return g_queue_pop_tail((GQueue*)list);
}
static inline gpointer fm_list_pop_nth(FmList* list, guint n)
{
return g_queue_pop_nth((GQueue*)list,n);
}
static inline gpointer fm_list_peek_head(FmList* list)
{
return g_queue_peek_head((GQueue*)list);
}
static inline gpointer fm_list_peek_tail(FmList* list)
{
return g_queue_peek_tail((GQueue*)list);
}
static inline gpointer fm_list_peek_nth(FmList* list, guint n)
{
return g_queue_peek_nth((GQueue*)list,n);
}
static inline gint fm_list_index(FmList* list, gconstpointer d)
{
return g_queue_index((GQueue*)list,d);
}
#endif /* __GTK_DOC_IGNORE__ */
void fm_list_remove(FmList* list, gpointer data);
void fm_list_remove_all(FmList* list, gpointer data);
#ifndef __GTK_DOC_IGNORE__
static inline void fm_list_insert_before(FmList* list, GList* s, gpointer d)
{
g_queue_insert_before((GQueue*)list,s,(list)->funcs->item_ref(d));
}
static inline void fm_list_insert_after(FmList* list, GList* s, gpointer d)
{
g_queue_insert_after((GQueue*)list,s,(list)->funcs->item_ref(d));
}
static inline void fm_list_insert_sorted(FmList* list, gpointer d, GCompareDataFunc f, gpointer u)
{
g_queue_insert_sorted((GQueue*)list,(list)->funcs->item_ref(d),f,u);
}
static inline void fm_list_insert_before_noref(FmList* list, GList* s, gpointer d)
{
g_queue_insert_before((GQueue*)list,s,d);
}
static inline void fm_list_insert_after_noref(FmList* list, GList* s, gpointer d)
{
g_queue_insert_after((GQueue*)list,s,d);
}
static inline void fm_list_insert_sorted_noref(FmList* list, gpointer d, GCompareDataFunc f, gpointer u)
{
g_queue_insert_sorted((GQueue*)list,d,f,u);
}
static inline void fm_list_push_head_link(FmList* list, GList* l_)
{
g_queue_push_head_link((GQueue*)list,l_);
}
static inline void fm_list_push_tail_link(FmList* list, GList* l_)
{
g_queue_push_tail_link((GQueue*)list,l_);
}
static inline void fm_list_push_nth_link(FmList* list, guint n, GList* l_)
{
g_queue_push_nth_link((GQueue*)list,n,l_);
}
static inline GList* fm_list_pop_head_link(FmList* list)
{
return g_queue_pop_head_link((GQueue*)list);
}
static inline GList* fm_list_pop_tail_link(FmList* list)
{
return g_queue_pop_tail_link((GQueue*)list);
}
static inline GList* fm_list_pop_nth_link(FmList* list, guint n)
{
return g_queue_pop_nth_link((GQueue*)list,n);
}
static inline GList* fm_list_peek_head_link(FmList* list)
{
return g_queue_peek_head_link((GQueue*)list);
}
static inline GList* fm_list_peek_tail_link(FmList* list)
{
return g_queue_peek_tail_link((GQueue*)list);
}
static inline GList* fm_list_peek_nth_link(FmList* list, guint n)
{
return g_queue_peek_nth_link((GQueue*)list,n);
}
static inline gint fm_list_link_index(FmList* list, GList* l_)
{
return g_queue_index((GQueue*)list,l_);
}
static inline void fm_list_unlink(FmList* list, GList* l_)
{
g_queue_unlink((GQueue*)list,l_);
}
static inline void fm_list_delete_link_nounref(FmList* list, GList* l_)
{
g_queue_delete_link((GQueue*)list,l_);
}
#endif /* __GTK_DOC_IGNORE__ */
void fm_list_delete_link(FmList* list, GList* l_);
G_END_DECLS
#endif /* __FM_LIST_H__ */
|