Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / gnulib-lib / file-ostream.h
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2
3 #line 1 "file-ostream.oo.h"
4 /* Output stream referring to an stdio FILE.
5    Copyright (C) 2006, 2015 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 <http://www.gnu.org/licenses/>.  */
20
21 #ifndef _FILE_OSTREAM_H
22 #define _FILE_OSTREAM_H
23
24 #include <stdio.h>
25
26 #include "ostream.h"
27
28
29 #line 30 "file-ostream.h"
30 struct file_ostream_representation;
31 /* file_ostream_t is defined as a pointer to struct file_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 file_ostream_t
36 {
37 private:
38   struct file_ostream_representation *_pointer;
39 public:
40   file_ostream_t () : _pointer (NULL) {}
41   file_ostream_t (struct file_ostream_representation *pointer) : _pointer (pointer) {}
42   struct file_ostream_representation * operator -> () { return _pointer; }
43   operator struct file_ostream_representation * () { return _pointer; }
44   operator struct any_ostream_representation * () { return (struct any_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; }
48   operator ostream_t () { return (ostream_t) (struct any_ostream_representation *) _pointer; }
49   explicit file_ostream_t (ostream_t x) : _pointer ((struct file_ostream_representation *) (void *) x) {}
50 };
51 #else
52 typedef ostream_t file_ostream_t;
53 #endif
54
55 /* Functions that invoke the methods.  */
56 extern        void file_ostream_write_mem (file_ostream_t first_arg, const void *data, size_t len);
57 extern         void file_ostream_flush (file_ostream_t first_arg);
58 extern         void file_ostream_free (file_ostream_t first_arg);
59
60 /* Type representing an implementation of file_ostream_t.  */
61 struct file_ostream_implementation
62 {
63   const typeinfo_t * const *superclasses;
64   size_t superclasses_length;
65   size_t instance_size;
66 #define THIS_ARG file_ostream_t first_arg
67 #include "file_ostream.vt.h"
68 #undef THIS_ARG
69 };
70
71 /* Public portion of the object pointed to by a file_ostream_t.  */
72 struct file_ostream_representation_header
73 {
74   const struct file_ostream_implementation *vtable;
75 };
76
77 #if HAVE_INLINE
78
79 /* Define the functions that invoke the methods as inline accesses to
80    the file_ostream_implementation.
81    Use #define to avoid a warning because of extern vs. static.  */
82
83 # define file_ostream_write_mem file_ostream_write_mem_inline
84 static inline void
85 file_ostream_write_mem (file_ostream_t first_arg, const void *data, size_t len)
86 {
87   const struct file_ostream_implementation *vtable =
88     ((struct file_ostream_representation_header *) (struct file_ostream_representation *) first_arg)->vtable;
89   vtable->write_mem (first_arg,data,len);
90 }
91
92 # define file_ostream_flush file_ostream_flush_inline
93 static inline void
94 file_ostream_flush (file_ostream_t first_arg)
95 {
96   const struct file_ostream_implementation *vtable =
97     ((struct file_ostream_representation_header *) (struct file_ostream_representation *) first_arg)->vtable;
98   vtable->flush (first_arg);
99 }
100
101 # define file_ostream_free file_ostream_free_inline
102 static inline void
103 file_ostream_free (file_ostream_t first_arg)
104 {
105   const struct file_ostream_implementation *vtable =
106     ((struct file_ostream_representation_header *) (struct file_ostream_representation *) first_arg)->vtable;
107   vtable->free (first_arg);
108 }
109
110 #endif
111
112 extern const typeinfo_t file_ostream_typeinfo;
113 #define file_ostream_SUPERCLASSES &file_ostream_typeinfo, ostream_SUPERCLASSES
114 #define file_ostream_SUPERCLASSES_LENGTH (1 + ostream_SUPERCLASSES_LENGTH)
115
116 extern const struct file_ostream_implementation file_ostream_vtable;
117
118 #line 30 "file-ostream.oo.h"
119
120
121 #ifdef __cplusplus
122 extern "C" {
123 #endif
124
125
126 /* Create an output stream referring to FP.
127    Note that the resulting stream must be closed before FP can be closed.  */
128 extern file_ostream_t file_ostream_create (FILE *fp);
129
130
131 #ifdef __cplusplus
132 }
133 #endif
134
135 #endif /* _FILE_OSTREAM_H */