Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
print_stream.h
Go to the documentation of this file.
1
12#pragma once
13#include "ws_symbol_export.h"
14
15#include <wsutil/color.h>
16#include <wsutil/str_util.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif /* __cplusplus */
21
22/*
23 * Print stream code; this provides a "print stream" class with subclasses
24 * of various sorts. Additional subclasses might be implemented elsewhere.
25 */
26struct print_stream;
27
31typedef struct print_stream_ops {
39 bool (*print_preamble)(struct print_stream *self, char *filename, const char *version_string);
40
48 bool (*print_line)(struct print_stream *self, int indent, const char *line);
49
59 bool (*print_line_color)(struct print_stream *self, int indent, const char *line, const color_t *fg, const color_t *bg);
60
68 bool (*print_bookmark)(struct print_stream *self, const char *name, const char *title);
69
75 bool (*new_page)(struct print_stream *self);
76
82 bool (*print_finale)(struct print_stream *self);
83
89 bool (*destroy)(struct print_stream *self);
91
99
100/*
101 * These return a print_stream_t * on success and NULL on failure.
102 */
103
111WS_DLL_PUBLIC print_stream_t *print_stream_text_new(bool to_file, const char *dest);
112
119WS_DLL_PUBLIC print_stream_t *print_stream_text_stdio_new(FILE *fh);
120
128WS_DLL_PUBLIC print_stream_t *print_stream_ps_new(bool to_file, const char *dest);
129
136WS_DLL_PUBLIC print_stream_t *print_stream_ps_stdio_new(FILE *fh);
137
146WS_DLL_PUBLIC bool print_preamble(print_stream_t *self, char *filename, const char *version_string);
147
156WS_DLL_PUBLIC bool print_line(print_stream_t *self, int indent, const char *line);
157
172WS_DLL_PUBLIC bool print_line_color(print_stream_t *self, int indent, const char *line, const color_t *fg, const color_t *bg);
173
182WS_DLL_PUBLIC bool print_bookmark(print_stream_t *self, const char *name,
183 const char *title);
184
191WS_DLL_PUBLIC bool new_page(print_stream_t *self);
192
199WS_DLL_PUBLIC bool print_finale(print_stream_t *self);
200
207WS_DLL_PUBLIC bool destroy_print_stream(print_stream_t *self);
208
209#ifdef __cplusplus
210}
211#endif /* __cplusplus */
WS_DLL_PUBLIC bool new_page(print_stream_t *self)
Create a new page in the print stream.
Definition print_stream.c:264
WS_DLL_PUBLIC print_stream_t * print_stream_ps_stdio_new(FILE *fh)
Create a new print stream for PostScript output using standard I/O.
Definition print_stream.c:857
WS_DLL_PUBLIC bool print_bookmark(print_stream_t *self, const char *name, const char *title)
Print a bookmark in the print stream.
Definition print_stream.c:258
WS_DLL_PUBLIC bool print_line(print_stream_t *self, int indent, const char *line)
Prints a line to the print stream.
Definition print_stream.c:242
struct print_stream_ops print_stream_ops_t
Vtable of operations implementing a print stream backend for rendering dissection output.
WS_DLL_PUBLIC bool print_preamble(print_stream_t *self, char *filename, const char *version_string)
Print the preamble to a print stream.
Definition print_stream.c:236
WS_DLL_PUBLIC bool destroy_print_stream(print_stream_t *self)
Destroys a print stream.
Definition print_stream.c:277
WS_DLL_PUBLIC print_stream_t * print_stream_ps_new(bool to_file, const char *dest)
Create a new print stream for PostScript output.
Definition print_stream.c:845
WS_DLL_PUBLIC bool print_line_color(print_stream_t *self, int indent, const char *line, const color_t *fg, const color_t *bg)
Print a colored line to a print stream.
Definition print_stream.c:248
WS_DLL_PUBLIC print_stream_t * print_stream_text_new(bool to_file, const char *dest)
Create a new print stream for text output.
Definition print_stream.c:675
WS_DLL_PUBLIC bool print_finale(print_stream_t *self)
Print the finale of the print stream.
Definition print_stream.c:271
WS_DLL_PUBLIC print_stream_t * print_stream_text_stdio_new(FILE *fh)
Create a new print stream for text output using standard I/O.
Definition print_stream.c:687
struct print_stream print_stream_t
Represents an abstract print stream, pairing a backend operations vtable with instance-specific state...
RGB color representation with 16-bit precision per channel.
Definition color.h:27
Vtable of operations implementing a print stream backend for rendering dissection output.
Definition print_stream.h:31
bool(* print_line)(struct print_stream *self, int indent, const char *line)
Prints a single line of text at the specified indentation level.
Definition print_stream.h:48
bool(* new_page)(struct print_stream *self)
Advances the output to a new page, if supported by the print format.
Definition print_stream.h:75
bool(* print_finale)(struct print_stream *self)
Outputs any finale or closing content required by the print format after all lines.
Definition print_stream.h:82
bool(* print_bookmark)(struct print_stream *self, const char *name, const char *title)
Inserts a named bookmark anchor at the current position in the output.
Definition print_stream.h:68
bool(* print_preamble)(struct print_stream *self, char *filename, const char *version_string)
Outputs any preamble required by the print format before the first line of content.
Definition print_stream.h:39
bool(* destroy)(struct print_stream *self)
Destroys the print stream and releases all associated resources.
Definition print_stream.h:89
bool(* print_line_color)(struct print_stream *self, int indent, const char *line, const color_t *fg, const color_t *bg)
Prints a single line of text with explicit foreground and background colors.
Definition print_stream.h:59
Represents an abstract print stream, pairing a backend operations vtable with instance-specific state...
Definition print_stream.h:95
void * data
Definition print_stream.h:97
const print_stream_ops_t * ops
Definition print_stream.h:96