1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 
3 #line 1 "noop-styled-ostream.oo.h"
4 /* Output stream with no-op styling.
5    Copyright (C) 2006, 2019 Free Software Foundation, Inc.
6    Written by Bruno Haible <bruno@clisp.org>, 2019.
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 _NOOP_STYLED_OSTREAM_H
22 #define _NOOP_STYLED_OSTREAM_H
23 
24 #include <stdbool.h>
25 
26 #include "styled-ostream.h"
27 
28 
29 #line 30 "noop-styled-ostream.h"
30 struct noop_styled_ostream_representation;
31 /* noop_styled_ostream_t is defined as a pointer to struct noop_styled_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 noop_styled_ostream_t
36 {
37 private:
38   struct noop_styled_ostream_representation *_pointer;
39 public:
noop_styled_ostream_tnoop_styled_ostream_t40   noop_styled_ostream_t () : _pointer (NULL) {}
noop_styled_ostream_tnoop_styled_ostream_t41   noop_styled_ostream_t (struct noop_styled_ostream_representation *pointer) : _pointer (pointer) {}
42   struct noop_styled_ostream_representation * operator -> () { return _pointer; }
43   operator struct noop_styled_ostream_representation * () { return _pointer; }
44   operator struct any_ostream_representation * () { return (struct any_ostream_representation *) _pointer; }
45   operator struct styled_ostream_representation * () { return (struct styled_ostream_representation *) _pointer; }
46   operator void * () { return _pointer; }
47   bool operator == (const void *p) { return _pointer == p; }
48   bool operator != (const void *p) { return _pointer != p; }
ostream_tnoop_styled_ostream_t49   operator ostream_t () { return (ostream_t) (struct any_ostream_representation *) _pointer; }
noop_styled_ostream_tnoop_styled_ostream_t50   explicit noop_styled_ostream_t (ostream_t x) : _pointer ((struct noop_styled_ostream_representation *) (void *) x) {}
styled_ostream_tnoop_styled_ostream_t51   operator styled_ostream_t () { return (styled_ostream_t) (struct styled_ostream_representation *) _pointer; }
noop_styled_ostream_tnoop_styled_ostream_t52   explicit noop_styled_ostream_t (styled_ostream_t x) : _pointer ((struct noop_styled_ostream_representation *) (void *) x) {}
53 };
54 #else
55 typedef styled_ostream_t noop_styled_ostream_t;
56 #endif
57 
58 /* Functions that invoke the methods.  */
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 extern        void noop_styled_ostream_write_mem (noop_styled_ostream_t first_arg, const void *data, size_t len);
63 extern         void noop_styled_ostream_flush (noop_styled_ostream_t first_arg, ostream_flush_scope_t scope);
64 extern         void noop_styled_ostream_free (noop_styled_ostream_t first_arg);
65 extern          void noop_styled_ostream_begin_use_class (noop_styled_ostream_t first_arg, const char *classname);
66 extern          void noop_styled_ostream_end_use_class (noop_styled_ostream_t first_arg, const char *classname);
67 extern         const char * noop_styled_ostream_get_hyperlink_ref (noop_styled_ostream_t first_arg);
68 extern    const char * noop_styled_ostream_get_hyperlink_id (noop_styled_ostream_t first_arg);
69 extern    void         noop_styled_ostream_set_hyperlink (noop_styled_ostream_t first_arg,                               const char *ref, const char *id);
70 extern              void noop_styled_ostream_flush_to_current_style (noop_styled_ostream_t first_arg);
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 /* Type representing an implementation of noop_styled_ostream_t.  */
76 struct noop_styled_ostream_implementation
77 {
78   const typeinfo_t * const *superclasses;
79   size_t superclasses_length;
80   size_t instance_size;
81 #define THIS_ARG noop_styled_ostream_t first_arg
82 #include "noop_styled_ostream.vt.h"
83 #undef THIS_ARG
84 };
85 
86 /* Public portion of the object pointed to by a noop_styled_ostream_t.  */
87 struct noop_styled_ostream_representation_header
88 {
89   const struct noop_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 noop_styled_ostream_implementation.
96    Use #define to avoid a warning because of extern vs. static.  */
97 
98 # define noop_styled_ostream_write_mem noop_styled_ostream_write_mem_inline
99 static inline void
noop_styled_ostream_write_mem(noop_styled_ostream_t first_arg,const void * data,size_t len)100 noop_styled_ostream_write_mem (noop_styled_ostream_t first_arg, const void *data, size_t len)
101 {
102   const struct noop_styled_ostream_implementation *vtable =
103     ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
104   vtable->write_mem (first_arg,data,len);
105 }
106 
107 # define noop_styled_ostream_flush noop_styled_ostream_flush_inline
108 static inline void
noop_styled_ostream_flush(noop_styled_ostream_t first_arg,ostream_flush_scope_t scope)109 noop_styled_ostream_flush (noop_styled_ostream_t first_arg, ostream_flush_scope_t scope)
110 {
111   const struct noop_styled_ostream_implementation *vtable =
112     ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
113   vtable->flush (first_arg,scope);
114 }
115 
116 # define noop_styled_ostream_free noop_styled_ostream_free_inline
117 static inline void
noop_styled_ostream_free(noop_styled_ostream_t first_arg)118 noop_styled_ostream_free (noop_styled_ostream_t first_arg)
119 {
120   const struct noop_styled_ostream_implementation *vtable =
121     ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
122   vtable->free (first_arg);
123 }
124 
125 # define noop_styled_ostream_begin_use_class noop_styled_ostream_begin_use_class_inline
126 static inline void
noop_styled_ostream_begin_use_class(noop_styled_ostream_t first_arg,const char * classname)127 noop_styled_ostream_begin_use_class (noop_styled_ostream_t first_arg, const char *classname)
128 {
129   const struct noop_styled_ostream_implementation *vtable =
130     ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
131   vtable->begin_use_class (first_arg,classname);
132 }
133 
134 # define noop_styled_ostream_end_use_class noop_styled_ostream_end_use_class_inline
135 static inline void
noop_styled_ostream_end_use_class(noop_styled_ostream_t first_arg,const char * classname)136 noop_styled_ostream_end_use_class (noop_styled_ostream_t first_arg, const char *classname)
137 {
138   const struct noop_styled_ostream_implementation *vtable =
139     ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
140   vtable->end_use_class (first_arg,classname);
141 }
142 
143 # define noop_styled_ostream_get_hyperlink_ref noop_styled_ostream_get_hyperlink_ref_inline
144 static inline const char *
noop_styled_ostream_get_hyperlink_ref(noop_styled_ostream_t first_arg)145 noop_styled_ostream_get_hyperlink_ref (noop_styled_ostream_t first_arg)
146 {
147   const struct noop_styled_ostream_implementation *vtable =
148     ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
149   return vtable->get_hyperlink_ref (first_arg);
150 }
151 
152 # define noop_styled_ostream_get_hyperlink_id noop_styled_ostream_get_hyperlink_id_inline
153 static inline const char *
noop_styled_ostream_get_hyperlink_id(noop_styled_ostream_t first_arg)154 noop_styled_ostream_get_hyperlink_id (noop_styled_ostream_t first_arg)
155 {
156   const struct noop_styled_ostream_implementation *vtable =
157     ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
158   return vtable->get_hyperlink_id (first_arg);
159 }
160 
161 # define noop_styled_ostream_set_hyperlink noop_styled_ostream_set_hyperlink_inline
162 static inline void
noop_styled_ostream_set_hyperlink(noop_styled_ostream_t first_arg,const char * ref,const char * id)163 noop_styled_ostream_set_hyperlink (noop_styled_ostream_t first_arg,                               const char *ref, const char *id)
164 {
165   const struct noop_styled_ostream_implementation *vtable =
166     ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
167   vtable->set_hyperlink (first_arg,ref,id);
168 }
169 
170 # define noop_styled_ostream_flush_to_current_style noop_styled_ostream_flush_to_current_style_inline
171 static inline void
noop_styled_ostream_flush_to_current_style(noop_styled_ostream_t first_arg)172 noop_styled_ostream_flush_to_current_style (noop_styled_ostream_t first_arg)
173 {
174   const struct noop_styled_ostream_implementation *vtable =
175     ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
176   vtable->flush_to_current_style (first_arg);
177 }
178 
179 #endif
180 
181 extern const typeinfo_t noop_styled_ostream_typeinfo;
182 #define noop_styled_ostream_SUPERCLASSES &noop_styled_ostream_typeinfo, styled_ostream_SUPERCLASSES
183 #define noop_styled_ostream_SUPERCLASSES_LENGTH (1 + styled_ostream_SUPERCLASSES_LENGTH)
184 
185 extern const struct noop_styled_ostream_implementation noop_styled_ostream_vtable;
186 
187 #line 30 "noop-styled-ostream.oo.h"
188 
189 
190 #ifdef __cplusplus
191 extern "C" {
192 #endif
193 
194 
195 /* Create an output stream that delegates to DESTINATION and that supports
196    the styling operations as no-ops.
197    If PASS_OWNERSHIP is true, closing the resulting stream will automatically
198    close the DESTINATION.
199    Note that if PASS_OWNERSHIP is false, the resulting stream must be closed
200    before DESTINATION can be closed.  */
201 extern noop_styled_ostream_t
202        noop_styled_ostream_create (ostream_t destination, bool pass_ownership);
203 
204 
205 #ifdef __cplusplus
206 }
207 #endif
208 
209 #endif /* _NOOP_STYLED_OSTREAM_H */
210