1 /* gEDA - GPL Electronic Design Automation
2  * libgeda - gEDA's library
3  * Copyright (C) 1998-2010 Ales Hvezda
4  * Copyright (C) 2007-2010 Peter Clifton
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02111-1301 USA.
20  */
21 
22 
23 #ifndef __GEDA_LIST_H__
24 #define __GEDA_LIST_H__
25 
26 G_BEGIN_DECLS
27 
28 #define GEDA_TYPE_LIST            (geda_list_get_type())
29 #define GEDA_LIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GEDA_TYPE_LIST, GedaList))
30 #define GEDA_LIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  GEDA_TYPE_LIST, GedaListClass))
31 #define GEDA_IS_LIST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GEDA_TYPE_LIST))
32 #define GEDA_IS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  GEDA_TYPE_LIST))
33 #define GEDA_LIST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  GEDA_TYPE_LIST, GedaListClass))
34 
35 
36 typedef struct _GedaList      GedaList;
37 typedef struct _GedaListClass GedaListClass;
38 
39 struct _GedaList {
40   GObject parent;
41   GList *glist;
42 };
43 
44 struct _GedaListClass {
45   GObjectClass parent;
46 };
47 
48 GType geda_list_get_type (void);
49 
50 /* It would be nice to add const qualifiers to some of these, but GLib
51  * is buggy in this respect, and doesn't have const where necessary. */
52 GedaList *geda_list_new( void );
53 void geda_list_add( GedaList *list, gpointer item );
54 void geda_list_add_glist( GedaList *list, GList *items );
55 void geda_list_remove( GedaList *list, gpointer item );
56 /*void geda_list_remove_glist( GedaList *list, GList *items ); */ /* Undemanded as yet */
57 void geda_list_remove_all( GedaList *list );
58 
59 /*const GList *geda_list_get_glist( GedaList *list ); */
60 #define geda_list_get_glist(list) (list->glist)
61 
62 G_END_DECLS
63 
64 #endif /* __GEDA_LIST_H__ */
65 
66