Blame gnulib-local/lib/ostream.oo.h

Packit Bot 06c835
/* Abstract output stream data type.
Packit Bot 06c835
   Copyright (C) 2006, 2015 Free Software Foundation, Inc.
Packit Bot 06c835
   Written by Bruno Haible <bruno@clisp.org>, 2006.
Packit Bot 06c835
Packit Bot 06c835
   This program is free software: you can redistribute it and/or modify
Packit Bot 06c835
   it under the terms of the GNU General Public License as published by
Packit Bot 06c835
   the Free Software Foundation; either version 3 of the License, or
Packit Bot 06c835
   (at your option) any later version.
Packit Bot 06c835
Packit Bot 06c835
   This program is distributed in the hope that it will be useful,
Packit Bot 06c835
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Bot 06c835
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Bot 06c835
   GNU General Public License for more details.
Packit Bot 06c835
Packit Bot 06c835
   You should have received a copy of the GNU General Public License
Packit Bot 06c835
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit Bot 06c835
Packit Bot 06c835
#ifndef _OSTREAM_H
Packit Bot 06c835
#define _OSTREAM_H
Packit Bot 06c835
Packit Bot 06c835
#include <stddef.h>
Packit Bot 06c835
#include <string.h>
Packit Bot 06c835
Packit Bot 06c835
#include "moo.h"
Packit Bot 06c835
Packit Bot 06c835
/* An output stream is an object to which one can feed a sequence of bytes.  */
Packit Bot 06c835
Packit Bot 06c835
struct ostream
Packit Bot 06c835
{
Packit Bot 06c835
methods:
Packit Bot 06c835
Packit Bot 06c835
  /* Write a sequence of bytes to a stream.  */
Packit Bot 06c835
  void write_mem (ostream_t stream, const void *data, size_t len);
Packit Bot 06c835
Packit Bot 06c835
  /* Bring buffered data to its destination.  */
Packit Bot 06c835
  void flush (ostream_t stream);
Packit Bot 06c835
Packit Bot 06c835
  /* Close and free a stream.  */
Packit Bot 06c835
  void free (ostream_t stream);
Packit Bot 06c835
};
Packit Bot 06c835
Packit Bot 06c835
#ifdef __cplusplus
Packit Bot 06c835
extern "C" {
Packit Bot 06c835
#endif
Packit Bot 06c835
Packit Bot 06c835
/* Write a string's contents to a stream.  */
Packit Bot 06c835
extern void ostream_write_str (ostream_t stream, const char *string);
Packit Bot 06c835
Packit Bot 06c835
#if HAVE_INLINE
Packit Bot 06c835
Packit Bot 06c835
#define ostream_write_str ostream_write_str_inline
Packit Bot 06c835
static inline void
Packit Bot 06c835
ostream_write_str (ostream_t stream, const char *string)
Packit Bot 06c835
{
Packit Bot 06c835
  ostream_write_mem (stream, string, strlen (string));
Packit Bot 06c835
}
Packit Bot 06c835
Packit Bot 06c835
#endif
Packit Bot 06c835
Packit Bot 06c835
#ifdef __cplusplus
Packit Bot 06c835
}
Packit Bot 06c835
#endif
Packit Bot 06c835
Packit Bot 06c835
#endif /* _OSTREAM_H */