1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2
3 #line 1 "styled-ostream.oo.h"
4 /* Abstract output stream for CSS styled text.
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 _STYLED_OSTREAM_H
22 #define _STYLED_OSTREAM_H
23
24 #include <stdbool.h>
25
26 #include "ostream.h"
27
28
29 /* A styled output stream is an object to which one can feed a sequence of
30 bytes, marking some runs of text as belonging to specific CSS classes,
31 where the rendering of the CSS classes is defined through a CSS (cascading
32 style sheet). */
33
34 #line 35 "styled-ostream.h"
35 struct styled_ostream_representation;
36 /* styled_ostream_t is defined as a pointer to struct styled_ostream_representation.
37 In C++ mode, we use a smart pointer class.
38 In C mode, we have no other choice than a typedef to the root class type. */
39 #if IS_CPLUSPLUS
40 struct styled_ostream_t
41 {
42 private:
43 struct styled_ostream_representation *_pointer;
44 public:
45 styled_ostream_t () : _pointer (NULL) {}
46 styled_ostream_t (struct styled_ostream_representation *pointer) : _pointer (pointer) {}
47 struct styled_ostream_representation * operator -> () { return _pointer; }
48 operator struct styled_ostream_representation * () { return _pointer; }
49 operator struct any_ostream_representation * () { return (struct any_ostream_representation *) _pointer; }
50 operator void * () { return _pointer; }
51 bool operator == (const void *p) { return _pointer == p; }
52 bool operator != (const void *p) { return _pointer != p; }
53 operator ostream_t () { return (ostream_t) (struct any_ostream_representation *) _pointer; }
54 explicit styled_ostream_t (ostream_t x) : _pointer ((struct styled_ostream_representation *) (void *) x) {}
55 };
56 #else
57 typedef ostream_t styled_ostream_t;
58 #endif
59
60 /* Functions that invoke the methods. */
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 extern void styled_ostream_write_mem (styled_ostream_t first_arg, const void *data, size_t len);
65 extern void styled_ostream_flush (styled_ostream_t first_arg, ostream_flush_scope_t scope);
66 extern void styled_ostream_free (styled_ostream_t first_arg);
67 extern void styled_ostream_begin_use_class (styled_ostream_t first_arg, const char *classname);
68 extern void styled_ostream_end_use_class (styled_ostream_t first_arg, const char *classname);
69 extern const char * styled_ostream_get_hyperlink_ref (styled_ostream_t first_arg);
70 extern const char * styled_ostream_get_hyperlink_id (styled_ostream_t first_arg);
71 extern void styled_ostream_set_hyperlink (styled_ostream_t first_arg, const char *ref, const char *id);
72 extern void styled_ostream_flush_to_current_style (styled_ostream_t first_arg);
73 #ifdef __cplusplus
74 }
75 #endif
76
77 /* Type representing an implementation of styled_ostream_t. */
78 struct styled_ostream_implementation
79 {
80 const typeinfo_t * const *superclasses;
81 size_t superclasses_length;
82 size_t instance_size;
83 #define THIS_ARG styled_ostream_t first_arg
84 #include "styled_ostream.vt.h"
85 #undef THIS_ARG
86 };
87
88 /* Public portion of the object pointed to by a styled_ostream_t. */
89 struct styled_ostream_representation_header
90 {
91 const struct styled_ostream_implementation *vtable;
92 };
93
94 #if HAVE_INLINE
95
96 /* Define the functions that invoke the methods as inline accesses to
97 the styled_ostream_implementation.
98 Use #define to avoid a warning because of extern vs. static. */
99
100 # define styled_ostream_write_mem styled_ostream_write_mem_inline
101 static inline void
102 styled_ostream_write_mem (styled_ostream_t first_arg, const void *data, size_t len)
103 {
104 const struct styled_ostream_implementation *vtable =
105 ((struct styled_ostream_representation_header *) (struct styled_ostream_representation *) first_arg)->vtable;
106 vtable->write_mem (first_arg,data,len);
107 }
108
109 # define styled_ostream_flush styled_ostream_flush_inline
110 static inline void
111 styled_ostream_flush (styled_ostream_t first_arg, ostream_flush_scope_t scope)
112 {
113 const struct styled_ostream_implementation *vtable =
114 ((struct styled_ostream_representation_header *) (struct styled_ostream_representation *) first_arg)->vtable;
115 vtable->flush (first_arg,scope);
116 }
117
118 # define styled_ostream_free styled_ostream_free_inline
119 static inline void
120 styled_ostream_free (styled_ostream_t first_arg)
121 {
122 const struct styled_ostream_implementation *vtable =
123 ((struct styled_ostream_representation_header *) (struct styled_ostream_representation *) first_arg)->vtable;
124 vtable->free (first_arg);
125 }
126
127 # define styled_ostream_begin_use_class styled_ostream_begin_use_class_inline
128 static inline void
129 styled_ostream_begin_use_class (styled_ostream_t first_arg, const char *classname)
130 {
131 const struct styled_ostream_implementation *vtable =
132 ((struct styled_ostream_representation_header *) (struct styled_ostream_representation *) first_arg)->vtable;
133 vtable->begin_use_class (first_arg,classname);
134 }
135
136 # define styled_ostream_end_use_class styled_ostream_end_use_class_inline
137 static inline void
138 styled_ostream_end_use_class (styled_ostream_t first_arg, const char *classname)
139 {
140 const struct styled_ostream_implementation *vtable =
141 ((struct styled_ostream_representation_header *) (struct styled_ostream_representation *) first_arg)->vtable;
142 vtable->end_use_class (first_arg,classname);
143 }
144
145 # define styled_ostream_get_hyperlink_ref styled_ostream_get_hyperlink_ref_inline
146 static inline const char *
147 styled_ostream_get_hyperlink_ref (styled_ostream_t first_arg)
148 {
149 const struct styled_ostream_implementation *vtable =
150 ((struct styled_ostream_representation_header *) (struct styled_ostream_representation *) first_arg)->vtable;
151 return vtable->get_hyperlink_ref (first_arg);
152 }
153
154 # define styled_ostream_get_hyperlink_id styled_ostream_get_hyperlink_id_inline
155 static inline const char *
156 styled_ostream_get_hyperlink_id (styled_ostream_t first_arg)
157 {
158 const struct styled_ostream_implementation *vtable =
159 ((struct styled_ostream_representation_header *) (struct styled_ostream_representation *) first_arg)->vtable;
160 return vtable->get_hyperlink_id (first_arg);
161 }
162
163 # define styled_ostream_set_hyperlink styled_ostream_set_hyperlink_inline
164 static inline void
165 styled_ostream_set_hyperlink (styled_ostream_t first_arg, const char *ref, const char *id)
166 {
167 const struct styled_ostream_implementation *vtable =
168 ((struct styled_ostream_representation_header *) (struct styled_ostream_representation *) first_arg)->vtable;
169 vtable->set_hyperlink (first_arg,ref,id);
170 }
171
172 # define styled_ostream_flush_to_current_style styled_ostream_flush_to_current_style_inline
173 static inline void
174 styled_ostream_flush_to_current_style (styled_ostream_t first_arg)
175 {
176 const struct styled_ostream_implementation *vtable =
177 ((struct styled_ostream_representation_header *) (struct styled_ostream_representation *) first_arg)->vtable;
178 vtable->flush_to_current_style (first_arg);
179 }
180
181 #endif
182
183 extern const typeinfo_t styled_ostream_typeinfo;
184 #define styled_ostream_SUPERCLASSES &styled_ostream_typeinfo, ostream_SUPERCLASSES
185 #define styled_ostream_SUPERCLASSES_LENGTH (1 + ostream_SUPERCLASSES_LENGTH)
186
187 extern const struct styled_ostream_implementation styled_ostream_vtable;
188
189 #line 58 "styled-ostream.oo.h"
190
191 #ifdef __cplusplus
192 extern "C" {
193 #endif
194
195
196 /* Test whether a given output stream is a styled_ostream. */
197 extern bool is_instance_of_styled_ostream (ostream_t stream);
198
199
200 #ifdef __cplusplus
201 }
202 #endif
203
204 #endif /* _STYLED_OSTREAM_H */