1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2
3 #line 1 "term-styled-ostream.oo.h"
4 /* Output stream for CSS styled text, producing ANSI escape sequences.
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 _TERM_STYLED_OSTREAM_H
22 #define _TERM_STYLED_OSTREAM_H
23
24 #include "styled-ostream.h"
25 #include "term-ostream.h"
26
27
28 #line 29 "term-styled-ostream.h"
29 struct term_styled_ostream_representation;
30 /* term_styled_ostream_t is defined as a pointer to struct term_styled_ostream_representation.
31 In C++ mode, we use a smart pointer class.
32 In C mode, we have no other choice than a typedef to the root class type. */
33 #if IS_CPLUSPLUS
34 struct term_styled_ostream_t
35 {
36 private:
37 struct term_styled_ostream_representation *_pointer;
38 public:
term_styled_ostream_tterm_styled_ostream_t39 term_styled_ostream_t () : _pointer (NULL) {}
term_styled_ostream_tterm_styled_ostream_t40 term_styled_ostream_t (struct term_styled_ostream_representation *pointer) : _pointer (pointer) {}
41 struct term_styled_ostream_representation * operator -> () { return _pointer; }
42 operator struct term_styled_ostream_representation * () { return _pointer; }
43 operator struct any_ostream_representation * () { return (struct any_ostream_representation *) _pointer; }
44 operator struct styled_ostream_representation * () { return (struct styled_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; }
ostream_tterm_styled_ostream_t48 operator ostream_t () { return (ostream_t) (struct any_ostream_representation *) _pointer; }
term_styled_ostream_tterm_styled_ostream_t49 explicit term_styled_ostream_t (ostream_t x) : _pointer ((struct term_styled_ostream_representation *) (void *) x) {}
styled_ostream_tterm_styled_ostream_t50 operator styled_ostream_t () { return (styled_ostream_t) (struct styled_ostream_representation *) _pointer; }
term_styled_ostream_tterm_styled_ostream_t51 explicit term_styled_ostream_t (styled_ostream_t x) : _pointer ((struct term_styled_ostream_representation *) (void *) x) {}
52 };
53 #else
54 typedef styled_ostream_t term_styled_ostream_t;
55 #endif
56
57 /* Functions that invoke the methods. */
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 extern void term_styled_ostream_write_mem (term_styled_ostream_t first_arg, const void *data, size_t len);
62 extern void term_styled_ostream_flush (term_styled_ostream_t first_arg, ostream_flush_scope_t scope);
63 extern void term_styled_ostream_free (term_styled_ostream_t first_arg);
64 extern void term_styled_ostream_begin_use_class (term_styled_ostream_t first_arg, const char *classname);
65 extern void term_styled_ostream_end_use_class (term_styled_ostream_t first_arg, const char *classname);
66 extern const char * term_styled_ostream_get_hyperlink_ref (term_styled_ostream_t first_arg);
67 extern const char * term_styled_ostream_get_hyperlink_id (term_styled_ostream_t first_arg);
68 extern void term_styled_ostream_set_hyperlink (term_styled_ostream_t first_arg, const char *ref, const char *id);
69 extern void term_styled_ostream_flush_to_current_style (term_styled_ostream_t first_arg);
70 #ifdef __cplusplus
71 }
72 #endif
73
74 /* Type representing an implementation of term_styled_ostream_t. */
75 struct term_styled_ostream_implementation
76 {
77 const typeinfo_t * const *superclasses;
78 size_t superclasses_length;
79 size_t instance_size;
80 #define THIS_ARG term_styled_ostream_t first_arg
81 #include "term_styled_ostream.vt.h"
82 #undef THIS_ARG
83 };
84
85 /* Public portion of the object pointed to by a term_styled_ostream_t. */
86 struct term_styled_ostream_representation_header
87 {
88 const struct term_styled_ostream_implementation *vtable;
89 };
90
91 #if HAVE_INLINE
92
93 /* Define the functions that invoke the methods as inline accesses to
94 the term_styled_ostream_implementation.
95 Use #define to avoid a warning because of extern vs. static. */
96
97 # define term_styled_ostream_write_mem term_styled_ostream_write_mem_inline
98 static inline void
term_styled_ostream_write_mem(term_styled_ostream_t first_arg,const void * data,size_t len)99 term_styled_ostream_write_mem (term_styled_ostream_t first_arg, const void *data, size_t len)
100 {
101 const struct term_styled_ostream_implementation *vtable =
102 ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
103 vtable->write_mem (first_arg,data,len);
104 }
105
106 # define term_styled_ostream_flush term_styled_ostream_flush_inline
107 static inline void
term_styled_ostream_flush(term_styled_ostream_t first_arg,ostream_flush_scope_t scope)108 term_styled_ostream_flush (term_styled_ostream_t first_arg, ostream_flush_scope_t scope)
109 {
110 const struct term_styled_ostream_implementation *vtable =
111 ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
112 vtable->flush (first_arg,scope);
113 }
114
115 # define term_styled_ostream_free term_styled_ostream_free_inline
116 static inline void
term_styled_ostream_free(term_styled_ostream_t first_arg)117 term_styled_ostream_free (term_styled_ostream_t first_arg)
118 {
119 const struct term_styled_ostream_implementation *vtable =
120 ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
121 vtable->free (first_arg);
122 }
123
124 # define term_styled_ostream_begin_use_class term_styled_ostream_begin_use_class_inline
125 static inline void
term_styled_ostream_begin_use_class(term_styled_ostream_t first_arg,const char * classname)126 term_styled_ostream_begin_use_class (term_styled_ostream_t first_arg, const char *classname)
127 {
128 const struct term_styled_ostream_implementation *vtable =
129 ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
130 vtable->begin_use_class (first_arg,classname);
131 }
132
133 # define term_styled_ostream_end_use_class term_styled_ostream_end_use_class_inline
134 static inline void
term_styled_ostream_end_use_class(term_styled_ostream_t first_arg,const char * classname)135 term_styled_ostream_end_use_class (term_styled_ostream_t first_arg, const char *classname)
136 {
137 const struct term_styled_ostream_implementation *vtable =
138 ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
139 vtable->end_use_class (first_arg,classname);
140 }
141
142 # define term_styled_ostream_get_hyperlink_ref term_styled_ostream_get_hyperlink_ref_inline
143 static inline const char *
term_styled_ostream_get_hyperlink_ref(term_styled_ostream_t first_arg)144 term_styled_ostream_get_hyperlink_ref (term_styled_ostream_t first_arg)
145 {
146 const struct term_styled_ostream_implementation *vtable =
147 ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
148 return vtable->get_hyperlink_ref (first_arg);
149 }
150
151 # define term_styled_ostream_get_hyperlink_id term_styled_ostream_get_hyperlink_id_inline
152 static inline const char *
term_styled_ostream_get_hyperlink_id(term_styled_ostream_t first_arg)153 term_styled_ostream_get_hyperlink_id (term_styled_ostream_t first_arg)
154 {
155 const struct term_styled_ostream_implementation *vtable =
156 ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
157 return vtable->get_hyperlink_id (first_arg);
158 }
159
160 # define term_styled_ostream_set_hyperlink term_styled_ostream_set_hyperlink_inline
161 static inline void
term_styled_ostream_set_hyperlink(term_styled_ostream_t first_arg,const char * ref,const char * id)162 term_styled_ostream_set_hyperlink (term_styled_ostream_t first_arg, const char *ref, const char *id)
163 {
164 const struct term_styled_ostream_implementation *vtable =
165 ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
166 vtable->set_hyperlink (first_arg,ref,id);
167 }
168
169 # define term_styled_ostream_flush_to_current_style term_styled_ostream_flush_to_current_style_inline
170 static inline void
term_styled_ostream_flush_to_current_style(term_styled_ostream_t first_arg)171 term_styled_ostream_flush_to_current_style (term_styled_ostream_t first_arg)
172 {
173 const struct term_styled_ostream_implementation *vtable =
174 ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
175 vtable->flush_to_current_style (first_arg);
176 }
177
178 #endif
179
180 extern const typeinfo_t term_styled_ostream_typeinfo;
181 #define term_styled_ostream_SUPERCLASSES &term_styled_ostream_typeinfo, styled_ostream_SUPERCLASSES
182 #define term_styled_ostream_SUPERCLASSES_LENGTH (1 + styled_ostream_SUPERCLASSES_LENGTH)
183
184 extern const struct term_styled_ostream_implementation term_styled_ostream_vtable;
185
186 #line 29 "term-styled-ostream.oo.h"
187
188
189 #ifdef __cplusplus
190 extern "C" {
191 #endif
192
193
194 /* Create an output stream referring to the file descriptor FD, styled with
195 the file CSS_FILENAME.
196 FILENAME is used only for error messages.
197 TTY_CONTROL specifies the amount of control to take over the underlying tty.
198 Note that the resulting stream must be closed before FD can be closed.
199 Return NULL upon failure. */
200 extern term_styled_ostream_t
201 term_styled_ostream_create (int fd, const char *filename,
202 ttyctl_t tty_control,
203 const char *css_filename);
204
205
206 #ifdef __cplusplus
207 }
208 #endif
209
210 #endif /* _TERM_STYLED_OSTREAM_H */
211