edca066ed2442f11211672a16bc82d79a2068672
[pspp] / src / output / spv / spv-output.c
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2018 Free Software Foundation, Inc.
3
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.
8
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.
13
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/>. */
16
17 #include <config.h>
18
19 #include "output/spv/spv-output.h"
20
21 #include "output/pivot-table.h"
22 #include "output/spv/spv.h"
23 #include "output/text-item.h"
24
25 #include "gl/xalloc.h"
26
27 void
28 spv_text_submit (const struct spv_item *in)
29 {
30   enum spv_item_class class = spv_item_get_class (in);
31   struct text_item *item = text_item_create_value (
32     (class == SPV_CLASS_HEADINGS ? TEXT_ITEM_TITLE
33      : class == SPV_CLASS_PAGETITLE ? TEXT_ITEM_PAGE_TITLE
34      : TEXT_ITEM_LOG),
35     pivot_value_clone (spv_item_get_text (in)),
36     in->label ? xstrdup (in->label) : NULL);
37   text_item_submit (item);
38 }