WPILibC++ 2025.3.1
Loading...
Searching...
No Matches
raw_ostream.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#ifndef WPIUTIL_WPI_FMT_RAW_OSTREAM_H_
6#define WPIUTIL_WPI_FMT_RAW_OSTREAM_H_
7
8#include <fmt/format.h>
9
10#include "wpi/raw_ostream.h"
11
12namespace wpi {
13
14inline void vprint(wpi::raw_ostream& os, fmt::string_view format_str,
15 fmt::format_args args) {
16 fmt::memory_buffer buffer;
17 fmt::detail::vformat_to(buffer, format_str, args);
18 os.write(buffer.data(), buffer.size());
19}
20
21/**
22 * Prints formatted data to the stream *os*.
23 */
24template <typename S, typename... Args>
25void print(wpi::raw_ostream& os, const S& format_str, Args&&... args) {
26 vprint(os, format_str, fmt::make_format_args(args...));
27}
28
29} // namespace wpi
30
31#endif // WPIUTIL_WPI_FMT_RAW_OSTREAM_H_
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:43
raw_ostream & write(unsigned char C)
Foonathan namespace.
Definition ntcore_cpp.h:26
void print(wpi::raw_ostream &os, const S &format_str, Args &&... args)
Prints formatted data to the stream os.
Definition raw_ostream.h:25
void vprint(wpi::raw_ostream &os, fmt::string_view format_str, fmt::format_args args)
Definition raw_ostream.h:14
#define S(label, offset, message)
Definition Errors.h:113