(root)/
gettext-0.22.4/
libtextstyle/
lib/
iconv-ostream.h
       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, 2020 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 <stdbool.h>
      28  
      29  #include "ostream.h"
      30  
      31  
      32  #line 33 "iconv-ostream.h"
      33  struct iconv_ostream_representation;
      34  /* iconv_ostream_t is defined as a pointer to struct iconv_ostream_representation.
      35     In C++ mode, we use a smart pointer class.
      36     In C mode, we have no other choice than a typedef to the root class type.  */
      37  #if IS_CPLUSPLUS
      38  struct iconv_ostream_t
      39  {
      40  private:
      41    struct iconv_ostream_representation *_pointer;
      42  public:
      43    iconv_ostream_t () : _pointer (NULL) {}
      44    iconv_ostream_t (struct iconv_ostream_representation *pointer) : _pointer (pointer) {}
      45    struct iconv_ostream_representation * operator -> () { return _pointer; }
      46    operator struct iconv_ostream_representation * () { return _pointer; }
      47    operator struct any_ostream_representation * () { return (struct any_ostream_representation *) _pointer; }
      48    operator void * () { return _pointer; }
      49    bool operator == (const void *p) { return _pointer == p; }
      50    bool operator != (const void *p) { return _pointer != p; }
      51    operator ostream_t () { return (ostream_t) (struct any_ostream_representation *) _pointer; }
      52    explicit iconv_ostream_t (ostream_t x) : _pointer ((struct iconv_ostream_representation *) (void *) x) {}
      53  };
      54  #else
      55  typedef ostream_t iconv_ostream_t;
      56  #endif
      57  
      58  /* Functions that invoke the methods.  */
      59  #ifdef __cplusplus
      60  extern "C" {
      61  #endif
      62  extern        void iconv_ostream_write_mem (iconv_ostream_t first_arg, const void *data, size_t len);
      63  extern         void iconv_ostream_flush (iconv_ostream_t first_arg, ostream_flush_scope_t scope);
      64  extern         void iconv_ostream_free (iconv_ostream_t first_arg);
      65  extern       const char * iconv_ostream_get_from_encoding (iconv_ostream_t first_arg);
      66  extern    const char * iconv_ostream_get_to_encoding (iconv_ostream_t first_arg);
      67  extern    ostream_t    iconv_ostream_get_destination (iconv_ostream_t first_arg);
      68  #ifdef __cplusplus
      69  }
      70  #endif
      71  
      72  /* Type representing an implementation of iconv_ostream_t.  */
      73  struct iconv_ostream_implementation
      74  {
      75    const typeinfo_t * const *superclasses;
      76    size_t superclasses_length;
      77    size_t instance_size;
      78  #define THIS_ARG iconv_ostream_t first_arg
      79  #include "iconv_ostream.vt.h"
      80  #undef THIS_ARG
      81  };
      82  
      83  /* Public portion of the object pointed to by a iconv_ostream_t.  */
      84  struct iconv_ostream_representation_header
      85  {
      86    const struct iconv_ostream_implementation *vtable;
      87  };
      88  
      89  #if HAVE_INLINE
      90  
      91  /* Define the functions that invoke the methods as inline accesses to
      92     the iconv_ostream_implementation.
      93     Use #define to avoid a warning because of extern vs. static.  */
      94  
      95  # define iconv_ostream_write_mem iconv_ostream_write_mem_inline
      96  static inline void
      97  iconv_ostream_write_mem (iconv_ostream_t first_arg, const void *data, size_t len)
      98  {
      99    const struct iconv_ostream_implementation *vtable =
     100      ((struct iconv_ostream_representation_header *) (struct iconv_ostream_representation *) first_arg)->vtable;
     101    vtable->write_mem (first_arg,data,len);
     102  }
     103  
     104  # define iconv_ostream_flush iconv_ostream_flush_inline
     105  static inline void
     106  iconv_ostream_flush (iconv_ostream_t first_arg, ostream_flush_scope_t scope)
     107  {
     108    const struct iconv_ostream_implementation *vtable =
     109      ((struct iconv_ostream_representation_header *) (struct iconv_ostream_representation *) first_arg)->vtable;
     110    vtable->flush (first_arg,scope);
     111  }
     112  
     113  # define iconv_ostream_free iconv_ostream_free_inline
     114  static inline void
     115  iconv_ostream_free (iconv_ostream_t first_arg)
     116  {
     117    const struct iconv_ostream_implementation *vtable =
     118      ((struct iconv_ostream_representation_header *) (struct iconv_ostream_representation *) first_arg)->vtable;
     119    vtable->free (first_arg);
     120  }
     121  
     122  # define iconv_ostream_get_from_encoding iconv_ostream_get_from_encoding_inline
     123  static inline const char *
     124  iconv_ostream_get_from_encoding (iconv_ostream_t first_arg)
     125  {
     126    const struct iconv_ostream_implementation *vtable =
     127      ((struct iconv_ostream_representation_header *) (struct iconv_ostream_representation *) first_arg)->vtable;
     128    return vtable->get_from_encoding (first_arg);
     129  }
     130  
     131  # define iconv_ostream_get_to_encoding iconv_ostream_get_to_encoding_inline
     132  static inline const char *
     133  iconv_ostream_get_to_encoding (iconv_ostream_t first_arg)
     134  {
     135    const struct iconv_ostream_implementation *vtable =
     136      ((struct iconv_ostream_representation_header *) (struct iconv_ostream_representation *) first_arg)->vtable;
     137    return vtable->get_to_encoding (first_arg);
     138  }
     139  
     140  # define iconv_ostream_get_destination iconv_ostream_get_destination_inline
     141  static inline ostream_t
     142  iconv_ostream_get_destination (iconv_ostream_t first_arg)
     143  {
     144    const struct iconv_ostream_implementation *vtable =
     145      ((struct iconv_ostream_representation_header *) (struct iconv_ostream_representation *) first_arg)->vtable;
     146    return vtable->get_destination (first_arg);
     147  }
     148  
     149  #endif
     150  
     151  extern const typeinfo_t iconv_ostream_typeinfo;
     152  #define iconv_ostream_SUPERCLASSES &iconv_ostream_typeinfo, ostream_SUPERCLASSES
     153  #define iconv_ostream_SUPERCLASSES_LENGTH (1 + ostream_SUPERCLASSES_LENGTH)
     154  
     155  extern const struct iconv_ostream_implementation iconv_ostream_vtable;
     156  
     157  #line 37 "iconv-ostream.oo.h"
     158  
     159  
     160  #ifdef __cplusplus
     161  extern "C" {
     162  #endif
     163  
     164  
     165  #if HAVE_ICONV
     166  
     167  /* Create an output stream that converts from FROM_ENCODING to TO_ENCODING,
     168     writing the result to DESTINATION.  */
     169  extern iconv_ostream_t iconv_ostream_create (const char *from_encoding,
     170                                               const char *to_encoding,
     171                                               ostream_t destination);
     172  
     173  #endif /* HAVE_ICONV */
     174  
     175  
     176  /* Test whether a given output stream is an iconv_ostream.  */
     177  extern bool is_instance_of_iconv_ostream (ostream_t stream);
     178  
     179  
     180  #ifdef __cplusplus
     181  }
     182  #endif
     183  
     184  #endif /* _ICONV_OSTREAM_H */