(root)/
gettext-0.22.4/
libtextstyle/
lib/
noop-styled-ostream.h
       1  /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
       2  
       3  #line 1 "noop-styled-ostream.oo.h"
       4  /* Output stream with no-op styling.
       5     Copyright (C) 2006, 2019-2020 Free Software Foundation, Inc.
       6     Written by Bruno Haible <bruno@clisp.org>, 2019.
       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 _NOOP_STYLED_OSTREAM_H
      22  #define _NOOP_STYLED_OSTREAM_H
      23  
      24  #include <stdbool.h>
      25  
      26  #include "styled-ostream.h"
      27  
      28  
      29  #line 30 "noop-styled-ostream.h"
      30  struct noop_styled_ostream_representation;
      31  /* noop_styled_ostream_t is defined as a pointer to struct noop_styled_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 noop_styled_ostream_t
      36  {
      37  private:
      38    struct noop_styled_ostream_representation *_pointer;
      39  public:
      40    noop_styled_ostream_t () : _pointer (NULL) {}
      41    noop_styled_ostream_t (struct noop_styled_ostream_representation *pointer) : _pointer (pointer) {}
      42    struct noop_styled_ostream_representation * operator -> () { return _pointer; }
      43    operator struct noop_styled_ostream_representation * () { return _pointer; }
      44    operator struct any_ostream_representation * () { return (struct any_ostream_representation *) _pointer; }
      45    operator struct styled_ostream_representation * () { return (struct styled_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; }
      49    operator ostream_t () { return (ostream_t) (struct any_ostream_representation *) _pointer; }
      50    explicit noop_styled_ostream_t (ostream_t x) : _pointer ((struct noop_styled_ostream_representation *) (void *) x) {}
      51    operator styled_ostream_t () { return (styled_ostream_t) (struct styled_ostream_representation *) _pointer; }
      52    explicit noop_styled_ostream_t (styled_ostream_t x) : _pointer ((struct noop_styled_ostream_representation *) (void *) x) {}
      53  };
      54  #else
      55  typedef styled_ostream_t noop_styled_ostream_t;
      56  #endif
      57  
      58  /* Functions that invoke the methods.  */
      59  #ifdef __cplusplus
      60  extern "C" {
      61  #endif
      62  extern        void noop_styled_ostream_write_mem (noop_styled_ostream_t first_arg, const void *data, size_t len);
      63  extern         void noop_styled_ostream_flush (noop_styled_ostream_t first_arg, ostream_flush_scope_t scope);
      64  extern         void noop_styled_ostream_free (noop_styled_ostream_t first_arg);
      65  extern          void noop_styled_ostream_begin_use_class (noop_styled_ostream_t first_arg, const char *classname);
      66  extern          void noop_styled_ostream_end_use_class (noop_styled_ostream_t first_arg, const char *classname);
      67  extern         const char * noop_styled_ostream_get_hyperlink_ref (noop_styled_ostream_t first_arg);
      68  extern    const char * noop_styled_ostream_get_hyperlink_id (noop_styled_ostream_t first_arg);
      69  extern    void         noop_styled_ostream_set_hyperlink (noop_styled_ostream_t first_arg,                               const char *ref, const char *id);
      70  extern              void noop_styled_ostream_flush_to_current_style (noop_styled_ostream_t first_arg);
      71  extern       ostream_t noop_styled_ostream_get_destination (noop_styled_ostream_t first_arg);
      72  extern    bool      noop_styled_ostream_is_owning_destination (noop_styled_ostream_t first_arg);
      73  #ifdef __cplusplus
      74  }
      75  #endif
      76  
      77  /* Type representing an implementation of noop_styled_ostream_t.  */
      78  struct noop_styled_ostream_implementation
      79  {
      80    const typeinfo_t * const *superclasses;
      81    size_t superclasses_length;
      82    size_t instance_size;
      83  #define THIS_ARG noop_styled_ostream_t first_arg
      84  #include "noop_styled_ostream.vt.h"
      85  #undef THIS_ARG
      86  };
      87  
      88  /* Public portion of the object pointed to by a noop_styled_ostream_t.  */
      89  struct noop_styled_ostream_representation_header
      90  {
      91    const struct noop_styled_ostream_implementation *vtable;
      92  };
      93  
      94  #if HAVE_INLINE
      95  
      96  /* Define the functions that invoke the methods as inline accesses to
      97     the noop_styled_ostream_implementation.
      98     Use #define to avoid a warning because of extern vs. static.  */
      99  
     100  # define noop_styled_ostream_write_mem noop_styled_ostream_write_mem_inline
     101  static inline void
     102  noop_styled_ostream_write_mem (noop_styled_ostream_t first_arg, const void *data, size_t len)
     103  {
     104    const struct noop_styled_ostream_implementation *vtable =
     105      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     106    vtable->write_mem (first_arg,data,len);
     107  }
     108  
     109  # define noop_styled_ostream_flush noop_styled_ostream_flush_inline
     110  static inline void
     111  noop_styled_ostream_flush (noop_styled_ostream_t first_arg, ostream_flush_scope_t scope)
     112  {
     113    const struct noop_styled_ostream_implementation *vtable =
     114      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     115    vtable->flush (first_arg,scope);
     116  }
     117  
     118  # define noop_styled_ostream_free noop_styled_ostream_free_inline
     119  static inline void
     120  noop_styled_ostream_free (noop_styled_ostream_t first_arg)
     121  {
     122    const struct noop_styled_ostream_implementation *vtable =
     123      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     124    vtable->free (first_arg);
     125  }
     126  
     127  # define noop_styled_ostream_begin_use_class noop_styled_ostream_begin_use_class_inline
     128  static inline void
     129  noop_styled_ostream_begin_use_class (noop_styled_ostream_t first_arg, const char *classname)
     130  {
     131    const struct noop_styled_ostream_implementation *vtable =
     132      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     133    vtable->begin_use_class (first_arg,classname);
     134  }
     135  
     136  # define noop_styled_ostream_end_use_class noop_styled_ostream_end_use_class_inline
     137  static inline void
     138  noop_styled_ostream_end_use_class (noop_styled_ostream_t first_arg, const char *classname)
     139  {
     140    const struct noop_styled_ostream_implementation *vtable =
     141      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     142    vtable->end_use_class (first_arg,classname);
     143  }
     144  
     145  # define noop_styled_ostream_get_hyperlink_ref noop_styled_ostream_get_hyperlink_ref_inline
     146  static inline const char *
     147  noop_styled_ostream_get_hyperlink_ref (noop_styled_ostream_t first_arg)
     148  {
     149    const struct noop_styled_ostream_implementation *vtable =
     150      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     151    return vtable->get_hyperlink_ref (first_arg);
     152  }
     153  
     154  # define noop_styled_ostream_get_hyperlink_id noop_styled_ostream_get_hyperlink_id_inline
     155  static inline const char *
     156  noop_styled_ostream_get_hyperlink_id (noop_styled_ostream_t first_arg)
     157  {
     158    const struct noop_styled_ostream_implementation *vtable =
     159      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     160    return vtable->get_hyperlink_id (first_arg);
     161  }
     162  
     163  # define noop_styled_ostream_set_hyperlink noop_styled_ostream_set_hyperlink_inline
     164  static inline void
     165  noop_styled_ostream_set_hyperlink (noop_styled_ostream_t first_arg,                               const char *ref, const char *id)
     166  {
     167    const struct noop_styled_ostream_implementation *vtable =
     168      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     169    vtable->set_hyperlink (first_arg,ref,id);
     170  }
     171  
     172  # define noop_styled_ostream_flush_to_current_style noop_styled_ostream_flush_to_current_style_inline
     173  static inline void
     174  noop_styled_ostream_flush_to_current_style (noop_styled_ostream_t first_arg)
     175  {
     176    const struct noop_styled_ostream_implementation *vtable =
     177      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     178    vtable->flush_to_current_style (first_arg);
     179  }
     180  
     181  # define noop_styled_ostream_get_destination noop_styled_ostream_get_destination_inline
     182  static inline ostream_t
     183  noop_styled_ostream_get_destination (noop_styled_ostream_t first_arg)
     184  {
     185    const struct noop_styled_ostream_implementation *vtable =
     186      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     187    return vtable->get_destination (first_arg);
     188  }
     189  
     190  # define noop_styled_ostream_is_owning_destination noop_styled_ostream_is_owning_destination_inline
     191  static inline bool
     192  noop_styled_ostream_is_owning_destination (noop_styled_ostream_t first_arg)
     193  {
     194    const struct noop_styled_ostream_implementation *vtable =
     195      ((struct noop_styled_ostream_representation_header *) (struct noop_styled_ostream_representation *) first_arg)->vtable;
     196    return vtable->is_owning_destination (first_arg);
     197  }
     198  
     199  #endif
     200  
     201  extern const typeinfo_t noop_styled_ostream_typeinfo;
     202  #define noop_styled_ostream_SUPERCLASSES &noop_styled_ostream_typeinfo, styled_ostream_SUPERCLASSES
     203  #define noop_styled_ostream_SUPERCLASSES_LENGTH (1 + styled_ostream_SUPERCLASSES_LENGTH)
     204  
     205  extern const struct noop_styled_ostream_implementation noop_styled_ostream_vtable;
     206  
     207  #line 33 "noop-styled-ostream.oo.h"
     208  
     209  
     210  #ifdef __cplusplus
     211  extern "C" {
     212  #endif
     213  
     214  
     215  /* Create an output stream that delegates to DESTINATION and that supports
     216     the styling operations as no-ops.
     217     If PASS_OWNERSHIP is true, closing the resulting stream will automatically
     218     close the DESTINATION.
     219     Note that if PASS_OWNERSHIP is false, the resulting stream must be closed
     220     before DESTINATION can be closed.  */
     221  extern noop_styled_ostream_t
     222         noop_styled_ostream_create (ostream_t destination, bool pass_ownership);
     223  
     224  
     225  /* Test whether a given output stream is a noop_styled_ostream.  */
     226  extern bool is_instance_of_noop_styled_ostream (ostream_t stream);
     227  
     228  
     229  #ifdef __cplusplus
     230  }
     231  #endif
     232  
     233  #endif /* _NOOP_STYLED_OSTREAM_H */