summaryrefslogtreecommitdiffstats
path: root/util/stream/printf.h
blob: 4f0f17551da7ea4fe4e6a4cdb0c22ebe8cb4350c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once

#include <util/system/compat.h>

class IOutputStream;

/**
 * Stream-based `printf` function. Prints formatted data into the provided stream.
 * Works the same way as a standard C `printf`.
 *
 * @param[inout] out                    Stream to write into.
 * @param fmt                           Format string.
 * @param ...                           Additional arguments.
 */
size_t Y_PRINTF_FORMAT(2, 3) Printf(IOutputStream& out, const char* fmt, ...);

/**
 * Stream-based `vprintf` function. Prints formatted data from variable argument
 * list into the provided stream. Works the same way as a standard C `vprintf`.
 *
 * @param[inout] out                    Stream to write into.
 * @param fmt                           Format string.
 * @param params                        Additional arguments as a variable argument list.
 */
size_t Y_PRINTF_FORMAT(2, 0) Printf(IOutputStream& out, const char* fmt, va_list params);