summaryrefslogtreecommitdiff
path: root/libdevkit-power/egg-obj-list.h
blob: ced0e79da2185d6711c7b8057a1532a6679fb95a (plain)
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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 *
 * Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
 *
 * Licensed under the GNU General Public License Version 2
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef __EGG_OBJ_LIST_H
#define __EGG_OBJ_LIST_H

#include <glib-object.h>

G_BEGIN_DECLS

#define EGG_TYPE_OBJ_LIST		(egg_obj_list_get_type ())
#define EGG_OBJ_LIST(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), EGG_TYPE_OBJ_LIST, EggObjList))
#define EGG_OBJ_LIST_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), EGG_TYPE_OBJ_LIST, EggObjListClass))
#define EGG_IS_OBJ_LIST(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), EGG_TYPE_OBJ_LIST))
#define EGG_IS_OBJ_LIST_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), EGG_TYPE_OBJ_LIST))
#define EGG_OBJ_LIST_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), EGG_TYPE_OBJ_LIST, EggObjListClass))

typedef struct EggObjListPrivate EggObjListPrivate;

typedef struct
{
	GObject		     	 parent;
	EggObjListPrivate	*priv;
	guint			 len;
} EggObjList;

typedef struct
{
	GObjectClass			 parent_class;
} EggObjListClass;

typedef gpointer (*EggObjListNewFunc)		(void);
typedef gpointer (*EggObjListCopyFunc)		(gconstpointer		 data);
typedef void	 (*EggObjListFreeFunc)		(gpointer		 data);
typedef gint	 (*EggObjListCompareFunc)	(gconstpointer		 data1,
						 gconstpointer		 data2);
typedef gpointer (*EggObjListFromStringFunc)	(const gchar		*data);
typedef gchar	*(*EggObjListToStringFunc)	(gconstpointer		 data);

GType		 egg_obj_list_get_type		(void);
EggObjList	*egg_obj_list_new		(void);

void		 egg_obj_list_set_new		(EggObjList		*list,
						 EggObjListNewFunc	 func);
void		 egg_obj_list_set_copy		(EggObjList		*list,
						 EggObjListCopyFunc	 func);
void		 egg_obj_list_set_free		(EggObjList		*list,
						 EggObjListFreeFunc	 func);
void		 egg_obj_list_set_compare	(EggObjList		*list,
						 EggObjListCompareFunc	 func);
void		 egg_obj_list_set_to_string	(EggObjList		*list,
						 EggObjListToStringFunc	 func);
void		 egg_obj_list_set_from_string	(EggObjList		*list,
						 EggObjListFromStringFunc func);
void		 egg_obj_list_clear		(EggObjList		*list);
void		 egg_obj_list_print		(EggObjList		*list);
gchar		*egg_obj_list_to_string		(EggObjList		*list)
						 G_GNUC_WARN_UNUSED_RESULT;
gboolean	 egg_obj_list_to_file		(EggObjList		*list,
						 const gchar		*filename);
gboolean	 egg_obj_list_from_file		(EggObjList		*list,
						 const gchar		*filename);
void		 egg_obj_list_add		(EggObjList		*list,
						 gconstpointer		 data);
void		 egg_obj_list_add_list		(EggObjList		*list,
						 const EggObjList	*data);
void		 egg_obj_list_remove_list	(EggObjList		*list,
						 const EggObjList	*data);
void		 egg_obj_list_remove_duplicate	(EggObjList		*list);
gboolean	 egg_obj_list_remove		(EggObjList		*list,
						 gconstpointer		 data);
gboolean	 egg_obj_list_remove_index	(EggObjList		*list,
						 guint			 index);
gconstpointer	 egg_obj_list_index		(const EggObjList	*list,
						 guint			 index);

G_END_DECLS

#endif /* __EGG_OBJ_LIST_H */