1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 
3 #line 1 "iconv-ostream.oo.h"
4 /* Output stream that converts the output to another encoding.
5    Copyright (C) 2006 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 _ICONV_OSTREAM_H
22 #define _ICONV_OSTREAM_H
23 
24 /* Note that this stream does not provide accurate error messages with line
25    and column number when the conversion fails.  */
26 
27 #include "ostream.h"
28 
29 
30 #line 31 "iconv-ostream.h"
31 struct iconv_ostream_representation;
32 /* iconv_ostream_t is defined as a pointer to struct iconv_ostream_representation.
33    In C++ mode, we use a smart pointer class.
34    In C mode, we have no other choice than a typedef to the root class type.  */
35 #if IS_CPLUSPLUS
36 struct iconv_ostream_t
37 {
38 private:
39   struct iconv_ostream_representation *_pointer;
40 public:
iconv_ostream_ticonv_ostream_t41   iconv_ostream_t () : _pointer (NULL) {}
iconv_ostream_ticonv_ostream_t42   iconv_ostream_t (struct iconv_ostream_representation *pointer) : _pointer (pointer) {}
43   struct iconv_ostream_representation * operator -> () { return _pointer; }
44   operator struct iconv_ostream_representation * () { return _pointer; }
45   operator struct any_ostream_representation * () { return (struct any_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_ticonv_ostream_t49   operator ostream_t () { return (ostream_t) (struct any_ostream_representation *) _pointer; }
iconv_ostream_ticonv_ostream_t50   explicit iconv_ostream_t (ostream_t x) : _pointer ((struct iconv_ostream_representation *) (void *) x) {}
51 };
52 #else
53 typedef ostream_t iconv_ostream_t;
54 #endif
55 
56 /* Functions that invoke the methods.  */
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 extern        void iconv_ostream_write_mem (iconv_ostream_t first_arg, const void *data, size_t len);
61 extern         void iconv_ostream_flush (iconv_ostream_t first_arg, ostream_flush_scope_t scope);
62 extern         void iconv_ostream_free (iconv_ostream_t first_arg);
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 /* Type representing an implementation of iconv_ostream_t.  */
68 struct iconv_ostream_implementation
69 {
70   const typeinfo_t * const *superclasses;
71   size_t superclasses_length;
72   size_t instance_size;
73 #define THIS_ARG iconv_ostream_t first_arg
74 #include "iconv_ostream.vt.h"
75 #undef THIS_ARG
76 };
77 
78 /* Public portion of the object pointed to by a iconv_ostream_t.  */
79 struct iconv_ostream_representation_header
80 {
81   const struct iconv_ostream_implementation *vtable;
82 };
83 
84 #if HAVE_INLINE
85 
86 /* Define the functions that invoke the methods as inline accesses to
87    the iconv_ostream_implementation.
88    Use #define to avoid a warning because of extern vs. static.  */
89 
90 # define iconv_ostream_write_mem iconv_ostream_write_mem_inline
91 static inline void
iconv_ostream_write_mem(iconv_ostream_t first_arg,const void * data,size_t len)92 iconv_ostream_write_mem (iconv_ostream_t first_arg, const void *data, size_t len)
93 {
94   const struct iconv_ostream_implementation *vtable =
95     ((struct iconv_ostream_representation_header *) (struct iconv_ostream_representation *) first_arg)->vtable;
96   vtable->write_mem (first_arg,data,len);
97 }
98 
99 # define iconv_ostream_flush iconv_ostream_flush_inline
100 static inline void
iconv_ostream_flush(iconv_ostream_t first_arg,ostream_flush_scope_t scope)101 iconv_ostream_flush (iconv_ostream_t first_arg, ostream_flush_scope_t scope)
102 {
103   const struct iconv_ostream_implementation *vtable =
104     ((struct iconv_ostream_representation_header *) (struct iconv_ostream_representation *) first_arg)->vtable;
105   vtable->flush (first_arg,scope);
106 }
107 
108 # define iconv_ostream_free iconv_ostream_free_inline
109 static inline void
iconv_ostream_free(iconv_ostream_t first_arg)110 iconv_ostream_free (iconv_ostream_t first_arg)
111 {
112   const struct iconv_ostream_implementation *vtable =
113     ((struct iconv_ostream_representation_header *) (struct iconv_ostream_representation *) first_arg)->vtable;
114   vtable->free (first_arg);
115 }
116 
117 #endif
118 
119 extern const typeinfo_t iconv_ostream_typeinfo;
120 #define iconv_ostream_SUPERCLASSES &iconv_ostream_typeinfo, ostream_SUPERCLASSES
121 #define iconv_ostream_SUPERCLASSES_LENGTH (1 + ostream_SUPERCLASSES_LENGTH)
122 
123 extern const struct iconv_ostream_implementation iconv_ostream_vtable;
124 
125 #line 31 "iconv-ostream.oo.h"
126 
127 
128 #ifdef __cplusplus
129 extern "C" {
130 #endif
131 
132 
133 #if HAVE_ICONV
134 
135 /* Create an output stream that converts from FROM_ENCODING to TO_ENCODING,
136    writing the result to DESTINATION.  */
137 extern iconv_ostream_t iconv_ostream_create (const char *from_encoding,
138                                              const char *to_encoding,
139                                              ostream_t destination);
140 
141 #endif /* HAVE_ICONV */
142 
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif /* _ICONV_OSTREAM_H */
149