1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2
3 #line 1 "html-ostream.oo.h"
4 /* Output stream that produces HTML output.
5 Copyright (C) 2006, 2019-2020 Free Software Foundation, Inc.
6 Written by Bruno Haible <bruno@clisp.org>, 2006.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <https://www.gnu.org/licenses/>. */
20
21 #ifndef _HTML_OSTREAM_H
22 #define _HTML_OSTREAM_H
23
24 #include <stdbool.h>
25
26 #include "ostream.h"
27
28
29 #line 30 "html-ostream.h"
30 struct html_ostream_representation;
31 /* html_ostream_t is defined as a pointer to struct html_ostream_representation.
32 In C++ mode, we use a smart pointer class.
33 In C mode, we have no other choice than a typedef to the root class type. */
34 #if IS_CPLUSPLUS
35 struct html_ostream_t
36 {
37 private:
38 struct html_ostream_representation *_pointer;
39 public:
40 html_ostream_t () : _pointer (NULL) {}
41 html_ostream_t (struct html_ostream_representation *pointer) : _pointer (pointer) {}
42 struct html_ostream_representation * operator -> () { return _pointer; }
43 operator struct html_ostream_representation * () { return _pointer; }
44 operator struct any_ostream_representation * () { return (struct any_ostream_representation *) _pointer; }
45 operator void * () { return _pointer; }
46 bool operator == (const void *p) { return _pointer == p; }
47 bool operator != (const void *p) { return _pointer != p; }
48 operator ostream_t () { return (ostream_t) (struct any_ostream_representation *) _pointer; }
49 explicit html_ostream_t (ostream_t x) : _pointer ((struct html_ostream_representation *) (void *) x) {}
50 };
51 #else
52 typedef ostream_t html_ostream_t;
53 #endif
54
55 /* Functions that invoke the methods. */
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 extern void html_ostream_write_mem (html_ostream_t first_arg, const void *data, size_t len);
60 extern void html_ostream_flush (html_ostream_t first_arg, ostream_flush_scope_t scope);
61 extern void html_ostream_free (html_ostream_t first_arg);
62 extern void html_ostream_begin_span (html_ostream_t first_arg, const char *classname);
63 extern void html_ostream_end_span (html_ostream_t first_arg, const char *classname);
64 extern const char * html_ostream_get_hyperlink_ref (html_ostream_t first_arg);
65 extern void html_ostream_set_hyperlink_ref (html_ostream_t first_arg, const char *ref);
66 extern void html_ostream_flush_to_current_style (html_ostream_t first_arg);
67 extern ostream_t html_ostream_get_destination (html_ostream_t first_arg);
68 #ifdef __cplusplus
69 }
70 #endif
71
72 /* Type representing an implementation of html_ostream_t. */
73 struct html_ostream_implementation
74 {
75 const typeinfo_t * const *superclasses;
76 size_t superclasses_length;
77 size_t instance_size;
78 #define THIS_ARG html_ostream_t first_arg
79 #include "html_ostream.vt.h"
80 #undef THIS_ARG
81 };
82
83 /* Public portion of the object pointed to by a html_ostream_t. */
84 struct html_ostream_representation_header
85 {
86 const struct html_ostream_implementation *vtable;
87 };
88
89 #if HAVE_INLINE
90
91 /* Define the functions that invoke the methods as inline accesses to
92 the html_ostream_implementation.
93 Use #define to avoid a warning because of extern vs. static. */
94
95 # define html_ostream_write_mem html_ostream_write_mem_inline
96 static inline void
97 html_ostream_write_mem (html_ostream_t first_arg, const void *data, size_t len)
98 {
99 const struct html_ostream_implementation *vtable =
100 ((struct html_ostream_representation_header *) (struct html_ostream_representation *) first_arg)->vtable;
101 vtable->write_mem (first_arg,data,len);
102 }
103
104 # define html_ostream_flush html_ostream_flush_inline
105 static inline void
106 html_ostream_flush (html_ostream_t first_arg, ostream_flush_scope_t scope)
107 {
108 const struct html_ostream_implementation *vtable =
109 ((struct html_ostream_representation_header *) (struct html_ostream_representation *) first_arg)->vtable;
110 vtable->flush (first_arg,scope);
111 }
112
113 # define html_ostream_free html_ostream_free_inline
114 static inline void
115 html_ostream_free (html_ostream_t first_arg)
116 {
117 const struct html_ostream_implementation *vtable =
118 ((struct html_ostream_representation_header *) (struct html_ostream_representation *) first_arg)->vtable;
119 vtable->free (first_arg);
120 }
121
122 # define html_ostream_begin_span html_ostream_begin_span_inline
123 static inline void
124 html_ostream_begin_span (html_ostream_t first_arg, const char *classname)
125 {
126 const struct html_ostream_implementation *vtable =
127 ((struct html_ostream_representation_header *) (struct html_ostream_representation *) first_arg)->vtable;
128 vtable->begin_span (first_arg,classname);
129 }
130
131 # define html_ostream_end_span html_ostream_end_span_inline
132 static inline void
133 html_ostream_end_span (html_ostream_t first_arg, const char *classname)
134 {
135 const struct html_ostream_implementation *vtable =
136 ((struct html_ostream_representation_header *) (struct html_ostream_representation *) first_arg)->vtable;
137 vtable->end_span (first_arg,classname);
138 }
139
140 # define html_ostream_get_hyperlink_ref html_ostream_get_hyperlink_ref_inline
141 static inline const char *
142 html_ostream_get_hyperlink_ref (html_ostream_t first_arg)
143 {
144 const struct html_ostream_implementation *vtable =
145 ((struct html_ostream_representation_header *) (struct html_ostream_representation *) first_arg)->vtable;
146 return vtable->get_hyperlink_ref (first_arg);
147 }
148
149 # define html_ostream_set_hyperlink_ref html_ostream_set_hyperlink_ref_inline
150 static inline void
151 html_ostream_set_hyperlink_ref (html_ostream_t first_arg, const char *ref)
152 {
153 const struct html_ostream_implementation *vtable =
154 ((struct html_ostream_representation_header *) (struct html_ostream_representation *) first_arg)->vtable;
155 vtable->set_hyperlink_ref (first_arg,ref);
156 }
157
158 # define html_ostream_flush_to_current_style html_ostream_flush_to_current_style_inline
159 static inline void
160 html_ostream_flush_to_current_style (html_ostream_t first_arg)
161 {
162 const struct html_ostream_implementation *vtable =
163 ((struct html_ostream_representation_header *) (struct html_ostream_representation *) first_arg)->vtable;
164 vtable->flush_to_current_style (first_arg);
165 }
166
167 # define html_ostream_get_destination html_ostream_get_destination_inline
168 static inline ostream_t
169 html_ostream_get_destination (html_ostream_t first_arg)
170 {
171 const struct html_ostream_implementation *vtable =
172 ((struct html_ostream_representation_header *) (struct html_ostream_representation *) first_arg)->vtable;
173 return vtable->get_destination (first_arg);
174 }
175
176 #endif
177
178 extern const typeinfo_t html_ostream_typeinfo;
179 #define html_ostream_SUPERCLASSES &html_ostream_typeinfo, ostream_SUPERCLASSES
180 #define html_ostream_SUPERCLASSES_LENGTH (1 + ostream_SUPERCLASSES_LENGTH)
181
182 extern const struct html_ostream_implementation html_ostream_vtable;
183
184 #line 54 "html-ostream.oo.h"
185
186
187 #ifdef __cplusplus
188 extern "C" {
189 #endif
190
191
192 /* Create an output stream that takes input in the UTF-8 encoding and
193 writes it in HTML form on DESTINATION.
194 This stream produces a sequence of lines. The caller is responsible
195 for opening the <body><html> elements before and for closing them after
196 the use of this stream.
197 Note that the resulting stream must be closed before DESTINATION can be
198 closed. */
199 extern html_ostream_t html_ostream_create (ostream_t destination);
200
201
202 /* Test whether a given output stream is a html_ostream. */
203 extern bool is_instance_of_html_ostream (ostream_t stream);
204
205
206 #ifdef __cplusplus
207 }
208 #endif
209
210 #endif /* _HTML_OSTREAM_H */