+
+
+void
+psppire_case_file_sort (PsppireCaseFile *cf, const struct sort_criteria *sc)
+{
+ gint c;
+
+ struct casereader *reader = casefile_get_reader (cf->flexifile, NULL);
+ struct casefile *cfile;
+
+ struct casefile_factory *factory = flexifile_factory_create ();
+
+ cfile = sort_execute (reader, sc, factory);
+
+ casefile_destroy (cf->flexifile);
+
+ cf->flexifile = cfile;
+
+ /* FIXME: Need to have a signal to change a range of cases, instead of
+ calling a signal many times */
+ for ( c = 0 ; c < casefile_get_case_cnt (cf->flexifile) ; ++c )
+ g_signal_emit (cf, signals [CASE_CHANGED], 0, c);
+
+ flexifile_factory_destroy (factory);
+}
+
+
+/* Resize the cases in the casefile, by inserting N_VALUES into every
+ one of them. */
+gboolean
+psppire_case_file_insert_values (PsppireCaseFile *cf,
+ gint n_values, gint before)
+{
+ g_return_val_if_fail (cf, FALSE);
+
+ if ( ! cf->flexifile )
+ {
+ cf->flexifile = flexifile_create (n_values);
+
+ return TRUE;
+ }
+
+ return flexifile_resize (FLEXIFILE (cf->flexifile), n_values, before);
+}
+
+/* Fills C with the CASENUMth case.
+ Returns true on success, false otherwise.
+ */
+gboolean
+psppire_case_file_get_case (const PsppireCaseFile *cf, gint casenum,
+ struct ccase *c)
+{
+ g_return_val_if_fail (cf, FALSE);
+ g_return_val_if_fail (cf->flexifile, FALSE);
+
+ return flexifile_get_case (FLEXIFILE (cf->flexifile), casenum, c);
+}