1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 #line 1 "file-ostream.oo.c"
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.
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.
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.
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/>. */
24 #include "file-ostream.h"
30 #line 31 "file-ostream.c"
32 #define file_ostream_representation any_ostream_representation
34 #include "file_ostream.priv.h"
36 const typeinfo_t file_ostream_typeinfo = { "file_ostream" };
38 static const typeinfo_t * const file_ostream_superclasses[] =
39 { file_ostream_SUPERCLASSES };
41 #define super ostream_vtable
43 #line 32 "file-ostream.oo.c"
45 /* Implementation of ostream_t methods. */
48 file_ostream__write_mem (file_ostream_t stream, const void *data, size_t len)
51 fwrite (data, 1, len, stream->fp);
55 file_ostream__flush (file_ostream_t stream)
57 /* This ostream has no internal buffer. No need to fflush (stream->fp),
58 since it's external to this ostream. */
62 file_ostream__free (file_ostream_t stream)
70 file_ostream_create (FILE *fp)
72 file_ostream_t stream = XMALLOC (struct file_ostream_representation);
74 stream->base.vtable = &file_ostream_vtable;
80 #line 81 "file-ostream.c"
82 const struct file_ostream_implementation file_ostream_vtable =
84 file_ostream_superclasses,
85 sizeof (file_ostream_superclasses) / sizeof (file_ostream_superclasses[0]),
86 sizeof (struct file_ostream_representation),
87 file_ostream__write_mem,
94 /* Define the functions that invoke the methods. */
97 file_ostream_write_mem (file_ostream_t first_arg, const void *data, size_t len)
99 const struct file_ostream_implementation *vtable =
100 ((struct file_ostream_representation_header *) (struct file_ostream_representation *) first_arg)->vtable;
101 vtable->write_mem (first_arg,data,len);
105 file_ostream_flush (file_ostream_t first_arg)
107 const struct file_ostream_implementation *vtable =
108 ((struct file_ostream_representation_header *) (struct file_ostream_representation *) first_arg)->vtable;
109 vtable->flush (first_arg);
113 file_ostream_free (file_ostream_t first_arg)
115 const struct file_ostream_implementation *vtable =
116 ((struct file_ostream_representation_header *) (struct file_ostream_representation *) first_arg)->vtable;
117 vtable->free (first_arg);