Added new files resulting from directory restructuring.
[pspp-builds.git] / src / ui / gui / psppire-case-array.h
1 /* 
2     PSPPIRE --- A Graphical User Interface for PSPP
3     Copyright (C) 2004  Free Software Foundation
4     Written by John Darrington
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     This program 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
14     GNU 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, MA
19     02110-1301, USA. */
20
21
22 #ifndef __CASE_ARRAY_H__
23 #define __CASE_ARRAY_H__
24
25
26 #include <glib-object.h>
27 #include <glib.h>
28
29
30
31 G_BEGIN_DECLS
32
33
34 /* --- type macros --- */
35 #define G_TYPE_PSPPIRE_CASE_ARRAY              (psppire_case_array_get_type ())
36 #define PSPPIRE_CASE_ARRAY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_PSPPIRE_CASE_ARRAY, PsppireCaseArray))
37 #define PSPPIRE_CASE_ARRAY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_PSPPIRE_CASE_ARRAY, PsppireCaseArrayClass))
38 #define G_IS_PSPPIRE_CASE_ARRAY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_PSPPIRE_CASE_ARRAY))
39 #define G_IS_PSPPIRE_CASE_ARRAY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_PSPPIRE_CASE_ARRAY))
40 #define PSPPIRE_CASE_ARRAY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_PSPPIRE_CASE_ARRAY, PsppireCaseArrayClass))
41
42
43
44
45 /* --- typedefs & structures --- */
46 typedef struct _PsppireCaseArray           PsppireCaseArray;
47 typedef struct _PsppireCaseArrayClass PsppireCaseArrayClass;
48
49 struct ccase;
50
51 struct _PsppireCaseArray
52 {
53   GObject             parent;
54
55   struct ccase *cases;
56   gint capacity;
57   gint width;
58   gint size;
59 };
60
61
62 struct _PsppireCaseArrayClass
63 {
64   GObjectClass parent_class;
65 };
66
67
68 /* -- PsppireCaseArray --- */
69 GType          psppire_case_array_get_type (void);
70
71 PsppireCaseArray *psppire_case_array_new (gint capacity, gint width);
72
73 void psppire_case_array_resize(PsppireCaseArray *ca,  gint new_size);
74
75 void psppire_case_array_insert_case(PsppireCaseArray *ca, gint posn);
76
77 void psppire_case_array_delete_cases(PsppireCaseArray *ca, gint first, gint n_cases);
78
79
80 typedef gboolean psppire_case_array_fill_case_func(struct ccase *, gpointer aux);
81
82 typedef gboolean psppire_case_array_use_case_func(const struct ccase *, gpointer aux);
83
84
85 gboolean psppire_case_array_add_case(PsppireCaseArray *ca, 
86                                   psppire_case_array_fill_case_func fill_case_func,
87                                   gpointer aux);
88
89
90 gboolean psppire_case_array_iterate_case(PsppireCaseArray *ca, 
91                                   psppire_case_array_use_case_func fill_case_func,
92                                   gpointer aux);
93
94
95
96 gint psppire_case_array_get_n_cases(const PsppireCaseArray *ca);
97
98
99 /* Clears the contents of CA */
100 void psppire_case_array_clear(PsppireCaseArray *ca);
101
102
103 const union value * psppire_case_array_get_value(const PsppireCaseArray *ca, 
104                                               gint c, gint idx);
105
106
107 typedef gboolean value_fill_func_t(union value *v, gpointer data);
108
109 void psppire_case_array_set_value(PsppireCaseArray *ca, gint c, gint idx,
110                                value_fill_func_t ff,
111                                gpointer data);
112
113 G_END_DECLS
114
115 #endif /* __PSPPIRE_CASE_ARRAY_H__ */