output-item: Make command name part of every output_item.
[pspp] / src / output / page-break-item.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2020 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_PAGE_BREAK_ITEM_H
18 #define OUTPUT_PAGE_BREAK_ITEM_H 1
19
20 /* Page break items.
21
22    This ejects the page (for output devices that have pages). */
23
24 #include <stdbool.h>
25 #include "output/output-item.h"
26
27 /* A page break item. */
28 struct page_break_item
29   {
30     struct output_item output_item;
31   };
32
33 struct page_break_item *page_break_item_create (void);
34 \f
35 /* This boilerplate for page_break_item, a subclass of output_item, was
36    autogenerated by mk-class-boilerplate. */
37
38 #include <assert.h>
39 #include "libpspp/cast.h"
40
41 extern const struct output_item_class page_break_item_class;
42
43 /* Returns true if SUPER is a page_break_item, otherwise false. */
44 static inline bool
45 is_page_break_item (const struct output_item *super)
46 {
47   return super->class == &page_break_item_class;
48 }
49
50 /* Returns SUPER converted to page_break_item.  SUPER must be a page_break_item, as
51    reported by is_page_break_item. */
52 static inline struct page_break_item *
53 to_page_break_item (const struct output_item *super)
54 {
55   assert (is_page_break_item (super));
56   return UP_CAST (super, struct page_break_item, output_item);
57 }
58
59 /* Returns INSTANCE converted to output_item. */
60 static inline struct output_item *
61 page_break_item_super (const struct page_break_item *instance)
62 {
63   return CONST_CAST (struct output_item *, &instance->output_item);
64 }
65
66 /* Increments INSTANCE's reference count and returns INSTANCE. */
67 static inline struct page_break_item *
68 page_break_item_ref (const struct page_break_item *instance)
69 {
70   return to_page_break_item (output_item_ref (&instance->output_item));
71 }
72
73 /* Decrements INSTANCE's reference count, then destroys INSTANCE if
74    the reference count is now zero. */
75 static inline void
76 page_break_item_unref (struct page_break_item *instance)
77 {
78   output_item_unref (&instance->output_item);
79 }
80
81 /* Returns true if INSTANCE's reference count is greater than 1,
82    false otherwise. */
83 static inline bool
84 page_break_item_is_shared (const struct page_break_item *instance)
85 {
86   return output_item_is_shared (&instance->output_item);
87 }
88
89 void page_break_item_submit (struct page_break_item *);
90 \f
91 #endif /* output/page-break-item.h */