1580d1e1eb6c3797b1e391bd77dc453ecf5b1147
[pspp] / src / output / output-item.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2009, 2011 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 #ifndef OUTPUT_ITEM_H
18 #define OUTPUT_ITEM_H 1
19
20 /* Output items.
21
22    An output item is a self-contained chunk of output.  Several kinds of output
23    items exist.  See *-item.h for details.
24 */
25
26 #include <stdbool.h>
27 #include "libpspp/cast.h"
28
29 /* A single output item. */
30 struct output_item
31   {
32     const struct output_item_class *class;
33
34     /* Reference count.  An output item may be shared between multiple owners,
35        indicated by a reference count greater than 1.  When this is the case,
36        the output item must not be modified. */
37     int ref_cnt;
38
39     /* The localized label for the item that appears in the outline pane in the
40        PSPPIRE output viewer and in PDF outlines.  This is NULL if no label has
41        been explicitly set.
42
43        Use output_item_get_label() to read an item's label. */
44     char *label;
45
46     /* A locale-invariant identifier for the command that produced the output,
47        which may be NULL if unknown or if a command did not produce this
48        output. */
49     char *command_name;
50   };
51
52 struct output_item *output_item_ref (const struct output_item *);
53 void output_item_unref (struct output_item *);
54 bool output_item_is_shared (const struct output_item *);
55
56 const char *output_item_get_label (const struct output_item *);
57 void output_item_set_label (struct output_item *, const char *);
58 void output_item_set_label_nocopy (struct output_item *, char *);
59
60 #endif /* output/output-item.h */