98ce6e9c03eb2d29d54bb03dc00ed9f672a310eb
[pspp-builds.git] / src / ui / gui / psppire-case-file.h
1 /*
2     PSPPIRE --- A Graphical User Interface for PSPP
3     Copyright (C) 2006  Free Software Foundation
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18     02110-1301, USA. */
19
20
21 #ifndef __CASE_FILE_H__
22 #define __CASE_FILE_H__
23
24
25 #include <glib-object.h>
26 #include <glib.h>
27
28 #include <libpspp/str.h>
29 #include <data/case.h>
30
31
32
33 G_BEGIN_DECLS
34
35
36 /* --- type macros --- */
37 #define G_TYPE_PSPPIRE_CASE_FILE              (psppire_case_file_get_type ())
38 #define PSPPIRE_CASE_FILE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_PSPPIRE_CASE_FILE, PsppireCaseFile))
39 #define PSPPIRE_CASE_FILE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_PSPPIRE_CASE_FILE, PsppireCaseFileClass))
40 #define G_IS_PSPPIRE_CASE_FILE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_PSPPIRE_CASE_FILE))
41 #define G_IS_PSPPIRE_CASE_FILE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_PSPPIRE_CASE_FILE))
42 #define PSPPIRE_CASE_FILE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_PSPPIRE_CASE_FILE, PsppireCaseFileClass))
43
44
45
46
47 /* --- typedefs & structures --- */
48 typedef struct _PsppireCaseFile    PsppireCaseFile;
49 typedef struct _PsppireCaseFileClass PsppireCaseFileClass;
50
51 struct ccase;
52 struct casereader;
53
54 struct _PsppireCaseFile
55 {
56   GObject             parent;
57
58   /* <private> */
59   struct datasheet *datasheet;
60   gboolean      accessible;
61 };
62
63
64 struct _PsppireCaseFileClass
65 {
66   GObjectClass parent_class;
67 };
68
69
70 /* -- PsppireCaseFile --- */
71 GType          psppire_case_file_get_type (void);
72
73 PsppireCaseFile *psppire_case_file_new (const struct casereader *);
74
75 gboolean psppire_case_file_insert_case (PsppireCaseFile *cf, struct ccase *c, gint row);
76
77 gint psppire_case_file_get_case_count (const PsppireCaseFile *cf);
78
79
80 union value * psppire_case_file_get_value (const PsppireCaseFile *cf,
81                                            casenumber, size_t idx,
82                                            union value *, int width);
83
84 struct fmt_spec;
85
86 gboolean psppire_case_file_data_in (PsppireCaseFile *cf, gint c, gint idx,
87                                    struct substring input,
88                                    const struct fmt_spec *);
89
90 gboolean psppire_case_file_set_value (PsppireCaseFile *cf, gint casenum,
91                                      gint idx, union value *v, gint width);
92
93 void psppire_case_file_clear (PsppireCaseFile *cf);
94
95
96 gboolean psppire_case_file_delete_cases (PsppireCaseFile *cf, gint n_rows,
97                                         gint first);
98
99 gboolean psppire_case_file_insert_values (PsppireCaseFile *cf, gint n_values, gint before);
100
101 struct case_ordering;
102
103 void psppire_case_file_sort (PsppireCaseFile *cf, struct case_ordering *);
104
105 gboolean psppire_case_file_get_case (const PsppireCaseFile *cf, gint casenum,
106                                     struct ccase *c);
107
108
109 struct casereader * psppire_case_file_make_reader (PsppireCaseFile *cf);
110
111
112 G_END_DECLS
113
114 #endif /* __PSPPIRE_CASE_FILE_H__ */