(root)/
gettext-0.22.4/
libtextstyle/
lib/
term-styled-ostream.h
       1  /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
       2  
       3  #line 1 "term-styled-ostream.oo.h"
       4  /* Output stream for CSS styled text, producing ANSI escape sequences.
       5     Copyright (C) 2006, 2019-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 _TERM_STYLED_OSTREAM_H
      22  #define _TERM_STYLED_OSTREAM_H
      23  
      24  #include <stdbool.h>
      25  
      26  #include "styled-ostream.h"
      27  #include "term-ostream.h"
      28  
      29  
      30  #line 31 "term-styled-ostream.h"
      31  struct term_styled_ostream_representation;
      32  /* term_styled_ostream_t is defined as a pointer to struct term_styled_ostream_representation.
      33     In C++ mode, we use a smart pointer class.
      34     In C mode, we have no other choice than a typedef to the root class type.  */
      35  #if IS_CPLUSPLUS
      36  struct term_styled_ostream_t
      37  {
      38  private:
      39    struct term_styled_ostream_representation *_pointer;
      40  public:
      41    term_styled_ostream_t () : _pointer (NULL) {}
      42    term_styled_ostream_t (struct term_styled_ostream_representation *pointer) : _pointer (pointer) {}
      43    struct term_styled_ostream_representation * operator -> () { return _pointer; }
      44    operator struct term_styled_ostream_representation * () { return _pointer; }
      45    operator struct any_ostream_representation * () { return (struct any_ostream_representation *) _pointer; }
      46    operator struct styled_ostream_representation * () { return (struct styled_ostream_representation *) _pointer; }
      47    operator void * () { return _pointer; }
      48    bool operator == (const void *p) { return _pointer == p; }
      49    bool operator != (const void *p) { return _pointer != p; }
      50    operator ostream_t () { return (ostream_t) (struct any_ostream_representation *) _pointer; }
      51    explicit term_styled_ostream_t (ostream_t x) : _pointer ((struct term_styled_ostream_representation *) (void *) x) {}
      52    operator styled_ostream_t () { return (styled_ostream_t) (struct styled_ostream_representation *) _pointer; }
      53    explicit term_styled_ostream_t (styled_ostream_t x) : _pointer ((struct term_styled_ostream_representation *) (void *) x) {}
      54  };
      55  #else
      56  typedef styled_ostream_t term_styled_ostream_t;
      57  #endif
      58  
      59  /* Functions that invoke the methods.  */
      60  #ifdef __cplusplus
      61  extern "C" {
      62  #endif
      63  extern        void term_styled_ostream_write_mem (term_styled_ostream_t first_arg, const void *data, size_t len);
      64  extern         void term_styled_ostream_flush (term_styled_ostream_t first_arg, ostream_flush_scope_t scope);
      65  extern         void term_styled_ostream_free (term_styled_ostream_t first_arg);
      66  extern          void term_styled_ostream_begin_use_class (term_styled_ostream_t first_arg, const char *classname);
      67  extern          void term_styled_ostream_end_use_class (term_styled_ostream_t first_arg, const char *classname);
      68  extern         const char * term_styled_ostream_get_hyperlink_ref (term_styled_ostream_t first_arg);
      69  extern    const char * term_styled_ostream_get_hyperlink_id (term_styled_ostream_t first_arg);
      70  extern    void         term_styled_ostream_set_hyperlink (term_styled_ostream_t first_arg,                               const char *ref, const char *id);
      71  extern              void term_styled_ostream_flush_to_current_style (term_styled_ostream_t first_arg);
      72  extern       term_ostream_t term_styled_ostream_get_destination (term_styled_ostream_t first_arg);
      73  extern    const char *   term_styled_ostream_get_css_filename (term_styled_ostream_t first_arg);
      74  #ifdef __cplusplus
      75  }
      76  #endif
      77  
      78  /* Type representing an implementation of term_styled_ostream_t.  */
      79  struct term_styled_ostream_implementation
      80  {
      81    const typeinfo_t * const *superclasses;
      82    size_t superclasses_length;
      83    size_t instance_size;
      84  #define THIS_ARG term_styled_ostream_t first_arg
      85  #include "term_styled_ostream.vt.h"
      86  #undef THIS_ARG
      87  };
      88  
      89  /* Public portion of the object pointed to by a term_styled_ostream_t.  */
      90  struct term_styled_ostream_representation_header
      91  {
      92    const struct term_styled_ostream_implementation *vtable;
      93  };
      94  
      95  #if HAVE_INLINE
      96  
      97  /* Define the functions that invoke the methods as inline accesses to
      98     the term_styled_ostream_implementation.
      99     Use #define to avoid a warning because of extern vs. static.  */
     100  
     101  # define term_styled_ostream_write_mem term_styled_ostream_write_mem_inline
     102  static inline void
     103  term_styled_ostream_write_mem (term_styled_ostream_t first_arg, const void *data, size_t len)
     104  {
     105    const struct term_styled_ostream_implementation *vtable =
     106      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     107    vtable->write_mem (first_arg,data,len);
     108  }
     109  
     110  # define term_styled_ostream_flush term_styled_ostream_flush_inline
     111  static inline void
     112  term_styled_ostream_flush (term_styled_ostream_t first_arg, ostream_flush_scope_t scope)
     113  {
     114    const struct term_styled_ostream_implementation *vtable =
     115      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     116    vtable->flush (first_arg,scope);
     117  }
     118  
     119  # define term_styled_ostream_free term_styled_ostream_free_inline
     120  static inline void
     121  term_styled_ostream_free (term_styled_ostream_t first_arg)
     122  {
     123    const struct term_styled_ostream_implementation *vtable =
     124      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     125    vtable->free (first_arg);
     126  }
     127  
     128  # define term_styled_ostream_begin_use_class term_styled_ostream_begin_use_class_inline
     129  static inline void
     130  term_styled_ostream_begin_use_class (term_styled_ostream_t first_arg, const char *classname)
     131  {
     132    const struct term_styled_ostream_implementation *vtable =
     133      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     134    vtable->begin_use_class (first_arg,classname);
     135  }
     136  
     137  # define term_styled_ostream_end_use_class term_styled_ostream_end_use_class_inline
     138  static inline void
     139  term_styled_ostream_end_use_class (term_styled_ostream_t first_arg, const char *classname)
     140  {
     141    const struct term_styled_ostream_implementation *vtable =
     142      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     143    vtable->end_use_class (first_arg,classname);
     144  }
     145  
     146  # define term_styled_ostream_get_hyperlink_ref term_styled_ostream_get_hyperlink_ref_inline
     147  static inline const char *
     148  term_styled_ostream_get_hyperlink_ref (term_styled_ostream_t first_arg)
     149  {
     150    const struct term_styled_ostream_implementation *vtable =
     151      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     152    return vtable->get_hyperlink_ref (first_arg);
     153  }
     154  
     155  # define term_styled_ostream_get_hyperlink_id term_styled_ostream_get_hyperlink_id_inline
     156  static inline const char *
     157  term_styled_ostream_get_hyperlink_id (term_styled_ostream_t first_arg)
     158  {
     159    const struct term_styled_ostream_implementation *vtable =
     160      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     161    return vtable->get_hyperlink_id (first_arg);
     162  }
     163  
     164  # define term_styled_ostream_set_hyperlink term_styled_ostream_set_hyperlink_inline
     165  static inline void
     166  term_styled_ostream_set_hyperlink (term_styled_ostream_t first_arg,                               const char *ref, const char *id)
     167  {
     168    const struct term_styled_ostream_implementation *vtable =
     169      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     170    vtable->set_hyperlink (first_arg,ref,id);
     171  }
     172  
     173  # define term_styled_ostream_flush_to_current_style term_styled_ostream_flush_to_current_style_inline
     174  static inline void
     175  term_styled_ostream_flush_to_current_style (term_styled_ostream_t first_arg)
     176  {
     177    const struct term_styled_ostream_implementation *vtable =
     178      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     179    vtable->flush_to_current_style (first_arg);
     180  }
     181  
     182  # define term_styled_ostream_get_destination term_styled_ostream_get_destination_inline
     183  static inline term_ostream_t
     184  term_styled_ostream_get_destination (term_styled_ostream_t first_arg)
     185  {
     186    const struct term_styled_ostream_implementation *vtable =
     187      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     188    return vtable->get_destination (first_arg);
     189  }
     190  
     191  # define term_styled_ostream_get_css_filename term_styled_ostream_get_css_filename_inline
     192  static inline const char *
     193  term_styled_ostream_get_css_filename (term_styled_ostream_t first_arg)
     194  {
     195    const struct term_styled_ostream_implementation *vtable =
     196      ((struct term_styled_ostream_representation_header *) (struct term_styled_ostream_representation *) first_arg)->vtable;
     197    return vtable->get_css_filename (first_arg);
     198  }
     199  
     200  #endif
     201  
     202  extern const typeinfo_t term_styled_ostream_typeinfo;
     203  #define term_styled_ostream_SUPERCLASSES &term_styled_ostream_typeinfo, styled_ostream_SUPERCLASSES
     204  #define term_styled_ostream_SUPERCLASSES_LENGTH (1 + styled_ostream_SUPERCLASSES_LENGTH)
     205  
     206  extern const struct term_styled_ostream_implementation term_styled_ostream_vtable;
     207  
     208  #line 34 "term-styled-ostream.oo.h"
     209  
     210  
     211  #ifdef __cplusplus
     212  extern "C" {
     213  #endif
     214  
     215  
     216  /* Create an output stream referring to the file descriptor FD, styled with
     217     the file CSS_FILENAME.
     218     FILENAME is used only for error messages.
     219     TTY_CONTROL specifies the amount of control to take over the underlying tty.
     220     Note that the resulting stream must be closed before FD can be closed.
     221     Return NULL upon failure.  */
     222  extern term_styled_ostream_t
     223         term_styled_ostream_create (int fd, const char *filename,
     224                                     ttyctl_t tty_control,
     225                                     const char *css_filename);
     226  
     227  
     228  /* Test whether a given output stream is a term_styled_ostream.  */
     229  extern bool is_instance_of_term_styled_ostream (ostream_t stream);
     230  
     231  
     232  #ifdef __cplusplus
     233  }
     234  #endif
     235  
     236  #endif /* _TERM_STYLED_OSTREAM_H */