(root)/
gettext-0.22.4/
libtextstyle/
lib/
html-ostream.oo.h
       1  /* Output stream that produces HTML output.
       2     Copyright (C) 2006, 2019-2020 Free Software Foundation, Inc.
       3     Written by Bruno Haible <bruno@clisp.org>, 2006.
       4  
       5     This program is free software: you can redistribute it and/or modify
       6     it under the terms of the GNU General Public License as published by
       7     the Free Software Foundation; either version 3 of the License, or
       8     (at your option) any later version.
       9  
      10     This program is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13     GNU General Public License for more details.
      14  
      15     You should have received a copy of the GNU General Public License
      16     along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
      17  
      18  #ifndef _HTML_OSTREAM_H
      19  #define _HTML_OSTREAM_H
      20  
      21  #include <stdbool.h>
      22  
      23  #include "ostream.h"
      24  
      25  
      26  struct html_ostream : struct ostream
      27  {
      28  methods:
      29  
      30    /* Start a <span class="CLASSNAME"> element.  The CLASSNAME is the name
      31       of a CSS class.  It can be chosen arbitrarily and customized through
      32       an inline or external CSS.  */
      33    void begin_span (html_ostream_t stream, const char *classname);
      34  
      35    /* End a <span class="CLASSNAME"> element.
      36       The begin_span / end_span calls must match properly.  */
      37    void end_span (html_ostream_t stream, const char *classname);
      38  
      39    /* Get/set the hyperlink attribute.  */
      40    const char * get_hyperlink_ref (html_ostream_t stream);
      41    void set_hyperlink_ref (html_ostream_t stream, const char *ref);
      42  
      43    /* Like html_ostream_flush (first_arg, FLUSH_THIS_STREAM), except that it
      44       leaves the destination with the current text style enabled, instead
      45       of with the default text style.
      46       After calling this function, you can output strings without newlines(!)
      47       to the underlying stream, and they will be rendered like strings passed
      48       to 'ostream_write_mem', 'ostream_write_str', or 'ostream_write_printf'.  */
      49    void flush_to_current_style (html_ostream_t stream);
      50  
      51    /* Accessors.  */
      52    ostream_t get_destination (html_ostream_t stream);
      53  };
      54  
      55  
      56  #ifdef __cplusplus
      57  extern "C" {
      58  #endif
      59  
      60  
      61  /* Create an output stream that takes input in the UTF-8 encoding and
      62     writes it in HTML form on DESTINATION.
      63     This stream produces a sequence of lines.  The caller is responsible
      64     for opening the <body><html> elements before and for closing them after
      65     the use of this stream.
      66     Note that the resulting stream must be closed before DESTINATION can be
      67     closed.  */
      68  extern html_ostream_t html_ostream_create (ostream_t destination);
      69  
      70  
      71  /* Test whether a given output stream is a html_ostream.  */
      72  extern bool is_instance_of_html_ostream (ostream_t stream);
      73  
      74  
      75  #ifdef __cplusplus
      76  }
      77  #endif
      78  
      79  #endif /* _HTML_OSTREAM_H */