1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2018 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #include "output/group-item.h"
23 #include "output/driver.h"
24 #include "output/output-item-provider.h"
26 #include "gl/xalloc.h"
28 struct group_open_item *
29 group_open_item_create (const char *command_name)
31 return group_open_item_create_nocopy (
32 command_name ? xstrdup (command_name) : NULL);
35 struct group_open_item *
36 group_open_item_create_nocopy (char *command_name)
38 struct group_open_item *item;
40 item = xmalloc (sizeof *item);
41 output_item_init (&item->output_item, &group_open_item_class);
42 item->command_name = command_name;
47 /* Submits ITEM to the configured output drivers, and transfers ownership to
48 the output subsystem. */
50 group_open_item_submit (struct group_open_item *item)
52 output_submit (&item->output_item);
56 group_open_item_destroy (struct output_item *output_item)
58 struct group_open_item *item = to_group_open_item (output_item);
60 free (item->command_name);
64 const struct output_item_class group_open_item_class =
67 group_open_item_destroy,
70 struct group_close_item *
71 group_close_item_create (void)
73 struct group_close_item *item;
75 item = xmalloc (sizeof *item);
76 output_item_init (&item->output_item, &group_close_item_class);
81 /* Submits ITEM to the configured output drivers, and transfers ownership to
82 the output subsystem. */
84 group_close_item_submit (struct group_close_item *item)
86 output_submit (&item->output_item);
90 group_close_item_destroy (struct output_item *output_item)
92 struct group_close_item *item = to_group_close_item (output_item);
97 const struct output_item_class group_close_item_class =
100 group_close_item_destroy,