| Wireshark 4.7.3 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
19 extern "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 */
26 struct print_stream;
27
31 typedef 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);
90} print_stream_ops_t;
91
95 typedef struct print_stream {
96 const print_stream_ops_t* ops;
97 void* data;
98} print_stream_t;
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 */
color.h
new_page
WS_DLL_PUBLIC bool new_page(print_stream_t *self)
Create a new page in the print stream.
Definition print_stream.c:264
print_stream_ps_stdio_new
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
print_bookmark
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
print_line
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
print_stream_ops_t
struct print_stream_ops print_stream_ops_t
Vtable of operations implementing a print stream backend for rendering dissection output.
print_preamble
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
destroy_print_stream
WS_DLL_PUBLIC bool destroy_print_stream(print_stream_t *self)
Destroys a print stream.
Definition print_stream.c:277
print_stream_ps_new
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
print_line_color
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
print_stream_text_new
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
print_finale
WS_DLL_PUBLIC bool print_finale(print_stream_t *self)
Print the finale of the print stream.
Definition print_stream.c:271
print_stream_text_stdio_new
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
print_stream_t
struct print_stream print_stream_t
Represents an abstract print stream, pairing a backend operations vtable with instance-specific state...
str_util.h
color_t
RGB color representation with 16-bit precision per channel.
Definition color.h:27
print_stream_ops
Vtable of operations implementing a print stream backend for rendering dissection output.
Definition print_stream.h:31
print_stream_ops::print_line
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
print_stream_ops::new_page
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
print_stream_ops::print_finale
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
print_stream_ops::print_bookmark
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
print_stream_ops::print_preamble
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
print_stream_ops::destroy
bool(* destroy)(struct print_stream *self)
Destroys the print stream and releases all associated resources.
Definition print_stream.h:89
print_stream_ops::print_line_color
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
print_stream
Represents an abstract print stream, pairing a backend operations vtable with instance-specific state...
Definition print_stream.h:95
print_stream::data
void * data
Definition print_stream.h:97
print_stream::ops
const print_stream_ops_t * ops
Definition print_stream.h:96