1 /* Output stream for CSS styled text, producing ANSI escape sequences.
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 _TERM_STYLED_OSTREAM_H
19 #define _TERM_STYLED_OSTREAM_H
20
21 #include <stdbool.h>
22
23 #include "styled-ostream.h"
24 #include "term-ostream.h"
25
26
27 struct term_styled_ostream : struct styled_ostream
28 {
29 methods:
30 /* Accessors. */
31 term_ostream_t get_destination (term_styled_ostream_t stream);
32 const char * get_css_filename (term_styled_ostream_t stream);
33 };
34
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40
41 /* Create an output stream referring to the file descriptor FD, styled with
42 the file CSS_FILENAME.
43 FILENAME is used only for error messages.
44 TTY_CONTROL specifies the amount of control to take over the underlying tty.
45 Note that the resulting stream must be closed before FD can be closed.
46 Return NULL upon failure. */
47 extern term_styled_ostream_t
48 term_styled_ostream_create (int fd, const char *filename,
49 ttyctl_t tty_control,
50 const char *css_filename);
51
52
53 /* Test whether a given output stream is a term_styled_ostream. */
54 extern bool is_instance_of_term_styled_ostream (ostream_t stream);
55
56
57 #ifdef __cplusplus
58 }
59 #endif
60
61 #endif /* _TERM_STYLED_OSTREAM_H */