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